diff --git a/Application/Base/Service/UserService.class.php b/Application/Base/Service/UserService.class.php index 74c4c1a4..a1e82cef 100644 --- a/Application/Base/Service/UserService.class.php +++ b/Application/Base/Service/UserService.class.php @@ -23,7 +23,7 @@ class UserService $sdkVersion = $params['sdk_version']; $deviceNum = $params['unique_code'] ?? ''; $clientIp = get_client_ip(); - + $game = M('game', 'tab_')->where(['id' => $gameId])->find(); $result = $this->doLogin($account, $password, $game, ['client_ip' => $clientIp, 'device_num' => $deviceNum]); if (!$result['status']) { @@ -72,6 +72,8 @@ class UserService 'notice_count' => $noticeCount, 'request_count' => 0, ]; + + $this->doUserSource($data['user_id'], $gameId, $params['promote_id'] ?? 0, $deviceNum, $sdkVersion, $clientIp); $this->resetLoginLimit(); return ['status' => true, 'message' => '登录成功', 'data' => $data]; @@ -157,6 +159,27 @@ class UserService ]; return ['status' => true, 'message' => '登录成功', 'data' => $data]; } + + protected function doUserSource($uid, $gameId, $promoteId, $deviceNum, $sdkVersion, $clientIp) { + $find = M('user_source', 'tab_')->where([ + 'user_id' => $uid, + 'game_id' => $gameId, + 'promote_id' => $promoteId + ])->find(); + + if (!$find) { + M('user_source', 'tab_')->add([ + 'user_id' => $uid, + 'game_id' => $gameId, + 'promote_id' => $promoteId, + 'device_num' => $deviceNum, + 'sdk_version' => $sdkVersion, + 'ip' => $clientIp, + 'create_time' => time() + ]); + } + } + protected function isDeviceError($user, $testResource, $deviceNum) {