Authored by lore-w

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

@@ -18,12 +18,12 @@ class SearchData extends \LibModels\Wap\Product\SearchData @@ -18,12 +18,12 @@ class SearchData extends \LibModels\Wap\Product\SearchData
18 case 'release': 18 case 'release':
19 if($type == 'sort'){ 19 if($type == 'sort'){
20 return 'http://100.98.132.63/yohosearch/sortgroup.json'; 20 return 'http://100.98.132.63/yohosearch/sortgroup.json';
21 - }  
22 - if($type == 'discount'){ 21 + }elseif($type == 'discount'){
23 return 'http://100.98.132.63/yohosearch/discount.json'; 22 return 'http://100.98.132.63/yohosearch/discount.json';
24 - }  
25 - if($type == 'recent'){ 23 + }elseif($type == 'recent'){
26 return 'http://100.98.132.63/yohosearch/recent.json'; 24 return 'http://100.98.132.63/yohosearch/recent.json';
  25 + }elseif($type == 'review'){
  26 +
27 } 27 }
28 return 'http://100.98.132.63/yohosearch/search.json'; 28 return 'http://100.98.132.63/yohosearch/search.json';
29 case 'test': 29 case 'test':
@@ -33,11 +33,13 @@ class SearchData extends \LibModels\Wap\Product\SearchData @@ -33,11 +33,13 @@ class SearchData extends \LibModels\Wap\Product\SearchData
33 if($type == 'sort'){ 33 if($type == 'sort'){
34 return 'http://101.200.31.165/yohosearch/sortgroup.json'; 34 return 'http://101.200.31.165/yohosearch/sortgroup.json';
35 } 35 }
36 - if($type == 'discount'){ 36 + elseif($type == 'discount'){
37 return 'http://101.200.31.165/yohosearch/discount.json'; 37 return 'http://101.200.31.165/yohosearch/discount.json';
38 } 38 }
39 - if($type == 'recent'){ 39 + elseif($type == 'recent'){
40 return 'http://101.200.31.165/yohosearch/recent.json'; 40 return 'http://101.200.31.165/yohosearch/recent.json';
  41 + }elseif($type == 'review'){
  42 + return 'http://itemapi.yohobuy.com/item/item/recentreview';
41 } 43 }
42 return 'http://101.200.31.165/yohosearch/search.json'; 44 return 'http://101.200.31.165/yohosearch/search.json';
43 } 45 }
@@ -125,4 +127,14 @@ class SearchData extends \LibModels\Wap\Product\SearchData @@ -125,4 +127,14 @@ class SearchData extends \LibModels\Wap\Product\SearchData
125 public static function recentShelve(){ 127 public static function recentShelve(){
126 return Yohobuy::get(self::getUrl('recent')); 128 return Yohobuy::get(self::getUrl('recent'));
127 } 129 }
  130 +
  131 + /**
  132 + * 获取最近浏览记录
  133 + * @param int $limit
  134 + * @return json
  135 + */
  136 + public static function getRecentReview($limit = 0)
  137 + {
  138 +
  139 + }
