Authored by biao

优选品牌

... ... @@ -14,3 +14,9 @@ exports.boysIndex = (req, res) => {
res.render('boys', data);
});
};
exports.getbrandFloorDataAjax = (req, res) => {
channelModel.getbrandFloorDataAjax('boys').then(data => {
res.json(data);
});
};
... ...
... ... @@ -9,6 +9,8 @@ const _ = require('lodash');
const ServiceAPI = require(`${global.library}/api`).ServiceAPI;
const sign = require(`${global.library}/sign`);
const helpers = require(`${global.library}/helpers`);
const serviceApi = new ServiceAPI();
... ... @@ -137,6 +139,30 @@ const getNewReportFloorData = args => {
return floorDatas;
};
// 优选品牌
const getPreBrandTopData = args => {
let item = args[0].data;
const data = {
preferenceBrands: {
name: '优选品牌',
imgBrand: [],
brandUrl:helpers.urlFormat('getbrandFloorDataAjax')
}
};
_.forEach(item, (topData) => {
let o = {};
o.href = topData.url;
o.img = topData.src;
data.preferenceBrands.imgBrand.push(o);
});
return data;
};
// 热门品类
const getHotGoodsFloorData = (args) => {
let item = args[0];
... ... @@ -266,8 +292,8 @@ const getSingleHotFloorData = args => {
const requestContent = type => {
let data = sign.apiSign({
/* eslint-disable */
client_type: 'web',
/* eslint-disable */
client_type: 'web',
/* eslint-enable */
content_code: channelMap[type || 'boys'].code,
gender: channelMap[type || 'boys'].gender,
... ... @@ -283,6 +309,7 @@ const floorMap = {
hot: getHotGoodsFloorData,
最新速报: getNewReportFloorData,
人气单品: getSingleHotFloorData,
优选品牌: getPreBrandTopData,
ad: getadbannerData
};
... ... @@ -335,3 +362,31 @@ exports.getContent = type => {
}
});
};
// 优选品牌楼层floorData-ajax
exports.getbrandFloorDataAjax = type => {
return requestContent(type).then(res => {
if (res.code === 200) {
let contentData = res.data.list;
let data = {
'logoBrand':[],
'moreBrand':''
};
_.forEach(contentData[6].data, (floorData) => {
let o = {};
o.href = floorData.url;
o.img = helpers.image(floorData.src, 185, 86, 2);
data.logoBrand.push(o);
});
data.moreBrand = contentData[7].data[0].url;
return data;
}
});
};
... ...
... ... @@ -6,7 +6,7 @@
'use strict';
const router = require('express').Router(); // eslint-disable-line
const router = require('express').Router(); // eslint-disable-line
const cRoot = './controllers';
// Your controller here
... ... @@ -14,4 +14,6 @@ const channelController = require(`${cRoot}/index`);
router.get('/boys', channelController.boysIndex);
router.get('/getbrandFloorDataAjax', channelController.getbrandFloorDataAjax);
module.exports = router;
... ...
... ... @@ -11,6 +11,7 @@ const isTest = process.env.NODE_ENV === 'test';
module.exports = {
port: 6002,
siteUrl: 'http://localhost:6002/',
domains: {
api: 'http://192.168.102.205:8080/gateway/',
service: 'http://testservice.yoho.cn:28077/',
... ...