推广员绑定设备

master
tping 5 years ago
parent 5ed4caf0ab
commit 9a179989d6

@ -372,6 +372,23 @@ class UserModel extends Model{
*user表加game_id
*/
public function sdk_register_($account,$password,$register_way,$register_type,$promote_id=0,$promote_account="",$phone="",$game_id="",$game_name="",$sdk_version="",$device_type="",$unique_code=""){
// 找该设备绑定的上级推广员 优先找这个表的
$deviceInfo = M('device_promote', 'tab_')->where(array(
'device_number' => $unique_code
))->find();
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,
'password' => $password,

@ -368,6 +368,23 @@ class UserController extends BaseController
'request_count' => $buddies_request,
);
// 登入时 该会员如果没绑定 优先找设备绑定表
if (!$user_res['promote_id']) {
$deviceInfo = M('device_promote', 'tab_')->where(array(
'device_number' => $user['unique_code']
))->find();
// pp(M('device_promote', 'tab_')->_sql());
if ($deviceInfo) {
M('user', 'tab_')->where(array('id' => $user_res['id']))->save(array(
'promote_id' => $deviceInfo['promote_id'],
'promote_account' => $deviceInfo['promote_account'],
));
$log['type'] = 11; // 修改绑定上级推广员
log_action($log);
}
}
// 通知后台 TASK_URLhttp://47.111.118.107:9501
$url = C('TASK_URL')."/game-event/login";
try {

Loading…
Cancel
Save