|
|
@@ -2653,8 +2653,15 @@ class User extends BaseController
|
|
2653
|
2653
|
if ($type == 1) {
|
|
2654
|
2654
|
$data = ["wechat_user_id" => $openid];
|
|
2655
|
2655
|
$unionId = $openid;
|
|
|
2656
|
+ $existUid = Db::name('user_extract_openid')->where('openid',$unionId)->value('uid');
|
|
|
2657
|
+ if ($existUid != $uid) throw new \Exception("此微信号已被绑定");
|
|
2656
|
2658
|
$check = Db::name('user_extract_openid')->where('uid',$uid)->value('openid');
|
|
2657
|
|
- if ($check) throw new \Exception("此微信号已被绑定");
|
|
|
2659
|
+ if ($check != $unionId) throw new \Exception("当前用户已绑定其他微信号");
|
|
|
2660
|
+ Db::name("user_extract_openid")->insert([
|
|
|
2661
|
+ 'uid' => $uid,
|
|
|
2662
|
+ 'openid' => $unionId,
|
|
|
2663
|
+ 'type' => 1
|
|
|
2664
|
+ ]);
|
|
2658
|
2665
|
} else {
|
|
2659
|
2666
|
$alinfo = json_decode($alinfo, true);
|
|
2660
|
2667
|
if (!$alinfo) throw new \Exception("参数异常");
|