同步修改

master
yulingwei 5 years ago
parent 8a9e0a9a8b
commit 899877e872

@ -101,12 +101,19 @@ class ConsoleController extends Think {
$this->modifyLogin(strtotime($start_time)); $this->modifyLogin(strtotime($start_time));
} }
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;
$this->modifyLogin($start_time, $end_time);
}
/** /**
* 登录校验 * 登录校验
*/ */
private function modifyLogin($start_time=0) private function modifyLogin($start_time=0, $end_time=0)
{ {
$current_time = strtotime(date("Y-m-d"))-86400; $current_time = $end_time?: strtotime(date("Y-m-d"))-86400;
for ($i=$start_time; $i<=$current_time; $i+=86400) { for ($i=$start_time; $i<=$current_time; $i+=86400) {
$end_time = $i+86400; $end_time = $i+86400;
$result = M()->query("SELECT $result = M()->query("SELECT
@ -115,9 +122,16 @@ class ConsoleController extends Think {
user_id, user_id,
promote_id promote_id
FROM FROM
tab_user_login_record tab_user_login_record ulr
WHERE WHERE
login_time >= {$i} and login_time < {$end_time} login_time >= {$i} and login_time < {$end_time}
AND NOT EXISTS (
SELECT
id
FROM
tab_login_daily_record ldr
where ldr.create_time >= {$i} and ldr.create_time < {$end_time} and ldr.game_id = ulr.game_id and ldr.user_id = ulr.user_id and ldr.promote_id = ulr.promote_id
)
GROUP BY GROUP BY
create_time, create_time,
game_id, game_id,
@ -131,6 +145,7 @@ class ConsoleController extends Think {
} else { } else {
echo "写入{$item['create_time']} error \n"; echo "写入{$item['create_time']} error \n";
} }
unset($result[$index]); unset($result[$index]);
} }
} else { } else {

Loading…
Cancel
Save