feat: 修复 Task2 中在线时长记录逻辑,调整参数以正确保存在线时间

This commit is contained in:
lingling 2025-03-16 12:02:34 +08:00
parent dd329c6ee0
commit 2e4e9a9e31
1 changed files with 2 additions and 2 deletions

View File

@ -84,7 +84,7 @@ class Task2
$phone->time += $currentTimestamp - $phone->last_time;
$phone->last_time = $currentTimestamp;
// 保存在线时长记录
UserPhoneLogDao::setOnlineTimeByPhone($phone->phone, 0, $currentTimestamp);
UserPhoneLogDao::setOnlineTimeByPhone($phone->phone, 1, $currentTimestamp);
$updateData[] = $phone;
}
//不在线
@ -112,7 +112,7 @@ class Task2
UserPhone::whereNotIn('phone', $all_usernames)
->where('status', '!=', 2)
->update(['status' => 2,'last_time'=>$currentTimestamp]);
UserPhone::where('status', 2)->update(['last_time'=>$currentTimestamp,'time'=>0]);
// 批量查询用户信息
$phones2 = UserPhone::whereIn('phone', $usernames2)->get();