Authored by biao

update for get by contentcode

... ... @@ -24,8 +24,9 @@ exports.index = (req, res) => {
let headerData = headerModel.setNavHeader('OUTLET', channel, true, '', null);
let categoryId = req.query.category_id;
let yhChannel = req.query.yh_channel || 1;
let contentcode = req.query.content_code;
outletModel.getContent(categoryId, yhChannel).then(result => {
outletModel.getContent(categoryId, yhChannel, contentcode).then(result => {
res.render('outlet', Object.assign({
page: 'outlet',
pageHeader: headerData,
... ...
... ... @@ -22,9 +22,10 @@ const serviceApi = new ServiceAPI();
const api = new API();
const getOutletResource = (channel) => {
const getOutletResource = (channel, contentcode) => {
console.log(contentcode);
const params = {
content_code: 'c19ffa03f053f4cac3690b22c8da26b7',
content_code: contentcode || 'c19ffa03f053f4cac3690b22c8da26b7',
limit: 25,
yh_channel: channel || '',
debug: 'XYZ'
... ... @@ -58,8 +59,7 @@ const convertNavData = (list) => {
const getNavData = (categoryId) => {
const params = {
v: 7,
parent_id: categoryId,
debug: 'XYZ'
parent_id: categoryId
};
return serviceApi.get('operations/api/v6/category/getCategory', sign.apiSign(params)).then(result => {
... ... @@ -137,7 +137,6 @@ const getHomeActivity = (data) => {
var params = {
method: 'app.outlets.activityGet',
platform: 2,
size: 0,
sort: 2,
client_type: 'h5'
};
... ... @@ -147,19 +146,16 @@ const getHomeActivity = (data) => {
});
};
exports.getContent = (categoryId, channel) => {
exports.getContent = (categoryId, channel, code) => {
let floorsData = {},
params = {
type: 0,
id: 0
};
if (channel === 'boys') {
params.yh_channel = 1;
}
const promises = [getNavData(categoryId), getOutletResource(channel), getHomeActivity(params), getGoodsList()];
const p = [getNavData(categoryId), getOutletResource(channel, code), getHomeActivity(params), getGoodsList()];
return Promise.all(promises).then(data => {
return Promise.all(p).then(data => {
floorsData.nav = data[0] || [];
floorsData.content = data[1] || [];
floorsData.activity = {data: data[2]};
... ... @@ -186,10 +182,6 @@ exports.getNearlyActivity = (channel, type, categoryId) => {
type: type
};
if (channel === 'boys') {
params.yh_channel = 1;
}
return Promise.all([getNavData(categoryId), getHomeActivity(params)]).then(res => {
var data = {
nav: res[0] || [],
... ...