...
|
...
|
@@ -12,12 +12,12 @@ const cheerio = require('cheerio'); |
|
|
const helpers = global.yoho.helpers;
|
|
|
|
|
|
const homeService = require('./home-service');
|
|
|
const globalApi = require('./global-api');
|
|
|
const headerModel = require('../../../doraemon/models/header');
|
|
|
const searchHandler = require('./search-handler');
|
|
|
const pager = require(`${global.utils}/pager`).setPager;
|
|
|
const productProcess = require(`${global.utils}/product-process`);
|
|
|
|
|
|
const GlobalApiModel = require('./global-api');
|
|
|
const GLOBAL_LIST_URI = '/product/global/list';
|
|
|
|
|
|
const _handelGlobalPathNav = (data, channel, page) => {
|
...
|
...
|
@@ -157,7 +157,7 @@ const _getProductSeoData = (detail) => { |
|
|
return resData;
|
|
|
};
|
|
|
|
|
|
const getGlobalProductListData = (params, yoho) => {
|
|
|
function getGlobalProductListData(params, yoho) {
|
|
|
let limitNum = params.limit ? params.limit - 1 : 59;
|
|
|
let dps = {};
|
|
|
|
...
|
...
|
@@ -169,14 +169,14 @@ const getGlobalProductListData = (params, yoho) => { |
|
|
|
|
|
return Promise.props({
|
|
|
header: headerModel.requestHeaderData(yoho.channel),
|
|
|
fullList: globalApi.getGlobalProductListAsync(Object.assign({
|
|
|
fullList: this.globalApi.getGlobalProductListAsync(Object.assign({
|
|
|
physical_channel: yoho.channelNum,
|
|
|
limit: 1
|
|
|
}, dps)),
|
|
|
list: globalApi.getGlobalProductListAsync(Object.assign({
|
|
|
list: this.globalApi.getGlobalProductListAsync(Object.assign({
|
|
|
physical_channel: yoho.channelNum
|
|
|
}, params, {limit: limitNum})),
|
|
|
brand: dps.brand ? globalApi.getGlobalBrandInfoAsync(dps.brand) : {}
|
|
|
brand: dps.brand ? this.globalApi.getGlobalBrandInfoAsync(dps.brand) : {}
|
|
|
}).then(result => {
|
|
|
let resData = {};
|
|
|
|
...
|
...
|
@@ -253,13 +253,13 @@ const getGlobalProductListData = (params, yoho) => { |
|
|
|
|
|
return resData;
|
|
|
});
|
|
|
};
|
|
|
}
|
|
|
|
|
|
const getGlobalProductDetailData = (skn, channelNum, channel) => {
|
|
|
function getGlobalProductDetailData(skn, channelNum, channel) {
|
|
|
return Promise.props({
|
|
|
header: headerModel.requestHeaderData(channel),
|
|
|
detail: globalApi.getGlobalProductDetailAsync(skn, channelNum),
|
|
|
html: globalApi.getGlobalProductHtmlAsync(skn, channelNum)
|
|
|
detail: this.globalApi.getGlobalProductDetailAsync(skn, channelNum),
|
|
|
html: this.globalApi.getGlobalProductHtmlAsync(skn, channelNum)
|
|
|
}).then(result => {
|
|
|
let resData = {};
|
|
|
let detailInfo, html = '';
|
...
|
...
|
@@ -361,9 +361,15 @@ const getGlobalProductDetailData = (skn, channelNum, channel) => { |
|
|
|
|
|
return resData;
|
|
|
});
|
|
|
};
|
|
|
}
|
|
|
|
|
|
module.exports = class extends global.yoho.BaseModel {
|
|
|
constructor(ctx) {
|
|
|
super(ctx);
|
|
|
|
|
|
module.exports = {
|
|
|
getGlobalProductListData,
|
|
|
getGlobalProductDetailData
|
|
|
this.globalApi = new GlobalApiModel(ctx);
|
|
|
|
|
|
this.getGlobalProductListData = getGlobalProductListData.bind(this);
|
|
|
this.getGlobalProductDetailData = getGlobalProductDetailData.bind(this);
|
|
|
}
|
|
|
}; |
...
|
...
|
|