brand.js 1.26 KB
/**
 * Created by PhpStorm.
 * User: Targaryen
 * Date: 2016/7/19
 * Time: 10:03
 */
'use strict';

const mRoot = '../models';
const brandModel = require(`${mRoot}/brand`);

/**
 * 品牌,品类,店铺相关页面
 */
module.exports = {

    /* 品牌列表页 */
    brandList: (req, res) => {

        res.render('brand/brand-list', {
            module: 'channel',
            page: 'brand-list'
        });
    },

    /* 获取品牌列表数据 */
    getBrandList: (req, res, next) => {

        brandModel.getBrandListData({
            channel: req.query.channel || req.cookies._Channel || 'men'
        }).then(result => {
            res.json(result);
        }).catch(next);
    },

    /* 全部分类 */
    cate: (req, res) => {
        res.render('brand/cate', {
            module: 'channel',
            page: 'cate',
            title: '全部分类'
        });
    },

    // 全部分类api
    getCateList: (req, res, next) => {
        brandModel.getCateListData({
            app_type: 1
        }).then(result => {
            res.json(result);
        }).catch(next);
    },

    // 品类资源位
    cateResource: (req, res) => {

        res.render('brand/cate-resource', {
            module: 'channel',
            page: 'cate-resource'
        });
    }
};