|
@@ -40,9 +40,6 @@ const channelType = { |
|
@@ -40,9 +40,6 @@ const channelType = { |
40
|
* @return {[array]}
|
40
|
* @return {[array]}
|
41
|
*/
|
41
|
*/
|
42
|
const _searchSales = (params) => {
|
42
|
const _searchSales = (params) => {
|
43
|
-
|
|
|
44
|
- console.log(params);
|
|
|
45
|
-
|
|
|
46
|
let method = 'app.search.li';
|
43
|
let method = 'app.search.li';
|
47
|
|
44
|
|
48
|
// 排除基本筛选项默认值为0的对象
|
45
|
// 排除基本筛选项默认值为0的对象
|
|
@@ -66,8 +63,6 @@ const _searchSales = (params) => { |
|
@@ -66,8 +63,6 @@ const _searchSales = (params) => { |
66
|
params.order = typeCont[params.type][params.order];
|
63
|
params.order = typeCont[params.type][params.order];
|
67
|
}
|
64
|
}
|
68
|
|
65
|
|
69
|
- console.log(params);
|
|
|
70
|
-
|
|
|
71
|
return api.get('', Object.assign({
|
66
|
return api.get('', Object.assign({
|
72
|
method: method
|
67
|
method: method
|
73
|
}, params), {
|
68
|
}, params), {
|
|
@@ -76,6 +71,29 @@ const _searchSales = (params) => { |
|
@@ -76,6 +71,29 @@ const _searchSales = (params) => { |
76
|
};
|
71
|
};
|
77
|
|
72
|
|
78
|
/**
|
73
|
/**
|
|
|
74
|
+ * 品牌名称处理
|
|
|
75
|
+ * @param {[object]} list
|
|
|
76
|
+ * @return {[object]}
|
|
|
77
|
+ */
|
|
|
78
|
+const _processBrandNames = (list) => {
|
|
|
79
|
+ const formatData = [];
|
|
|
80
|
+
|
|
|
81
|
+ list = list || [];
|
|
|
82
|
+ list = camelCase(list);
|
|
|
83
|
+
|
|
|
84
|
+ _.forEach(list, function(item) {
|
|
|
85
|
+ _.forEach(item, function(obj) {
|
|
|
86
|
+ formatData.push({
|
|
|
87
|
+ brandDomain: obj.brandDomain,
|
|
|
88
|
+ brandName: obj.brandName
|
|
|
89
|
+ });
|
|
|
90
|
+ });
|
|
|
91
|
+ });
|
|
|
92
|
+
|
|
|
93
|
+ return formatData;
|
|
|
94
|
+};
|
|
|
95
|
+
|
|
|
96
|
+/**
|
79
|
* 获取商品数据
|
97
|
* 获取商品数据
|
80
|
*/
|
98
|
*/
|
81
|
const getSearchData = (params, uid) => {
|
99
|
const getSearchData = (params, uid) => {
|
|
@@ -105,7 +123,44 @@ const getFilterData = (params) => { |
|
@@ -105,7 +123,44 @@ const getFilterData = (params) => { |
105
|
});
|
123
|
});
|
106
|
};
|
124
|
};
|
107
|
|
125
|
|
|
|
126
|
+/**
|
|
|
127
|
+ * 获取所有的品牌名称
|
|
|
128
|
+ **/
|
|
|
129
|
+const getAllBrandNames = (query) => {
|
|
|
130
|
+ return api.get('', {
|
|
|
131
|
+ method: 'app.brand.brandlist'
|
|
|
132
|
+ }, {
|
|
|
133
|
+ cache: true
|
|
|
134
|
+ }).then((result) => {
|
|
|
135
|
+ if (result && result.code === 200) {
|
|
|
136
|
+ let domain = null;
|
|
|
137
|
+ let brandNames = _processBrandNames(result.data.brands);
|
|
|
138
|
+
|
|
|
139
|
+ _.forEach(brandNames, function(obj) {
|
|
|
140
|
+ // 精确查品牌域名
|
|
|
141
|
+ if (query === obj.brandDomain) {
|
|
|
142
|
+ domain = query;
|
|
|
143
|
+ }
|
|
|
144
|
+
|
|
|
145
|
+ // 精确查品牌名称
|
|
|
146
|
+ if (query === obj.brandName) {
|
|
|
147
|
+ domain = query;
|
|
|
148
|
+ }
|
|
|
149
|
+
|
|
|
150
|
+ // 模糊查品牌域名
|
|
|
151
|
+ //if ()
|
|
|
152
|
+ });
|
|
|
153
|
+
|
|
|
154
|
+ return domain;
|
|
|
155
|
+ } else {
|
|
|
156
|
+ logger.error('断码区分类接口返回 code 不是 200');
|
|
|
157
|
+ return {};
|
|
|
158
|
+ }
|
|
|
159
|
+ });
|
|
|
160
|
+};
|
|
|
161
|
+
|
108
|
module.exports = {
|
162
|
module.exports = {
|
109
|
getSearchData,
|
163
|
getSearchData,
|
110
|
- getFilterData
|
164
|
+ getFilterData,
|
|
|
165
|
+ getAllBrandNames
|
111
|
}; |
166
|
}; |