From 2e64e690ac0c4b8c18434027c678ba187abf5168 Mon Sep 17 00:00:00 2001 From: liu <1873441552@qq.com> Date: Mon, 24 Jun 2024 14:24:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E7=BB=91=E5=AE=9A=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/LoginController.php | 5 ++++- app/api/logic/LoginLogic.php | 6 +++--- app/api/logic/user/UserLogic.php | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/api/controller/LoginController.php b/app/api/controller/LoginController.php index 1c94ce971..4c4ce8d18 100644 --- a/app/api/controller/LoginController.php +++ b/app/api/controller/LoginController.php @@ -78,7 +78,10 @@ class LoginController extends BaseApiController public function updateUser() { $params = (new WechatLoginValidate())->post()->goCheck("updateUser"); - LoginLogic::updateUser($params, $this->userId); + $result = LoginLogic::updateUser($params, $this->userId); + if ($result === false) { + return $this->fail(LoginLogic::getError()); + } return $this->success('操作成功', [], 1, 1); } diff --git a/app/api/logic/LoginLogic.php b/app/api/logic/LoginLogic.php index 85b90c9b5..5ca9d4c29 100644 --- a/app/api/logic/LoginLogic.php +++ b/app/api/logic/LoginLogic.php @@ -435,7 +435,7 @@ class LoginLogic extends BaseLogic * @notes 更新用户信息 * @param $params * @param $userId - * @return User + * @return User|bool * @author 段誉 * @date 2023/2/22 11:19 */ @@ -443,12 +443,12 @@ class LoginLogic extends BaseLogic { $find=User::where(['mobile' =>$params['mobile']])->find(); if($find){ - $auth=UserAuth::where('user_id',$find['id'])->find(); + $auth=UserAuth::where(['user_id'=>$find['id'],'terminal'=>1])->find(); if($auth){ self::$error ='该手机号已被绑定'; return false; }else{ - UserAuth::where('user_id',$userId)->update(['user_id'=>$find['id']]); + UserAuth::where(['user_id'=>$find['id'],'terminal'=>1])->update(['user_id'=>$find['id']]); } } $data=[ diff --git a/app/api/logic/user/UserLogic.php b/app/api/logic/user/UserLogic.php index 65d300c19..90428f7e8 100644 --- a/app/api/logic/user/UserLogic.php +++ b/app/api/logic/user/UserLogic.php @@ -12,6 +12,7 @@ use app\common\{logic\BaseLogic, model\system_store\SystemStore, model\system_store\SystemStoreStaff, model\user\User, + model\user\UserAuth, model\user\UserRecharge, model\user\UserShip, model\user_sign\UserSign, @@ -103,7 +104,7 @@ class UserLogic extends BaseLogic $data['no_writeoff'] = StoreOrder::where([ 'is_writeoff'=>0,'uid'=>$uid ])->whereIn('shipping_type',[1,2])->count(); - + $data['openid'] = UserAuth::where(['user_id'=>$uid,'terminal'=>1])->value('openid'); }else{ $data = []; }