记录用户来源

master
tping 4 years ago
parent 98eb8a99ae
commit 5366687fe4

@ -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)
{

Loading…
Cancel
Save