Authored by zhangxiaoru

brand

... ... @@ -7,6 +7,11 @@
'use strict';
const brand = require('../models/brand');
/**
* 品牌一览数据
* @param req
* @param res
*/
const index = (req, res) => {
let channel = req.query.brand || 1;
let contentCode = 'd0149783b8dd2adaf083fd10556c39a9';
... ...
... ... @@ -7,6 +7,10 @@ const logger = global.yoho.logger;
const serviceAPI = global.yoho.ServiceAPI;
const config = global.yoho.config;
/**
* 品牌一览列表数据处理
* @returns {*}
*/
const _processListData = (list) => {
let listData = [];
... ... @@ -36,6 +40,10 @@ const _processListData = (list) => {
return listData;
};
/**
* 品牌一览banner数据处理
* @returns {*}
*/
const _processTabData = (list) => {
let tabData = [];
... ... @@ -61,6 +69,11 @@ const _processTabData = (list) => {
};
/**
* 获取品牌banner
* @param channel
* @returns {*}
*/
const _getResources = (contentCode) => {
return serviceAPI.get('operations/api/v5/resource/get', {content_code: contentCode}).then((result) => {
if (result && result.code === 200) {
... ... @@ -72,6 +85,11 @@ const _getResources = (contentCode) => {
});
};
/**
* 获取品牌列表数据
* @param channel
* @returns {*}
*/
const _getBreakingSort = (channel) => {
return api.get('', {
yo_channel: channel,
... ... @@ -86,6 +104,10 @@ const _getBreakingSort = (channel) => {
});
};
/**
* 获取品牌一览相关数据
* @returns {*}
*/
const getListData = (contentCode, channel) => {
return Promise.all([_getResources(contentCode), _getBreakingSort(channel)])
.then((result) => {
... ...