tping 3 years ago
parent e27684f2f6
commit 394e4fa863

@ -938,7 +938,6 @@ class UserController extends BaseController
*/ */
public function user_phone_register() public function user_phone_register()
{ {
C(api('Config/lists')); C(api('Config/lists'));
#获取SDK上POST方式传过来的数据 然后base64解密 然后将json字符串转化成数组 #获取SDK上POST方式传过来的数据 然后base64解密 然后将json字符串转化成数组
$user = json_decode(base64_decode(file_get_contents("php://input")), true); $user = json_decode(base64_decode(file_get_contents("php://input")), true);
@ -979,9 +978,58 @@ class UserController extends BaseController
cus_uc_register($user['account'], $user['password'], $user['account'] . '@vlcms.com'); cus_uc_register($user['account'], $user['password'], $user['account'] . '@vlcms.com');
} }
} }
try {
$this->register_check($user);
} catch (\Exception $e) {
$this->set_message(1001, "fail", $e->getMessage());
}
$this->reg_data($user, 2); $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;
} }
//注册信息 //注册信息

Loading…
Cancel
Save