From a1716ce10ae1647cd16c659a397871b7a190d96a Mon Sep 17 00:00:00 2001 From: yin5th <541304803@qq.com> Date: Wed, 11 Jan 2023 10:41:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=89=93=E5=8D=A1=E6=8E=A5=E5=8F=A3):=20?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=99=AE=E9=80=9A=E7=94=A8=E6=88=B7=E6=89=93?= =?UTF-8?q?=E5=8D=A1=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/v1/User.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controller/api/v1/User.php b/app/controller/api/v1/User.php index e1599f1..0531ab7 100644 --- a/app/controller/api/v1/User.php +++ b/app/controller/api/v1/User.php @@ -462,13 +462,13 @@ class User extends Base return $this->json(6001, '请先登录'); } + $input = input('post.'); + // 工人打卡 - if ($customer['role'] == Account::ROLE_NORMAL && $this->normalSign($accountId)) { + if ($customer['role'] == Account::ROLE_NORMAL && $this->normalSign($accountId, $input['type'])) { return $this->json(); } - $input = input('post.'); - $rules = [ 'type|打卡类型' => 'require|in:morning_on,morning_off,afternoon_on,afternoon_off', 'lat|维度' => 'require', @@ -541,20 +541,20 @@ class User extends Base * @throws \app\exception\ApiException * @throws \think\db\exception\DbException */ - private function normalSign(int $accountId): bool + private function normalSign(int $accountId, string $type): bool { $time = time(); // $time = $time - 86401 * 3; $now = date('Y-m-d H:i:s', $time); $day = date('Ymd', $time); - if (ClockLog::checkRate($accountId)) { + if (ClockLog::checkRate($accountId, $type)) { throw new ApiException('打卡频率过快!'); } ClockLog::create([ 'account_id' => $accountId, - 'type' => ClockLog::TYPE_NORMAL, + 'type' => $type, 'created_at' => $now, 'create_time' => $time, 'day' => $day,