|
|
|
@ -600,4 +600,38 @@ class ConsoleController extends Think {
|
|
|
|
|
// ARPU (当日充值金额/当日活跃用户数)
|
|
|
|
|
// ARRPU (当日充值金额/当日充值用户数)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function checkAndfreezeTestingUser()
|
|
|
|
|
{
|
|
|
|
|
$pageCount = 100;
|
|
|
|
|
$hasNext = true;
|
|
|
|
|
$lastId = 0;
|
|
|
|
|
do {
|
|
|
|
|
$testingUsers = M('testing_user', 'tab_')
|
|
|
|
|
->where(['status' => ['in', [1, 2]], 'id' => ['gt', $lastId]])
|
|
|
|
|
->order('id asc')
|
|
|
|
|
->limit($pageCount)
|
|
|
|
|
->select();
|
|
|
|
|
if (count($testingUser) < $pageCount) {
|
|
|
|
|
$hasNext = false;
|
|
|
|
|
}
|
|
|
|
|
$userIds = array_column($testingUsers, 'user_id');
|
|
|
|
|
$users = M('user', 'tab_')->field(['id', 'login_time'])->where(['id' => ['in', $userIds]])->select();
|
|
|
|
|
$users = index_by_column('id', $users);
|
|
|
|
|
$unloginLimitTime = 7 * 24 * 3600;
|
|
|
|
|
$unloginUserIds = [];
|
|
|
|
|
foreach ($testingUsers as $testingUser) {
|
|
|
|
|
$user = $users[$testingUser['user_id']] ?? null;
|
|
|
|
|
if ($user && (time() - $user['login_time']) > $unloginLimitTime) {
|
|
|
|
|
$unloginUserIds[] = $user['id'];
|
|
|
|
|
}
|
|
|
|
|
$lastId = $testingUser['id'];
|
|
|
|
|
}
|
|
|
|
|
if (count($unloginUserIds) > 0) {
|
|
|
|
|
M('testing_user', 'tab_')->where(['user_id' => ['in', $unloginUserIds]])->save([
|
|
|
|
|
'status' => 2
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
} while($hasNext);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|