Authored by unknown

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

... ... @@ -30,7 +30,6 @@ class LoginData extends \LibModels\Wap\Passport\LoginData
// 构建必传参数
$param = Yohobuy::param();
$param['v'] = '4';
$param['method'] = 'app.passport.signinByOpenID';
$param['openId'] = $openId;
$param['source_type'] = $sourceType;
... ...
... ... @@ -33,7 +33,7 @@ class HelperSearch
$options = self::$options;
$cookieChannel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys';
if (isset($options['brandName']) && !empty($options['brandName'])) {
$initNav = $options['brandName'];
$initNav = $options['brandNameEn'] . $options['brandNameCn'];
}else{
$initNav = '列表';
}
... ...
... ... @@ -150,7 +150,7 @@ exports.init = function(num) {
$goodItemWrapper.mouseleave(function() {
removeHtmlFn();
// removeHtmlFn();
});
function removeHtmlFn() {
... ... @@ -171,15 +171,19 @@ $(document).on('hover', '.good-select-color li', function() {
});
$goodInfoMain.on('click', '.col-btn', function() {
var $this = $(this);
$.ajax({
type: 'POST',
url: '/product/list/changeFavorite',
data: {
skn: $(this).closest('.good-info').data('skn'),
isFavorite: !$(this).hasClass('coled')
skn: $this.closest('.good-info').data('skn'),
isFavorite: !$this.hasClass('coled')
}
}).then(function(res) {
console.log(res);
if (res.code === 200) {
$this.toggleClass('coled');
}
});
});
... ...
... ... @@ -123,7 +123,7 @@
display: block;
&:hover {
color: #f95b4f;
// color: #f95b4f;
cursor: pointer;
}
}
... ...
... ... @@ -26,8 +26,8 @@ class PassportModel
const AUTOUSERINFO_LEFT_BANNER_CODE = 'c62d5da06d843b6ed78d8d27e87fa143'; //完善信息页左边的banner
const BACK_FIND_SECRET_KEY = '_+@#$%^';
//简单头部
public static function getSimpleHeader($isLogin, $username = '')
//默认简单头部(不带登录信息 请登录/注册)
public static function getSimpleHeader()
{
//拼接简单头部
$tool = array(
... ... @@ -36,20 +36,10 @@ class PassportModel
'orderHref' => Helpers::url('/home/orders?t=' . time()), //订单中心连接
'helpHref' => Helpers::url('/help'),
);
if ($isLogin) {
$tool+=array(
'user' => $username,
'userCenter' => Helpers::url('/home?t=' . time()), //用户中心链接
'logoutHref' => Helpers::url('/logout.html?t=' . time()), //退出
);
}
else {
$tool+=array(
'loginHref' => Helpers::url('/signin.html'), //登录链接,已登录不传
'registerHref' => Helpers::url('/reg.html'), //注册链接,已登录不传
);
}
$tool+=array(
'loginHref' => Helpers::url('/signin.html'), //登录链接,已登录不传
'registerHref' => Helpers::url('/reg.html'), //注册链接,已登录不传
);
$simpleHeader = array(
'logo' => array(
'img' => 'http://static.yohobuy.com/newheader/img/logo_e.png',
... ... @@ -57,7 +47,6 @@ class PassportModel
),
'tool' => $tool
);
return $simpleHeader;
}
... ...
... ... @@ -5,18 +5,19 @@ use WebPlugin\Images;
use Api\Yohobuy;
use LibModels\Web\Product\HotrankData;
use LibModels\Web\Product\SearchData;
use LibModels\Web\Home\IndexData;
use WebPlugin\DataProcess\WebChannel\Channel as ChannelProcess;
class HotrankModel {
/**
* 获取热销排行频道资源
*
* @param string $channel
*
* @return array
*/
static public function getChannelResource()
{
$channel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys';
$channel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys';
switch ($channel)
{
case 'boys' :
... ... @@ -34,33 +35,75 @@ class HotrankModel {
}
}
/**
* 人气单品 一周热卖
* 获取焦点图,热门品牌资源
* @param string $channel
* @param string $content_code
* @return array
*/
static public function getSearchData($param,$page,$ajax)
static public function getFocusResource($channel, $content_code)
{
// 调用接口查询商品数据
$result = SearchData::searchElasticByCondition($param);
if(!empty($result))
$resource = IndexData::getResourceData($content_code);
// 格式化数据
$data = ChannelProcess::getFormat($channel, $resource['data']);
return $data;
}
/**
* 获取人气单品,一周热卖商品资源
* @param $config 过滤参数
* @param $page 当前页数
* @param $ajax 是否是ajax加载 默认0不是
*/
static public function getSearchData($config,$page,$ajax)
{
//配置查询商品参数
$viewNum = 60;
$param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'stocknumber'=>1,'status'=>1,
'sort'=>$config['sort'],'gender'=>$config['gender'],'attribute_not'=>2);
if($ajax == 0)
{
$res = self::getProductList($result,$page,$ajax);
if(!empty($res['popular']))
if($config['sort'] != 0)
{
$data['popular'] = $res['popular'];
$param['sort'] = $sort_id;
}else{
$param['sort'] = '';
}
if(!empty($res['hotWeek']))
if($config['road'] == 3)
{
$param['msort'] = 365;
}elseif($config['road'] == 4){
$param['msort'] = 10;
}else{
$param['not_maxSortId'] = '10,365';
}
}else{
if(empty($param['sort']))
{
$data['hotWeek'] = $res['hotWeek'];
}
if($config['road'] == 3)
{
$param['msort'] = 365;
}elseif($config['road'] == 4){
$param['msort'] = 10;
}else{
$param['not_maxSortId'] = '10,365';
}
}
}
//根据给定查询数据搜索数据列表
$result = SearchData::searchElasticByCondition($param);
$data = self::getProductList($result,$page,$ajax);
return $data;
}
/**
* 获取分类标签
* 获取标签资源
* @param $client_type 客户端类型
* @param $channel 频道类型
* @param $is_concurrent 是否异步,true异步,false同步,默认true
*/
static public function getHotranktag($client_type,$channel,$is_concurrent)
{
... ... @@ -76,10 +119,13 @@ class HotrankModel {
}
return $nav;
}
/**
* 人气单品 一周热卖 数据处理
/**
* 人气单品 一周热卖 数据处理
* @param $result 过滤参数
* @param $page 当前页数
* @param $ajax 是否是ajax加载 默认0不是
*/
static public function getProductList($result,$page,$ajax=0)
{
... ... @@ -144,7 +190,9 @@ class HotrankModel {
'name'=>'一周热卖',
'list'=>$hot,
);
return array('popular'=>$popular,'hotWeek'=>$hotWeek);
$data['popular'] = $popular;
$data['hotWeek'] = $hotWeek;
return $data;
}
}
\ No newline at end of file
... ...
... ... @@ -133,20 +133,16 @@ class AutosignController extends WebAction
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
$refer = SITE_MAIN;
}
else {
$refer = rawurldecode($refer);
}
//判定是否需要绑定手机号
if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') {
$token = Helpers::makeToken($result['data']['uid']);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$fillHerf = rawurlencode(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $access['openid'], 'sourceType' => 'qq', 'nickname' => $partnerInfo['nickname'])));
$this->go(Helpers::syncUserSession($result['data']['uid'], $fillHerf));
if (isset($result['data']['is_bind']) && $result['data']['is_bind'] == 'N') {
$fillHerf = Helpers::url('/passport/thirdlogin/index', array('openId' => $access['openid'], 'sourceType' => 'qq', 'nickname' => $partnerInfo['nickname']));
$this->go($fillHerf);
}
if (isset($result['code']) && $result['code'] == 200 && !empty($result['data']['uid'])) {
... ... @@ -273,7 +269,7 @@ class AutosignController extends WebAction
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$fillHerf =rawurlencode(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $access['douban_user_id'], 'sourceType' => 'douban', 'nickname' => $partnerInfo['name'])));
$fillHerf = rawurlencode(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $access['douban_user_id'], 'sourceType' => 'douban', 'nickname' => $partnerInfo['name'])));
$this->go(Helpers::syncUserSession($result['data']['uid'], $fillHerf));
}
... ... @@ -311,7 +307,7 @@ class AutosignController extends WebAction
$result = array();
if ($partnerInfo && is_array($partnerInfo)) {
$shoppingKey = Helpers::getShoppingKeyByCookie();
$result = LoginData::signinByOpenID($partnerInfo['nickname'],$partnerInfo['openid'], 'wechat', $shoppingKey,$partnerInfo['openid']);
$result = LoginData::signinByOpenID($partnerInfo['nickname'], $partnerInfo['openid'], 'wechat', $shoppingKey, $partnerInfo['openid']);
}
//判定是否需要绑定手机号
... ... @@ -320,7 +316,7 @@ class AutosignController extends WebAction
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$fillHerf =rawurlencode(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $partnerInfo['openid'], 'sourceType' => 'wechat', 'nickname' => $partnerInfo['nickname'])));
$fillHerf = rawurlencode(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $partnerInfo['openid'], 'sourceType' => 'wechat', 'nickname' => $partnerInfo['nickname'])));
$this->go(Helpers::syncUserSession($result['data']['uid'], $fillHerf));
}
... ... @@ -342,5 +338,6 @@ class AutosignController extends WebAction
else {
$this->go($refer);
}
}
}
}
... ...
... ... @@ -39,7 +39,7 @@ class AutouserinfoController extends WebAction
$isLogin = true;
$username = $this->_uname;
}
$simpleHeader = PassportModel::getSimpleHeader($isLogin, $username);
$simpleHeader = PassportModel::getSimpleHeader();
$cover = PassportModel::getLeftBanner(PassportModel::AUTOUSERINFO_LEFT_BANNER_CODE);
//整合
... ... @@ -76,15 +76,7 @@ class AutouserinfoController extends WebAction
$openId = $this->get('openId');
$sourceType = $this->get('sourceType');
if (!$uid) {
$isLogin = false;
$username = '';
}
else {
$isLogin = true;
$username = $this->_uname;
}
$simpleHeader = PassportModel::getSimpleHeader($isLogin, $username);
$simpleHeader = PassportModel::getSimpleHeader();
$cover = PassportModel::getLeftBanner(PassportModel::AUTOUSERINFO_LEFT_BANNER_CODE);
//整合
$data = array(
... ... @@ -224,7 +216,7 @@ class AutouserinfoController extends WebAction
$code = trim($this->post('code')); //短信验证码
//校验手机号格式
if (!is_numeric($phoneNum) || !is_numeric($areaCode)) {
$data['code'] = 401;
$data['code'] = 400;
$data['message'] = '手机号码格式不正确';
break;
}
... ... @@ -264,23 +256,25 @@ class AutouserinfoController extends WebAction
//校验手机号格式
if (!is_numeric($phoneNum) || !is_numeric($areaCode)) {
$data['code'] = 401;
$data['code'] = 400;
$data['message'] = '手机号码格式不正确';
break;
}
//校验图形验证码
$picFlag = PassportModel::verifyCode($verifyCode);
if (!$picFlag) {
$data['code'] = 402;
$data['code'] = 400;
$data['message'] = '图形验证码不正确';
break;
}
//校验手机验证码
$bindMsgFlag = BindData::checkBindCode($areaCode, $phoneNum, $code);
if (isset($bindMsgFlag['code']) && $bindMsgFlag['code'] != 200) {
$data['code'] = 403;
$data['code'] = 400;
$data['message'] = '短信验证码不正确';
break;
}
//绑定手机号
$res = BindData::bindMobile($openId, $sourceType, $phoneNum, $areaCode, $password);
if (!isset($res['code'])) {
break;
... ...
... ... @@ -13,7 +13,7 @@ class BackController extends WebAction {
public function indexAction() {
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader(false),
'simpleHeader' => PassportModel::getSimpleHeader(),
'backPage' => true,
'back' => array (
'coverHref' => $banner ['url'],
... ... @@ -128,7 +128,7 @@ class BackController extends WebAction {
$emailUrl = 'http://mail.'.$emailArr[1];
}
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader(false),
'simpleHeader' => PassportModel::getSimpleHeader(),
'sendEmail' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
... ... @@ -166,7 +166,7 @@ class BackController extends WebAction {
}
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader(false),
'simpleHeader' => PassportModel::getSimpleHeader(),
'resetPage' => true,
'resetPwd' => array (
'coverHref' => $banner ['url'],
... ... @@ -224,7 +224,7 @@ class BackController extends WebAction {
{
$banner = PassportModel::getLeftBanner ( PassportModel::BACK_LFFT_BANNER_CODE );
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader ( false ),
'simpleHeader' => PassportModel::getSimpleHeader (),
'resetSuccess' => array (
'coverHref' => $banner ['url'],
'coverImg' => $banner ['img'],
... ... @@ -247,7 +247,7 @@ class BackController extends WebAction {
}
$banner = PassportModel::getLeftBanner (PassportModel::BACK_LFFT_BANNER_CODE);
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader ( false ),
'simpleHeader' => PassportModel::getSimpleHeader (),
'vertificationPage' => true,
'verification' => array (
'coverHref' => $banner ['url'],
... ...
... ... @@ -23,17 +23,7 @@ class LoginController extends WebAction
if (!empty($refer)) {
$this->setCookie('refer', $refer);
}
//获取用户
$uid = $this->getUid(true);
if (!$uid) {
$isLogin = false;
$username = '';
}
else {
$isLogin = true;
$username = $this->_uname;
}
$simpleHeader = PassportModel::getSimpleHeader($isLogin, $username);
$simpleHeader = PassportModel::getSimpleHeader();
//获取登陆页左侧资源
$cover = PassportModel::getLeftBanner(PassportModel::SIGNIN_LEFT_BANNER_CODE);
//是否记住密码
... ...
... ... @@ -17,7 +17,7 @@ class RegisterController extends WebAction
$this->setSession('effective_time', time() + 1800);
$data = array(
'registerPage' => true,
'simpleHeader' => PassportModel::getSimpleHeader(false),
'simpleHeader' => PassportModel::getSimpleHeader(),
'passport' => array(
'actionUrl' => SITE_MAIN.'/passport/register/mobileregister',
'region' => RegData::getAreasData(),
... ...
<?php
use Action\WebAction;
use Passport\PassportModel;
use LibModels\Wap\Passport\RegData;
class ThirdloginController extends WebAction
{
/**
* 登录
* 第三方联合登录手机绑定流程
*/
public function indexAction()
{
$this->setTitle('联合登录补全信息');
// $nickname = $this->get('nickname');
$openId = trim($this->get('openId'));
$sourceType = trim($this->get('sourceType'));
//登录后跳转页面
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN;
}
else {
$refer = rawurldecode($refer);
}
$simpleHeader = PassportModel::getSimpleHeader();
//整合
$data = array(
'thirdLogin' => true,
'simpleHeader' => $simpleHeader,
'openId' => $openId,
'sourceType' => $sourceType,
'region' => RegData::getAreasData(),
);
$this->_view->display('index', $data);
}
}
... ...
... ... @@ -3,7 +3,7 @@ use Action\WebAction;
use LibModels\Web\Product\BrandData;
use LibModels\Web\Product\FavoriteData;
use \LibModels\Web\Product\HotrankData;
use LibModels\Web\Product\HotrankData;
use product\HotrankModel;
use LibModels\Web\Home\IndexData;
... ... @@ -28,6 +28,8 @@ class IndexController extends WebAction
$brandId = $brandInfo['data']['id'];
$node = isset($brandInfo['data']['static_content_code']) ? $brandInfo['data']['static_content_code'] : false;
$brandBanner = $brandInfo['data']['brand_banner'];
$brandNameEn = $brandInfo['data']['brand_name_en'];
$brandNameCn = $brandInfo['data']['brand_name_cn'];
} else {
$this->go(SITE_MAIN);
}
... ... @@ -47,6 +49,8 @@ class IndexController extends WebAction
$options['brandId'] = $brandId;
$options['node'] = $node;
$options['brandBanner'] = $brandBanner;
$options['brandNameEn'] = $brandNameEn;
$options['brandNameCn'] = $brandNameCn;
$options['reviewNum'] = 6;
//调用模型获得数据
... ... @@ -140,28 +144,15 @@ class IndexController extends WebAction
);
//焦点图 热门品牌
$focus = \Index\HomeModel::getChannelResource($channel['channel'], $channel['code']);
$data['hotrank']['slide'] = $focus[0]['slide'];
$data['hotrank']['hotBrands'] = $focus[1]['hotBrands'];
$focus = \product\HotrankModel::getFocusResource($channel['channel'], $channel['code']);
$data['hotrank']['slide'] = $focus[0]['slide'];
$data['hotrank']['hotBrands'] = $focus[1]['hotBrands'];
//人气单品 一周热卖
$page = $this->get('page',1);
$sort_id = $this->get('sid',0);
$viewNum = 60;
$param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'stocknumber'=>1,'status'=>1,'gender'=>$channel['gender'],'attribute_not'=>2);
if($sort_id != 0)
{
$param['sort'] = $sort_id;
}
if($channel['road'] == 3)
{
$param['msort'] = 365;
}elseif($channel['road'] == 4){
$param['msort'] = 10;
}else{
$param['not_maxSortId'] = '10,365';
}
$publiclist = \product\HotrankModel::getSearchData($param,$page,0);
$page = $this->get('page',1);
$sort_id = $this->get('sid',0);
$config = array('sort' =>$sort_id,'gender' => $channel['gender'],'road' => $channel['road']);
$publiclist = \product\HotrankModel::getSearchData($config,$page,0);
$data['hotrank']['popular'] = $publiclist['popular'];
$data['hotrank']['hotWeek'] = $publiclist['hotWeek'];
... ... @@ -176,7 +167,6 @@ class IndexController extends WebAction
*/
public function getdataAction()
{
$page = $this->get('page',1);
//加载到100个以后停止
if($page > 2)
... ... @@ -196,24 +186,11 @@ class IndexController extends WebAction
$sort = $info['data']['category_id'];
}
}
$viewNum = 60;
//获取频道资源
$channel = \product\HotrankModel::getChannelResource();
$param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'sort'=>$sort,'stocknumber'=>1,'status'=>1,
'gender'=>$channel['gender'],'attribute_not'=>2,);
if(empty($param['sort']))
{
if($channel['road'] == 3)
{
$param['msort'] = 365;
}elseif($channel['road'] == 4){
$param['msort'] = 10;
}else{
$param['not_maxSortId'] = '10,365';
}
}
//一周热卖
$list = \product\HotrankModel::getSearchData($param, $page, 1);
$config = array('sort' =>$sort,'gender' => $channel['gender'],'road' => $channel['road']);
$list = \product\HotrankModel::getSearchData($config, $page, 1);
$lister = $list['hotWeek']['list'];
$lister = array_values($lister);
if($sid == 1 && $page == 1)
... ...
... ... @@ -29,7 +29,8 @@ class ListController extends WebAction
/**
* list列表new(模板new-sale)
*/
public function newAction(){
public function newAction()
{
$condition = array(
'order' => 's_t_desc'
);
... ... @@ -113,7 +114,7 @@ class ListController extends WebAction
* @author
* @return json
*/
public static function changeFavoriteAction()
public function changeFavoriteAction()
{
if (!$this->isAjax()) {
return;
... ...
... ... @@ -46,6 +46,7 @@ class SaleController extends WebAction
);
$saleData = Product\SaleModel::getSaleSearchData($condition, $options, $specialInfo);
$data = array(
//初始化js
'productListPage' => true,
... ...