Authored by wangqing

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

... ... @@ -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 = '列表';
}
... ... @@ -1085,7 +1085,7 @@ class HelperSearch
}
//组织静态资源数据格式
public static function formatNodeContent($code)
public static function getNodeContent($code)
{
$nodeContent = BrandData::getByNodeContent($code);
if (isset($nodeContent['code']) && $nodeContent['code'] === 200) {
... ... @@ -1102,6 +1102,7 @@ class HelperSearch
$result[$key]['href'] = $vo;
$result[$key]['src'] = $img[1][$key];
}
return $result;
}
}
... ... @@ -1311,7 +1312,8 @@ class HelperSearch
'coled' => $is_favorite,
'banner' => $bannerImg,
'brandHome' => $brandHome,
'brandIntro' => $brandIntro
'brandIntro' => $brandIntro,
'dataId' => $brand['brand_id']
);
}
... ...
... ... @@ -48,7 +48,7 @@
.gift-advance-good .name {
margin-bottom: 20rem / $pxConvertRem;
width: 440rem / $pxConvertRem;
width: 320rem / $pxConvertRem;
font-size: 28rem / $pxConvertRem;
}
... ...
... ... @@ -11,3 +11,19 @@
{{/ resetSuccess}}
</div>
{{> layout/footer}}
<script type="text/javascript">
(function() {
var count = 5,
countDown = document.getElementById('count-down');
var timer = setInterval(function(){
if (count > 1) {
count--;
countDown.innerHTML = count;
} else {
location.href = '/';
}
}, 1000);
})();
</script>
\ No newline at end of file
... ...
... ... @@ -137,7 +137,7 @@
</div>
<div class="gobuy float-left {{gobytype}}" id="miniCartBox">
{{# gobuy}}
<span class="ic-infomation">{{gobuynum}}</span>
<span class="ic-infomation">0</span>
<div class="gobuy-wrapper"></div>
{{/gobuy}}
</div>
... ...
... ... @@ -11,6 +11,7 @@
{{!-- 搜索 --}}
{{#if searchListPage}}
<script>
seajs.use('js/product/brand');
seajs.use(['js/product/list', 'js/product/product'], function (list, product) {
product.init(5);
... ...
... ... @@ -14,7 +14,7 @@
<i class="iconfont">&#xe618;</i>
品牌介绍
</a>
<span id="brand-favor" class="brand-favor">
<span id="brand-favor" class="brand-favor" data-id="{{brandId}}">
<i class="iconfont{{#if coled}} coled{{/if}}">&#xe616;</i>
</span>
</p>
... ... @@ -58,4 +58,4 @@
</div>
{{/ list}}
</div>
{{> layout/footer}}
\ No newline at end of file
{{> layout/footer}}
... ...
... ... @@ -2415,12 +2415,18 @@ exports.init = function(num) {
removeHtmlFn();
ulStr = createColorList(data).colorListStr; //ajax请求的颜色列表
ulNum = createColorList(data).ulNum;//ajax请求的颜色的数量
ulStr = createColorList(data.pics).colorListStr; //ajax请求的颜色列表
ulNum = createColorList(data.pics).ulNum;//ajax请求的颜色的数量
$goodInfoMain.append(event.targetDuplicate);
$goodSelectColor.append($(ulStr));
if (data.isFavorite) {
$goodInfoMain.find('.col-btn').addClass('coled');
} else {
$goodInfoMain.find('.col-btn').removeClass('coled');
}
wrapperPl = $goodItemWrapper.css('paddingLeft');
wrapperPt = $goodItemWrapper.css('paddingTop');
containerPt = $goodsContainer.css('paddingTop');
... ... @@ -2448,8 +2454,8 @@ exports.init = function(num) {
});
// 鼠标悬浮获取到商品信息后显示第一张图片
if (data[0] && data[0].src) {
$goodInfoMain.find('.good-thumb img').attr('src', data[0].src);
if (data.pics[0] && data.pics[0].src) {
$goodInfoMain.find('.good-thumb img').attr('src', data.pics[0].src);
}
//}, 1000);
... ... @@ -2457,7 +2463,8 @@ exports.init = function(num) {
});
$goodItemWrapper.mouseleave(function() {
removeHtmlFn();
// removeHtmlFn();
});
function removeHtmlFn() {
... ... @@ -2477,6 +2484,23 @@ $(document).on('hover', '.good-select-color li', function() {
$coverImg.attr('src', coverImg);
});
$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')
}
}).then(function(res) {
if (res.code === 200) {
$this.toggleClass('coled');
}
});
});
// 左侧导航
$productListNav.click(function() {
if ($(this).hasClass('active')) {
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
/**
* 品牌页面
* @auhtor: bikai<kai.bi@yoho.cn>
* @date: 2016/1/21
*/
var $ = require('yoho.jquery');
$('#brand-favor').on('click', function() {
var $this = $(this),
uid = window.getUid();
if (!uid) {
location.href = '/signin.html?refer=' + location.href;
return;
}
$.ajax({
type: 'post',
url: '/product/index/favoriteBrand',
data: {
uid: uid,
brandId: $this.data('id')
}
}).then(function(res) {
if (res.code === 200) {
$this.addClass('favored');
}
});
});
... ...
... ... @@ -6,4 +6,6 @@
require('./list');
require('./hotrank');
\ No newline at end of file
require('./brand');
require('./hotrank');
... ...
... ... @@ -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;
}
}
... ...
... ... @@ -149,6 +149,11 @@
.brand-favor {
margin-right: 0;
cursor: pointer;
&.favored {
color: #ee0014;
}
}
.coled {
... ...
... ... @@ -469,7 +469,7 @@ class HomeController extends AbstractAction
$info = 'userId=' . $uid . '&name=' . $this->_uname . '&memo=&hashCode=' . md5( strtoupper( rawurlencode($uid . $this->_uname . $time . '1231') ) ) . '&timestamp=' . $time;
$serviceUrl .= rawurlencode($info);
}
$this->_view->display('online-service', array(
'onlineServicePage' => true,
'pageFooter' => true,
... ... @@ -937,7 +937,7 @@ class HomeController extends AbstractAction
}
$this->setTitle('订单详情');
$this->setNavHeader('订单详情', true, false);
$this->setNavHeader('订单详情', Helpers::url('/home/orders'), false);
$this->_view->display('order-detail', array(
'orderDetailPage' => true,
... ...
... ... @@ -115,7 +115,7 @@ class UserModel
// 处理个人中心页面优选新品数据
if (!empty($preferenceData['data'])) {
foreach ($preferenceData['data'] as $value) {
$value = Helpers::formatProduct($value, false, true, true, 299, 388, false, false);
$value = Helpers::formatProduct($value, false, true, true, 299, 388, false);
if (false !== $value) {
$result['recommendList'][] = $value;
}
... ...
... ... @@ -71,7 +71,7 @@ class Bootstrap extends Bootstrap_Abstract
$controller = 'Index';
$action = 'Index';
// 二级域名
if (2 === $level) {
if (3 === $level) {
$url = strtolower($dispatcher->getRequest()->getRequestUri());
if(empty($url) || $url == '/index' || $url == '/') {
$urlAction = '/index';
... ...
... ... @@ -40,7 +40,7 @@ class BrandsModel
//获取静态内容
if ($options['node']) {
$nodeContent = HelperSearch::formatNodeContent($options['node']);
$nodeContent = HelperSearch::getNodeContent($options['node']);
$data['leftContent'][]['picLink']['list'] = $nodeContent;
}
... ...
... ... @@ -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\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
... ...
... ... @@ -35,14 +35,16 @@ class SaleModel
$data = HelperSearch::getList($result, $searchCondition['options']);
//组织sale数据
$special = array();
if (isset($specialInfo['data']) && !empty($specialInfo['data']['banner_img'])) {
$banner = json_decode($specialInfo['data']['banner_img'], true);
foreach ($banner as $k => $v) {
$v['img'] = Images::getSourceUrl($v['img'], 'couponImg');
$specialInfo['data']['banner'][] = $v;
}
$special = $specialInfo['data'];
$special = $specialInfo['data'];
}
//Sale首页 banner数据
$data['saleBanner']['bannerHeight'] = $special['banner'][0]['height'];
$data['saleBanner']['img'] = $special['banner'][0]['img'];
... ... @@ -51,7 +53,7 @@ class SaleModel
//获取广告位数据
if (isset($special['left_ad_code'])) {
$nodeContent = HelperSearch::formatNodeContent($special['left_ad_code']);
$nodeContent = HelperSearch::getNodeContent($special['left_ad_code']);
$data['leftContent'][]['picLink']['list'] = $nodeContent;
}
... ...
... ... @@ -68,26 +68,27 @@ class BackController extends WebAction {
$area = intval ($this->post('area', '86'));
$verifyCode = $this->post('verifyCode', '');//图形验证码
$ret = false;
if (Helpers::verifyEmail($phoneNum)) { // 验证邮箱
$email = $phoneNum;
$data = BackData::sendCodeToEmail($email);
if ($data ['code'] == 200) {
$ret = true;
$this->setSession('email', $email);
return $this->redirect ('sendemail');
}
} else if (Helpers::verifyMobile($phoneNum)) { // 验证手机号
$mobile = $phoneNum;
$data = BackData::sendCodeToMobile($mobile, $area);
if ($data['code'] == 200) {
$ret = true;
$this->setSession ('mobile', $mobile );
$this->setSession ('area', $area );
$this->setSession ('verifyCode', $verifyCode );
return $this->redirect ('verification');
}
if(PassportModel::verifyCode($verifyCode)) {
if (Helpers::verifyEmail($phoneNum)) { // 验证邮箱
$email = $phoneNum;
$data = BackData::sendCodeToEmail($email);
if ($data ['code'] == 200) {
$ret = true;
$this->setSession('email', $email);
return $this->redirect ('sendemail');
}
} else if (Helpers::verifyMobile($phoneNum)) { // 验证手机号
$mobile = $phoneNum;
$data = BackData::sendCodeToMobile($mobile, $area);
if ($data['code'] == 200) {
$ret = true;
$this->setSession ('mobile', $mobile );
$this->setSession ('area', $area );
$this->setSession ('verifyCode', $verifyCode );
return $this->redirect ('verification');
}
}
}
if(!$ret) {//重新找回密码页
return $this->redirect('index');
}
... ... @@ -150,7 +151,7 @@ class BackController extends WebAction {
$ret = array();
if (!empty ( $info )) {
$verifyState = true;
if(isset($info['uid'])) { //老版修改邮箱密码
if(isset($info['uid'])) { //老版修改邮箱密码不处理
$verifyState = false;//重新找回密码
}
} else {
... ... @@ -187,6 +188,7 @@ class BackController extends WebAction {
$password = $this->post('pwd');
$info = $this->checkCode($code);
$ret = false;
$successType = '';
if (Helpers::verifyPassword ($password)) {
if(!empty($info)) { //手机号找回
// 修改密码
... ... @@ -196,6 +198,7 @@ class BackController extends WebAction {
$area = $info ['area'];
$data = BackData::modifyPasswordByMobile($mobile, $token, $password, $area);
if ($data ['code'] == 200) {
$successType ='mobile';
$ret = true;
}
} else if (isset ($info ['uid'])) { //其他方式修改密码,跳到找回密码首页
... ... @@ -204,11 +207,13 @@ class BackController extends WebAction {
} else { //新版邮箱修改接口
$data = BackData::modifyPasswordByEmailCode($code, $password);
if ($data ['code'] == 200) {
$successType = 'email';
$ret = true;
}
}
}
if($ret) { //跳转到成功页
$this->setSession('successType', $successType);
return $this->redirect ('resetsuccess');
}
else {
... ... @@ -222,6 +227,11 @@ class BackController extends WebAction {
*/
public function resetsuccessAction()
{
$successType = $this->getSession('successType');
//成功状态标识
if(empty($successType)) {
return $this->redirect('index');
}
$banner = PassportModel::getLeftBanner ( PassportModel::BACK_LFFT_BANNER_CODE );
$data = array (
'simpleHeader' => PassportModel::getSimpleHeader (),
... ... @@ -231,6 +241,8 @@ class BackController extends WebAction {
'countrys' => array ()
)
);
//清除标识
$this->setSession('successType', '');
$this->_view->display ( 'reset-success', $data );
}
... ... @@ -242,7 +254,7 @@ class BackController extends WebAction {
$mobile = $this->getSession ('mobile');
$area = $this->getSession ('area');
$verifyCode = $this->getSession ('verifyCode');//图形验证码
if (empty ($mobile)) {
if (empty ($mobile) || !PassportModel::verifyCode($verifyCode)) {
$this->redirect ('index');
}
$banner = PassportModel::getLeftBanner (PassportModel::BACK_LFFT_BANNER_CODE);
... ... @@ -271,7 +283,8 @@ class BackController extends WebAction {
$verifyCode = $this->post ( 'verifyCode' );//图形验证码
$code = $this->post ( 'code' ); //手机验证码
$data = array('code'=> 400, 'message' => '验证码错误!','data' => SITE_MAIN.'/passport/back/index');
if ($this->getSession ( 'mobile' ) == $mobile && $this->getSession ( 'area' ) == $area && ! empty($code)) {
if ($this->getSession ( 'mobile' ) == $mobile && $this->getSession ( 'area' ) == $area && ! empty($code)
&& PassportModel::verifyCode($verifyCode)) {
$result = BackData::validateMobileCode ( $mobile, $code, $area );
if ($result ['code'] == 200) {
$str = json_encode ( array (
... ...
... ... @@ -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;
... ...
... ... @@ -32,7 +32,7 @@ class SaleController extends WebAction
if(!empty($special['brand_id'])){
$condition['brand'] = $special['brand_id'];
}
//传促销id
//传促销id,促销id为空时传专区id
if(!empty($special['ispromotion'])){
$condition['promotion'] = $special['ispromotion'];
}else{
... ... @@ -40,12 +40,12 @@ class SaleController extends WebAction
}
$options = array(
'specialsale_id' => 'Y',
'controller' => $this->_request->controller,
'reviewNum' => 6
);
$saleData = Product\SaleModel::getSaleSearchData($condition, $options, $specialInfo);
$data = array(
//初始化js
'productListPage' => true,
... ...