From 5366687fe486f88c9cd7192c64bfe58bd1af912c Mon Sep 17 00:00:00 2001 From: tping Date: Fri, 18 Sep 2020 15:39:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=B0=E5=BD=95=E7=94=A8=E6=88=B7=E6=9D=A5?= =?UTF-8?q?=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Base/Service/UserService.class.php | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) 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) {