Authored by whb

Merge branch 'develop' of http://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) {
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,8 +13,7 @@ use LibModels\Web\Product\SearchData as WebProduct; @@ -11,8 +13,7 @@ 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
@@ -27,38 +28,50 @@ class BrandsModel @@ -27,38 +28,50 @@ class BrandsModel
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 - { 31 + public static function getBrandSearchData($condition, $options, $domain, $uid, $brandId) {
32 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 + $options['brandName'] = $brandName;
39 40
40 - //配置调用分类接口参数 41 + if (isset($data['code']) && $data['code'] === 200) {
  42 + //获取分类列表数据
41 $param = array(); 43 $param = array();
42 $param['brand'] = $condition['brand']; 44 $param['brand'] = $condition['brand'];
43 - //获取分类列表数据  
44 $classes = WebProduct::getClassesData($param); 45 $classes = WebProduct::getClassesData($param);
  46 + if (isset($classes['code']) && $classes['code'] === 200) {
  47 + $data['data']['filter']['group_sort'] = $classes['data']['sort'];
  48 + }
45 49
46 -  
47 - //获取品牌系列数据  
48 - $adNav = self::getAdNav($condition['brand']); 50 + //用户浏览记录
49 51
50 52
51 - //获取品牌数据  
52 - $banner = self::getBannerByDomain($domain, $brandId, $uid = ''); 53 + // 组织模板数据
  54 + $list = HelperSearch::getList($data, $options);
53 55
  56 + //合并商品搜索数据与品牌banner数据
  57 + $list = array_merge_recursive($list,$banner);
54 58
55 - //开始组装数据 59 + $data = array(
  60 + //初始化js
  61 + 'productListPage' => true,
  62 + 'list' => $list
  63 + );
  64 + } else {
  65 + $data = array();
  66 + }
56 67
  68 + //获取品牌系列数据
  69 + $adNav = self::getAdNav($condition['brand']);
  70 + $data['list']['leftContent'][] = array('picLink' => $adNav);
57 71
58 return $data; 72 return $data;
59 } 73 }
60 74
61 -  
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图
@@ -85,7 +97,7 @@ class BrandsModel @@ -85,7 +97,7 @@ class BrandsModel
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 // 获取是否收藏
@@ -102,7 +114,6 @@ class BrandsModel @@ -102,7 +114,6 @@ class BrandsModel
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
@@ -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;
@@ -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);