...
|
...
|
@@ -73,15 +73,40 @@ class RegisterController extends WebAction |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 校验并发送验证码
|
|
|
* 校验图形验证码
|
|
|
*
|
|
|
* @return json
|
|
|
*/
|
|
|
public function piccaptchaAction()
|
|
|
{
|
|
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
|
|
|
|
|
do {
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!$this->isAjax()) {
|
|
|
break;
|
|
|
}
|
|
|
$verifyCode = trim($this->post('verifyCode'));
|
|
|
$picFlag = PassportModel::verifyCode($verifyCode);
|
|
|
if ($picFlag) {
|
|
|
$data = array('code' => 200, 'message' => '验证码正确', 'data' => '');
|
|
|
}
|
|
|
else {
|
|
|
$data = array('code' => 400, 'message' => '验证码错误', 'data' => '');
|
|
|
}
|
|
|
}
|
|
|
while (false);
|
|
|
|
|
|
$this->echoJson($data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发送短信验证码
|
|
|
*/
|
|
|
public function sendBindMsgAction(){
|
|
|
$mobile = trim($this->post('mobile'), ' ');
|
|
|
$area = intval(trim($this->post('area'), ' '));
|
|
|
$verifyCode = strtolower(trim($this->post('code'),' '));
|
|
|
$verifyCode = strtolower(trim($this->post('verifyCode'),' '));
|
|
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
|
|
do
|
|
|
{
|
...
|
...
|
@@ -91,13 +116,14 @@ class RegisterController extends WebAction |
|
|
}
|
|
|
/* 判断参数是否合法 */
|
|
|
if (!is_numeric($mobile) || !is_numeric($area)) {
|
|
|
$code = 400;
|
|
|
$data['code'] = 400;
|
|
|
$data['message'] = '手机号码格式不正确';
|
|
|
break;
|
|
|
}
|
|
|
//检测验证码不正确
|
|
|
if(!PassportModel::verifyCode($verifyCode)) {
|
|
|
$data['message'] = '验证码不正确';
|
|
|
$data['code'] = 400;
|
|
|
$data['message'] = '图形验证码不正确';
|
|
|
break;
|
|
|
}
|
|
|
//发送代码
|
...
|
...
|
@@ -119,7 +145,32 @@ class RegisterController extends WebAction |
|
|
|
|
|
public function msgcaptchaAction()
|
|
|
{
|
|
|
$this->echoJson(array('code'=>200));
|
|
|
$data = array('code' => 400, 'message' => '', 'data' => '');
|
|
|
|
|
|
do {
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!$this->isAjax()) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$phoneNum = trim($this->post('mobile'));
|
|
|
$areaCode = trim($this->post('area'));
|
|
|
$code = trim($this->post('code')); //短信验证码
|
|
|
//校验手机号格式
|
|
|
if (!is_numeric($phoneNum) || !is_numeric($areaCode)) {
|
|
|
$data['code'] = 401;
|
|
|
$data['message'] = '手机号码格式不正确';
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$data = BindData::checkBindCode($areaCode, $phoneNum, $code);
|
|
|
if (!isset($data['code'])) {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
while (false);
|
|
|
|
|
|
$this->echoJson($data);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -130,7 +181,7 @@ class RegisterController extends WebAction |
|
|
{
|
|
|
$mobile = trim($this->post('mobile'), ' ');//mobile
|
|
|
$area = intval(trim($this->post('area'), ' '));//area
|
|
|
$verifyCode = strtolower(trim($this->post('captcha'),' '));//captcha
|
|
|
$verifyCode = strtolower(trim($this->post('verifyCode'),' '));//图形验证码
|
|
|
$code = trim($this->post('code'),'');//code
|
|
|
$password = $this->post('password');
|
|
|
$url = '/passport/register/index';
|
...
|
...
|
@@ -156,18 +207,18 @@ class RegisterController extends WebAction |
|
|
$data['message'] = '密码不正确';
|
|
|
break;
|
|
|
}
|
|
|
/* 验证注册的标识码是否有效 */
|
|
|
$data = RegData::validMobileCode($area, $mobile, $code);
|
|
|
if (!isset($data['code']) || $data['code'] != 200) {
|
|
|
$data['message'] = '验证码错误';
|
|
|
break;
|
|
|
}
|
|
|
$effective_time = $this->getSession('effective_time');
|
|
|
if($effective_time < time() || empty($effective_time))
|
|
|
{
|
|
|
$data['message'] = '注册超时';
|
|
|
break;
|
|
|
}
|
|
|
/* 验证注册的标识码是否有效 */
|
|
|
$data = RegData::validMobileCode($area, $mobile, $code);
|
|
|
if (!isset($data['code']) || $data['code'] != 200) {
|
|
|
$data['message'] = '验证码错误';
|
|
|
break;
|
|
|
}
|
|
|
/*手机注册*/
|
|
|
$data = RegData::regMobile($area, $mobile, $password);
|
|
|
if (!isset($data['code']) || $data['code'] != 200) {
|
...
|
...
|
|