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

+ 6 - 0
application/api/controller/Login.php

@@ -176,10 +176,16 @@ class Login extends Api
 
 
         $user=Db::table('q_user')->where('openid',$data['openid'])->find();
+
         if(empty($user)){
             $id=Db::table('q_user')->insertGetId(['openid'=>$data['openid'],'phone'=>$decryptedData['phoneNumber']]);
             $user=Db::table('q_user')->where('id',$id)->find();
 
+        }else{
+            if(empty($user['phone'])){
+                $id=Db::table('q_user')->where('openid',$data['openid'])->update(['phone'=>$decryptedData['phoneNumber']]);
+
+            }
         }
 
         $token = JWT::encode($user,config('jwt.key'));