|
@@ -13,7 +13,6 @@ const formaData = (data, gender) => { |
|
@@ -13,7 +13,6 @@ const formaData = (data, gender) => { |
13
|
_.forEach(data, function(val) {
|
13
|
_.forEach(data, function(val) {
|
14
|
// 多张图
|
14
|
// 多张图
|
15
|
if (val.data[1]) {
|
15
|
if (val.data[1]) {
|
16
|
-
|
|
|
17
|
let imgs = [];
|
16
|
let imgs = [];
|
18
|
|
17
|
|
19
|
_.forEach(val.data, function(list) {
|
18
|
_.forEach(val.data, function(list) {
|
|
@@ -34,7 +33,7 @@ const formaData = (data, gender) => { |
|
@@ -34,7 +33,7 @@ const formaData = (data, gender) => { |
34
|
}
|
33
|
}
|
35
|
|
34
|
|
36
|
// 单张图
|
35
|
// 单张图
|
37
|
- if (val.data[0]) {
|
36
|
+ if (val.data[0] && !val.data[1]) {
|
38
|
_.forEach(val.data, function(list) {
|
37
|
_.forEach(val.data, function(list) {
|
39
|
build.push({
|
38
|
build.push({
|
40
|
url: '/guang/plustar/brandinfo?id=' + val.id + '&gender=' + gender,
|
39
|
url: '/guang/plustar/brandinfo?id=' + val.id + '&gender=' + gender,
|
|
@@ -48,15 +47,19 @@ const formaData = (data, gender) => { |
|
@@ -48,15 +47,19 @@ const formaData = (data, gender) => { |
48
|
return build;
|
47
|
return build;
|
49
|
};
|
48
|
};
|
50
|
|
49
|
|
|
|
50
|
+const getContentData = (gender, type, channel, isRecommend) => {
|
|
|
51
|
+ let param = {
|
|
|
52
|
+ gender: gender,
|
|
|
53
|
+ brand_type: type,
|
|
|
54
|
+ yh_channel: channel
|
|
|
55
|
+ };
|
51
|
|
56
|
|
52
|
-const getContentData = (gender, type) => {
|
57
|
+ if (isRecommend) {
|
|
|
58
|
+ param.is_recommend = isRecommend;
|
|
|
59
|
+ }
|
53
|
|
60
|
|
54
|
- return serviceAPI.get('guang/api/v3/plustar/getlist', {
|
|
|
55
|
- gender: gender,
|
|
|
56
|
- brand_type: type
|
|
|
57
|
- }).then((result) => {
|
61
|
+ return serviceAPI.get('guang/api/v3/plustar/getlist', param).then((result) => {
|
58
|
if (result && result.code === 200) {
|
62
|
if (result && result.code === 200) {
|
59
|
- // console.log(result)
|
|
|
60
|
return formaData(result.data.data.list[0].data, gender);
|
63
|
return formaData(result.data.data.list[0].data, gender);
|
61
|
} else {
|
64
|
} else {
|
62
|
logger.error('列表 list data return code is not 200');
|
65
|
logger.error('列表 list data return code is not 200');
|
|
@@ -74,6 +77,15 @@ const getListData = (gender, recom, all) => { |
|
@@ -74,6 +77,15 @@ const getListData = (gender, recom, all) => { |
74
|
});
|
77
|
});
|
75
|
};
|
78
|
};
|
76
|
|
79
|
|
|
|
80
|
+const getBrandsData = (gender, starBrand, originalBrand, channel, isRecommend) => {
|
|
|
81
|
+ return Promise.all([getContentData(gender, starBrand, isRecommend, channel), getContentData(gender, originalBrand, isRecommend, channel)]).then((result) => {
|
|
|
82
|
+ return {
|
|
|
83
|
+ star: result[0],
|
|
|
84
|
+ plus: result[1]
|
|
|
85
|
+ };
|
|
|
86
|
+ });
|
|
|
87
|
+}
|
|
|
88
|
+
|
77
|
// 新品到着
|
89
|
// 新品到着
|
78
|
const getNewProduct = (brandId, gender, url) => {
|
90
|
const getNewProduct = (brandId, gender, url) => {
|
79
|
|
91
|
|
|
@@ -270,5 +282,6 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => { |
|
@@ -270,5 +282,6 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => { |
270
|
module.exports = {
|
282
|
module.exports = {
|
271
|
getListData,
|
283
|
getListData,
|
272
|
getContentData,
|
284
|
getContentData,
|
273
|
- getDetailData
|
285
|
+ getDetailData,
|
|
|
286
|
+ getBrandsData
|
274
|
}; |
287
|
}; |