Merge branch 'hotfix/login_crontab' of wmtx/platform into release

修复登录统计问题
master
万盟天下 5 years ago committed by Gogs
commit 8e9749bacb

@ -104,7 +104,7 @@ class ConsoleController extends Think {
public function modifyLoginCheck($start_time=0, $end_time=0)
{
$start_time = $start_time ? strtotime($start_time) : strtotime(date("Y-m-d"));
$end_time = $end_time ? strtotime($end_time) : $start_time + 86400;
$end_time = $end_time ? strtotime($end_time) : $start_time;
$this->modifyLogin($start_time, $end_time);
}
@ -118,7 +118,7 @@ class ConsoleController extends Think {
$end_time = $i+86400;
$result = M()->query("SELECT
game_id,
FROM_UNIXTIME(login_time, '%Y-%m-%d') create_time,
UNIX_TIMESTAMP(FROM_UNIXTIME(login_time, '%Y-%m-%d')) create_time,
user_id,
promote_id
FROM
@ -135,18 +135,24 @@ class ConsoleController extends Think {
GROUP BY
create_time,
game_id,
user_id");
user_id,
promote_id");
if ($result) {
foreach ($result as $index => $item) {
$item['create_time'] = strtotime($item['create_time']);
if ($item['create_time']) {
$res = M("login_daily_record", "tab_")->add($item);
echo "写入{$item['create_time']} $res \n";
if (is_null($result[$index]['promote_id']))
{
unset($result[$index]);
}
}
$step = 500;
for ($j=0;;$j+=$step) {
$insData = array_slice($result, $j, $step);
if ($insData) {
$res = M("login_daily_record", 'tab_')->addAll($insData);
echo "写入 $res \n";
} else {
echo "写入{$item['create_time']} error \n";
break;
}
unset($result[$index]);
}
} else {
echo "写入{$item['create_time']} 无 \n";

Loading…
Cancel
Save