feat: 修复 Task2 中在线时长记录逻辑,调整参数以正确保存在线时间
This commit is contained in:
parent
dd329c6ee0
commit
2e4e9a9e31
|
@ -84,7 +84,7 @@ class Task2
|
||||||
$phone->time += $currentTimestamp - $phone->last_time;
|
$phone->time += $currentTimestamp - $phone->last_time;
|
||||||
$phone->last_time = $currentTimestamp;
|
$phone->last_time = $currentTimestamp;
|
||||||
// 保存在线时长记录
|
// 保存在线时长记录
|
||||||
UserPhoneLogDao::setOnlineTimeByPhone($phone->phone, 0, $currentTimestamp);
|
UserPhoneLogDao::setOnlineTimeByPhone($phone->phone, 1, $currentTimestamp);
|
||||||
$updateData[] = $phone;
|
$updateData[] = $phone;
|
||||||
}
|
}
|
||||||
//不在线
|
//不在线
|
||||||
|
@ -112,7 +112,7 @@ class Task2
|
||||||
UserPhone::whereNotIn('phone', $all_usernames)
|
UserPhone::whereNotIn('phone', $all_usernames)
|
||||||
->where('status', '!=', 2)
|
->where('status', '!=', 2)
|
||||||
->update(['status' => 2,'last_time'=>$currentTimestamp]);
|
->update(['status' => 2,'last_time'=>$currentTimestamp]);
|
||||||
|
UserPhone::where('status', 2)->update(['last_time'=>$currentTimestamp,'time'=>0]);
|
||||||
// 批量查询用户信息
|
// 批量查询用户信息
|
||||||
$phones2 = UserPhone::whereIn('phone', $usernames2)->get();
|
$phones2 = UserPhone::whereIn('phone', $usernames2)->get();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue