|
|
|
@ -32,7 +32,6 @@ class UserController extends BaseController {
|
|
|
|
|
|
|
|
|
|
/*是否开启Ucenter*/
|
|
|
|
|
if( C('UC_OPEN')==1 ){
|
|
|
|
|
|
|
|
|
|
$username = $account;
|
|
|
|
|
|
|
|
|
|
//Ucenter登录
|
|
|
|
@ -142,13 +141,57 @@ class UserController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$res = $this->suser->login($account,$password);file_put_contents(dirname(__FILE__) . '/login_res_text.txt',json_encode([$res]));
|
|
|
|
|
if($res > 0) {
|
|
|
|
|
$data=array(
|
|
|
|
|
'status' => 1,
|
|
|
|
|
'msg' => '登录成功',
|
|
|
|
|
);
|
|
|
|
|
$promoteId = I('post.promote_id');
|
|
|
|
|
$promoteId = intval($promoteId);
|
|
|
|
|
|
|
|
|
|
if ($promoteId > 0) {
|
|
|
|
|
$wherePromote['id'] = $promoteId;
|
|
|
|
|
$promoteData = M('Promote','tab_')->field('id,account')->where($wherePromote)->find();
|
|
|
|
|
|
|
|
|
|
if (!empty($promoteData)) {
|
|
|
|
|
$whereUser['account'] = $account;
|
|
|
|
|
$whereUser['_logic'] = 'or';
|
|
|
|
|
$whereUser['mobile_phone'] = $account;
|
|
|
|
|
$userData = M('User', 'tab_')->where($whereUser)->find();
|
|
|
|
|
|
|
|
|
|
if (!empty($userData)) {
|
|
|
|
|
if (empty($userData['promote_id'])) {
|
|
|
|
|
$saveData['promote_id'] = $promoteId;
|
|
|
|
|
$saveData['promote_account'] = $promoteData['account'];
|
|
|
|
|
|
|
|
|
|
$saveRes = M('User', 'tab_')->where(array('id'=>$userData['id']))->save($saveData);
|
|
|
|
|
if ($saveRes) {
|
|
|
|
|
$data = array(
|
|
|
|
|
'status' => 2,
|
|
|
|
|
'msg' => '登录成功!绑定成功',
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
$data = array(
|
|
|
|
|
'status' => 0,
|
|
|
|
|
'msg' => '登录成功!绑定失败',
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$data = array(
|
|
|
|
|
'status' => 0,
|
|
|
|
|
'msg' => '登录成功!绑定失败',
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$data = array(
|
|
|
|
|
'status' => 0,
|
|
|
|
|
'msg' => '登录成功!绑定失败',
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$data=array(
|
|
|
|
|
'status' => 1,
|
|
|
|
|
'msg' => '登录成功',
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
switch($res) {
|
|
|
|
|
case -1000: $error = '账号不存在'; break;
|
|
|
|
@ -190,9 +233,18 @@ class UserController extends BaseController {
|
|
|
|
|
if (empty($password)) {
|
|
|
|
|
echo json_encode(array('status'=>0,'msg'=>'请输入密码'));exit;
|
|
|
|
|
}
|
|
|
|
|
$safeinfo = array('nickname' => $account, 'password' => $password, 'sex' => $sex ,'status' => 1);
|
|
|
|
|
|
|
|
|
|
$promoteId = I('post.promote_id');
|
|
|
|
|
$promoteId = intval($promoteId);
|
|
|
|
|
if ($promoteId > 0) {
|
|
|
|
|
$gameId = intval(I('post.game_id'));
|
|
|
|
|
$safeinfo = array('nickname' => $account, 'password' => $password, 'sex' => $sex ,'status' => 1,'promote_id' => $promoteId, 'game_id' => $gameId);
|
|
|
|
|
} else {
|
|
|
|
|
$safeinfo = array('nickname' => $account, 'password' => $password, 'sex' => $sex ,'status' => 1);
|
|
|
|
|
}
|
|
|
|
|
session('safeinfo',$safeinfo);
|
|
|
|
|
$url = U('register');
|
|
|
|
|
|
|
|
|
|
echo json_encode(array('status'=>1,'msg'=>$url));
|
|
|
|
|
} else{
|
|
|
|
|
$this->display();
|
|
|
|
@ -275,11 +327,19 @@ class UserController extends BaseController {
|
|
|
|
|
$pid = $this->suser->register($phone,$password,$phone,$register_way,$register_type,'','',$sex,$nickname,$head_img);
|
|
|
|
|
}
|
|
|
|
|
if($pid > 0){
|
|
|
|
|
$data = array(
|
|
|
|
|
'status' => 1,
|
|
|
|
|
'msg' => '注册成功',
|
|
|
|
|
'url' => U('Index/index'),
|
|
|
|
|
);
|
|
|
|
|
if (empty($safeinfo['promote_id'])) {
|
|
|
|
|
$data = array(
|
|
|
|
|
'status' => 1,
|
|
|
|
|
'msg' => '注册成功',
|
|
|
|
|
'url' => U('Index/index'),
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
$data = array(
|
|
|
|
|
'status' => 1,
|
|
|
|
|
'msg' => '注册成功',
|
|
|
|
|
'url' => U('User/login', array('pid' => $safeinfo['promote_id'], 'gid' => $safeinfo['game_id'])),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
session('safeinfo',null);
|
|
|
|
|
} else{
|
|
|
|
|
$data = array(
|
|
|
|
@ -369,14 +429,28 @@ class UserController extends BaseController {
|
|
|
|
|
if($is_setting){
|
|
|
|
|
echo json_encode(array('status'=>0,'msg'=>'账号已存在'));exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$pid = $this->suser->register($account,$password,'',$register_way,$register_type,'','',$sex,$nickname,$head_img);
|
|
|
|
|
|
|
|
|
|
if($pid > 0){
|
|
|
|
|
$data = array(
|
|
|
|
|
'status' => 1,
|
|
|
|
|
'msg' => '注册成功',
|
|
|
|
|
'url' => U('Index/index'),
|
|
|
|
|
);
|
|
|
|
|
$promoteId = I('post.promote_id');
|
|
|
|
|
$promoteId = intval($promoteId);
|
|
|
|
|
|
|
|
|
|
if ($promoteId > 0) {
|
|
|
|
|
$gameId = intval(I('post.game_id'));
|
|
|
|
|
|
|
|
|
|
$data = array(
|
|
|
|
|
'status' => 1,
|
|
|
|
|
'msg' => '注册成功',
|
|
|
|
|
'url' => U('User/login', array('pid' => $promoteId, 'gid' => $gameId)),
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
$data = array(
|
|
|
|
|
'status' => 1,
|
|
|
|
|
'msg' => '注册成功',
|
|
|
|
|
'url' => U('Index/index'),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
} else{
|
|
|
|
|
$data = array(
|
|
|
|
|
'status' => $pid,
|
|
|
|
|