Showing
1 changed file
with
90 additions
and
28 deletions
@@ -24,44 +24,106 @@ let CODE_TOPPOS_LIFESTYLE = 'f1aa914fd23cbcda71a87de6f5416c75'; | @@ -24,44 +24,106 @@ let CODE_TOPPOS_LIFESTYLE = 'f1aa914fd23cbcda71a87de6f5416c75'; | ||
24 | /** | 24 | /** |
25 | * 获取频道接口 | 25 | * 获取频道接口 |
26 | */ | 26 | */ |
27 | -const _package = () => { | 27 | + |
28 | +const _packageAd = (params) => { | ||
28 | return api.get('', { | 29 | return api.get('', { |
29 | - method: 'app.brand.newBrandList' | ||
30 | - }, {code: 200}); | 30 | + method: 'app.brand.newBrandList', |
31 | + yh_channel: params.channel | ||
32 | + | ||
33 | + }, { code: 200 }).then(result => { | ||
34 | + | ||
35 | + return result; | ||
36 | + | ||
37 | + }); | ||
31 | }; | 38 | }; |
32 | 39 | ||
33 | -const getBrandByChannel = (channel) => { | 40 | +const _packageList = (params) => { |
41 | + return api.get('', { | ||
42 | + method: 'app.brand.newBrandList', | ||
43 | + yh_channel: params.channel | ||
34 | 44 | ||
35 | - return api.all([ | 45 | + }, { code: 200 }).then(result => { |
36 | 46 | ||
37 | - _package() | 47 | + return result; |
38 | 48 | ||
39 | -]).then(result => { | 49 | + }); |
50 | +}; | ||
40 | 51 | ||
41 | - let resu = { | ||
42 | - channel: { | ||
43 | - channels: [ | ||
44 | - { | ||
45 | - name: 'Boy' | ||
46 | - }, | ||
47 | - { | ||
48 | - name: 'Girl' | ||
49 | - }, | ||
50 | - { | ||
51 | - name: 'Kid' | ||
52 | - }, | ||
53 | - { | ||
54 | - name: 'Lifestyle' | ||
55 | - }, | ||
56 | - ] | ||
57 | - } | ||
58 | - }; | 52 | +const _package = (params) => { |
53 | + return api.all([ | ||
59 | 54 | ||
60 | - resu.channel.channels[channel - 1].active = true; | 55 | + _packageAd(params), |
56 | + //_packageList(params) | ||
61 | 57 | ||
62 | - return resu; | 58 | + ]).then(result => { |
59 | + | ||
60 | + console.log(result[0]); | ||
61 | + | ||
62 | + return result; | ||
63 | + | ||
64 | + }); | ||
65 | +}; | ||
66 | + | ||
67 | +const getBrandByChannel = (channel) => { | ||
63 | 68 | ||
64 | -}); | 69 | + let params = {}; |
70 | + | ||
71 | + /* 根据频道调用接口 */ | ||
72 | + switch (channel) { | ||
73 | + case '1': // 男生 | ||
74 | + params = { | ||
75 | + contentCode: CODE_TOPPOS_BOYS, | ||
76 | + channel: 1 | ||
77 | + }; | ||
78 | + break; | ||
79 | + case '2': // 女生 | ||
80 | + params = { | ||
81 | + contentCode: CODE_TOPPOS_GIRLS, | ||
82 | + channel: 2 | ||
83 | + }; | ||
84 | + break; | ||
85 | + case '3': // 潮童 | ||
86 | + params = { | ||
87 | + contentCode: CODE_TOPPOS_KIDS, | ||
88 | + channel: 3 | ||
89 | + }; | ||
90 | + break; | ||
91 | + case '4': // 创意生活 | ||
92 | + params = { | ||
93 | + contentCode: CODE_TOPPOS_LIFESTYLE, | ||
94 | + channel: 4 | ||
95 | + }; | ||
96 | + break; | ||
97 | + default: | ||
98 | + | ||
99 | + | ||
100 | + } | ||
101 | + | ||
102 | + return api.all([ | ||
103 | + | ||
104 | + _package(params) | ||
105 | + | ||
106 | + ]).then(result => { | ||
107 | + | ||
108 | + let resu = { | ||
109 | + channel: { | ||
110 | + channels: [{ | ||
111 | + name: 'Boy' | ||
112 | + }, { | ||
113 | + name: 'Girl' | ||
114 | + }, { | ||
115 | + name: 'Kid' | ||
116 | + }, { | ||
117 | + name: 'Lifestyle' | ||
118 | + }, ] | ||
119 | + } | ||
120 | + }; | ||
121 | + | ||
122 | + resu.channel.channels[channel - 1].active = true; | ||
123 | + | ||
124 | + return resu; | ||
125 | + | ||
126 | + }); | ||
65 | }; | 127 | }; |
66 | 128 | ||
67 | module.exports = { | 129 | module.exports = { |
-
Please register or login to post a comment