From c5c5fffb8f6c35d7b11d60b9eafbc08471104141 Mon Sep 17 00:00:00 2001 From: yin5th <541304803@qq.com> Date: Fri, 13 Jan 2023 09:48:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=89=93=E5=8D=A1=E6=8E=A5=E5=8F=A3):=20?= =?UTF-8?q?=E4=BB=8A=E6=97=A5=E6=89=93=E5=8D=A1=E8=AE=B0=E5=BD=95=E5=92=8C?= =?UTF-8?q?=E6=9C=88=E5=BA=A6=E6=89=93=E5=8D=A1=E8=AE=B0=E5=BD=95=E5=AE=8C?= =?UTF-8?q?=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/v1/User.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/controller/api/v1/User.php b/app/controller/api/v1/User.php index 51315c9..7247ad0 100644 --- a/app/controller/api/v1/User.php +++ b/app/controller/api/v1/User.php @@ -360,7 +360,11 @@ class User extends Base */ public function signToday(): Json { - $accountId = $this->request->user['user_id'] ?? 0; + $accountId = $this->request->user['user_id'] ?? 0; + $day = input('day/s', ''); + $day = $day ?: date('Y-m-d'); + $worksiteId = input('worksite_id/d', 0); + $worksiteId = $worksiteId ?: 0; $list = []; @@ -372,9 +376,12 @@ class User extends Base } $where = []; - $where[] = ['cl.created_at', '>', date('Y-m-d 00:00:00')]; - $where[] = ['cl.created_at', '<', date('Y-m-d 23:59:59')]; + $where[] = ['cl.created_at', '>', date($day.' 00:00:00')]; + $where[] = ['cl.created_at', '<', date($day.' 23:59:59')]; $where[] = ['cl.account_id', '=', $accountId]; + if ($worksiteId) { + $where[] = ['cl.worksite_id', '=', $worksiteId]; + } $where[] = ['cl.role', '=', $account['role']]; $limit = $account['role'] == Account::ROLE_NORMAL ? 4 : 0;//普通用户只展示最新4条 其他不限制