perf: 优化签到打卡提醒

This commit is contained in:
kuaifan 2023-01-31 12:05:25 +08:00
parent e3877a11a6
commit 92966ed516

View File

@ -140,19 +140,19 @@ class PublicController extends AbstractController
if ($dialog) { if ($dialog) {
$hi = date("H:i"); $hi = date("H:i");
$pre = $type == "up" ? "上班" : "下班"; $pre = $type == "up" ? "上班" : "下班";
$remark = $checkin->remark ?: $checkin->mac; $remark = $checkin->remark ? " ({$checkin->remark})": "";
$text = "{$pre}签到成功,签到时间: {$hi} ({$remark})"; $text = "{$pre}打卡成功,打卡时间: {$hi} {$remark}";
WebSocketDialogMsg::sendMsg(null, $dialog->id, 'text', ['text' => $text], $botUser->userid); WebSocketDialogMsg::sendMsg(null, $dialog->id, 'text', ['text' => $text], $botUser->userid);
} }
}; };
if ($timeAdvance <= Base::time() && Base::time() <= $timeStart + 3600) { if ($timeAdvance <= Base::time() && Base::time() < $timeEnd) {
// 上班签到迟到1小时内仍提醒 // 上班打卡通知(从最早打卡时间 到 下班打卡时间
foreach ($checkins as $checkin) { foreach ($checkins as $checkin) {
$sendMsg('up', $checkin); $sendMsg('up', $checkin);
} }
} }
if ($timeEnd <= Base::time() && Base::time() <= $timeDelay) { if ($timeEnd <= Base::time() && Base::time() <= $timeDelay) {
// 下班签到 // 下班打卡通知(下班打卡时间 到 最晚打卡时间)
foreach ($checkins as $checkin) { foreach ($checkins as $checkin) {
$sendMsg('down', $checkin); $sendMsg('down', $checkin);
} }