|
|
'use strict';
|
|
|
const api = global.yoho.API;
|
|
|
const serviceAPI = global.yoho.ServiceAPI;
|
|
|
const _ = require('lodash');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
|
...
|
...
|
@@ -104,11 +102,13 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
_getChannelData(params) {
|
|
|
let gender = params - 1 || 0;
|
|
|
|
|
|
return api.get('', {
|
|
|
method: 'app.blk.getAllChannels'
|
|
|
}, {
|
|
|
cache: true,
|
|
|
code: 200
|
|
|
return this.get({
|
|
|
data: {method: 'app.blk.getAllChannels'},
|
|
|
api: global.yoho.API,
|
|
|
param: {
|
|
|
cache: true,
|
|
|
code: 200
|
|
|
}
|
|
|
}).then(result => {
|
|
|
let channel = [];
|
|
|
|
...
|
...
|
@@ -135,11 +135,14 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
if (!contentCode) {
|
|
|
return [];
|
|
|
}
|
|
|
return serviceAPI.get('operations/api/v5/resource/get', {
|
|
|
content_code: contentCode
|
|
|
}, {
|
|
|
cache: true,
|
|
|
code: 200
|
|
|
return this.get({
|
|
|
url: 'operations/api/v5/resource/get',
|
|
|
data: {content_code: contentCode},
|
|
|
api: global.yoho.ServiceAPI,
|
|
|
param: {
|
|
|
cache: true,
|
|
|
code: 200
|
|
|
}
|
|
|
}).then(result => {
|
|
|
return result && result.data ? result.data : [];
|
|
|
});
|
...
|
...
|
@@ -148,13 +151,16 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
_getBrandListOriginData(channel) {
|
|
|
let finalResult = {};
|
|
|
|
|
|
return api.get('', {
|
|
|
method: 'app.brand.newBrandList',
|
|
|
yh_channel: yhChannel[channel].channel,
|
|
|
app_type: 1
|
|
|
}, {
|
|
|
code: 200,
|
|
|
cache: true
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.brand.newBrandList',
|
|
|
yh_channel: yhChannel[channel].channel,
|
|
|
app_type: 1
|
|
|
},
|
|
|
params: {
|
|
|
code: 200,
|
|
|
cache: true
|
|
|
}
|
|
|
}).then(result => {
|
|
|
if (result.data && result.data.all_list) {
|
|
|
return Object.assign(finalResult, this.handleBrandList(result.data.all_list));
|
...
|
...
|
@@ -218,11 +224,14 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
}
|
|
|
|
|
|
_getCateData(channel, appType) {
|
|
|
return api.get('', {
|
|
|
method: 'app.sort.get',
|
|
|
app_type: 1
|
|
|
}, {
|
|
|
cache: true
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.sort.get',
|
|
|
app_type: 1
|
|
|
},
|
|
|
param: {
|
|
|
cache: true
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
if (!result.code || result.code !== 200 || !result.data) {
|
|
|
return [];
|
...
|
...
|
|