Kirin 3 years ago
parent
commit
043ebc4abb

+ 1 - 0
app/api/controller/wechat/AuthController.php

@@ -76,6 +76,7 @@ class AuthController
         $userInfo['code'] = $data['spread_code'];
         $userInfo['session_key'] = $session_key;
         $userInfo['login_type'] = $login_type;
+        $userInfo['site_id'] = $request->site_id();
         $uid = WechatUser::routineOauth($userInfo);
         $userInfo = User::where('uid', $uid)->find();
         if ($userInfo->login_type == 'h5' && ($h5UserInfo = User::where(['account' => $userInfo->phone, 'phone' => $userInfo->phone, 'user_type' => 'h5'])->find()))

+ 2 - 1
app/models/user/User.php

@@ -225,7 +225,8 @@ class User extends BaseModel
             'add_ip' => request()->ip(),
             'last_time' => time(),
             'last_ip' => request()->ip(),
-            'user_type' => $routineUser['user_type']
+            'user_type' => $routineUser['user_type'],
+            'site_id' => $routineUser['site_id'],
         ]);
         $res = $res1 && $res2 && UserSpread::setSpread($routineUser['uid'], $spread_uid);
         self::checkTrans($res);

+ 1 - 0
app/models/user/WechatUser.php

@@ -118,6 +118,7 @@ class WechatUser extends BaseModel
         } else {
             $routineInfo['add_time'] = time();//用户添加时间
             $routineInfo = self::create($routineInfo);
+            $routineInfo['site_id'] = $routine['site_id'];
             $res = User::setRoutineUser($routineInfo, $spid);
             $uid = $res->uid;
         }