|
@@ -6,7 +6,38 @@ |
|
@@ -6,7 +6,38 @@ |
6
|
*/
|
6
|
*/
|
7
|
'use strict';
|
7
|
'use strict';
|
8
|
const api = global.yoho.API;
|
8
|
const api = global.yoho.API;
|
|
|
9
|
+const helpers = global.yoho.helpers;
|
9
|
const brandApi = require('./brand-api');
|
10
|
const brandApi = require('./brand-api');
|
|
|
11
|
+const logger = global.yoho.logger;
|
|
|
12
|
+const _ = require('lodash');
|
|
|
13
|
+
|
|
|
14
|
+/**
|
|
|
15
|
+ * 处理品牌一览品牌列表数据
|
|
|
16
|
+ * @param origin
|
|
|
17
|
+ * @returns {Array}
|
|
|
18
|
+ */
|
|
|
19
|
+const handleBrandList = origin => {
|
|
|
20
|
+ let dest = [];
|
|
|
21
|
+
|
|
|
22
|
+ _.forEach(origin, (value, key) => {
|
|
|
23
|
+ let brands = [];
|
|
|
24
|
+
|
|
|
25
|
+ _.forEach(value, (subValue) => {
|
|
|
26
|
+ brands.push({
|
|
|
27
|
+ name: subValue.brand_name,
|
|
|
28
|
+ link: helpers.urlFormat('', null, subValue.brand_domain),
|
|
|
29
|
+ logo: subValue.brand_ico
|
|
|
30
|
+ });
|
|
|
31
|
+ });
|
|
|
32
|
+
|
|
|
33
|
+ dest.push({
|
|
|
34
|
+ index: key,
|
|
|
35
|
+ brands: brands
|
|
|
36
|
+ });
|
|
|
37
|
+ });
|
|
|
38
|
+
|
|
|
39
|
+ return dest;
|
|
|
40
|
+};
|
10
|
|
41
|
|
11
|
/**
|
42
|
/**
|
12
|
* 获取品牌店铺数据
|
43
|
* 获取品牌店铺数据
|
|
@@ -53,70 +84,13 @@ const getBrandListData = params => { |
|
@@ -53,70 +84,13 @@ const getBrandListData = params => { |
53
|
let finalResult = {};
|
84
|
let finalResult = {};
|
54
|
|
85
|
|
55
|
return api.all([brandApi.getBrandListOriginData(params)]).then(result => {
|
86
|
return api.all([brandApi.getBrandListOriginData(params)]).then(result => {
|
56
|
- Object.assign(finalResult, {
|
|
|
57
|
- brandList: [
|
|
|
58
|
- {
|
|
|
59
|
- index: 'A',
|
|
|
60
|
- brands: [
|
|
|
61
|
- {
|
|
|
62
|
- name: 'Yohji Yamamoto(eyes wear)',
|
|
|
63
|
- link: '#',
|
|
|
64
|
- logo: 'https://img11.static.yhbimg.com/brandLogo/2016/04/13/15/010eb8606c1072fd2e769c62567d3bbe93.png?imageView2/2/w/140/h/140'
|
|
|
65
|
- },
|
|
|
66
|
- {
|
|
|
67
|
- name: 'TEEN TEAM',
|
|
|
68
|
- link: '#',
|
|
|
69
|
- logo: 'https://img12.static.yhbimg.com/brandLogo/2015/12/03/14/02d4dba71951e8e971dc85d2eab5fe7a7f.jpg?imageView2/2/w/140/h/140'
|
|
|
70
|
- },
|
|
|
71
|
- {
|
|
|
72
|
- name: 'MYGESMART',
|
|
|
73
|
- link: '#',
|
|
|
74
|
- logo: 'https://img11.static.yhbimg.com/brandLogo/2014/01/27/11/01d9dbee4c83e9122bd1fc363ceb85e484.jpg?imageView2/2/w/140/h/140'
|
|
|
75
|
- },
|
|
|
76
|
- {
|
|
|
77
|
- name: 'MYGESMART',
|
|
|
78
|
- link: '#',
|
|
|
79
|
- logo: 'https://img11.static.yhbimg.com/brandLogo/2014/01/27/11/01d9dbee4c83e9122bd1fc363ceb85e484.jpg?imageView2/2/w/140/h/140'
|
|
|
80
|
- },
|
|
|
81
|
- {
|
|
|
82
|
- name: 'MYGESMART',
|
|
|
83
|
- link: '#',
|
|
|
84
|
- logo: 'https://img11.static.yhbimg.com/brandLogo/2014/01/27/11/01d9dbee4c83e9122bd1fc363ceb85e484.jpg?imageView2/2/w/140/h/140'
|
|
|
85
|
- }
|
|
|
86
|
- ]
|
|
|
87
|
- },
|
|
|
88
|
- {
|
|
|
89
|
- index: 'B',
|
|
|
90
|
- brands: [
|
|
|
91
|
- {
|
|
|
92
|
- name: 'Yohji Yamamoto(eyes wear)',
|
|
|
93
|
- link: '#',
|
|
|
94
|
- logo: 'https://img11.static.yhbimg.com/brandLogo/2016/04/13/15/010eb8606c1072fd2e769c62567d3bbe93.png?imageView2/2/w/140/h/140'
|
|
|
95
|
- },
|
|
|
96
|
- {
|
|
|
97
|
- name: 'TEEN TEAM',
|
|
|
98
|
- link: '#',
|
|
|
99
|
- logo: 'https://img12.static.yhbimg.com/brandLogo/2015/12/03/14/02d4dba71951e8e971dc85d2eab5fe7a7f.jpg?imageView2/2/w/140/h/140'
|
|
|
100
|
- },
|
|
|
101
|
- {
|
|
|
102
|
- name: 'MYGESMART',
|
|
|
103
|
- link: '#',
|
|
|
104
|
- logo: 'https://img11.static.yhbimg.com/brandLogo/2014/01/27/11/01d9dbee4c83e9122bd1fc363ceb85e484.jpg?imageView2/2/w/140/h/140'
|
|
|
105
|
- },
|
|
|
106
|
- {
|
|
|
107
|
- name: 'MYGESMART',
|
|
|
108
|
- link: '#',
|
|
|
109
|
- logo: 'https://img11.static.yhbimg.com/brandLogo/2014/01/27/11/01d9dbee4c83e9122bd1fc363ceb85e484.jpg?imageView2/2/w/140/h/140'
|
|
|
110
|
- },
|
|
|
111
|
- {
|
|
|
112
|
- name: 'MYGESMART',
|
|
|
113
|
- link: '#',
|
|
|
114
|
- logo: 'https://img11.static.yhbimg.com/brandLogo/2014/01/27/11/01d9dbee4c83e9122bd1fc363ceb85e484.jpg?imageView2/2/w/140/h/140'
|
|
|
115
|
- }
|
|
|
116
|
- ]
|
|
|
117
|
- }
|
|
|
118
|
- ]
|
|
|
119
|
- });
|
87
|
+ if (result[0].code === 200 && result[0].data.all_list) {
|
|
|
88
|
+ Object.assign(finalResult, {
|
|
|
89
|
+ brandList: handleBrandList(result[0].data.all_list)
|
|
|
90
|
+ });
|
|
|
91
|
+ } else {
|
|
|
92
|
+ logger.error('getBrandListOriginData api code no 200 or allList is null');
|
|
|
93
|
+ }
|
120
|
|
94
|
|
121
|
return finalResult;
|
95
|
return finalResult;
|
122
|
});
|
96
|
});
|