推广员绑定设备

master
tping 5 years ago
parent 947f12930a
commit 9997c117d0

@ -380,14 +380,7 @@ class UserModel extends Model{
if ($deviceInfo) {
$promote_id = $deviceInfo['promote_id'];
$promote_account = $deviceInfo['promote_account'];
} else {
M('device_promote', 'tab_')->add(array(
'promote_id' => $promote_id,
'promote_account' => $promote_account,
'device_number' => $unique_code,
'create_time' => time(),
));
}
}
$data = array(
'account' => $account,
@ -428,6 +421,18 @@ class UserModel extends Model{
/* 添加用户 */
if($this->create($data)){
$uid = $this->add();
// 找该设备绑定的上级推广员 优先找这个表的
if (!$deviceInfo) {
M('device_promote', 'tab_')->add(array(
'user_id' => $uid,
'promote_id' => $promote_id,
'promote_account' => $promote_account,
'device_number' => $unique_code,
'create_time' => time(),
));
}
$u_user['uid']=$uid;
$u_user['account']=$account;
$u_user['password']=think_encrypt($password);

@ -32,7 +32,7 @@ class UserController extends BaseController
$log['uid'] = 0;
$log['game_id'] = $user['game_id'];
$log['type'] = 3;
$log['action'] = json_encode($user);
$log['action'] = json_encode($user); // 请求参数
$ip = get_client_ip();
$device_bans_ip = M('device_bans','tab_')->where(['tag' => $ip,'type' => 2])->find();
@ -304,7 +304,7 @@ class UserController extends BaseController
switch ($result) {
case - 1:
$log['remarks'] = '密码错误';
$log['remarks'] = '扶持号被禁用';
log_action($log);
$this -> set_message(1005, "fail", "密码错误");
break;
@ -315,7 +315,6 @@ class UserController extends BaseController
break;
default:
if (is_array($result)) {
$user["user_id"] = $result['user_id'];
$user['puid'] = 0;
$this -> add_user_play($user);
@ -369,21 +368,63 @@ class UserController extends BaseController
);
// 登入时 该会员如果没绑定 优先找设备绑定表
if (!$user_res['promote_id']) {
$deviceInfo = M('device_promote', 'tab_')->where(array(
// 仅对3月1日之后注册的用户有效。登入时 该会员如果没绑定 优先找设备绑定表
$registerTimeLimit = strtotime("2020-03-01");
if ($user_res['register_time'] > $registerTimeLimit) {
// 1 看自己的推广员是否绑定了设备 绑定过得不修改
// 2 没有推广员的以设备为准 没有设备以包为准
$changeFlag = false; // 是否修改推广员
$changePromoteId = 0;
$changePromoteAccount = 0;
$deviceInfoByDevice = M('device_promote', 'tab_')->where(array(
'device_number' => $user['unique_code']
))->find();
// pp(M('device_promote', 'tab_')->_sql());
if ($deviceInfo) {
if ($user_res['promote_id'] > 0) { // 已存在推广员 修改推广员的情况 设备被其他推广绑定
$deviceInfoByUID = M('device_promote', 'tab_')->where(array(
'user_id' => $user_res['id']
))->find();
if (!$deviceInfoByUID) {
if ($deviceInfoByDevice) {
$changeFlag = true;
$changePromoteId = $deviceInfoByDevice['promote_id'];
$changePromoteAccount = $deviceInfoByDevice['promote_account'];
}
}
} else { // 没有推广员的情况下直接绑定这个设备
if ($deviceInfoByDevice) { // 这个设备绑定过推官员的修改成改推广员
$changeFlag = true;
$changePromoteId = $deviceInfoByDevice['promote_id'];
$changePromoteAccount = $deviceInfoByDevice['promote_account'];
} else {
if ($user['promote_id'] > 0) {
$promote = M('promote', 'tab_')->where(array(
'id' => $user['promote_id']
))->find();
if ($promote) {
M('device_promote', 'tab_')->add(array(
'user_id' => $user_res['id'],
'promote_id' => $user['promote_id'],
'promote_account' => $promote['promote_account'],
'device_number' => $user['unique_code'],
'create_time' => time(),
));
}
}
}
}
// pp(M('device_promote', 'tab_')->_sql());
if ($changeFlag) {
M('user', 'tab_')->where(array('id' => $user_res['id']))->save(array(
'promote_id' => $deviceInfo['promote_id'],
'promote_account' => $deviceInfo['promote_account'],
'promote_id' => $changePromoteId,
'promote_account' => $changePromoteAccount,
));
$log['type'] = 11; // 修改绑定上级推广员
log_action($log);
}
}
// 通知后台 TASK_URLhttp://47.111.118.107:9501
$url = C('TASK_URL')."/game-event/login";

Loading…
Cancel
Save