...
|
...
|
@@ -17,12 +17,15 @@ class RegController extends AbstractAction |
|
|
$this->setTitle('注册');
|
|
|
|
|
|
$data = array();
|
|
|
$data['regIndex'] = true;
|
|
|
$data['backUrl'] = '/';
|
|
|
$data['headerText'] = '注册';
|
|
|
$data['isPassportPage'] = true;
|
|
|
$data['countrys'] = array();
|
|
|
|
|
|
// 获取地区数据列表
|
|
|
$area = RegData::getAreasData();
|
|
|
// 有数据
|
|
|
if (!empty($area['data'])) {
|
|
|
$build = array();
|
|
|
foreach ($area['data'] as $value) {
|
...
|
...
|
@@ -32,7 +35,9 @@ class RegController extends AbstractAction |
|
|
$build['name'] = $value['name'];
|
|
|
$data['countrys'][] = $build;
|
|
|
}
|
|
|
} else {
|
|
|
}
|
|
|
// 没数据
|
|
|
else {
|
|
|
$data['countrys'][0] = array();
|
|
|
$data['countrys'][0]['areaCode'] = '+86';
|
|
|
$data['countrys'][0]['selected'] = true;
|
...
|
...
|
@@ -65,11 +70,13 @@ class RegController extends AbstractAction |
|
|
$this->setTitle('注册-验证码');
|
|
|
|
|
|
$data = array();
|
|
|
$data['regCode'] = true;
|
|
|
$data['backUrl'] = '/';
|
|
|
$data['headerText'] = '注册';
|
|
|
$data['isPassportPage'] = true;
|
|
|
$data['areaCode'] = $area;
|
|
|
$data['phoneNum'] = $mobile;
|
|
|
$data['token'] = $token;
|
|
|
|
|
|
$this->_view->display('code', $data);
|
|
|
}
|
...
|
...
|
@@ -83,14 +90,27 @@ class RegController extends AbstractAction |
|
|
*/
|
|
|
public function passwordAction()
|
|
|
{
|
|
|
$data = array(
|
|
|
'backUrl' => 'm.yohobuy.com',
|
|
|
'headerText' => '注册',
|
|
|
'isPassportPage' => true,
|
|
|
'modulePath' => 'passport/register/password'
|
|
|
);
|
|
|
$token = $this->get('token');
|
|
|
$mobile = $this->get('mobile');
|
|
|
$area = $this->get('area', '86');
|
|
|
|
|
|
// 判断是否允许访问, 不允许则跳转到错误页面
|
|
|
if (!is_string($token) || !is_numeric($mobile) || !is_numeric($area)
|
|
|
|| !Helpers::verifyToken($mobile, $token)) {
|
|
|
$this->error();
|
|
|
}
|
|
|
|
|
|
$this->setTitle('注册-设置密码');
|
|
|
|
|
|
$data = array();
|
|
|
$data['regPwd'] = true;
|
|
|
$data['backUrl'] = '/';
|
|
|
$data['headerText'] = '注册';
|
|
|
$data['isPassportPage'] = true;
|
|
|
$data['areaCode'] = $area;
|
|
|
$data['phoneNum'] = $mobile;
|
|
|
$data['token'] = $token;
|
|
|
|
|
|
$this->_view->assign('title', '注册-密码');
|
|
|
$this->_view->display('password', $data);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -99,7 +119,6 @@ class RegController extends AbstractAction |
|
|
*
|
|
|
* @param string area 地区编号,注意不需要+号
|
|
|
* @param string mobile 手机号
|
|
|
* @param string token 访问TOKEN凭证
|
|
|
* @return json
|
|
|
*/
|
|
|
public function verifymobileAction()
|
...
|
...
|
@@ -112,16 +131,10 @@ class RegController extends AbstractAction |
|
|
break;
|
|
|
}
|
|
|
|
|
|
$token = $this->post('token');
|
|
|
$mobile = $this->post('mobile');
|
|
|
$area = $this->post('area', '86');
|
|
|
/* 判断参数是否合法 */
|
|
|
if (!is_string($token) || !is_numeric($mobile) || !is_numeric($area)) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
/* 判断是否允许访问 */
|
|
|
if (!Helpers::verifyToken($mobile, $token)) {
|
|
|
if (!is_numeric($mobile) || !is_numeric($area)) {
|
|
|
break;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -133,12 +146,13 @@ class RegController extends AbstractAction |
|
|
|
|
|
/* 返回跳转到验证页面的链接*/
|
|
|
if ($data['code'] == 200) {
|
|
|
$token = Helpers::makeToken($mobile);
|
|
|
$data['data'] = '/passport/reg/code?token='.$token.'&mobile='.$mobile.'&area='.$area;
|
|
|
}
|
|
|
|
|
|
} while (false);
|
|
|
|
|
|
echo $this->echoJson($data);
|
|
|
$this->echoJson($data);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -160,17 +174,11 @@ class RegController extends AbstractAction |
|
|
break;
|
|
|
}
|
|
|
|
|
|
$token = $this->post('token');
|
|
|
$mobile = $this->post('mobile');
|
|
|
$area = $this->post('area');
|
|
|
$code = $this->post('code');
|
|
|
/* 判断参数是否合法 */
|
|
|
if (!is_string($token) || !is_numeric($mobile) || !is_numeric($area) || !isset($code)) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
/* 判断是否允许访问 */
|
|
|
if (!Helpers::verifyToken($mobile, $token)) {
|
|
|
if (!is_numeric($mobile) || !is_numeric($area) || !isset($code)) {
|
|
|
break;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -182,12 +190,48 @@ class RegController extends AbstractAction |
|
|
|
|
|
/* 返回跳转到设置密码的链接*/
|
|
|
if ($data['code'] == 200) {
|
|
|
$token = Helpers::makeToken($mobile);
|
|
|
$data['data'] = '/passport/reg/password?token='.$token.'&mobile='.$mobile.'&area='.$area;
|
|
|
}
|
|
|
|
|
|
} while (false);
|
|
|
|
|
|
echo $this->echoJson($data);
|
|
|
$this->echoJson($data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发送验证码
|
|
|
*
|
|
|
* @param string area 地区编号,注意不需要+号
|
|
|
* @param string mobile 手机号
|
|
|
* @return json
|
|
|
*/
|
|
|
public function sendcodeAction()
|
|
|
{
|
|
|
$data = array('code' => 400, 'message' => '参数不正确!', 'data' => '');
|
|
|
|
|
|
do {
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (!$this->isAjax()) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$mobile = $this->post('mobile');
|
|
|
$area = $this->post('area', '86');
|
|
|
/* 判断参数是否合法 */
|
|
|
if (!is_numeric($mobile) || !is_numeric($area)) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
/* 向手机发送注册验证码 */
|
|
|
$data = RegData::sendCodeToMobile($area, $mobile);
|
|
|
if (!isset($data['code'])) {
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
} while (false);
|
|
|
|
|
|
$this->echoJson($data);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -201,7 +245,7 @@ class RegController extends AbstractAction |
|
|
*/
|
|
|
public function setpasswordAction()
|
|
|
{
|
|
|
$data = array('code' => 400, 'message' => '参数不正确!', 'data' => '');
|
|
|
$data = array('code' => 400, 'message' => '密码格式不正确!', 'data' => '');
|
|
|
|
|
|
do {
|
|
|
/* 判断是不是AJAX请求 */
|
...
|
...
|
@@ -229,14 +273,14 @@ class RegController extends AbstractAction |
|
|
break;
|
|
|
}
|
|
|
|
|
|
/* 返回跳转到设置密码的链接*/
|
|
|
/* 返回跳转到来源页面 */
|
|
|
if ($data['code'] == 200) {
|
|
|
$data['data'] = '/passport/reg/password?token='.$token.'&mobile='.$mobile.'&area='.$area;
|
|
|
}
|
|
|
|
|
|
} while (false);
|
|
|
|
|
|
echo $this->echoJson($data);
|
|
|
$this->echoJson($data);
|
|
|
}
|
|
|
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|