Authored by whb

common的广告修改

... ... @@ -465,7 +465,7 @@ class WebAction extends Controller_Abstract
*/
protected function setWebNavHeader($channel = '')
{
//TODO
//TODO
if(empty($channel)) {
$channel = \Index\HomeModel::getSwitchChannel();
}
... ... @@ -477,63 +477,63 @@ class WebAction extends Controller_Abstract
'gobytype'=> 'gobuy'.$channel,
'searchcate'=>'searchcate'.$channel,
'myyoho' => array(
'email'=>'hhh@126.com',
'viptype'=>'普通会员',
'currentscore' => 495,
'totalscore' => 600,
'cardtype' => '银卡',
'infolist' => array(
array(
'name' =>'待处理的订单',
'link' =>'',
'num' => '0'
),
array(
'name' =>'我的收藏',
'link' =>'',
'num' => '1'
),
'email'=>'hhh@126.com',
'viptype'=>'普通会员',
'currentscore' => 495,
'totalscore' => 600,
'cardtype' => '银卡',
'infolist' => array(
array(
'name' =>'我的优惠券',
'link' =>'',
'num' => '2'
),
'name' =>'待处理的订单',
'link' =>'',
'num' => '0'
),
array(
'name' =>'我的YOHO币',
'link' =>'',
'num' => '1'
),
'name' =>'我的收藏',
'link' =>'',
'num' => '1'
),
array(
'name' =>'我的退货换货',
'link' =>'',
'num' => '1'
)
),
'updlink' => ''
),
'gobuy'=> array(
'gobuynum' =>3
),
'breadcrumbnav'=> array(
array(
'notend'=>array(
'link' => 'http=>//www.baidu.com',
'name' => 'BOYS首页'
)
),
array(
'notend'=>array(
'link' => 'http=>//www.baidu.com',
'name' => '上衣'
)
),
array(
'isend'=>array(
'link' => 'http=>//www.baidu.com',
'name' => '衬衫'
)
)
)
'name' =>'我的优惠券',
'link' =>'',
'num' => '2'
),
array(
'name' =>'我的YOHO币',
'link' =>'',
'num' => '1'
),
array(
'name' =>'我的退货换货',
'link' =>'',
'num' => '1'
)
),
'updlink' => ''
),
'gobuy'=> array(
'gobuynum' =>3
),
'breadcrumbnav'=> array(
array(
'notend'=>array(
'link' => 'http=>//www.baidu.com',
'name' => 'BOYS首页'
)
),
array(
'notend'=>array(
'link' => 'http=>//www.baidu.com',
'name' => '上衣'
)
),
array(
'isend'=>array(
'link' => 'http=>//www.baidu.com',
'name' => '衬衫'
)
)
)
);
$this->_view->assign('headerdata', $header);
}
... ...
... ... @@ -94,10 +94,10 @@ class SearchData extends \LibModels\Wap\Product\SearchData
* @param integer $sell_channels 销售平台
* @param integer $p_d_int 促销折扣 int型如7
* @param integer $act_temp 活动模板
* @param integer $act_rec 活动模板是否推荐
* @param integer $act_status 活动模板商品状态
* @param integer $attribute_not 过滤商品属性,attribute_not=2过滤掉赠品
* @param integer $not_* not_字段名,过滤字段
* @param integer $act_rec 活动模板是否推荐
* @param integer $act_status 活动模板商品状态
* @param integer $attribute_not 过滤商品属性,attribute_not=2过滤掉赠品
* @param integer $not_* not_字段名,过滤字段
* @return array 搜索到的数据
*/
public static function getClassesData($classes = array(), $cache = false)
... ...
... ... @@ -80,7 +80,7 @@ class Bootstrap extends Bootstrap_Abstract
case 'web':
break;
case 'search': // 搜索
$searchRequest = new Yaf\Request\Http('/product/search/index');
$searchRequest = new Yaf\Request\Http('/product/search/index');
$dispatcher->setRequest($searchRequest);
break;
case 'guang': // 逛
... ... @@ -90,7 +90,7 @@ class Bootstrap extends Bootstrap_Abstract
$module = 'Product';
$url = strtolower($dispatcher->getRequest()->getRequestUri());
//list列表的index
if(empty($url) || $url == '/index' || $url == '/') {
if(empty($url) || $url == '/index' || $url == '/') {
$listRequest = new Yaf\Request\Http('/product/list/index');
$dispatcher->setRequest($listRequest);
}
... ...
... ... @@ -85,6 +85,8 @@ class CommonController extends WebAction
$content_code = $this->get('content_code', '');
$client_type = $this->get('client_type', 'web');
$callback = $this->get('callback', '');
$width = $this->get('width', '');
$height = $this->get('height', '');
$params = array(
'content_code' => $content_code,
'client_type' => $client_type
... ... @@ -96,16 +98,19 @@ class CommonController extends WebAction
}
else
{
$banner = '';
if(isset($data['data'][0]['data']))
{
$banner = current($data['data'][0]['data']);
if(!empty($banner)) {
$banner['src'] = Images::getImageUrl($banner['src'], 2600, 60 ,2);
//str_replace('?imageView/{mode}/w/{width}/h/{height}', '', $banner['src']);
}
}
$banner = '';
if(isset($data['data'][0]['data']))
{
$banner = current($data['data'][0]['data']);
if(!empty($banner)) {
if(empty($width) || empty($height) ) {
$width = 2600;//通栏广告
$height = 60;
}
$banner['src'] = Images::getImageUrl($banner['src'], $width, $height ,2);
//str_replace('?imageView/{mode}/w/{width}/h/{height}', '', $banner['src']);
}
}
}
return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $banner);
}
... ...
... ... @@ -66,57 +66,60 @@ class HomeModel
$key = sprintf('%s_%s_%s',CacheConfig::KEY_WEB_HOME_NAVBAR_DATA, md5(serialize($data)), $channel);
$menu = Cache::get($key);
if(empty($menu)) {
$item = array();
$index_main = 0;
foreach ($data['data'] as $val) {
$item = array(
'name_cn' => $val['sort_name'], // 父级
'name_en' => $val['sort_name_en'],
'link' => $val['sort_url'],
'icon' => $val['sort_ico'],
'classname' => str_replace(' ', '', strtolower($val['sort_name_en'])) == $channel ? $channel : '',
'index_main' => $index_main++,
'is_hot' => $val['is_hot'] == 'Y' ? true : false,
'is_new' => $val['is_new'] == 'Y' ? true : false,
// 'subnav' => array()
);
$index_sub = 0;
foreach ($val['sub'] as $sub) { // 二级
$subnav = array(
'name' => $sub['sort_name'],
'name_en' => $sub['sort_name_en'],
'link' => $sub['sort_url'],
'is_hot' => $sub['is_hot'] == 'Y' ? true : false,
'is_new' => $sub['is_new'] == 'Y' ? true : false,
// 'thirdnav' => array(),
'index_sub' => $index_sub ++
);
if (isset($sub['sub'])) {
foreach ($sub['sub'] as $thirdsub) { // 三级
$thirdnav = array(
'title' => $thirdsub['sort_name'],
'name_en' => $thirdsub['sort_name_en'],
'link' => $thirdsub['sort_url'],
// 'branditems' => array()
);
if (isset($thirdsub['sub'])) {
foreach ($thirdsub['sub'] as $fourthnav) { // 四级
$thirdnav['branditems'][] = array(
'brandname' => $fourthnav['sort_name'],
'link' => $fourthnav['sort_url'],
'hot' => $fourthnav['is_hot'] == 'Y' ? 'hot' : ''
);
}
}
$subnav['thirdnav'][] = $thirdnav;
}
}
$item['subnav'][] = $subnav;
}
$menu[] = $item;
}
Cache::set($key, $menu, 3600);
$item = array();
$index_main = 0;
foreach ($data['data'] as $val) {
$item = array(
'name_cn' => $val['sort_name'], // 父级
'name_en' => $val['sort_name_en'],
'link' => $val['sort_url'],
'icon' => $val['sort_ico'],
'classname' => str_replace(' ', '', strtolower($val['sort_name_en'])) == $channel ? $channel : '',
'index_main' => $index_main ++,
'content_code' => $val['content_code'],
'is_hot' => $val['is_hot'] == 'Y' ? true : false,
'is_new' => $val['is_new'] == 'Y' ? true : false,
// 'subnav' => array()
);
$index_sub = 0;
foreach ($val['sub'] as $sub) { // 二级
$subnav = array(
'name' => $sub['sort_name'],
'name_en' => $sub['sort_name_en'],
'link' => $sub['sort_url'],
'is_hot' => $sub['is_hot'] == 'Y' ? true : false,
'is_new' => $sub['is_new'] == 'Y' ? true : false,
'content_code' => $sub['content_code'],
// 'thirdnav' => array(),
'index_sub' => $index_sub ++
);
if (isset($sub['sub'])) {
foreach ($sub['sub'] as $thirdsub) { // 三级
$thirdnav = array(
'title' => $thirdsub['sort_name'],
'name_en' => $thirdsub['sort_name_en'],
'link' => $thirdsub['sort_url'],
'content_code' => $thirdsub['content_code'],
// 'branditems' => array()
);
if (isset($thirdsub['sub'])) {
foreach ($thirdsub['sub'] as $fourthnav) { // 四级
$thirdnav['branditems'][] = array(
'brandname' => $fourthnav['sort_name'],
'link' => $fourthnav['sort_url'],
'hot' => $fourthnav['is_hot'] == 'Y' ? 'hot' : ''
);
}
}
$subnav['thirdnav'][] = $thirdnav;
}
}
$item['subnav'][] = $subnav;
}
$menu[] = $item;
}
Cache::set($key, $menu, 3600);
}
return $menu;
}
... ... @@ -171,14 +174,14 @@ class HomeModel
*/
public static function getChannelResource($channel, $content_code)
{
$key = sprintf(CacheConfig::KEY_WEB_HOME_CHANNEL_DATA.'_'.$channel);
$data = Cache::get($key);
if(empty($data)) {
$resource = IndexData::getResourceData($content_code);
// 格式化数据
$data = ChannelProcess::getFormat($channel, $resource['data']);
Cache::set($key, $data, 3600);
}
$key = sprintf(CacheConfig::KEY_WEB_HOME_CHANNEL_DATA.'_'.$channel);
$data = Cache::get($key);
if(empty($data)) {
$resource = IndexData::getResourceData($content_code);
// 格式化数据
$data = ChannelProcess::getFormat($channel, $resource['data']);
Cache::set($key, $data, 3600);
}
return $data;
}
... ... @@ -228,47 +231,47 @@ class HomeModel
//缓存数据
$result = Cache::get($key);
if(empty($result)) {
$params = array(
'order' => 's_t_desc',
'shelve_time' => strtotime("-60 days") . ',' . time()
);
//男首频道最新上架参数是gender=1,3
if($channel == self::COOKIE_NAME_BOYS) {
$params['gender'] = '1,3';
}
//女首频道最新上架参数是gender=2,3
else if($channel == self::COOKIE_NAME_GIRLS) {
$params['gender'] = '2,3';
}
// 最新上架分类
if (isset(ChannelConfig::$newArrivalSortList[$channel])) {
$sortList = ChannelConfig::$newArrivalSortList[$channel];
// 获取分类列表获取商品信息
$goodsList = SearchData::getSearchDataBySort($params, $sortList);
$pos = 1;
foreach ($goodsList as $goods) {
// 格式化数据
$val = Helpers::formatProduct($goods, true, true, true, 280, 373);
if ($val['price'] == false) {
$val['price'] = $val['salePrice'];
}
$val['url'] = sprintf('%s?channel=%s&from=%s-n_%s', $val['url'], $channel , $channel, $pos++);
//TODO 字段要调整
$val['isFew'] = $val['is_soon_sold_out'];
$val['tags']['isLimit'] = $val['tags']['is_limited'];
$val['tags']['isSale'] = false;//$val['tags']['is_discount'];暂时不显示
$val['tags']['isNew'] = false;//$val['tags']['is_new'];暂时不显示
$val['tags']['isYearMidPromotion'] = $val['tags']['midYear'];
$val['tags']['isYearEndPromotion'] = $val['tags']['yearEnd'];
$val['tags']['isReNew'] = false;//$val['tags']['is_advance'];暂时不显示
unset($val['tags']['is_advance'], $val['tags']['is_discount'], $val['tags']['is_limited'], $val['tags']['is_new'],
$val['tags']['is_yohood'], $val['tags']['midYear'], $val['tags']['yearEnd']);
if (! empty($val)) {
$result[] = $val;
}
}
}
Cache::set($key, $result, 3600);
$params = array(
'order' => 's_t_desc',
'shelve_time' => strtotime("-60 days") . ',' . time()
);
//男首频道最新上架参数是gender=1,3
if($channel == self::COOKIE_NAME_BOYS) {
$params['gender'] = '1,3';
}
//女首频道最新上架参数是gender=2,3
else if($channel == self::COOKIE_NAME_GIRLS) {
$params['gender'] = '2,3';
}
// 最新上架分类
if (isset(ChannelConfig::$newArrivalSortList[$channel])) {
$sortList = ChannelConfig::$newArrivalSortList[$channel];
// 获取分类列表获取商品信息
$goodsList = SearchData::getSearchDataBySort($params, $sortList);
$pos = 1;
foreach ($goodsList as $goods) {
// 格式化数据
$val = Helpers::formatProduct($goods, true, true, true, 280, 373);
if ($val['price'] == false) {
$val['price'] = $val['salePrice'];
}
$val['url'] = sprintf('%s?channel=%s&from=%s-n_%s', $val['url'], $channel , $channel, $pos++);
//TODO 字段要调整
$val['isFew'] = $val['is_soon_sold_out'];
$val['tags']['isLimit'] = $val['tags']['is_limited'];
$val['tags']['isSale'] = false;//$val['tags']['is_discount'];暂时不显示
$val['tags']['isNew'] = false;//$val['tags']['is_new'];暂时不显示
$val['tags']['isYearMidPromotion'] = $val['tags']['midYear'];
$val['tags']['isYearEndPromotion'] = $val['tags']['yearEnd'];
$val['tags']['isReNew'] = false;//$val['tags']['is_advance'];暂时不显示
unset($val['tags']['is_advance'], $val['tags']['is_discount'], $val['tags']['is_limited'], $val['tags']['is_new'],
$val['tags']['is_yohood'], $val['tags']['midYear'], $val['tags']['yearEnd']);
if (! empty($val)) {
$result[] = $val;
}
}
}
Cache::set($key, $result, 3600);
}
return $result;
}
... ...
... ... @@ -6,225 +6,225 @@ use Plugin\Helpers;
use LibModels\Wap\Passport\BackData;
use Plugin\AuthCode;
class BackController extends WebAction {
/**
* 找回密码
*/
public function indexAction() {
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader(false),
'backPage' => true,
'back' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'countryCode' => '86',
'countryName' => '中国',
'captchaUrl' => '/passport/images?t=1449799445',
'countryList' => RegData::getAreasData()
)
);
$this->_view->display ( 'index', $data );
}
/**
* 校验验证码
*/
public function authcodeAction() {
$phoneNum = $this->post ('phoneNum', '');
$area = intval ($this->post( 'area', '86' ));
$verifyCode = $this->post ('verifyCode', '');
$data = array('code' => 400, 'message' =>'验证失败');
if ((Helpers::verifyEmail($phoneNum) || Helpers::verifyMobile($phoneNum))
&& PassportModel::verifyCode($verifyCode)) {
$data['code'] = 200;
$data['message'] = '验证成功';
}
echo $this->echoJson($data);
}
/**
* 邮箱
*/
public function emailAction() {
$phoneNum = $this->post ('phoneNum', '');
$area = intval ($this->post('area', '86'));
$verifyCode = $this->post('verifyCode', '');
if (Helpers::verifyEmail($phoneNum)) { // 验证邮箱
$email = $phoneNum;
$data = BackData::sendCodeToEmail($email);
if ($data ['code'] == 200) {
$this->setSession('email', $email);
$this->redirect ('sendemail');
} else {
$this->redirect ('index');
}
} else if (Helpers::verifyMobile($phoneNum)) { // 验证手机号
$mobile = $phoneNum;
$data = BackData::sendCodeToMobile($mobile, $area);
if ($data['code'] == 200) {
$this->setSession ('mobile', $mobile );
$this->setSession ('area', $area );
$this->setSession ('verifyCode', $verifyCode );
$this->redirect ('verification');
} else {
$this->redirect ('index');
}
}
}
/**
* 发送邮件页面
*/
public function sendemailAction() {
$email = $this->getSession ('email');
if (empty ( $email )) {
$this->redirect ('index');
}
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader(false),
'sendEmail' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'countrys' => array ()
)
);
$this->_view->display('send-email', $data);
}
/**
* 重置密码页面
*/
public function backcodeAction() {
$code = $this->get('code');
$info = $this->checkCode($code);
if (empty ( $info )) {
$this->redirect ('index');
}
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader(false),
'resetPage' => true,
'resetPwd' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'countrys' => array(),
'code' => $code
)
);
$this->_view->display('reset-pwd', $data);
}
/**
* 更新密码接口
*/
public function updateAction() {
$code = $this->post('code');
$password = $this->post('pwd');
$info = $this->checkCode($code);
if (Helpers::verifyPassword ($password) && ! empty ($info)) {
// 修改密码
if (isset ( $info ['mobile'] )) { // 手机号修改密码
$mobile = $info ['mobile'];
$token = $info ['token'];
$area = $info ['area'];
$data = BackData::modifyPasswordByMobile($mobile, $token, $password, $area);
if ($data ['code'] == 200) {
$this->redirect ( 'resetSuccess' );
}
} else if (isset ($info ['uid'])) { // 其他方式修改密码
$uid = $info ['uid'];
$this->redirect ( 'resetSuccess' );
}
}
// 跳转错误页面
$this->redirect('/error/index');
}
/**
* 重置密码成功
*/
public function resetSuccessAction() {
$banner = PassportModel::getLeftBanner ( PassportModel::BACK_LFFT_BANNER_CODE );
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader ( false ),
'resetSuccess' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'countrys' => array ()
)
);
$this->_view->display ( 'reset-success', $data );
}
/**
* 手机验证页面
*/
public function verificationAction() {
$mobile = $this->getSession ('mobile');
$area = $this->getSession ('area');
$verifyCode = $this->getSession ('verifyCode');
if (empty ($mobile)) {
$this->redirect ('index');
}
$banner = PassportModel::getLeftBanner (PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader ( false ),
'vertificationPage' => true,
'verification' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'mobile' => $mobile,
'area' => $area,
'verifyCode' => $verifyCode,
'countrys' => array ()
)
);
$this->_view->display ('verification', $data);
}
/**
* 手机找回密码验证
*/
public function backmobileAction() {
$mobile = $this->post ( 'mobile' );
$area = $this->post ( 'area' );
$verifyCode = $this->post ( 'verifyCode' );
$code = $this->post ( 'code' ); // code
if ($this->getSession ( 'mobile' ) == $mobile && $this->getSession ( 'area' ) == $area) {
$result = BackData::validateMobileCode ( $mobile, $code, $area );
if ($result ['code'] == 200) {
$str = json_encode ( array (
'mobile' => $mobile,
'area' => $area,
'token' => $result ['data'] ['token'],
'create_time' => time ()
) );
$code = AuthCode::encode ( $str, PassportModel::BACK_FIND_SECRET_KEY );
$url = '/passport/back/backcode?code=' . base64_encode ( $code );
$this->redirect ( SITE_MAIN . $url );
return true;
}
}
//出错直接跳到找回密码页
$this->redirect ('/passport/back/index');
}
/**
* 检查code
*
* @param string $code
* @return boolean
*/
private function checkCode($code) {
$code = base64_decode ( $code );
$info = json_decode ( AuthCode::decode ( $code, PassportModel::BACK_FIND_SECRET_KEY ), true );
if ($info ['create_time'] < 1 || (time () - $info ['create_time']) > 86400) {
return array ();
}
return $info;
}
/**
* 找回密码
*/
public function indexAction() {
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader(false),
'backPage' => true,
'back' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'countryCode' => '86',
'countryName' => '中国',
'captchaUrl' => '/passport/images?t=1449799445',
'countryList' => RegData::getAreasData()
)
);
$this->_view->display ( 'index', $data );
}
/**
* 校验验证码
*/
public function authcodeAction() {
$phoneNum = $this->post ('phoneNum', '');
$area = intval ($this->post( 'area', '86' ));
$verifyCode = $this->post ('verifyCode', '');
$data = array('code' => 400, 'message' =>'验证失败');
if ((Helpers::verifyEmail($phoneNum) || Helpers::verifyMobile($phoneNum))
&& PassportModel::verifyCode($verifyCode)) {
$data['code'] = 200;
$data['message'] = '验证成功';
}
echo $this->echoJson($data);
}
/**
* 邮箱
*/
public function emailAction() {
$phoneNum = $this->post ('phoneNum', '');
$area = intval ($this->post('area', '86'));
$verifyCode = $this->post('verifyCode', '');
if (Helpers::verifyEmail($phoneNum)) { // 验证邮箱
$email = $phoneNum;
$data = BackData::sendCodeToEmail($email);
if ($data ['code'] == 200) {
$this->setSession('email', $email);
$this->redirect ('sendemail');
} else {
$this->redirect ('index');
}
} else if (Helpers::verifyMobile($phoneNum)) { // 验证手机号
$mobile = $phoneNum;
$data = BackData::sendCodeToMobile($mobile, $area);
if ($data['code'] == 200) {
$this->setSession ('mobile', $mobile );
$this->setSession ('area', $area );
$this->setSession ('verifyCode', $verifyCode );
$this->redirect ('verification');
} else {
$this->redirect ('index');
}
}
}
/**
* 发送邮件页面
*/
public function sendemailAction() {
$email = $this->getSession ('email');
if (empty ( $email )) {
$this->redirect ('index');
}
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader(false),
'sendEmail' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'countrys' => array ()
)
);
$this->_view->display('send-email', $data);
}
/**
* 重置密码页面
*/
public function backcodeAction() {
$code = $this->get('code');
$info = $this->checkCode($code);
if (empty ( $info )) {
$this->redirect ('index');
}
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader(false),
'resetPage' => true,
'resetPwd' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'countrys' => array(),
'code' => $code
)
);
$this->_view->display('reset-pwd', $data);
}
/**
* 更新密码接口
*/
public function updateAction() {
$code = $this->post('code');
$password = $this->post('pwd');
$info = $this->checkCode($code);
if (Helpers::verifyPassword ($password) && ! empty ($info)) {
// 修改密码
if (isset ( $info ['mobile'] )) { // 手机号修改密码
$mobile = $info ['mobile'];
$token = $info ['token'];
$area = $info ['area'];
$data = BackData::modifyPasswordByMobile($mobile, $token, $password, $area);
if ($data ['code'] == 200) {
$this->redirect ( 'resetSuccess' );
}
} else if (isset ($info ['uid'])) { // 其他方式修改密码
$uid = $info ['uid'];
$this->redirect ( 'resetSuccess' );
}
}
// 跳转错误页面
$this->redirect('/error/index');
}
/**
* 重置密码成功
*/
public function resetSuccessAction() {
$banner = PassportModel::getLeftBanner ( PassportModel::BACK_LFFT_BANNER_CODE );
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader ( false ),
'resetSuccess' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'countrys' => array ()
)
);
$this->_view->display ( 'reset-success', $data );
}
/**
* 手机验证页面
*/
public function verificationAction() {
$mobile = $this->getSession ('mobile');
$area = $this->getSession ('area');
$verifyCode = $this->getSession ('verifyCode');
if (empty ($mobile)) {
$this->redirect ('index');
}
$banner = PassportModel::getLeftBanner (PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader ( false ),
'vertificationPage' => true,
'verification' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
'mobile' => $mobile,
'area' => $area,
'verifyCode' => $verifyCode,
'countrys' => array ()
)
);
$this->_view->display ('verification', $data);
}
/**
* 手机找回密码验证
*/
public function backmobileAction() {
$mobile = $this->post ( 'mobile' );
$area = $this->post ( 'area' );
$verifyCode = $this->post ( 'verifyCode' );
$code = $this->post ( 'code' ); // code
if ($this->getSession ( 'mobile' ) == $mobile && $this->getSession ( 'area' ) == $area) {
$result = BackData::validateMobileCode ( $mobile, $code, $area );
if ($result ['code'] == 200) {
$str = json_encode ( array (
'mobile' => $mobile,
'area' => $area,
'token' => $result ['data'] ['token'],
'create_time' => time ()
) );
$code = AuthCode::encode ( $str, PassportModel::BACK_FIND_SECRET_KEY );
$url = '/passport/back/backcode?code=' . base64_encode ( $code );
$this->redirect ( SITE_MAIN . $url );
return true;
}
}
//出错直接跳到找回密码页
$this->redirect ('/passport/back/index');
}
/**
* 检查code
*
* @param string $code
* @return boolean
*/
private function checkCode($code) {
$code = base64_decode ( $code );
$info = json_decode ( AuthCode::decode ( $code, PassportModel::BACK_FIND_SECRET_KEY ), true );
if ($info ['create_time'] < 1 || (time () - $info ['create_time']) > 86400) {
return array ();
}
return $info;
}
}
\ No newline at end of file
... ...