1
|
'use strict';
|
1
|
'use strict';
|
2
|
-const api = global.yoho.API;
|
|
|
3
|
-const serviceAPI = global.yoho.ServiceAPI;
|
|
|
4
|
const _ = require('lodash');
|
2
|
const _ = require('lodash');
|
5
|
const helpers = global.yoho.helpers;
|
3
|
const helpers = global.yoho.helpers;
|
6
|
|
4
|
|
|
@@ -104,11 +102,13 @@ module.exports = class extends global.yoho.BaseModel { |
|
@@ -104,11 +102,13 @@ module.exports = class extends global.yoho.BaseModel { |
104
|
_getChannelData(params) {
|
102
|
_getChannelData(params) {
|
105
|
let gender = params - 1 || 0;
|
103
|
let gender = params - 1 || 0;
|
106
|
|
104
|
|
107
|
- return api.get('', {
|
|
|
108
|
- method: 'app.blk.getAllChannels'
|
|
|
109
|
- }, {
|
|
|
110
|
- cache: true,
|
|
|
111
|
- code: 200
|
105
|
+ return this.get({
|
|
|
106
|
+ data: {method: 'app.blk.getAllChannels'},
|
|
|
107
|
+ api: global.yoho.API,
|
|
|
108
|
+ param: {
|
|
|
109
|
+ cache: true,
|
|
|
110
|
+ code: 200
|
|
|
111
|
+ }
|
112
|
}).then(result => {
|
112
|
}).then(result => {
|
113
|
let channel = [];
|
113
|
let channel = [];
|
114
|
|
114
|
|
|
@@ -135,11 +135,14 @@ module.exports = class extends global.yoho.BaseModel { |
|
@@ -135,11 +135,14 @@ module.exports = class extends global.yoho.BaseModel { |
135
|
if (!contentCode) {
|
135
|
if (!contentCode) {
|
136
|
return [];
|
136
|
return [];
|
137
|
}
|
137
|
}
|
138
|
- return serviceAPI.get('operations/api/v5/resource/get', {
|
|
|
139
|
- content_code: contentCode
|
|
|
140
|
- }, {
|
|
|
141
|
- cache: true,
|
|
|
142
|
- code: 200
|
138
|
+ return this.get({
|
|
|
139
|
+ url: 'operations/api/v5/resource/get',
|
|
|
140
|
+ data: {content_code: contentCode},
|
|
|
141
|
+ api: global.yoho.ServiceAPI,
|
|
|
142
|
+ param: {
|
|
|
143
|
+ cache: true,
|
|
|
144
|
+ code: 200
|
|
|
145
|
+ }
|
143
|
}).then(result => {
|
146
|
}).then(result => {
|
144
|
return result && result.data ? result.data : [];
|
147
|
return result && result.data ? result.data : [];
|
145
|
});
|
148
|
});
|
|
@@ -148,13 +151,16 @@ module.exports = class extends global.yoho.BaseModel { |
|
@@ -148,13 +151,16 @@ module.exports = class extends global.yoho.BaseModel { |
148
|
_getBrandListOriginData(channel) {
|
151
|
_getBrandListOriginData(channel) {
|
149
|
let finalResult = {};
|
152
|
let finalResult = {};
|
150
|
|
153
|
|
151
|
- return api.get('', {
|
|
|
152
|
- method: 'app.brand.newBrandList',
|
|
|
153
|
- yh_channel: yhChannel[channel].channel,
|
|
|
154
|
- app_type: 1
|
|
|
155
|
- }, {
|
|
|
156
|
- code: 200,
|
|
|
157
|
- cache: true
|
154
|
+ return this.get({
|
|
|
155
|
+ data: {
|
|
|
156
|
+ method: 'app.brand.newBrandList',
|
|
|
157
|
+ yh_channel: yhChannel[channel].channel,
|
|
|
158
|
+ app_type: 1
|
|
|
159
|
+ },
|
|
|
160
|
+ params: {
|
|
|
161
|
+ code: 200,
|
|
|
162
|
+ cache: true
|
|
|
163
|
+ }
|
158
|
}).then(result => {
|
164
|
}).then(result => {
|
159
|
if (result.data && result.data.all_list) {
|
165
|
if (result.data && result.data.all_list) {
|
160
|
return Object.assign(finalResult, this.handleBrandList(result.data.all_list));
|
166
|
return Object.assign(finalResult, this.handleBrandList(result.data.all_list));
|
|
@@ -218,11 +224,14 @@ module.exports = class extends global.yoho.BaseModel { |
|
@@ -218,11 +224,14 @@ module.exports = class extends global.yoho.BaseModel { |
218
|
}
|
224
|
}
|
219
|
|
225
|
|
220
|
_getCateData(channel, appType) {
|
226
|
_getCateData(channel, appType) {
|
221
|
- return api.get('', {
|
|
|
222
|
- method: 'app.sort.get',
|
|
|
223
|
- app_type: 1
|
|
|
224
|
- }, {
|
|
|
225
|
- cache: true
|
227
|
+ return this.get({
|
|
|
228
|
+ data: {
|
|
|
229
|
+ method: 'app.sort.get',
|
|
|
230
|
+ app_type: 1
|
|
|
231
|
+ },
|
|
|
232
|
+ param: {
|
|
|
233
|
+ cache: true
|
|
|
234
|
+ }
|
226
|
}).then((result) => {
|
235
|
}).then((result) => {
|
227
|
if (!result.code || result.code !== 200 || !result.data) {
|
236
|
if (!result.code || result.code !== 200 || !result.data) {
|
228
|
return [];
|
237
|
return [];
|