Explorar o código

完善安卓微信授权绑定逻辑

sunxbiao hai 1 ano
pai
achega
925e38f91a
Modificáronse 2 ficheiros con 10 adicións e 2 borrados
  1. 9 1
      app/controller/api/Auth.php
  2. 1 1
      app/controller/api/user/UserExtract.php

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

@@ -1719,7 +1719,15 @@ class Auth extends BaseController
1719
             $user = $repository->accountByUser($data['phone']);
1719
             $user = $repository->accountByUser($data['phone']);
1720
             if ($data['type'] == 1) {
1720
             if ($data['type'] == 1) {
1721
                 $data1 = ["wechat_user_id" => $data['third_user_id']];
1721
                 $data1 = ["wechat_user_id" => $data['third_user_id']];
1722
-
1722
+                // 屎山上边堆屎
1723
+                $check = Db::name('user_extract_openid')->where('uid', $user->uid)->count();
1724
+                if ($check < 1) {
1725
+                    Db::name("user_extract_openid")->insert([
1726
+                        'uid' => $user->uid,
1727
+                        'openid' => $data['third_user_id'],
1728
+                        'type' => 1
1729
+                    ]);
1730
+                }
1723
                 if($this->source=='yhc' && $this->merId){ //一壶茶创建用户
1731
                 if($this->source=='yhc' && $this->merId){ //一壶茶创建用户
1724
                     $enterprise_user_count = Db::name("enterprise_user")->where("mer_id",$this->merId)->where('uid',$user->uid)->count();
1732
                     $enterprise_user_count = Db::name("enterprise_user")->where("mer_id",$this->merId)->where('uid',$user->uid)->count();
1725
                     if($enterprise_user_count<1){
1733
                     if($enterprise_user_count<1){

+ 1 - 1
app/controller/api/user/UserExtract.php

@@ -172,7 +172,7 @@ class UserExtract extends BaseController
172
         $type=input("type/d","1");
172
         $type=input("type/d","1");
173
         $openid=input("openid","");
173
         $openid=input("openid","");
174
         $nickname = input("nickname", "");
174
         $nickname = input("nickname", "");
175
-        $avatar = input("openid", "");
175
+        $avatar = input("avatar", "");
176
         if(empty($openid)){
176
         if(empty($openid)){
177
             return app('json')->fail("绑定微信失败");
177
             return app('json')->fail("绑定微信失败");
178
         }
178
         }