Kaynağa Gözat

完善跟新用户三方信息方法

sunxbiao 1 yıl önce
ebeveyn
işleme
0efcb6c92a
1 değiştirilmiş dosya ile 2 ekleme ve 2 silme
  1. 2 2
      app/controller/api/user/User.php

+ 2 - 2
app/controller/api/user/User.php

@@ -2654,9 +2654,9 @@ class User extends BaseController
2654 2654
                 $data = ["wechat_user_id" => $openid];
2655 2655
                 $unionId = $openid;
2656 2656
                 $existUid = Db::name('user_extract_openid')->where('openid',$unionId)->value('uid');
2657
-                if ($existUid != $uid) throw new \Exception("此微信号已被绑定");
2657
+                if (!empty($existUid) && $existUid != $uid) throw new \Exception("此微信号已被绑定");
2658 2658
                 $check = Db::name('user_extract_openid')->where('uid',$uid)->value('openid');
2659
-                if ($check != $unionId) throw new \Exception("当前用户已绑定其他微信号");
2659
+                if (!empty($check) && $check != $unionId) throw new \Exception("当前用户已绑定其他微信号");
2660 2660
                 Db::name("user_extract_openid")->insert([
2661 2661
                     'uid' => $uid,
2662 2662
                     'openid' => $unionId,