修复:勤务日榜在线时长统计虚高(142小时)+ UI文字调整
Bug修复: - closeDutyLog 增加 whereDate 限制,只关闭今日日志,历史遗留记录置0,避免跨天时长被计入榜单 - tickDutyLog(ChatController/AutoSaveExp)找不到今日开放日志时不再盲目新建,避免同一 login_at 产生几十条重复记录后 SUM 叠加导致虚假142小时 - AppointmentService 撤职时 closeDutyLog 同步增加今日/历史遗留区分处理 UI调整: - 登录页版权文字「飘落的流星」→「流星」 - 后台布局标题「飘落流星 控制台」→「控制台」 - 后台侧边栏移除非超管查看各模块时的「(只读)」标注
This commit is contained in:
@@ -208,14 +208,24 @@ class AppointmentService
|
||||
'revoked_by_user_id' => $operator->id,
|
||||
]);
|
||||
|
||||
// 关闭尚未结束的 duty_log
|
||||
// 关闭尚未结束的 duty_log(只结算今日,历史遗留置0)
|
||||
$target->activePosition?->dutyLogs()
|
||||
->whereNull('logout_at')
|
||||
->whereDate('login_at', today())
|
||||
->update([
|
||||
'logout_at' => now(),
|
||||
'logout_at' => now(),
|
||||
'duration_seconds' => DB::raw('TIMESTAMPDIFF(SECOND, login_at, NOW())'),
|
||||
]);
|
||||
|
||||
// 历史遗留未关闭日志直接清零
|
||||
$target->activePosition?->dutyLogs()
|
||||
->whereNull('logout_at')
|
||||
->whereDate('login_at', '<', today())
|
||||
->update([
|
||||
'logout_at' => DB::raw('login_at'),
|
||||
'duration_seconds' => 0,
|
||||
]);
|
||||
|
||||
// user_level 归 1(由系统经验值自然升级机制重新成长)
|
||||
$target->update(['user_level' => 1]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user