From f3004f2382cf00213aae1b183c67efbe505810ca Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Thu, 27 Jun 2024 20:05:08 +0800 Subject: [PATCH] =?UTF-8?q?feat(LoginLogic):=20=E6=9B=B4=E6=96=B0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E4=BF=A1=E6=81=AFAPI=E9=80=BB=E8=BE=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/logic/LoginLogic.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/app/api/logic/LoginLogic.php b/app/api/logic/LoginLogic.php index cf0b3eff2..c4d715a3d 100644 --- a/app/api/logic/LoginLogic.php +++ b/app/api/logic/LoginLogic.php @@ -441,20 +441,22 @@ class LoginLogic extends BaseLogic */ public static function updateUser($params, $userId) { - $find=User::where(['mobile' =>$params['mobile']])->find(); - if($find){ - $auth=UserAuth::where(['user_id'=>$find['id']])->find();//别人的 - if($auth){ - self::$error ='该手机号已绑定'; - return false; - }else{ - UserAuth::where(['user_id'=>$userId])->update(['user_id'=>$find['id']]); - } - } $data=['is_new_user' => YesNoEnum::NO]; + if(isset($params['mobile']) && $params['mobile']!=''){ $data['mobile']=$params['mobile']; + $find=User::where(['mobile' =>$params['mobile']])->find(); + if($find){ + $auth=UserAuth::where(['user_id'=>$find['id']])->find();//别人的 + if($auth){ + self::$error ='该手机号已绑定'; + return false; + }else{ + UserAuth::where(['user_id'=>$userId])->update(['user_id'=>$find['id']]); + } + } } + if(!empty($params['nickname'])){ $data['nickname'] = $params['nickname']; }