brand.js 1.76 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 = '';
    let gender = '';

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

    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品牌'
                    }
                ],
                gender: gender,
                tabs: result.tabs,
                category: result.category
            }
        });
    }).catch(next);
};

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