brand.js 1.56 KB
/**
 * 品牌一览
 * @author: zxr
 * @date: 2016/07/13
 */

'use strict';
const brand = require('../models/brand');

/**
 * 品牌一览数据
 * @param req
 * @param res
 */
const index = (req, res, next) => {
    let channel = req.cookies._Channel || 'men';
    let contentCode = '';
    let name = '';
    let link = '';

    if (channel === 'women') {
        contentCode = '527079e6c46d0f125eb46b835968971b';
        name = 'WOMEN首页';
        link = 'http://www.yohoblk.com/women';
    } else if (channel === 'lifestyle') {
        contentCode = '94b5ed607b6d565ffc29c2c04be121dc';
        name = 'LIFT STYLE首页';
        link = 'http://www.yohoblk.com/lifestyle';
    } else {
        contentCode = '81886aaa5e82e3741bc1ba1e04ec7706';
        name = 'MEN首页';
        link = 'http://www.yohoblk.com';
    }

    let appType = 1;

    brand.getListData(contentCode, channel, appType).then((result) => {
        res.display('index', {
            module: 'brand',
            page: 'index',
            title: '品牌',
            brand: {
                nav: [
                    {
                        link: link,
                        pathTitle: '首页',
                        name: name
                    },
                    {
                        link: '',
                        pathTitle: '品牌',
                        name: 'Brand品牌'
                    }
                ],
                tabs: result.tabs,
                category: result.category
            }
        });
    }).catch(next);
};

module.exports = {
    index // 品牌一览
};