From 78f197e7f97f27e6c8495b7659023b385e26eeb7 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Sun, 29 Jan 2023 08:05:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AD=BE=E5=88=B0=E9=80=9A=E7=9F=A5=E5=8A=A0?= =?UTF-8?q?=E4=B8=8A=E8=AE=BE=E5=A4=87=E5=A4=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Api/PublicController.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/Api/PublicController.php b/app/Http/Controllers/Api/PublicController.php index 5937981a5..f8308aeed 100755 --- a/app/Http/Controllers/Api/PublicController.php +++ b/app/Http/Controllers/Api/PublicController.php @@ -102,7 +102,7 @@ class PublicController extends AbstractController } // $macs = explode(",", $mac); - $creates = []; + $checkins = []; foreach ($macs as $mac) { $mac = strtoupper($mac); if (Base::isMac($mac) && $UserCheckinMac = UserCheckinMac::whereMac($mac)->first()) { @@ -114,7 +114,7 @@ class PublicController extends AbstractController $record = UserCheckinRecord::where($array)->first(); if (empty($record)) { $record = UserCheckinRecord::createInstance($array); - $creates[] = $UserCheckinMac->userid; + $checkins[] = $UserCheckinMac; } $record->times = Base::array2json(array_merge($record->times, [$nowTime])); $record->report_time = $time; @@ -123,13 +123,15 @@ class PublicController extends AbstractController } } // - if ($creates && $setting['notice'] === 'open') { + if ($checkins && $setting['notice'] === 'open') { $botUser = User::botGetOrCreate('check-in'); if ($botUser) { - foreach ($creates as $create) { - $dialog = WebSocketDialog::checkUserDialog($botUser->userid, $create); + foreach ($checkins as $checkin) { + $dialog = WebSocketDialog::checkUserDialog($botUser->userid, $checkin->userid); if ($dialog) { - $text = "签到成功,签到时间:" . date("H:i"); + $hi = date("H:i"); + $remark = $checkin->remark ?: $checkin->mac; + $text = "签到成功,签到时间: {$hi} ({$remark})"; WebSocketDialogMsg::sendMsg(null, $dialog->id, 'text', ['text' => $text], $botUser->userid); // todo 未能在任务end事件来发送任务 } }