diff --git a/process/Task2.php b/process/Task2.php index ca12cf8..8c6728d 100644 --- a/process/Task2.php +++ b/process/Task2.php @@ -21,6 +21,7 @@ class Task2 { // 每小时执行一次 new Crontab('0 */1 * * * *', function () { + return; $start_time = time(); Rocketgo::test_login(); //查询系统配置 是否自动删除用户 @@ -56,26 +57,34 @@ class Task2 continue; } - + //在线 - if ($phone->time > 3600 && $v['logged'] == 1) { - // 计算超过 1 小时的积分 - $hours = intdiv($phone->time, 3600); - $score = $hours * 20; - $remainingTime = $phone->time % 3600; - - // 更新用户积分和时长 - $phone->score += $score; - $phone->day_score += $score; - $phone->time = $remainingTime; - - // 保存用户收益到 UserReward 表 - UserRewardDao::Onhookincome($phone->user_id, $score, $phone->phone); - // 保存在线时长记录 - UserPhoneLogDao::setOnlineTimeByPhone($phone->phone, 1, $currentTimestamp); + if ($v['logged'] == 1) { + if ($phone->time > 3600) { + // 计算超过 1 小时的积分 + $hours = intdiv($phone->time, 3600); + $score = $hours * 20; + $remainingTime = $phone->time % 3600; + + // 更新用户积分和时长 + $phone->score += $score; + $phone->day_score += $score; + $phone->time = $remainingTime; + + // 保存用户收益到 UserReward 表 + UserRewardDao::Onhookincome($phone->user_id, $score, $phone->phone); + // // 保存在线时长记录 + // UserPhoneLogDao::setOnlineTimeByPhone($phone->phone, 1, $currentTimestamp); + // $phone->status = 1; + // $phone->time += $currentTimestamp - $phone->last_time; + // $phone->last_time = $currentTimestamp; + // $updateData[] = $phone; + } $phone->status = 1; $phone->time += $currentTimestamp - $phone->last_time; $phone->last_time = $currentTimestamp; + // 保存在线时长记录 + UserPhoneLogDao::setOnlineTimeByPhone($phone->phone, 0, $currentTimestamp); $updateData[] = $phone; } //不在线