From e35532850d398efb80d8e651f80c4c67eb0ea635 Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Sun, 13 Sep 2020 11:13:09 +0800 Subject: [PATCH] =?UTF-8?q?update:=E6=9B=B4=E6=96=B0=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- catch/login/controller/Index.php | 4 +++- catch/wechat/repository/WechatMenusRepository.php | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/catch/login/controller/Index.php b/catch/login/controller/Index.php index ac29c39..0285653 100644 --- a/catch/login/controller/Index.php +++ b/catch/login/controller/Index.php @@ -29,7 +29,9 @@ class Index extends CatchController 'token' => $token, ], '登录成功'); } catch (\Exception $exception) { - return CatchResponse::fail('登录失败', $exception->getCode()); + $code = $exception->getCode(); + return CatchResponse::fail($code == Code::USER_FORBIDDEN ? + '该账户已被禁用,请联系管理员' : '登录失败,请检查邮箱和密码', Code::LOGIN_FAILED); } } diff --git a/catch/wechat/repository/WechatMenusRepository.php b/catch/wechat/repository/WechatMenusRepository.php index 84ace08..9f19a4e 100644 --- a/catch/wechat/repository/WechatMenusRepository.php +++ b/catch/wechat/repository/WechatMenusRepository.php @@ -45,6 +45,9 @@ class WechatMenusRepository extends CatchRepository * @time 2020年06月26日 * @param array $data * @return mixed + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @throws \think\db\exception\DataNotFoundException */ public function storeBy(array $data) { @@ -55,6 +58,8 @@ class WechatMenusRepository extends CatchRepository $data['parent_id'] = $parentId; $data['key'] = $data['type'] . '_' . rand(10000, 999999); + $data['created_at'] = $data['updated_at'] = time(); + if (parent::storeBy($data)) { return $this->syncToWechat(); }// TODO: Change the autogenerated stub @@ -75,6 +80,8 @@ class WechatMenusRepository extends CatchRepository */ public function updateBy(int $id, array $data) { + $data['updated_at'] = time(); + if (parent::updateBy($id, $data)) { return $this->syncToWechat(); }