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