记录用户来源

master
tping 4 years ago
parent 98eb8a99ae
commit 5366687fe4

@ -73,6 +73,8 @@ class UserService
'request_count' => 0,
];
$this->doUserSource($data['user_id'], $gameId, $params['promote_id'] ?? 0, $deviceNum, $sdkVersion, $clientIp);
$this->resetLoginLimit();
return ['status' => true, 'message' => '登录成功', 'data' => $data];
}
@ -158,6 +160,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)
{
if ($testResource && $user['device_number'] && $deviceNum && $user['device_number'] != $deviceNum) {

Loading…
Cancel
Save