128 } 140 }
@@ -74,7 +74,7 @@ class HelperSearch @@ -74,7 +74,7 @@ class HelperSearch
74 //分类 74 //分类
75 $result['filters']['sort'] = array(); 75 $result['filters']['sort'] = array();
76 //品牌 76 //品牌
77 - $result['filters']['brand'] = self::brand($filter); 77 + $result['filters']['brand'] = self::brand($filter, $options);
78 //价格 78 //价格
79 $result['filters']['price'] = self::price($filter); 79 $result['filters']['price'] = self::price($filter);
80 //颜色 80 //颜色
@@ -105,14 +105,13 @@ class HelperSearch @@ -105,14 +105,13 @@ class HelperSearch
105 //分类 105 //分类
106 $result['leftContent'][]['allSort'] = isset($filter['group_sort']) ? self::groupSort($filter['group_sort'], $options) : array(); 106 $result['leftContent'][]['allSort'] = isset($filter['group_sort']) ? self::groupSort($filter['group_sort'], $options) : array();
107 //一周新品上架 107 //一周新品上架
108 - $result['leftContent'][]['newSales'] = self::recentShelve($filter['recent']); 108 + $result['leftContent'][]['newSales'] = isset($filter['recent']) ? self::recentShelve($filter['recent']) : array();
109 //全部折扣 109 //全部折扣
110 - $result['leftContent'][]['allDiscount'] = self::getDiscount($filter['discount']); 110 + $result['leftContent'][]['allDiscount'] = isset($filter['discount']) ? self::getDiscount($filter['discount']) : array();
111 //总记录数 111 //总记录数
112 $result['totalCount'] = $data['data']['total']; 112 $result['totalCount'] = $data['data']['total'];
113 //分页 113 //分页
114 $result['pager'] = self::pager($result['totalCount'],$options['viewNum']); 114 $result['pager'] = self::pager($result['totalCount'],$options['viewNum']);
115 - //echo $result['pager']; exit;  
116 //选中条件 115 //选中条件
117 $result['filters']['checkedConditions']['conditions'] = self::getSelected(); 116 $result['filters']['checkedConditions']['conditions'] = self::getSelected();
118 $result['pathNav'] = self::$listnav; 117 $result['pathNav'] = self::$listnav;
@@ -247,11 +246,11 @@ class HelperSearch @@ -247,11 +246,11 @@ class HelperSearch
247 /** 246 /**
248 * 组织搜索列表页面的左侧分类 247 * 组织搜索列表页面的左侧分类
249 * @param array $sort 248 * @param array $sort
250 - * @param array $params 249 + * @param array $option
251 * @return array 250 * @return array
252 */ 251 */
253 public static function groupSort($sort, $option = array()) { 252 public static function groupSort($sort, $option = array()) {
254 - self::setListNav(); 253 + self::setListNav($option);
255 $params = self::$params; 254 $params = self::$params;
256 $gender = isset($params['gender']) ? $params['gender'] : ''; 255 $gender = isset($params['gender']) ? $params['gender'] : '';
257 256
@@ -291,7 +290,8 @@ class HelperSearch @@ -291,7 +290,8 @@ class HelperSearch
291 ); 290 );
292 foreach ($sort as $val) { 291 foreach ($sort as $val) {
293 if (isset($params['msort']) && $params['msort'] == $val['sort_id']) { 292 if (isset($params['msort']) && $params['msort'] == $val['sort_id']) {
294 - self::$listnav[1] = array( 293 + $nav_index = isset($option['brandName']) && $option['brandName'] ? 2 : 1;
  294 + self::$listnav[$nav_index] = array(
295 'sort_id' => $val['sort_id'], 295 'sort_id' => $val['sort_id'],
296 'name' => $val['sort_name'], 296 'name' => $val['sort_name'],
297 'href' => self::buildurl(array( 297 'href' => self::buildurl(array(
@@ -325,7 +325,8 @@ class HelperSearch @@ -325,7 +325,8 @@ class HelperSearch
325 ); 325 );
326 foreach ($val['sub'] as $mval) { 326 foreach ($val['sub'] as $mval) {
327 if (isset($params['misort']) && $params['misort'] == $mval['sort_id']) { 327 if (isset($params['misort']) && $params['misort'] == $mval['sort_id']) {
328 - self::$listnav[2] = array( 328 + $nav_index = isset($option['brandName']) && $option['brandName'] ? 3 : 2;
  329 + self::$listnav[$nav_index] = array(
329 'sort_id' => $mval['sort_id'], 330 'sort_id' => $mval['sort_id'],
330 'name' => $mval['sort_name'], 331 'name' => $mval['sort_name'],
331 'href' => '' 332 'href' => ''
@@ -352,7 +353,7 @@ class HelperSearch @@ -352,7 +353,7 @@ class HelperSearch
352 353
353 /** 354 /**
354 * 品牌,可以多选 355 * 品牌,可以多选
355 - * @param array $brand 356 + * @param array $filter
356 * @param array $options 357 * @param array $options
357 * @return array 358 * @return array
358 */ 359 */
@@ -481,7 +482,7 @@ class HelperSearch @@ -481,7 +482,7 @@ class HelperSearch
481 482
482 /** 483 /**
483 * 尺码的链接,不能多选 484 * 尺码的链接,不能多选
484 - * @param array $size 485 + * @param array $filter
485 * @return array 486 * @return array
486 */ 487 */
487 public static function size($filter) { 488 public static function size($filter) {
@@ -525,7 +526,7 @@ class HelperSearch @@ -525,7 +526,7 @@ class HelperSearch
525 526
526 /** 527 /**
527 * 颜色,不能多选 528 * 颜色,不能多选
528 - * @param array $color 529 + * @param array $filter
529 * @return array 530 * @return array
530 */ 531 */
531 public static function color($filter) { 532 public static function color($filter) {
@@ -580,7 +581,7 @@ class HelperSearch @@ -580,7 +581,7 @@ class HelperSearch
580 581
581 /** 582 /**
582 * 获取价格,不能多选 583 * 获取价格,不能多选
583 - * @param array $price 584 + * @param array $filter
584 * @return array 585 * @return array
585 */ 586 */
586 public static function price($filter) { 587 public static function price($filter) {
@@ -638,7 +639,7 @@ class HelperSearch @@ -638,7 +639,7 @@ class HelperSearch
638 639
639 /** 640 /**
640 * 风格,可以多选 641 * 风格,可以多选
641 - * @param array $style 642 + * @param array $filter
642 * @return array 643 * @return array
643 */ 644 */
644 public static function style($filter) { 645 public static function style($filter) {
@@ -9,7 +9,9 @@ var $ = require('yoho.jquery'); @@ -9,7 +9,9 @@ var $ = require('yoho.jquery');
9 var handlebars = require('yoho.handlebars'); 9 var handlebars = require('yoho.handlebars');
10 var json2 = require('json2'); 10 var json2 = require('json2');
11 var noticeSuccess = false; 11 var noticeSuccess = false;
12 - 12 +var apiDomain = 'http://api.open.yohobuy.com';
  13 +var vipInfoCombine = null;
  14 +var loginInfoCombine = null;
13 /** 15 /**
14 * 判断为1的helper 16 * 判断为1的helper
15 * @param {[type]} v1 [description] 17 * @param {[type]} v1 [description]
@@ -24,6 +26,37 @@ handlebars.registerHelper('equalone', function(v1, options) { @@ -24,6 +26,37 @@ handlebars.registerHelper('equalone', function(v1, options) {
24 return options.inverse(this); 26 return options.inverse(this);
25 } 27 }
26 }); 28 });
  29 +/**
  30 + * 判断等级为3的helper
  31 + * @param {[type]} v1 [description]
  32 + * @param {[type]} options) { if (v1 [description]
  33 + * @return {[type]} [description]
  34 + */
  35 +
  36 +handlebars.registerHelper('equallevelthree', function(v1, options) {
  37 +
  38 + if (v1 === '3') {
  39 + return options.fn(this);
  40 + } else {
  41 + return options.inverse(this);
  42 + }
  43 +});
  44 +
  45 +/**
  46 + * 判断为0的helper
  47 + * @param {[type]} v1 [description]
  48 + * @param {[type]} options) { if (v1 [description]
  49 + * @return {[type]} [description]
  50 + */
  51 +
  52 +handlebars.registerHelper('equalzero', function(v1, options) {
  53 +
  54 + if (v1 === '0') {
  55 + return options.fn(this);
  56 + } else {
  57 + return options.inverse(this);
  58 + }
  59 +});
27 require('../plugin/yohocookie'); 60 require('../plugin/yohocookie');
28 require('../plugin/yohocart'); 61 require('../plugin/yohocart');
29 /** 62 /**
@@ -817,6 +850,7 @@ function actionExeTemplate() { @@ -817,6 +850,7 @@ function actionExeTemplate() {
817 var resulthtml = $('#goodcartempwarpper').html().replace(/\\/g, ''); 850 var resulthtml = $('#goodcartempwarpper').html().replace(/\\/g, '');
818 851
819 $('#goodcartempwarpper').html(resulthtml); 852 $('#goodcartempwarpper').html(resulthtml);
  853 + vipInfoCombine = handlebars.compile($('#tmpl-my-login-new').html())
820 } 854 }
821 /** 855 /**
822 * 执行搜索 856 * 执行搜索
@@ -828,6 +862,138 @@ function actionSearch() { @@ -828,6 +862,138 @@ function actionSearch() {
828 $('#query_key').search(searchDomain); 862 $('#query_key').search(searchDomain);
829 } 863 }
830 /** 864 /**
  865 + * 获取登录状态
  866 + * @return {[type]} [description]
  867 + */
  868 +function actionLoginState(_data) {
  869 + var timestamp = new Date().getTime();
  870 + var noLoginHtml = '<span>Hi~</span>[<a href="http://www.yohobuy.com/signin.html" class="list-a login-out ">请登录</a>]&nbsp;[<a href="http://www.yohobuy.com/reg.html" class="list-a login-out" onclick="">免费注册</a>]'
  871 + var loginHtml = '<span>Hi~<a href="http://www.yohobuy.com/home?t=' + timestamp + '">{{user_name}}</a></span>&nbsp;'+
  872 + '{{#equalone is_login}}'+
  873 + '[<a href="{{logout}}" class="list-a login-out">退出</a>]'+
  874 + '{{else}}'+
  875 + '[<a href="http://www.yohobuy.com/signin.html" class="list-a login-out">请登录</a>]&nbsp;'+
  876 + '[<a href="http://www.yohobuy.com/reg.html" onclick="" class="list-a login-out">免费注册</a>]'+
  877 + '{{/equalone}}';
  878 + var boxObj = $('#loginBox');
  879 + var info = $.cookie('_UID');
  880 + loginInfoCombine = handlebars.compile(loginHtml);
  881 +
  882 + if (typeof info == 'undefined' || info == null) {
  883 + boxObj.html(noLoginHtml);
  884 + return false;
  885 + }
  886 + var user = info.split('::');
  887 + if (typeof user == 'undefined' || user.length < 4) {
  888 + boxObj.html(noLoginHtml);
  889 + return false;
  890 + }
  891 + var userName = user[0] || ' ';
  892 + var name = '';
  893 + var _length = 0;
  894 + for (var t = 0; t < userName.length; t++) {
  895 + var char = userName.substr(t, 1);
  896 + if (/.*[\u4e00-\u9fa5]+.*$/.test(char)) {
  897 + _length += 2;
  898 + } else {
  899 + _length += 1;
  900 + }
  901 + }
  902 + if (_length <= 10) {
  903 + name = userName;
  904 + } else {
  905 + _num = 0;
  906 + for (var t = 0; t < userName.length; t++) {
  907 + if (_num < 10) {
  908 + var char = userName.substr(t, 1);
  909 + if (char != '*') {
  910 + if (/.*[\u4e00-\u9fa5]+.*$/.test(char)) {
  911 + _num += 2;
  912 + } else {
  913 + _num += 1;
  914 + }
  915 + }
  916 + name += char;
  917 + }
  918 + }
  919 + if (name.length < userName.length) {
  920 + name += '...';
  921 + }
  922 + }
  923 + var _logout = '';
  924 + if (/http:\/\//.test(user[3])) {
  925 + _logout = user[3].replace('www.yohobuy.com', 'www.yohobuy.com');
  926 + } else {
  927 + _logout = 'http://www.yohobuy.com/logout_' + user[3] + '.html';
  928 + }
  929 + var data = {
  930 + "user_name": name,
  931 + "logout": _logout,
  932 + "random": Math.random()
  933 + };
  934 + var is_login = '1';
  935 + if (_data.result === -1) {
  936 + is_login = '-1';
  937 + }
  938 + data['is_login'] = is_login;
  939 + boxObj.html(loginInfoCombine(data));
  940 +}
  941 +/**
  942 + * 获得vip用户信息
  943 + * @return {[type]} [description]
  944 + */
  945 +function actionVipInfo(_data) {
  946 + if (_data.result == 1) {
  947 + var vipInfo = _data.data;
  948 +
  949 + if (typeof vipInfo == undefined || vipInfo.length < 1) {
  950 + return false;
  951 + }
  952 + $('#myYohoBox').mouseenter(function() {
  953 + $(this).addClass('acttags');
  954 + $('#myYohoBox .myyoho-info').show().html(vipInfoCombine(vipInfo));
  955 + var headUrl = $('.myyoho-photo img').attr('data-url');
  956 + if ($._checkUrlState == 1) {
  957 + $('.myyoho-photo').show().find('img').attr('src', headUrl);
  958 + return;
  959 + }
  960 + if (headUrl == '' || $._checkUrl != '') {
  961 + return;
  962 + }
  963 + $.ajax({
  964 + url: headUrl,
  965 + type: 'GET',
  966 + complete: function(response) {
  967 + if (response.status == 200 || response.status == 0) {
  968 + $('.myyoho-photo').show().find('img').attr('src', headUrl);
  969 + $._checkUrlState = 1;
  970 + }
  971 + $._checkUrl = headUrl;
  972 + }
  973 + });
  974 +
  975 + ;
  976 + });
  977 + $('#myYohoBox').mouseleave(function() {
  978 + $(this).removeClass('acttags');
  979 + $('#myYohoBox .myyoho-info').hide()
  980 + });
  981 + } else {}
  982 +}
  983 +/**
  984 + * 获取登录信息
  985 + * @return {[type]} [description]
  986 + */
  987 +function actionLoginInfo() {
  988 + var param = {
  989 + method: 'open.passport.get'
  990 + };
  991 + $.getData(apiDomain, param, function(_data) {
  992 + actionLoginState(_data); // 更改登录状态
  993 + actionVipInfo(_data);//获得vip;
  994 + });
  995 +}
  996 +/**
831 * 初始化函数 997 * 初始化函数
832 * @return {[type]} [description] 998 * @return {[type]} [description]
833 */ 999 */
@@ -849,6 +1015,7 @@ function init() { @@ -849,6 +1015,7 @@ function init() {
849 actionClickMiniCartBox(); //点击购物车跳转 1015 actionClickMiniCartBox(); //点击购物车跳转
850 actionListenDelCarGoods(); //监听购物车删除 1016 actionListenDelCarGoods(); //监听购物车删除
851 actionListenCartMore(); // 1017 actionListenCartMore(); //
  1018 + actionLoginInfo();//获取登录信息
852 } 1019 }
853 1020
854 init(); 1021 init();
1 <?php 1 <?php
  2 +
2 namespace Product; 3 namespace Product;
3 4
4 use Plugin\Helpers; 5 use Plugin\Helpers;
  6 +use Plugin\HelperSearch;
5 use LibModels\Web\Product\BrandData; 7 use LibModels\Web\Product\BrandData;
6 use LibModels\Wap\Product\SearchData; 8 use LibModels\Wap\Product\SearchData;
7 use LibModels\Web\Product\SearchData as WebProduct; 9 use LibModels\Web\Product\SearchData as WebProduct;
@@ -11,54 +13,65 @@ use LibModels\Web\Product\SearchData as WebProduct; @@ -11,54 +13,65 @@ use LibModels\Web\Product\SearchData as WebProduct;
11 * 13 *
12 * @author Administrator 14 * @author Administrator
13 */ 15 */
14 -class BrandsModel  
15 -{ 16 +class BrandsModel {
16 17
17 const URL_BRAND_INDEX = '/product/index/brand'; 18 const URL_BRAND_INDEX = '/product/index/brand';
18 - 19 +
19 public static $shopName; 20 public static $shopName;
20 public static $home; 21 public static $home;
21 -  
22 - /** 22 +
  23 + /**
23 * 搜索品牌数据 24 * 搜索品牌数据
24 * 25 *
25 * @param $condition array 26 * @param $condition array
26 - * 搜索数据的条件 27 + * 搜索数据的条件
27 * @param $options array 28 * @param $options array
28 * @return array 29 * @return array
29 */ 30 */
30 - public static function getBrandSearchData($condition, $options,$domain,$uid,$brandId)  
31 - {  
32 - 31 + public static function getBrandSearchData($condition, $options, $domain, $uid, $brandId) {
  32 +
33 // 调用商品搜索接口 33 // 调用商品搜索接口
34 $data = SearchData::searchElasticByCondition($condition); 34 $data = SearchData::searchElasticByCondition($condition);
35 35
36 - //导航名 36 + //获取品牌banner数据
  37 + $banner = self::getBannerByDomain($domain, $brandId, $uid = '');
37 $brandName = self::$shopName; 38 $brandName = self::$shopName;
38 - $option['brandName'] = $brandName;  
39 -  
40 - //配置调用分类接口参数  
41 - $param = array();  
42 - $param['brand'] = $condition['brand'];  
43 - //获取分类列表数据  
44 - $classes = WebProduct::getClassesData($param);  
45 - 39 + $options['brandName'] = $brandName;
46 40
  41 + if (isset($data['code']) && $data['code'] === 200) {
  42 + //获取分类列表数据
  43 + $param = array();
  44 + $param['brand'] = $condition['brand'];
  45 + $classes = WebProduct::getClassesData($param);
  46 + if (isset($classes['code']) && $classes['code'] === 200) {
  47 + $data['data']['filter']['group_sort'] = $classes['data']['sort'];
  48 + }
  49 +
  50 + //用户浏览记录
  51 +
  52 +
  53 + // 组织模板数据
  54 + $list = HelperSearch::getList($data, $options);
  55 +
  56 + //合并商品搜索数据与品牌banner数据
  57 + $list = array_merge_recursive($list,$banner);
  58 +
  59 + $data = array(
  60 + //初始化js
  61 + 'productListPage' => true,
  62 + 'list' => $list
  63 + );
  64 + } else {
  65 + $data = array();
  66 + }
  67 +
47 //获取品牌系列数据 68 //获取品牌系列数据
48 $adNav = self::getAdNav($condition['brand']); 69 $adNav = self::getAdNav($condition['brand']);
49 -  
50 -  
51 - //获取品牌数据  
52 - $banner = self::getBannerByDomain($domain, $brandId, $uid = '');  
53 -  
54 -  
55 - //开始组装数据  
56 -  
57 - 70 + $data['list']['leftContent'][] = array('picLink' => $adNav);
  71 +
58 return $data; 72 return $data;
59 } 73 }
60 -  
61 - 74 +
62 /** 75 /**
63 * 获取品牌首页banner条 76 * 获取品牌首页banner条
64 * @string $domain 品牌域名 77 * @string $domain 品牌域名
@@ -67,8 +80,7 @@ class BrandsModel @@ -67,8 +80,7 @@ class BrandsModel
67 * 80 *
68 * @return array 品牌banner条数据 81 * @return array 品牌banner条数据
69 */ 82 */
70 - public static function getBannerByDomain($domain, $brandId, $uid = '')  
71 - { 83 + public static function getBannerByDomain($domain, $brandId, $uid = '') {
72 // 构造品牌主页url 84 // 构造品牌主页url
73 self::$home = Helpers::url('', '', $domain) . self::URL_BRAND_INDEX; 85 self::$home = Helpers::url('', '', $domain) . self::URL_BRAND_INDEX;
74 // 根据品牌Id获取品牌banner图 86 // 根据品牌Id获取品牌banner图
@@ -83,9 +95,9 @@ class BrandsModel @@ -83,9 +95,9 @@ class BrandsModel
83 $is_favorite = false; 95 $is_favorite = false;
84 $logo = false; 96 $logo = false;
85 $shopName = false; 97 $shopName = false;
86 - 98 +
87 do { 99 do {
88 - if (! isset($intro['data'])) { 100 + if (!isset($intro['data'])) {
89 break; 101 break;
90 } 102 }
91 // 获取是否收藏 103 // 获取是否收藏
@@ -99,10 +111,9 @@ class BrandsModel @@ -99,10 +111,9 @@ class BrandsModel
99 // 获取品牌名 111 // 获取品牌名
100 self::$shopName = $intro['data']['brand_name']; 112 self::$shopName = $intro['data']['brand_name'];
101 } while (false); 113 } while (false);
102 - 114 +
103 // 返回banner数据 115 // 返回banner数据
104 return array( 116 return array(
105 - 'list' => array(  
106 'brandBanner' => array( 117 'brandBanner' => array(
107 'bannerHeight' => '150', 118 'bannerHeight' => '150',
108 'coled' => $is_favorite, 119 'coled' => $is_favorite,
@@ -123,26 +134,21 @@ class BrandsModel @@ -123,26 +134,21 @@ class BrandsModel
123 ) 134 )
124 ) 135 )
125 ) 136 )
126 - )  
127 - ); 137 + );
128 } 138 }
129 139
130 -  
131 -  
132 //获取品牌系列数据 140 //获取品牌系列数据
133 - public static function getAdNav($brandId,$status = 1)  
134 - {//$condition['brand'] 141 + public static function getAdNav($brandId, $status = 1) {
135 //调用接口获得数据 142 //调用接口获得数据
136 - $advNav = BrandData::getFolderByBrand($brandId,$status); 143 + $advNav = BrandData::getFolderByBrand($brandId, $status);
137 $result = array(); 144 $result = array();
138 if (isset($advNav['data']) && $advNav['code'] === 200) { 145 if (isset($advNav['data']) && $advNav['code'] === 200) {
139 foreach ($advNav['data'] as $key => $value) { 146 foreach ($advNav['data'] as $key => $value) {
140 - $result['list'][$key]['href'] = self::$home . '?folder=' . $value['id']; 147 + $result['list'][$key]['href'] = self::$home . '?folder_id=' . $value['id'];
141 $result['list'][$key]['src'] = $value['brand_sort_ico']; 148 $result['list'][$key]['src'] = $value['brand_sort_ico'];
142 } 149 }
143 } 150 }
144 return $result; 151 return $result;
145 - //$data['list']['advNav'] = $result;  
146 } 152 }
147 - 153 +
148 } 154 }
1 <?php 1 <?php
2 namespace Product; 2 namespace Product;
3 3
4 -use Configs\CacheConfig;  
5 -use Plugin\HelperSearchNew;  
6 -use Plugin\Images;  
7 -use Plugin\Cache;  
8 use Plugin\HelperSearch; 4 use Plugin\HelperSearch;
9 use \LibModels\Web\Product\SearchData; 5 use \LibModels\Web\Product\SearchData;
10 6
@@ -23,7 +19,7 @@ class SearchModel @@ -23,7 +19,7 @@ class SearchModel
23 /** 19 /**
24 * 根据条件获取搜索数据 20 * 根据条件获取搜索数据
25 * 21 *
26 - * @param $condition 搜索数据的条件 22 + * @param $condition 搜索数据的条件
27 * @param $options Array([imgSize] 23 * @param $options Array([imgSize]
28 * => Array([0] => 235[1] => 314)[minImgSize] => Array([0] => 60[1] => 80)[gender] => 1[needPd] => Y[rowNum] => 5[viewNum] => 60) 24 * => Array([0] => 235[1] => 314)[minImgSize] => Array([0] => 60[1] => 80)[gender] => 1[needPd] => Y[rowNum] => 5[viewNum] => 60)
29 * @author sefon 2015-12-17 16:12:18 25 * @author sefon 2015-12-17 16:12:18
@@ -32,7 +28,6 @@ class SearchModel @@ -32,7 +28,6 @@ class SearchModel
32 public static function getSearchData($condition, $options) 28 public static function getSearchData($condition, $options)
33 { 29 {
34 $data = array(); 30 $data = array();
35 -  
36 // 调用接口查询商品数据 31 // 调用接口查询商品数据
37 $result = SearchData::searchElasticByCondition($condition); 32 $result = SearchData::searchElasticByCondition($condition);
38 if (isset($result['code']) && $result['code'] === 200) { 33 if (isset($result['code']) && $result['code'] === 200) {
@@ -51,6 +46,8 @@ class SearchModel @@ -51,6 +46,8 @@ class SearchModel
51 if (isset($discount['code']) && $discount['code'] === 200) { 46 if (isset($discount['code']) && $discount['code'] === 200) {
52 $result['data']['filter']['recent'] = $recent['data']['recent']; 47 $result['data']['filter']['recent'] = $recent['data']['recent'];
53 } 48 }
  49 + //用户浏览记录
  50 + $result['data']['filter']['review'] = SearchData::getRecentReview();
54 // 组织模板数据 51 // 组织模板数据
55 $list = HelperSearch::getList($result, $options); 52 $list = HelperSearch::getList($result, $options);
56 $data = array( 53 $data = array(
@@ -60,11 +60,11 @@ class IndexController extends WebAction @@ -60,11 +60,11 @@ class IndexController extends WebAction
60 60
61 //每页显示商品数 61 //每页显示商品数
62 if(!isset($condition['viewNum']) || empty($condition['viewNum'])){ 62 if(!isset($condition['viewNum']) || empty($condition['viewNum'])){
63 - $condition['viewNum'] = 60; 63 + $condition['viewNum'] = 59;
64 } 64 }
65 $view_num_arr = array(60, 100, 200); 65 $view_num_arr = array(60, 100, 200);
66 if (!in_array($condition['viewNum'], $view_num_arr)) { 66 if (!in_array($condition['viewNum'], $view_num_arr)) {
67 - $condition['viewNum'] = 60; 67 + $condition['viewNum'] = 59;
68 } 68 }
69 //每行显示的商品数量 69 //每行显示的商品数量
70 if(!isset($condition['rowNum']) || empty($condition['rowNum'])){ 70 if(!isset($condition['rowNum']) || empty($condition['rowNum'])){
@@ -87,7 +87,7 @@ class IndexController extends WebAction @@ -87,7 +87,7 @@ class IndexController extends WebAction
87 'gender' => $gender, 87 'gender' => $gender,
88 'needPd' => 'Y', 88 'needPd' => 'Y',
89 'rowNum' => $condition['rowNum'], 89 'rowNum' => $condition['rowNum'],
90 - 'viewNum' => $condition['viewNum'], 90 + 'viewNum' => $condition['viewNum'] - 1,
91 ); 91 );
92 92
93 $params = $condition + $_GET; 93 $params = $condition + $_GET;
@@ -5,13 +5,13 @@ class ListController extends WebAction @@ -5,13 +5,13 @@ class ListController extends WebAction
5 { 5 {
6 public function indexAction() 6 public function indexAction()
7 { 7 {
8 - 8 +
9 } 9 }
10 10
11 public function newAction(){ 11 public function newAction(){
12 12
13 } 13 }
14 - 14 +
15 /** 15 /**
16 * list列表sale 16 * list列表sale
17 */ 17 */
@@ -48,11 +48,11 @@ class ListController extends WebAction @@ -48,11 +48,11 @@ class ListController extends WebAction
48 $condition['gender'] = $gender; 48 $condition['gender'] = $gender;
49 //每页显示商品数 49 //每页显示商品数
50 if(!isset($condition['viewNum']) || empty($condition['viewNum'])){ 50 if(!isset($condition['viewNum']) || empty($condition['viewNum'])){
51 - $condition['viewNum'] =60; 51 + $condition['viewNum'] =59;
52 } 52 }
53 $view_num_arr = array(60, 100, 200); 53 $view_num_arr = array(60, 100, 200);
54 if (!in_array($condition['viewNum'], $view_num_arr)) { 54 if (!in_array($condition['viewNum'], $view_num_arr)) {
55 - $condition['viewNum'] = 60; 55 + $condition['viewNum'] = 59;
56 } 56 }
57 //每行显示的商品数量 57 //每行显示的商品数量
58 if(!isset($condition['rowNum']) || empty($condition['rowNum'])){ 58 if(!isset($condition['rowNum']) || empty($condition['rowNum'])){
@@ -70,14 +70,25 @@ class ListController extends WebAction @@ -70,14 +70,25 @@ class ListController extends WebAction
70 //$query = $this->get('query'); 70 //$query = $this->get('query');
71 //返回搜索条件 71 //返回搜索条件
72 $condition['needFilter'] = 1; 72 $condition['needFilter'] = 1;
  73 + //过滤赠品
  74 + $condition['attribute_not'] = 2;
  75 + /*sale*/
  76 + //默认排序
  77 + if (!isset($condition['order']) || empty($condition['order'])) {
  78 + $condition['order'] = 's_n_desc';
  79 + }
  80 + if (!isset($condition['p_d']) || empty($condition['p_d'])) {
  81 + $condition['p_d'] = '0,0.9';
  82 + }
73 $options = array( 83 $options = array(
74 'imgSize' => $imgSize, 84 'imgSize' => $imgSize,
75 'minImgSize' => $minImgSize, 85 'minImgSize' => $minImgSize,
76 'gender' => $gender, 86 'gender' => $gender,
77 'needPd' => 'Y', 87 'needPd' => 'Y',
78 'rowNum' =>$condition['rowNum'], 88 'rowNum' =>$condition['rowNum'],
79 - 'viewNum' =>$condition['viewNum'], 89 + 'viewNum' =>$condition['viewNum']-1,
80 ); 90 );
  91 +
81 $params = $condition + $_GET; 92 $params = $condition + $_GET;
82 $params = array_filter($params); 93 $params = array_filter($params);
83 $data = SearchModel::getSearchData($params,$options); 94 $data = SearchModel::getSearchData($params,$options);