王新凯 3 年之前
父節點
當前提交
36fadde84b
共有 1 個文件被更改,包括 3 次插入8 次删除
  1. 3 8
      application/api/controller/Login.php

+ 3 - 8
application/api/controller/Login.php

@@ -118,11 +118,10 @@ class Login extends Api
             $user_id = $this->check_login();
             $avatar=input('avatarUrl');
             $nickname=input('nickname');
-            $user=Db::table('q_user')->where('id',$user_id)->find();
 
 
 
-            $res=Db::table('q_user')->where('id',$user_id)->update(['headimg'=>$avatar,'nickname'=>$nickname,'phone'=>$decryptedData['phoneNumber']]);
+            $res=Db::table('q_user')->where('id',$user_id)->update(['headimg'=>$avatar,'nickname'=>$nickname]);
             if(empty($res)){
                 $this->success('授权信息失败,请重新授权');
             }else{
@@ -142,18 +141,14 @@ class Login extends Api
         $data=$app->auth->session($code);
         $decryptedData = $app->encryptor->decryptData($data['session_key'], input('iv'), input('encryptedData'));
 
-        dump($decryptedData);die();
+
         $user=Db::table('q_user')->where('openid',$data['openid'])->find();
         if(empty($user)){
-            $id=Db::table('q_user')->insertGetId(['openid'=>$data['openid'],'session_key'=>$data['session_key']]);
+            $id=Db::table('q_user')->insertGetId(['openid'=>$data['openid'],'phone'=>$decryptedData['phoneNumber']]);
             $user=Db::table('q_user')->where('id',$id)->find();
 
-        }else{
-            Db::table('q_user')->where('openid',$data['openid'])->update(['session_key'=>$data['session_key']]);
-            $user['session_key']=$data['session_key'];
         }
         $token = JWT::encode($user,config('jwt.key'));
-
         $this->success('登陆成功',['token'=>$token]);