Explorar el Código

Merge branch 'master' of https://git.bjtdba.com/shop/php

hefei hace 1 año
padre
commit
e35d0e945e
Se han modificado 2 ficheros con 9 adiciones y 1 borrados
  1. 1 0
      app/controller/api/Auth.php
  2. 8 1
      app/controller/api/user/User.php

+ 1 - 0
app/controller/api/Auth.php

@@ -1920,6 +1920,7 @@ class Auth extends BaseController
1920 1920
             $pc = new WXBizDataCrypt($appid, $sessionKey);
1921 1921
 //            dump($pc);
1922 1922
             $errCode = $pc->decryptData($encryptedData, $iv, $data );
1923
+            // $data   "{\"phoneNumber\":\"15350612089\",\"purePhoneNumber\":\"15350612089\",\"countryCode\":\"86\",\"watermark\":{\"timestamp\":1745288870,\"appid\":\"wx9082e5ac2fdb513f\"}}"
1923 1924
 //            dump($errCode);
1924 1925
             if ($errCode != 0) {
1925 1926
                 return app('json')->fail('没有获取到手机号1');

+ 8 - 1
app/controller/api/user/User.php

@@ -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 (!empty($existUid) && $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 (!empty($check) && $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("参数异常");