修改品牌数据分类信息,修改分类列表返回数据格式
Showing
4 changed files
with
79 additions
and
27 deletions
@@ -21,11 +21,11 @@ class BrandData | @@ -21,11 +21,11 @@ class BrandData | ||
21 | const URL_BRAND_LOGO = '/shops/service/v1/brand'; | 21 | const URL_BRAND_LOGO = '/shops/service/v1/brand'; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | - * 获取品牌介绍 | 24 | + * 获取品牌简介 |
25 | * | 25 | * |
26 | * @param integer $brandId 品牌ID | 26 | * @param integer $brandId 品牌ID |
27 | - * @param int 用户ID | ||
28 | - * @return array 品牌介绍信息 | 27 | + * @param int 用户ID |
28 | + * @return array 品牌介绍信息 | ||
29 | */ | 29 | */ |
30 | public static function getBrandIntro($brandId, $uid) | 30 | public static function getBrandIntro($brandId, $uid) |
31 | { | 31 | { |
@@ -42,9 +42,9 @@ class BrandData | @@ -42,9 +42,9 @@ class BrandData | ||
42 | } | 42 | } |
43 | 43 | ||
44 | /** | 44 | /** |
45 | - * 获取品牌banner数据 | 45 | + * 获取品牌banner图 |
46 | * @param integer $brandId 品牌ID | 46 | * @param integer $brandId 品牌ID |
47 | - * @return array banner数据 | 47 | + * @return array banner图 |
48 | */ | 48 | */ |
49 | public static function getBrandBanner($brandId) | 49 | public static function getBrandBanner($brandId) |
50 | { | 50 | { |
@@ -58,14 +58,14 @@ class BrandData | @@ -58,14 +58,14 @@ class BrandData | ||
58 | } | 58 | } |
59 | 59 | ||
60 | /** | 60 | /** |
61 | - * 获取品牌介绍信息 | 61 | + * 获取品牌介绍详情 |
62 | * | 62 | * |
63 | * @param int $id 品牌id | 63 | * @param int $id 品牌id |
64 | * @return array | 64 | * @return array |
65 | */ | 65 | */ |
66 | - public static function getBrandLogo($id) | ||
67 | - { | ||
68 | - return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByids', array($id )); | 66 | + public static function getBrandLogo($brandId) |
67 | + { | ||
68 | + return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_BRAND_LOGO, 'getBrandByids', array($brandId )); | ||
69 | } | 69 | } |
70 | 70 | ||
71 | /** | 71 | /** |
@@ -68,14 +68,48 @@ class SearchData extends \LibModels\Wap\Product\SearchData | @@ -68,14 +68,48 @@ class SearchData extends \LibModels\Wap\Product\SearchData | ||
68 | } | 68 | } |
69 | 69 | ||
70 | /** | 70 | /** |
71 | - * 获取品类数据 | ||
72 | - * | ||
73 | - * @return array 品类数据 | 71 | + * 根据查询条件查询品类列表 |
72 | + * | ||
73 | + * @param string $query 关键字 | ||
74 | + * @param bool $needAllSort 为1时返回全部分类 | ||
75 | + * @param bool needSmallSort 为1时返回小分类 | ||
76 | + * @param string $brand 品牌,查多个品牌以逗号分隔 | ||
77 | + * @param string $mosort 产品产品大分类ID,查多个大类以逗号分隔 | ||
78 | + * @param string $misort 产品产品中分类ID,查多个中类以逗号分隔 | ||
79 | + * @param string $sort 产品产品小分类ID,查多个小类以逗号分隔 | ||
80 | + * @param string $gender 性别,默认为null,"1"表示男, "2"表示女, "3"表示通用 | ||
81 | + * @param integer $color 颜色id | ||
82 | + * @param integer $size 尺码id | ||
83 | + * @param integer $price 价格 | ||
84 | + * @param integer $style 风格ID | ||
85 | + * @param integer $parameter_xxx 属性类型ID与值ID 参数名称格式:parameter_{属性类型ID}={属性值ID},如查询厚度为中“parameter_875=4801” | ||
86 | + * @param integer $stocknumber 库存量 | ||
87 | + * @param integer $shelve_time 时间区间 | ||
88 | + * @param integer $specialoffer 特价类型 | ||
89 | + * @param bool $sales 是否销售 | ||
90 | + * @param bool $promotion 是否为促销品 | ||
91 | + * @param integer $vdt 是否为促销品 | ||
92 | + * @param bool $vdt 折扣类型 | ||
93 | + * @param integer $p_d 促销浮点值 | ||
94 | + * @param integer $attribute 商品属性 1正常商品 2赠品 | ||
95 | + * @param integer $limited 是否限量 “N”或“Y” | ||
96 | + * @param integer $new 是否新品 “N”或“Y” | ||
97 | + * @param integer $status 是否上架 | ||
98 | + * @param integer $sell_channels 销售平台 | ||
99 | + * @param integer $p_d_int 促销折扣 int型如7 | ||
100 | + * @param integer $act_temp 活动模板 | ||
101 | + * @param integer $act_rec 活动模板是否推荐 | ||
102 | + * @param integer $act_status 活动模板商品状态 | ||
103 | + * @param integer $attribute_not 过滤商品属性,attribute_not=2过滤掉赠品 | ||
104 | + * @param integer $not_* not_字段名,过滤字段 | ||
105 | + * @return array 搜索到的数据 | ||
74 | */ | 106 | */ |
75 | - public static function getClassesData($condition = array(), $cache = false) | 107 | + public static function getClassesData($classes = array(), $cache = false) |
76 | { | 108 | { |
77 | - $param['brand'] = $condition; | ||
78 | - return Yohobuy::get(self::getUrl('sort'),$param, $cache); | 109 | + $classes['sales'] = 'Y'; //在销售商品分类 |
110 | + $classes['status'] = 1; //上架商品分类 | ||
111 | + $classes['stocknumber'] = 1; //过滤掉已售罄 | ||
112 | + return Yohobuy::get(self::getUrl('sort'),$classes, $cache); | ||
79 | } | 113 | } |
80 | 114 | ||
81 | /** | 115 | /** |
@@ -14,7 +14,8 @@ class BrandsModel | @@ -14,7 +14,8 @@ class BrandsModel | ||
14 | { | 14 | { |
15 | 15 | ||
16 | const URL_BRAND_INDEX = '/product/brands/index'; | 16 | const URL_BRAND_INDEX = '/product/brands/index'; |
17 | - | 17 | + |
18 | + public static $shopName; | ||
18 | /** | 19 | /** |
19 | * 获取品牌首页banner条 | 20 | * 获取品牌首页banner条 |
20 | * @string $domain 品牌域名 | 21 | * @string $domain 品牌域名 |
@@ -53,7 +54,7 @@ class BrandsModel | @@ -53,7 +54,7 @@ class BrandsModel | ||
53 | // 获取品牌logo | 54 | // 获取品牌logo |
54 | $logo = Helpers::getImageUrl($intro['data']['brand_ico'], 80, 50); | 55 | $logo = Helpers::getImageUrl($intro['data']['brand_ico'], 80, 50); |
55 | // 获取品牌名 | 56 | // 获取品牌名 |
56 | - $shopName = $intro['data']['brand_name']; | 57 | + self::$shopName = $intro['data']['brand_name']; |
57 | } while (false); | 58 | } while (false); |
58 | 59 | ||
59 | // 返回banner数据 | 60 | // 返回banner数据 |
@@ -67,7 +68,7 @@ class BrandsModel | @@ -67,7 +68,7 @@ class BrandsModel | ||
67 | 'shopEntry' => array( | 68 | 'shopEntry' => array( |
68 | 'home' => $home, | 69 | 'home' => $home, |
69 | 'logo' => $logo, | 70 | 'logo' => $logo, |
70 | - 'shopName' => $shopName, | 71 | + 'shopName' => self::$shopName, |
71 | 'sort' => array( | 72 | 'sort' => array( |
72 | array( | 73 | array( |
73 | 'href' => '', | 74 | 'href' => '', |
@@ -93,9 +94,26 @@ class BrandsModel | @@ -93,9 +94,26 @@ class BrandsModel | ||
93 | */ | 94 | */ |
94 | public static function getBrandSearchData($condition, $options) | 95 | public static function getBrandSearchData($condition, $options) |
95 | { | 96 | { |
97 | + //配置调用分类接口参数 | ||
98 | + $classes = array(); | ||
99 | + $classes['brand'] = $condition['brand']; | ||
96 | // 调用商品搜索接口 | 100 | // 调用商品搜索接口 |
97 | - $data = \Product\SearchModel::getSearchData($condition, $options); | 101 | + $data = \Product\SearchModel::getSearchData($condition, $options,$classes); |
102 | + $shopName = self::$shopName; | ||
103 | + if(isset($data['list'])){ | ||
104 | + $arr = array_chunk($data['list']['pathNav'],1); | ||
105 | + $arr[0][] = Array( | ||
106 | + 'name' => $shopName | ||
107 | + ); | ||
108 | + } | ||
109 | + $nav = array_merge_recursive($arr[0],$arr[1]); | ||
110 | + $data['list']['pathNav'] = $nav; | ||
111 | + //删除品牌列表 | ||
98 | unset($data['list']['filters']['brand']); | 112 | unset($data['list']['filters']['brand']); |
113 | + //删除折扣分类 | ||
114 | + unset($data['list']['allDiscount']); | ||
115 | + //删除新品分类 | ||
116 | + unset($data['list']['newSales']); | ||
99 | return $data; | 117 | return $data; |
100 | } | 118 | } |
101 | 119 |
@@ -28,12 +28,12 @@ class SearchModel | @@ -28,12 +28,12 @@ class SearchModel | ||
28 | * @author sefon 2015-12-17 16:12:18 | 28 | * @author sefon 2015-12-17 16:12:18 |
29 | * @return array | 29 | * @return array |
30 | */ | 30 | */ |
31 | - public static function getSearchData($condition, $options) | 31 | + public static function getSearchData($condition, $options,$classes) |
32 | { | 32 | { |
33 | // 调用接口查询商品数据 | 33 | // 调用接口查询商品数据 |
34 | $result = SearchData::searchElasticByCondition($condition); | 34 | $result = SearchData::searchElasticByCondition($condition); |
35 | // 调用分类信息 | 35 | // 调用分类信息 |
36 | - $category = SearchData::getClassesData(); | 36 | + $category = SearchData::getClassesData($classes); |
37 | if (isset($category['code']) && $category['code'] === 200) { | 37 | if (isset($category['code']) && $category['code'] === 200) { |
38 | $result['data']['filter']['group_sort'] = $category['data']['sort']; | 38 | $result['data']['filter']['group_sort'] = $category['data']['sort']; |
39 | } | 39 | } |
@@ -52,10 +52,10 @@ class SearchModel | @@ -52,10 +52,10 @@ class SearchModel | ||
52 | $res = HelperSearch::getList($result, $options); | 52 | $res = HelperSearch::getList($result, $options); |
53 | $list = HelperSearch::getTemplateData($res, $options); | 53 | $list = HelperSearch::getTemplateData($res, $options); |
54 | $data = array( | 54 | $data = array( |
55 | - 'productListPage' => true, //初始化js | ||
56 | - 'list' => $list | ||
57 | - ); | ||
58 | - } | ||
59 | - return $data; | ||
60 | - } | 55 | + 'productListPage' => true, //初始化js |
56 | + 'list' => $list | ||
57 | + ); | ||
58 | + } | ||
59 | + return $data; | ||
60 | + } | ||
61 | } | 61 | } |
-
Please register or login to post a comment