虚拟注册

master
zhanglingsheng 5 years ago
parent 196bdf1c68
commit 522ba685dc

@ -38,42 +38,13 @@ class SimulationRegisterController extends Controller
#获取SDK上POST方式传过来的数据 然后base64解密 然后将json字符串转化成数组
$user = I('request.');
$user['register_type'] = 7;//模拟注册
$user['register_type'] = 17;//模拟注册
#判断数据是否为空
if (empty($user)) {
$this->set_message(1001, "fail", "注册数据不能为空");
}
Log::write('mn_user_register:' . date('Y-m-d H:i:s') . ' ---- ' . json_encode($user), 'INFO');
/**是否开启ucenter**/
if (C('UC_OPEN') == 1) {
//Ucenter注册
//1.验证本平台是否存在账号
$is_user_info = M('user', 'tab_')->where(['account' => $user['account']])->find();
if (!empty($is_user_info)) {
$this->set_message(1017, "fail", "用户名已存在");
}
//2.验证其他平台是否存在账号
$domain = C('UC_OTHER_WEB_URL');
if (!empty($domain)) {
$url = "http://{$domain}/Api/user/checkUserName?account={$user['account']}";
$check_res = json_decode(file_get_contents($url), true);
if ($check_res['status'] == 0) {
$this->set_message(1017, "fail", "用户名已存在");
}
}
//3.ucenter注册账号
$ucresult = uc_user_checkname($user['account']);
if ($ucresult == -1) {
$this->set_message(0, "fail", "用户名不合法");
} elseif ($ucresult == -2) {
$this->set_message(0, "fail", "包含要允许注册的词语");
} elseif ($ucresult == -3) {
$this->set_message(1017, "fail", "用户名已存在");
} else {
//同步ucenter注册
cus_uc_register($user['account'], $user['password'], $user['account'] . '@vlcms.com');
}
}
$this->reg_data($user);
}

Loading…
Cancel
Save