|
|
|
@ -938,17 +938,16 @@ class UserController extends BaseController
|
|
|
|
|
*/
|
|
|
|
|
public function user_phone_register()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
C(api('Config/lists'));
|
|
|
|
|
#获取SDK上POST方式传过来的数据 然后base64解密 然后将json字符串转化成数组
|
|
|
|
|
$user = json_decode(base64_decode(file_get_contents("php://input")), true);
|
|
|
|
|
#判断数据是否为空
|
|
|
|
|
if (empty($user)) {
|
|
|
|
|
$this -> set_message(1001, "fail", "注册数据不能为空");
|
|
|
|
|
$this->set_message(1001, "fail", "注册数据不能为空");
|
|
|
|
|
}
|
|
|
|
|
Log::write('user_phone_register:' . date('Y-m-d H:i:s') . ' ---- ' . json_encode($user), 'INFO');
|
|
|
|
|
#验证短信验证码
|
|
|
|
|
$this -> sms_verify($user['account'], $user['code']);
|
|
|
|
|
$this->sms_verify($user['account'], $user['code']);
|
|
|
|
|
/**是否开启ucenter**/
|
|
|
|
|
if (C('UC_OPEN') == 1) {
|
|
|
|
|
//Ucenter注册
|
|
|
|
@ -979,9 +978,58 @@ class UserController extends BaseController
|
|
|
|
|
cus_uc_register($user['account'], $user['password'], $user['account'] . '@vlcms.com');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$this -> reg_data($user, 2);
|
|
|
|
|
try {
|
|
|
|
|
$this->register_check($user);
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
$this->set_message(1001, "fail", $e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
$this->reg_data($user, 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function register_check($data) {
|
|
|
|
|
if (!isset($data['promote_id']) || !$data['promote_id']) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
$baseGame = M('base_game', 'tab_')->where([
|
|
|
|
|
'android_game_id|ios_game_id' => $data['game_id']
|
|
|
|
|
])->find();
|
|
|
|
|
if (!$baseGame) {
|
|
|
|
|
throw new \Exception("游戏不存在".$data['game_id']);
|
|
|
|
|
}
|
|
|
|
|
$promote = M('promote', 'tab_')->where([
|
|
|
|
|
'id' => $data['promote_id']
|
|
|
|
|
])->find();
|
|
|
|
|
if (!$promote) {
|
|
|
|
|
throw new \Exception("推广不存在");
|
|
|
|
|
}
|
|
|
|
|
// 上级推广员
|
|
|
|
|
$promoteRule = M('promote_limit_rules', 'tab_')->where([
|
|
|
|
|
'promote_id' => $data['promote_id']
|
|
|
|
|
])->find();
|
|
|
|
|
if ($promoteRule && !$promoteRule['base_game_id']) {
|
|
|
|
|
throw new \Exception("推广员违规,请更换推广员");
|
|
|
|
|
}
|
|
|
|
|
if ($promoteRule && $promoteRule['base_game_id'] == $baseGame['id']) {
|
|
|
|
|
throw new \Exception("推广员违规,请更换推广员");
|
|
|
|
|
}
|
|
|
|
|
// 推广员链
|
|
|
|
|
$promote['chain'] = '/1032/10099/10118/';
|
|
|
|
|
$promoteChain = explode('/', $promote['chain']);
|
|
|
|
|
// $promoteStr = implode(',', $promoteChain);
|
|
|
|
|
|
|
|
|
|
$promoteRules = M('promote_limit_rules', 'tab_')->where([
|
|
|
|
|
'in' => ['promote_id', $promoteChain]
|
|
|
|
|
])->select();
|
|
|
|
|
foreach ($promoteRules as $promoteRule) {
|
|
|
|
|
if ($promoteRule['base_game_id'] == 0 && $promoteRule['with_sub'] == 1) {
|
|
|
|
|
throw new \Exception("推广员违规,请更换推广员");
|
|
|
|
|
}
|
|
|
|
|
if ($promoteRule['base_game_id'] == $baseGame['id'] && $promoteRule['with_sub'] == 1) {
|
|
|
|
|
throw new \Exception("推广员违规,请更换推广员");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//注册信息
|
|
|
|
|