update:更新微信菜单
This commit is contained in:
parent
0da4627217
commit
e35532850d
@ -29,7 +29,9 @@ class Index extends CatchController
|
|||||||
'token' => $token,
|
'token' => $token,
|
||||||
], '登录成功');
|
], '登录成功');
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
return CatchResponse::fail('登录失败', $exception->getCode());
|
$code = $exception->getCode();
|
||||||
|
return CatchResponse::fail($code == Code::USER_FORBIDDEN ?
|
||||||
|
'该账户已被禁用,请联系管理员' : '登录失败,请检查邮箱和密码', Code::LOGIN_FAILED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,9 @@ class WechatMenusRepository extends CatchRepository
|
|||||||
* @time 2020年06月26日
|
* @time 2020年06月26日
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
* @throws \think\db\exception\DbException
|
||||||
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
|
* @throws \think\db\exception\DataNotFoundException
|
||||||
*/
|
*/
|
||||||
public function storeBy(array $data)
|
public function storeBy(array $data)
|
||||||
{
|
{
|
||||||
@ -55,6 +58,8 @@ class WechatMenusRepository extends CatchRepository
|
|||||||
$data['parent_id'] = $parentId;
|
$data['parent_id'] = $parentId;
|
||||||
$data['key'] = $data['type'] . '_' . rand(10000, 999999);
|
$data['key'] = $data['type'] . '_' . rand(10000, 999999);
|
||||||
|
|
||||||
|
$data['created_at'] = $data['updated_at'] = time();
|
||||||
|
|
||||||
if (parent::storeBy($data)) {
|
if (parent::storeBy($data)) {
|
||||||
return $this->syncToWechat();
|
return $this->syncToWechat();
|
||||||
}// TODO: Change the autogenerated stub
|
}// TODO: Change the autogenerated stub
|
||||||
@ -75,6 +80,8 @@ class WechatMenusRepository extends CatchRepository
|
|||||||
*/
|
*/
|
||||||
public function updateBy(int $id, array $data)
|
public function updateBy(int $id, array $data)
|
||||||
{
|
{
|
||||||
|
$data['updated_at'] = time();
|
||||||
|
|
||||||
if (parent::updateBy($id, $data)) {
|
if (parent::updateBy($id, $data)) {
|
||||||
return $this->syncToWechat();
|
return $this->syncToWechat();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user