|
|
<?php
|
|
|
|
|
|
use Action\AbstractAction;
|
|
|
use LibModels\Wap\Passport\BackData;
|
|
|
use Hood\Core\Security\AuthCode;
|
|
|
/**
|
|
|
* 频道选择
|
|
|
*/
|
...
|
...
|
@@ -23,6 +26,23 @@ class BackController extends AbstractAction |
|
|
$this->_view->display('email', $data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发送邮箱验证码
|
|
|
*/
|
|
|
public function sendemailAction()
|
|
|
{
|
|
|
if($this->isAjax())
|
|
|
{
|
|
|
$email = $this->get('email', '');
|
|
|
|
|
|
// 发送邮箱验证码
|
|
|
$result = BackData::sendCodeToEmail($email);
|
|
|
$result['data'] = '/passport/back/success';
|
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public function successAction()
|
|
|
{
|
|
|
$data = array(
|
...
|
...
|
@@ -38,24 +58,59 @@ class BackController extends AbstractAction |
|
|
$this->_view->display('email-success', $data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据邮箱修改密码
|
|
|
*
|
|
|
* @return array 根据邮箱修改密码的结果
|
|
|
*/
|
|
|
public function passwordByEmailAction()
|
|
|
{
|
|
|
if($this->isAjax())
|
|
|
{
|
|
|
$pwd = $this->get('pwd', '');
|
|
|
$code = $this->get('code', '');
|
|
|
|
|
|
$data = BackData::modifyPasswordByEmail($pwd, $code);
|
|
|
|
|
|
$this->returnJson(200, '成功', '');// 前端不需要判断结果
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public function mobileAction()
|
|
|
{
|
|
|
// 获取地区信息
|
|
|
$areas = array();
|
|
|
$areaDatas = $data = BackData::getAreasData();
|
|
|
if($areaDatas['code'] == 200)
|
|
|
{
|
|
|
$areas = $areaDatas['data'];
|
|
|
}
|
|
|
// 处理地区信息
|
|
|
foreach ($areas as &$val) {
|
|
|
$val['areaCode'] = $val['area'];
|
|
|
if($val['area'] == 86)
|
|
|
{
|
|
|
$val['selected'] = true;
|
|
|
}
|
|
|
unset($val['area']);
|
|
|
}
|
|
|
/*// 排序
|
|
|
uasort($areas, function($a, $b) {
|
|
|
if($a['id'] === $b['id'])
|
|
|
{
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
return ($a['id'] < $b['id'] ? -1 : 1);
|
|
|
});*/
|
|
|
|
|
|
$data = array(
|
|
|
'backUrl' => 'm.yohobuy.com',
|
|
|
'headerText' => '找回密码',
|
|
|
'isPassportPage' => true,
|
|
|
'modulePath' => 'passport/back/mobile',
|
|
|
'countrys' => array(
|
|
|
array(
|
|
|
'areaCode' => '+86',
|
|
|
'selected' => true,
|
|
|
'name' => '中国'
|
|
|
),
|
|
|
array(
|
|
|
'areaCode' => '+864',
|
|
|
'name' => '中国香港'
|
|
|
)
|
|
|
),
|
|
|
'countrys' => $areas,
|
|
|
'countryCode' => '+86'
|
|
|
);
|
|
|
|
...
|
...
|
@@ -63,23 +118,67 @@ class BackController extends AbstractAction |
|
|
$this->_view->display('mobile', $data);
|
|
|
}
|
|
|
|
|
|
public function codeAction()
|
|
|
/**
|
|
|
* 发送手机验证码
|
|
|
*/
|
|
|
public function mobilecodeSendAction()
|
|
|
{
|
|
|
if($this->isAjax())
|
|
|
{
|
|
|
$mobile = $this->get('mobile', '');
|
|
|
$area = $this->get('area', 86);
|
|
|
|
|
|
// 发送手机验证码
|
|
|
$result = BackData::sendCodeToMobile($mobile, $area);
|
|
|
|
|
|
$this->returnJson($result['code'], $result['message'], $result['data']);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public function mobilecodeAction()
|
|
|
{
|
|
|
$mobile = $this->get('mobile', '');
|
|
|
$area = $this->get('area', 86);
|
|
|
|
|
|
$data = array(
|
|
|
'backUrl' => 'm.yohobuy.com',
|
|
|
'headerText' => '找回密码',
|
|
|
'isPassportPage' => true,
|
|
|
'modulePath' => 'passport/back/code',
|
|
|
'areaCode' => '+86',
|
|
|
'phoneNum' => '15895869035'
|
|
|
'phoneNum' => $mobile
|
|
|
);
|
|
|
|
|
|
$this->_view->assign('title', 'YOHO!有货');
|
|
|
$this->_view->display('mobile-code', $data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 校验手机验证码
|
|
|
*
|
|
|
* @return array 校验手机验证码的结果(token)
|
|
|
*/
|
|
|
public function mobilecodeValidateAction()
|
|
|
{
|
|
|
if($this->isAjax())
|
|
|
{
|
|
|
$mobile = $this->get('mobile', '');
|
|
|
$code = $this->get('code', '');
|
|
|
$area = $this->get('area', 86);
|
|
|
|
|
|
// 校验手机验证码
|
|
|
$result = BackData::validateMobileCode($mobile, $code, $area);
|
|
|
|
|
|
$this->returnJson($result['code'], $result['message'], $result['data']);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public function passwordAction()
|
|
|
{
|
|
|
$mobile = $this->get('mobile', '');
|
|
|
$token = $this->get('token', '');
|
|
|
$area = $this->get('area', 86);
|
|
|
|
|
|
$data = array(
|
|
|
'backUrl' => 'm.yohobuy.com',
|
|
|
'headerText' => '找回密码',
|
...
|
...
|
@@ -99,4 +198,25 @@ class BackController extends AbstractAction |
|
|
$this->_view->assign('title', 'YOHO!有货');
|
|
|
$this->_view->display('new-password', $data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据手机验证码修改密码
|
|
|
*
|
|
|
* @return array 根据手机验证码修改密码的结果
|
|
|
*/
|
|
|
public function passwordByMobileAction()
|
|
|
{
|
|
|
if($this->isAjax())
|
|
|
{
|
|
|
$mobile = $this->get('mobile', '');
|
|
|
$token = $this->get('token', '');
|
|
|
$newpwd = $this->get('newpwd', 86);
|
|
|
$area = $this->get('area', 86);
|
|
|
|
|
|
// 根据手机验证码修改密码
|
|
|
$result = BackData::modifyPasswordByMobile($mobile, $token, $newpwd, $area);
|
|
|
|
|
|
$this->returnJson($result['code'], $result['message'], $result['data']);
|
|
|
}
|
|
|
}
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|