Authored by hf

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

Showing 42 changed files with 224 additions and 74 deletions
... ... @@ -323,7 +323,7 @@
### 编辑页
{
author: {
authorInfo: {
avatar: '',
name: '',
info: ''
... ... @@ -747,7 +747,8 @@
brandHome: {
id: 0,
banner: ''
intro: '...'
intro: '...',
collected: true //是否已收藏
},
new: [
{
... ...
framework @ 119c247f
Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05
... ...
... ... @@ -17,10 +17,10 @@ use Plugin\Cache;
class Yohobuy
{
// /* 正式环境 */
// const API_URL = 'http://api2.open.yohobuy.com/';
// const SERVICE_URL = 'http://service.api.yohobuy.com/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// /* 正式环境 */
// const API_URL = 'http://api2.open.yohobuy.com/';
// const SERVICE_URL = 'http://service.api.yohobuy.com/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
/* 测试环境 */
const API_URL = 'http://test2.open.yohobuy.com/';
... ...
<?php
namespace Plugin\DataProcess;
use Plugin\Helpers;
/**
... ... @@ -18,9 +17,10 @@ class ListProcess
*/
public static function getListData($data, $returnFilter = true)
{
$result = array('new' => array(), 'filter' => array());
$result = array();
if (isset($data['product_list'])) {
if(isset($data['product_list']))
{
$result['new'] = self::getProductData($data['product_list']);
}
if ($returnFilter && isset($data['filter'])) {
... ... @@ -28,6 +28,7 @@ class ListProcess
}
return $result;
}
/**
... ... @@ -46,34 +47,40 @@ class ListProcess
}
return $products;
}
/**
* 处理筛选数据
*
* @param $data
* @param string | integer $gender 默认选择的性别,默认1,2,3表示所有
* @return array 处理之后的筛选数据
*/
public static function getFilterData($data)
public static function getFilterData($data, $gender = '1,2,3')
{
// 过滤条件数据
$filters = array('classify' => array());
$filters = array('classify'=>array());
// 返回数据中有没有gender时要添加gender
// $data['gender'] = array('2,3'=>'GIRLS','1,3'=>'BOYS');
$num = 1;
$build = array();
foreach ($data as $key => $val) {
if (empty($val)) {
if(empty($val))
{
continue;
}
if (!is_callable("self::$key")) {
continue;
}
$build = self::$key($val);
if ($num === 1) {
$build = self::$key($val, $gender);
if($num === 1)
{
$build['active'] = true;
}
$num ++;
$num++;
$filters['classify'][] = $build;
}
... ... @@ -81,6 +88,7 @@ class ListProcess
self::sortArrByField($filters['classify'], 'sort_col');
return $filters;
}
private static function brand($data)
... ... @@ -159,7 +167,7 @@ class ListProcess
foreach ($data as $key => $one) {
$discount = array();
$discount['dataId'] = $key;
$discount['name'] = $one['name'] . '折商品';
$discount['name'] = $one['name'] .'折商品';
$result['subs'][] = $discount;
}
... ... @@ -167,7 +175,7 @@ class ListProcess
return $result;
}
private static function gender($data)
private static function gender($data, $gender)
{
$result = array(
'title' => '性别',
... ... @@ -176,8 +184,7 @@ class ListProcess
'dataType' => 'gender',
'subs' => array(
array(
'chosed' => true,
'dataId' => 0,
'dataId' => '1,2,3',
'name' => '所有性别'
),
array(
... ... @@ -191,6 +198,11 @@ class ListProcess
)
);
// 处理选中状态
foreach ($result['subs'] as &$val) {
$val['dataId'] === $gender && $val['chosed'] = true;
}
return $result;
}
... ... @@ -215,7 +227,7 @@ class ListProcess
$category['dataId'] = isset($one['relation_parameter']) ? $one['relation_parameter']['sort'] : 0;
$category['name'] = $one['category_name'];
/* // 子品类(目前h5不支持二级)
/*// 子品类(目前h5不支持二级)
if(isset($one['sub']))
{
$category['subs'] = array();
... ... @@ -226,7 +238,7 @@ class ListProcess
$category['subs'][] = $subitem;
}
} */
}*/
$result['subs'][] = $category;
}
... ... @@ -295,8 +307,7 @@ class ListProcess
* @param string $field 字段名称
* @param boolean $desc 时候降序排列,默认为false
*/
private static function sortArrByField(&$array, $field, $desc = false)
{
private static function sortArrByField(&$array, $field, $desc = false){
$fieldArr = array();
foreach ($array as $k => $v) {
$fieldArr[$k] = $v[$field];
... ... @@ -304,5 +315,4 @@ class ListProcess
$sort = $desc == false ? SORT_ASC : SORT_DESC;
array_multisort($fieldArr, $sort, $array);
}
}
... ...
... ... @@ -161,7 +161,7 @@ class Helpers
break;
case 'newest':
default:
$result = ($order == 0) ? 's_t_desc' : 's_t_asc';
$result = ($order == 1) ? 's_t_desc' : 's_t_asc';
break;
}
... ...
No preview for this file type
... ... @@ -2,7 +2,7 @@
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>
Created by FontForge 20120731 at Fri Oct 30 10:27:45 2015
Created by FontForge 20120731 at Sun Nov 1 15:22:48 2015
By Ads
</metadata>
<defs>
... ... @@ -149,12 +149,13 @@ d="M459 754h22h23h20h22h22v-191v-191h191h191v-109h-191h-191v-191v-190h-109v190v1
d="M77 372h873v-109h-873v109z" />
<glyph glyph-name="uniE626" unicode="&#xe626;"
d="M866.5 663.5q-97.5 97.5 -228 132t-261.5 0t-228.5 -132t-132 -228.5t0 -261.5t132 -228t228.5 -132t261.5 0t228 132t132 228t0 261.5t-132 228.5zM798 115l-101 -101l-187 186l-186 -186l-101 101l186 186l-186 187l101 101l186 -186l187 186l101 -101l-186 -187z" />
<glyph glyph-name="uniE627" unicode="&#xe627;"
d="M741 258q-23 9 -22 34q6 114 -8 186q-13 68 -37.5 125.5t-48 89.5t-50.5 57t-38 32t-18 10l-7 3l-7 -3q-7 -3 -18 -10t-38 -32t-50.5 -57t-48 -89.5t-37.5 -125.5q-14 -72 -8 -186q1 -25 -22 -34q-19 -9 -37 -19.5t-39 -29.5t-36 -41.5t-25.5 -56t-10.5 -72.5v-16h198
q2 -22 17.5 -36.5t37.5 -14.5h248q22 0 37.5 14.5t17.5 36.5h198v16q0 48 -14.5 87.5t-39 65t-47 40.5t-47.5 26zM512 442q-31 0 -53 22t-22 53t22 53t53 22q20 0 37.5 -10t27.5 -27t10 -38q0 -31 -22 -53t-53 -22zM453 -61q-14 0 -23.5 -10t-9.5 -24v-83q0 -10 4.5 -17.5
t12 -12t16.5 -4.5t17 4.5t12.5 12t4.5 17.5v83q0 9 -4.5 17t-12.5 12.5t-17 4.5zM571 -61q-7 0 -13.5 -2.5t-11 -7t-7 -11t-2.5 -13.5v-83q0 -14 10 -24t24 -10q6 0 12.5 2.5t11 7t7 11t2.5 13.5v83q0 9 -4.5 17t-12 12.5t-16.5 4.5z" />
<glyph glyph-name="uniE628" unicode="&#xe628;"
d="M505 776q77 0 148.5 -23.5t129 -67t101 -101.5t67.5 -129.5t24 -147.5q0 -64 -17 -125t-47.5 -112t-74 -94.5t-94.5 -74t-112 -47.5t-125 -17q-95 0 -182 37.5t-150 100.5t-100 150t-37 182t37 182t100 150t150 100t182 37zM505 -104q112 0 206.5 55t149.5 149.5
t55 206.5q0 37 -6.5 73.5t-19.5 69.5t-30.5 64t-40.5 57.5t-49.5 49.5t-57.5 40.5t-64 30t-69.5 19t-73.5 6.5q-111 0 -205.5 -55t-149.5 -149.5t-55 -206t55 -206t149.5 -149.5t205.5 -55zM528 138v-59h-58v59h58zM470 564h58v-349h-58v349z" />
<glyph glyph-name="uniE629" unicode="&#xe629;"
d="M442 274h-84v-76h-230v76h-81q-20 0 -33.5 -12.5t-13.5 -31.5v-395q0 -20 13.5 -33.5t33.5 -13.5h395q19 0 31.5 13.5t12.5 33.5v395q0 13 -5.5 23t-15.5 15.5t-23 5.5zM977 812h-81v-77h-230v77h-84q-10 0 -18 -3.5t-14 -10t-9 -15t-3 -18.5v-395q0 -13 5.5 -23
t15.5 -15.5t23 -5.5h395q20 0 33.5 12.5t13.5 31.5v395q0 20 -13.5 33.5t-33.5 13.5zM977 274h-81v-76h-230v76h-84q-13 0 -23 -5.5t-15.5 -15.5t-5.5 -23v-395q0 -13 5.5 -23.5t15.5 -17t23 -6.5h395q20 0 33.5 13.5t13.5 33.5v395q0 19 -13.5 31.5t-33.5 12.5z" />
<glyph glyph-name="uniE62A" unicode="&#xe62a;"
d="M497 806l-451 -386q-6 -6 -11 -13t-7 -15t-2 -17v-500q0 -32 22.5 -54.5t53.5 -22.5h256v333h308v-333h256q31 0 53.5 22.5t22.5 54.5v500q0 27 -20 45l-451 386q-15 13 -30 0z" />
<glyph glyph-name="uniE62B" unicode="&#xe62b;"
... ...
No preview for this file type
No preview for this file type
... ... @@ -108,7 +108,7 @@ function rePosFooter() {
}
//页面通用底部位置及status设置
(function () {
(function() {
var $op = $footer.children('.op-row');
var user = getUser();
... ... @@ -135,9 +135,21 @@ function rePosFooter() {
);
}
$op.find('.back-to-top').on('touchend', function() {
$(window).scrollTop(0);
return false;
});
$footer.removeClass('hide');
}());
(function() {
var uid = getUid();
uid = uid === 0 ? '' : uid;
window._yas(1 * new Date(), '1.0.8', 'yohobuy_m', uid, '');
}());
//暴露公共接口
window.cookie = cookie;
... ...
... ... @@ -73,18 +73,20 @@ navHammer.on('tap', function(e) {
$this.addClass('focus');
$curNav.removeClass('focus');
$infos.not('.hide').addClass('hide');
$content = $infos.eq(index);
$content.removeClass('hide');
$curNav = $this;
curType = $this.data('type');
//当未加载数据时去请求数据
if (state[curType].page === 1) {
//无数据时隐藏正在加载和没有更多字样
$loading.addClass('hide');
$noMore.addClass('hide');
loadMore($content, state[curType]);
}
} else {
//重置当前Tab的load-more
if (state[curType].end) {
... ... @@ -94,6 +96,14 @@ navHammer.on('tap', function(e) {
$loading.removeClass('hide');
$noMore.addClass('hide');
}
}
$infos.not('.hide').addClass('hide');
$content.removeClass('hide');
if (state[curType].page === 1) {
window.rePosFooter();//进入空内容时重新定位footer位置
}
});
$(document).scroll(function() {
... ...
... ... @@ -128,6 +128,7 @@ function loadMore($container, opt) {
return;
}
$container.append(data);
if (num > 0) {
... ... @@ -140,6 +141,10 @@ function loadMore($container, opt) {
if (opt.page === 1) {
loading.hideLoadingMask();
$loading.removeClass('hide');//显示空屏加载时hide的隐藏
window.rePosFooter();//插入内容后重新计算底部位置
}
opt.page++;
... ...
... ... @@ -2,7 +2,7 @@
float: left;
width: 276rem / $pxConvertRem;
height: 486rem / $pxConvertRem;
margin: 0 (15rem / $pxConvertRem) (28rem / $pxConvertRem);
margin: 0 (15rem / $pxConvertRem) (15rem / $pxConvertRem);
.tag-container {
height: 28rem / $pxConvertRem;
... ...
.loading-mask {
position: absolute;
position: fixed;
background: rgba(0,0,0,.1);
top: 0;
bottom: 0;
... ...
... ... @@ -4,7 +4,7 @@
.op-row {
position: relative;
padding: 0 30px;
padding: 0 15px;
height: 60px;
line-height: 60px;
... ...
... ... @@ -112,6 +112,8 @@
.goods-container {
position: relative;
min-height: 440px;
padding-left: 0.375rem;
padding-top: 0.2rem;
}
}
... ...
... ... @@ -73,6 +73,7 @@
> img {
display: block;
height: 100%;
width: 100%;
}
}
... ... @@ -100,6 +101,18 @@
.iconfont {
font-size: 12px;
}
&.coled {
opacity: 0.5;
}
.txt:after {
content: '收藏'
}
&.coled .txt:after {
content: '已收藏'
}
}
.brand-intro-box {
... ... @@ -152,6 +165,8 @@
}
.list-nav {
border-bottom: 1px solid #e6e6e6;
> li {
float: left;
width: 25%;
... ... @@ -226,5 +241,7 @@
.goods-container {
position: relative;
min-height: 440px;
padding-left: 0.375rem;
padding-top: 0.2rem;
}
}
\ No newline at end of file
... ...
... ... @@ -84,6 +84,8 @@
.goods-container {
position: relative;
min-height: 440px;
padding-left: 0.375rem;
padding-top: 0.2rem;
}
}
... ...
... ... @@ -12,7 +12,7 @@
.iconfont {
color: #fff;
font-size: 22px;
font-size: 18px;
}
.cart-count {
... ...
... ... @@ -83,4 +83,3 @@
</div>
</div>
{{> layout/footer}}
{{> layout/download_app}}
... ...
... ... @@ -19,4 +19,3 @@
{{{brandList}}}
</script>
{{> layout/footer}}
{{> layout/download_app}}
... ...
... ... @@ -41,4 +41,3 @@
{{/ category}}
</div>
{{> layout/footer}}
\ No newline at end of file
{{> layout/download_app}}
\ No newline at end of file
... ...
... ... @@ -15,7 +15,7 @@
<div class="swiper-pagination"></div>
</div>
{{# author}}
{{# authorInfo}}
<div id="author-infos" class="editor-header clearfix" data-id={{id}}>
<div class="avatar">
<img src="{{avatar}}">
... ... @@ -25,7 +25,7 @@
<p class="info">{{info}}</p>
</div>
</div>
{{/ author}}
{{/ authorInfo}}
<ul id="guang-nav" class="guang-nav clearfix">
{{# navs}}
... ... @@ -37,7 +37,7 @@
<div id="info-list" class="info-list-container">
{{# infos}}
<div class="info-list {{^show}}hide{{/show}}">
<div class="info-list{{^show}} hide{{/show}}">
{{# info}}
{{> guang/info}}
{{/ info}}
... ...
... ... @@ -25,4 +25,3 @@
</div>
</div>
{{> layout/footer}}
\ No newline at end of file
{{> layout/download_app}}
\ No newline at end of file
... ...
... ... @@ -3,4 +3,3 @@
{{> product/list}}
</div>
{{> layout/footer}}
\ No newline at end of file
{{> layout/download_app}}
\ No newline at end of file
... ...
... ... @@ -85,4 +85,3 @@
{{> product/suspend-cart}}
</div>
{{> layout/footer}}
\ No newline at end of file
{{> layout/download_app}}
\ No newline at end of file
... ...
... ... @@ -96,4 +96,3 @@
{{> product/suspend-cart}}
</div>
{{> layout/footer}}
\ No newline at end of file
{{> layout/download_app}}
\ No newline at end of file
... ...
... ... @@ -10,7 +10,7 @@
<div class="trend-coll-tail">
<h3 class="recommend-title">推荐搭配</h3>
<div class="recommend-swiper">
<ul class="recommend-list clearfix">
<ul class="recommend-list swiper-wrapper clearfix">
{{# recommend_collocation}}
<li class="recommend-item swiper-slide"><a href="{{url}}"><img class="img" src="{{img}}" alt="" /></a></li>
{{/ recommend_collocation}}
... ...
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-W958MG" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-W958MG');
</script>
<!-- End Google Tag Manager -->
<script type="text/javascript">
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "//hm.baidu.com/hm.js?c6ee7218b8321cb65fb2e98f284d8311";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<script>
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "//hm.baidu.com/hm.js?65dd99e0435a55177ffda862198ce841";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
</script>
<script type="text/javascript">
(function(w,d,s,j,f){
w['YohoAcquisitionObject']=f;
w[f]=function(){w[f].p=arguments;};
var a=d.createElement(s);
var m=d.getElementsByTagName(s)[0];
a.async=1;
a.src=j;
m.parentNode.insertBefore(a,m);
})(window,document,'script','http://cdn.yoho.cn/yas-jssdk/1.0.8/yas.js','_yas');
</script>
\ No newline at end of file
... ...
... ... @@ -19,6 +19,8 @@
<script src="http://localhost:8000/static/js/sea.js?nowrap"></script>
<script>seajs.config({base: 'http://localhost:8000/'});</script>
{{/if}}
{{> layout/analysis}}
{{> layout/use}}
</body>
</html>
\ No newline at end of file
... ...
... ... @@ -9,7 +9,7 @@
<p class="tab-name">分类</p>
</div>
<div class="tab-item {{#if guangHome}}current{{/if}}">
<p class="iconfont tab-icon">&#xe611;</p>
<p class="iconfont tab-icon">&#xe627;</p>
<p class="tab-name">逛</p>
</div>
<div class="tab-item {{#if shoppingCartPage}}current{{/if}}">
... ...
... ... @@ -29,9 +29,9 @@
<a class="btn-intro" href="javascript:void(0);">
品牌介绍
</a>
<a class="btn-col" href="javascript:void(0);">
<a class="btn-col{{#if collected}} coled{{/if}}" href="javascript:void(0);">
<span class="iconfont">&#xe622;</span>
收藏
<span class="txt"></span>
</a>
</div>
<div id="intro-box" class="brand-intro-box hide">
... ...
... ... @@ -31,7 +31,7 @@ class BoysController extends AbstractAction
$this->_view->display('index', array(
'boysHomePage' => true,
'homeHeader' => array('searchUrl' => Helpers::url('/search', null, 'search')),
'showFooterTab' => false,
'showFooterTab' => true,
'maybeLike' => true,
'content' => Index\HomeModel::getBoysFloor(),
'pageFooter' => true,
... ... @@ -57,6 +57,8 @@ class BoysController extends AbstractAction
$this->echoJson($bottomBanner);
} while (false);
echo ' ';
}
}
... ...
... ... @@ -26,7 +26,7 @@ class GirlsController extends AbstractAction
$this->_view->display('index', array(
'grilsHomePage' => true,
'homeHeader' => array('searchUrl' => Helpers::url('/search', null, 'search')),
'showFooterTab' => false,
'showFooterTab' => true,
'maybeLike' => true,
'content' => Index\HomeModel::getGirlsFloor(),
'pageFooter' => true,
... ... @@ -53,6 +53,8 @@ class GirlsController extends AbstractAction
$this->echoJson($bottomBanner);
} while (false);
echo ' ';
}
}
... ...
... ... @@ -26,7 +26,7 @@ class KidsController extends AbstractAction
$this->_view->display('index', array(
'kidsHomePage' => true,
'homeHeader' => array('searchUrl' => Helpers::url('/search', null, 'search')),
'showFooterTab' => false,
'showFooterTab' => true,
'maybeLike' => true,
'content' => Index\HomeModel::getKidsFloor(),
'pageFooter' => true,
... ...
... ... @@ -26,7 +26,7 @@ class LifestyleController extends AbstractAction
$this->_view->display('index', array(
'lifestyleHomePage' => true,
'homeHeader' => array('searchUrl' => Helpers::url('/search', null, 'search')),
'showFooterTab' => false,
'showFooterTab' => true,
'maybeLike' => true,
'content' => Index\HomeModel::getLifestyleFloor(),
'pageFooter' => true,
... ...
<?php
use Action\AbstractAction;
use LibModels\Wap\Product\SearchData;
// use LibModels\Wap\Product\SearchData;
use Plugin\DataProcess\ListProcess;
use Plugin\Helpers;
... ... @@ -94,8 +94,7 @@ class SearchController extends AbstractAction
if ($domain !== null) {
$url = Helpers::url('', array(
'from' => 'search',
'query' => $query,
'gender' => $condition['gender']
'query' => $query
), $domain);
$this->go($url);
}
... ... @@ -277,23 +276,22 @@ class SearchController extends AbstractAction
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,), false);
// 转义分类
if (isset($condition['sort'])) {
$condition['sort'] = rawurldecode($condition['sort']);
}
// 转换折扣
if (isset($condition['discount'])) {
$condition['p_d'] = rawurldecode($condition['discount']);
unset($condition['discount']);
}
// 转义性别
if (isset($condition['gender'])) {
$condition['gender'] = rawurldecode($condition['gender']);
}
$listData = SearchData::searchByCondition($condition);
// 处理返回的数据
if (isset($listData['data']) && isset($listData['data']['filter'])) {
$data['filter'] = ListProcess::getFilterData($listData['data']['filter']);
}
$listData = array();
// 区别各种列表页面的筛选数据
$data = Product\FilterModel::getFilterData($condition);
}
if (empty($data)) {
... ... @@ -308,7 +306,7 @@ class SearchController extends AbstractAction
*
* @return array 模糊搜索的结果
*/
public function fuzzysearch()
/*public function fuzzysearch()
{
if ($this->isAjax()) {
$keyword = $this->post('keyword', '');
... ... @@ -317,6 +315,6 @@ class SearchController extends AbstractAction
$this->echoJson($result);
}
}
}*/
}
... ...
... ... @@ -65,7 +65,7 @@ class BrandModel
$build = array();
foreach ($brand['brandTop'][0]['data'] as $value) {
$build['url'] = Helpers::getFilterUrl($value['url']);
$build['img'] = Helpers::getImageUrl($value['src'], 640, 300);
$build['img'] = Helpers::getImageUrl($value['src'], 640, 310);
$build['title'] = $value['title'];
$result['bannerTop']['list'][] = $build;
}
... ...
<?php
namespace Product;
use Configs\CacheConfig;
use LibModels\Wap\Product\SearchData;
use LibModels\Wap\Category\BrandData;
use LibModels\Wap\Category\ClassData;
use Plugin\DataProcess\ListProcess;
/**
* 搜索相关的模板数据模型
*
* @name Filter
* @package Product
* @copyright yoho.inc
* @version 1.0 (2015-11-1 17:35:52)
*/
class FilterModel
{
/**
* 获取筛选的数据
*
* @param array $condition 查询条件
* @return array
*/
public static function getFilterData($condition)
{
$result = array();
// 区别各种列表页面的筛选数据
if (isset($condition['brand'])) {
$listData = BrandData::filterBrandData($condition);
} else if(isset($condition['sort'])) {
$listData = ClassData::filterClassData($condition);
} else {
$listData = SearchData::searchByCondition($condition);
}
if (isset($listData['data']) && isset($listData['data']['filter'])) {
$result['filter'] = ListProcess::getFilterData($listData['data']['filter']);
}
return $result;
}
}
... ...
... ... @@ -224,15 +224,16 @@ class NewsaleModel
/**
* 获取筛选数据
* @param array $data 接口返回的数据
* @param string $gender 默认选择的性别,默认1,2,3表示所有
* @return array 处理之后的数据
*/
public static function filterData($data)
public static function filterData($data, $gender = '1,2,3')
{
$result = array();
/* 格式化筛选数据 */
if (isset($data['code']) && $data['code'] == 200 && isset($data['data']['filter'])) {
$result['filter'] = ListProcess::getFilterData($data['data']['filter']);
$result['filter'] = ListProcess::getFilterData($data['data']['filter'], $gender);
}
return $result;
... ...
... ... @@ -117,6 +117,8 @@ class IndexController extends AbstractAction
if (isset($condition['gender'])) {
$condition['gender'] = rawurldecode($condition['gender']);
} else {
$condition['gender'] = Helpers::getGenderByCookie();
}
$data = array();
... ...
... ... @@ -54,7 +54,7 @@ class NewsaleController extends AbstractAction
// 设置一些默认参数
$data = array(
'discountPage' => true,
'headerBanner' => \Product\NewsaleModel::getNewFocus($channel),
'headerBanner' => \Product\NewsaleModel::getSaleFocus($channel),
'showDownloadApp' => true,
'pageFooter' => true,
'brand' => '0',
... ... @@ -142,7 +142,7 @@ class NewsaleController extends AbstractAction
$data = NewsaleData::selectNewSaleProducts(
$gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order
);
$result = \Product\NewsaleModel::filterData($data);
$result = \Product\NewsaleModel::filterData($data, $gender);
}
if (empty($result)) {
... ...