Authored by xuqi

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

... ... @@ -15,6 +15,7 @@ namespace Action;
use Yaf\Controller_Abstract;
use Yaf\Dispatcher;
use Hood\Cache;
use LibModels\Wap\Home\SideData;
class AbstractAction extends Controller_Abstract
{
... ... @@ -262,4 +263,77 @@ class AbstractAction extends Controller_Abstract
$this->_view->assign('footer', $footer);
}
/**
* 设置侧边栏信息
*
* @param string $guangChoosed 逛默认选中项 "all"表示全部,"boys":只看男生,"girls":只看女生
* @return void
*/
protected function setNavSide($guangChoosed = 'all')
{
$this->_view->assign('subNav', array(
0 => array(
'textCn' => '男生',
'textEn' => 'BOYS',
'styleClass' => 'boys',
'url' => '/boys.html',
),
1 => array(
'textCn' => '女生',
'textEn' => 'GIRLS',
'styleClass' => 'girls',
'url' => '/girls.html',
),
2 => array(
'textCn' => '潮童',
'textEn' => 'KIDS',
'styleClass' => 'kids',
'url' => '/kids.html',
),
3 => array(
'textCn' => '创意生活',
'textEn' => 'LIFE STYLE',
'styleClass' => 'life',
'url' => '/life.html',
),
4 => array(
'textCn' => '逛',
'textEn' => 'TRENDFINDER',
'styleClass' => 'guang',
'url' => '/guang.html',
'subNav' => array(
'list' => array(
0 => array(
'textCn' => '逛',
'textEn' => 'TrendFinder',
'back' => true,
'isSelect' => false,
),
1 => array(
'textCn' => '查看全部',
'textEn' => '',
'back' => false,
'isSelect' => ($guangChoosed === 'all') ? true : false,
'url' => '/guang/list/index?gender=1,2,3'
),
2 => array(
'textCn' => '只看男生',
'textEn' => 'Boys',
'back' => false,
'isSelect' => ($guangChoosed === 'boys') ? true : false,
'url' => '/guang/list/index?gender=1,3'
),
3 => array(
'textCn' => '只看女生',
'textEn' => 'Girls',
'back' => false,
'isSelect' => ($guangChoosed === 'girls') ? true : false,
'url' => '/guang/list/index?gender=2,3',
),
)
)
),
));
}
}
... ...
<?php
namespace LibModels\Wap\Home;
use Api\Sign;
use Api\Yohobuy;
/**
* 侧边栏的数据模型
*
* @name SideData
* @package LibModels/Wap/Home
* @copyright yoho.inc
* @version 1.0 (2015-10-13 17:42:27)
* @author fei.hong <fei.hong@yoho.cn>
*/
class SideData
{
const URI_LEFTNAV_ENTRANCE = 'operations/api/v5/entrance/getEntrance';
const URI_LEFTNAV_CATEGORY = 'operations/api/v5/category/getCategory';
/**
* 左侧边栏的分类和图标数据
*
* 备注:暂不使用,因很少变,获取后还需要再封装
*
* @return array
*/
public static function leftNav()
{
$param = Yohobuy::param();
$param['client_type'] = 'iphone'; // 因安卓不返回icon的地址
$param['client_secret'] = Sign::getSign($param);
$query = Yohobuy::httpBuildQuery('', $param);
$urlList = array();
$urlList['getEntrance'] = Yohobuy::SERVICE_URL . self::URI_LEFTNAV_ENTRANCE . $query;
$urlList['getCategory'] = Yohobuy::SERVICE_URL . self::URI_LEFTNAV_CATEGORY . $query;
return Yohobuy::getMulti($urlList);
// $param = Yohobuy::param();
// $param['client_secret'] = Sign::getSign($param);
//
// return Yohobuy::get(Yohobuy::SERVICE_URL . self::URI_LEFTNAV_CATEGORY, $param);
}
}
... ...
... ... @@ -10,6 +10,9 @@ class BoysController extends AbstractAction
public function indexAction()
{
// 显示侧边栏
$this->setNavSide();
// 频道数据
$channelData = Index::getUserChannelData(0, '1,3', '201504091403001');
... ...
... ... @@ -2,6 +2,7 @@
use Action\AbstractAction;
use LibModels\Wap\Home\IndexData as Index;
/**
* 女生首页
*/
... ... @@ -10,6 +11,9 @@ class GirlsController extends AbstractAction
public function indexAction()
{
// 显示侧边栏
$this->setNavSide();
$data = array(
'headerDownload' => array(
'img' => 'http://img11.static.yhbimg.com/adpic/2015/02/28/18/01d83bfad41c8fca8fd1ad334216d7d733.jpg?imageView/2/w/640/h/480',
... ... @@ -72,11 +76,9 @@ class GirlsController extends AbstractAction
'url' => '',
'isSelect' => true
)
)
)
)
),
'content' => array(
'bannerTop' => array(
... ... @@ -373,12 +375,7 @@ class GirlsController extends AbstractAction
)
)
)
),
));
// 频道数据
$channelData = Index::getUserChannelData(0, '2,3', '201504091403002');
... ... @@ -391,11 +388,10 @@ class GirlsController extends AbstractAction
// // 频道数据
// $channelData = Index::getUserChannelData(0, '2,3', '201504091403002');
// echo '<pre>';
// print_r($channelData);
// $this->_view->assign('title', 'YOHO!有货');
// $this->_view->display('girls', compact('channelData'));
}
}
... ...
<?php
use Action\AbstractAction;
use LibModels\Wap\Home\IndexData;
... ... @@ -16,23 +17,21 @@ class IndexController extends AbstractAction
// 启动滚动图
$startBannerData = IndexData::getBannerStart();
$startBanner = array();
if($startBannerData['code'] == 200)
{
foreach ($startBannerData['data'] as $single)
{
if ($startBannerData['code'] == 200) {
foreach ($startBannerData['data'] as $single) {
$startBanner = $single['data'];
}
}
// 启动频道数据
$homeChannels = IndexData::getHomeChannels();
// 用户个人信息
$userProfile = IndexData::getUserProfile(0);
/*echo '<pre>';
var_dump($homeChannels);exit;*/
/* echo '<pre>';
var_dump($homeChannels);exit; */
$this->_view->assign('title', 'YOHO!有货');
$this->_view->display('index', compact('startBanner', 'homeChannels', 'userProfile'));
}
}
... ...
... ... @@ -18,5 +18,8 @@ class KidsController extends AbstractAction
$this->_view->assign('title', 'YOHO!有货');
$this->_view->display('kids', compact('channelData'));
// 显示侧边栏
$this->setNavSide();
}
}
\ No newline at end of file
... ...
... ... @@ -2,6 +2,7 @@
use Action\AbstractAction;
use LibModels\Wap\Home\IndexData as Index;
/**
* 创意生活首页
*/
... ... @@ -10,7 +11,6 @@ class LifestyleController extends AbstractAction
public function indexAction()
{
// 频道数据
$channelData = Index::getUserChannelData(0, '1,3', '9aa25f5133f011ec96c2045eb15ae425');
... ... @@ -19,5 +19,9 @@ class LifestyleController extends AbstractAction
$this->_view->assign('title', 'YOHO!有货');
$this->_view->display('lifestyle', compact('channelData'));
// 显示侧边栏
$this->setNavSide();
}
}
... ...
... ... @@ -51,7 +51,7 @@ class PlusstarController extends AbstractAction
// 情况2: 单张图
elseif (isset($star['data'][0])) {
$build['url'] = $star['data'][0]['url'];
$build['img'] = $star['data'][0]['src'];
$build['img'] = Helpers::getImageUrl($star['data'][0]['src'], 640, 310);
$data['ps']['star'][] = $build;
}
}
... ...
... ... @@ -76,8 +76,8 @@ class LoginController extends AbstractAction
/**
* 登录操作
*
* @param string area 地区编号, 不需要+号
* @param string profile 账号(邮箱或手机号)
* @param string areaCode 地区编号, 不需要+号
* @param string account 账号(邮箱或手机号)
* @param string password 密码
* @return json
*/
... ... @@ -92,8 +92,8 @@ class LoginController extends AbstractAction
}
/* 判断参数是否传递 */
$area = $this->post('area', '86');
$profile = $this->post('profile');
$area = $this->post('areaCode', '86');
$profile = $this->post('account');
$password = $this->post('password');
if (!is_numeric($area) || empty($profile) || empty($password)) {
break;
... ... @@ -109,6 +109,9 @@ class LoginController extends AbstractAction
/* 调用登录接口进行登录 */
$data = LoginData::signin($area, $profile, $password);
if ($data['code'] == 200) {
$data['data'] = '/'; // @todo
}
} while (false);
... ...
... ... @@ -22,6 +22,7 @@ class RegController extends AbstractAction
$data['headerText'] = '注册';
$data['isPassportPage'] = true;
$data['countrys'] = array();
$data['areaCode'] = '+86';
// 获取地区数据列表
$area = RegData::getAreasData();
... ... @@ -52,15 +53,15 @@ class RegController extends AbstractAction
/**
* 验证码
*
* @param string area 地区编号
* @param string mobile 手机号
* @param string areaCode 地区编号
* @param string phoneNum 手机号
* @param string token 访问TOKEN凭证
*/
public function codeAction()
{
$token = $this->get('token');
$mobile = $this->get('mobile');
$area = $this->get('area', '86');
$mobile = $this->get('phoneNum');
$area = $this->get('areaCode', '86');
// 判断是否允许访问, 不允许则跳转到错误页面
if (!is_string($token) || !is_numeric($mobile) || !Helpers::verifyToken($mobile, $token)) {
... ... @@ -74,7 +75,7 @@ class RegController extends AbstractAction
$data['backUrl'] = '/';
$data['headerText'] = '注册';
$data['isPassportPage'] = true;
$data['areaCode'] = $area;
$data['areaCode'] = '+' . $area;
$data['phoneNum'] = $mobile;
$data['token'] = $token;
... ... @@ -84,15 +85,15 @@ class RegController extends AbstractAction
/**
* 填写密码页面
*
* @param string area 地区编号
* @param string mobile 手机号
* @param string areaCode 地区编号
* @param string phoneNum 手机号
* @param string token 访问TOKEN凭证
*/
public function passwordAction()
{
$token = $this->get('token');
$mobile = $this->get('mobile');
$area = $this->get('area', '86');
$mobile = $this->get('phoneNum');
$area = $this->get('areaCode', '86');
// 判断是否允许访问, 不允许则跳转到错误页面
if (!is_string($token) || !is_numeric($mobile) || !is_numeric($area)
... ... @@ -117,13 +118,13 @@ class RegController extends AbstractAction
/**
* 验证注册的手机号
*
* @param string area 地区编号,注意不需要+号
* @param string mobile 手机号
* @param string areaCode 地区编号,注意不需要+号
* @param string phoneNum 手机号
* @return json
*/
public function verifymobileAction()
{
$data = array('code' => 400, 'message' => '参数不正确!', 'data' => '');
$data = array('code' => 400, 'message' => '手机号已存在', 'data' => '');
do {
/* 判断是不是AJAX请求 */
... ... @@ -131,8 +132,8 @@ class RegController extends AbstractAction
break;
}
$mobile = $this->post('mobile');
$area = $this->post('area', '86');
$mobile = $this->post('phoneNum');
$area = $this->post('areaCode', '86');
/* 判断参数是否合法 */
if (!is_numeric($mobile) || !is_numeric($area)) {
break;
... ... @@ -147,7 +148,7 @@ class RegController extends AbstractAction
/* 返回跳转到验证页面的链接*/
if ($data['code'] == 200) {
$token = Helpers::makeToken($mobile);
$data['data'] = '/passport/reg/code?token='.$token.'&mobile='.$mobile.'&area='.$area;
$data['data'] = '/passport/reg/code?token='.$token.'&phoneNum='.$mobile.'&areaCode='.$area;
}
} while (false);
... ... @@ -158,15 +159,15 @@ class RegController extends AbstractAction
/**
* 验证注册的识别码
*
* @param string area 地区编号,注意不需要+号
* @param string mobile 手机号
* @param string areaCode 地区编号,注意不需要+号
* @param string phoneNum 手机号
* @param string token 访问TOKEN凭证
* @param int code 验证码, 手机上收到的
* @return json
*/
public function verifycodeAction()
{
$data = array('code' => 400, 'message' => '参数不正确!', 'data' => '');
$data = array('code' => 400, 'message' => '验证码不正确', 'data' => '');
do {
/* 判断是不是AJAX请求 */
... ... @@ -174,8 +175,8 @@ class RegController extends AbstractAction
break;
}
$mobile = $this->post('mobile');
$area = $this->post('area');
$mobile = $this->post('phoneNum');
$area = $this->post('areaCode');
$code = $this->post('code');
/* 判断参数是否合法 */
if (!is_numeric($mobile) || !is_numeric($area) || !isset($code)) {
... ... @@ -191,7 +192,7 @@ class RegController extends AbstractAction
/* 返回跳转到设置密码的链接*/
if ($data['code'] == 200) {
$token = Helpers::makeToken($mobile);
$data['data'] = '/passport/reg/password?token='.$token.'&mobile='.$mobile.'&area='.$area;
$data['data'] = '/passport/reg/password?token='.$token.'&phoneNum='.$mobile.'&areaCode='.$area;
}
} while (false);
... ... @@ -202,8 +203,8 @@ class RegController extends AbstractAction
/**
* 发送验证码
*
* @param string area 地区编号,注意不需要+号
* @param string mobile 手机号
* @param string areaCode 地区编号,注意不需要+号
* @param string phoneNum 手机号
* @return json
*/
public function sendcodeAction()
... ... @@ -216,8 +217,8 @@ class RegController extends AbstractAction
break;
}
$mobile = $this->post('mobile');
$area = $this->post('area', '86');
$mobile = $this->post('phoneNum');
$area = $this->post('areaCode', '86');
/* 判断参数是否合法 */
if (!is_numeric($mobile) || !is_numeric($area)) {
break;
... ... @@ -237,8 +238,8 @@ class RegController extends AbstractAction
/**
* 设置密码
*
* @param string area 地区编号,注意不需要+号
* @param string mobile 手机号
* @param string areaCode 地区编号,注意不需要+号
* @param string phoneNum 手机号
* @param string token 访问TOKEN凭证
* @param string password 用户设置的密码
* @return json
... ... @@ -254,8 +255,8 @@ class RegController extends AbstractAction
}
$token = $this->post('token');
$mobile = $this->post('mobile');
$area = $this->post('area');
$mobile = $this->post('phoneNum');
$area = $this->post('areaCode');
$password = $this->post('password');
/* 判断参数是否合法 */
if (!is_string($token) || !is_numeric($mobile) || !is_numeric($area) || !isset($password)) {
... ... @@ -275,7 +276,7 @@ class RegController extends AbstractAction
/* 返回跳转到来源页面 */
if ($data['code'] == 200) {
$data['data'] = '/passport/reg/password?token='.$token.'&mobile='.$mobile.'&area='.$area;
$data['data'] = '/';
}
} while (false);
... ...