get();
$text1 = '';
foreach ($logs as $log) {
if (strpos($log->content, 'Links') === false) {
$text1 = $text1 . $log->content . '
';
}
}
$lastday_total = 0;
foreach ($users as $user) {
$lastday = (($user->u + $user->d) - $user->last_day_t) / 1024 / 1024;
$lastday_total += (($user->u + $user->d) - $user->last_day_t);
if ($user->sendDailyMail == 1) {
echo 'Send daily mail to user: ' . $user->id;
$subject = Config::get('appName') . '-每日流量报告以及公告';
$to = $user->email;
$text = '下面是系统中目前的公告:
' . $text1 . '
晚安!';
try {
Mail::send($to, $subject, 'news/daily-traffic-report.tpl', [
'user' => $user, 'text' => $text, 'lastday' => $lastday
], [
]);
} catch (Exception $e) {
echo $e->getMessage();
}
$text = '';
}
}
$sts = new Analytics();
if (Config::get('sendDiary_Telegram') == 'true') {
Telegram::Send(
str_replace(
array(
'%getTodayCheckinUser%',
'%lastday_total%'
),
array(
$sts->getTodayCheckinUser(),
Tools::flowAutoShow($lastday_total)
),
Config::get('sendDiary_Msg')
)
);
}
}
public static function reall()
{
$users = User::all();
foreach ($users as $user) {
$user->last_day_t = ($user->u + $user->d);
$user->save();
}
}
}