sale.js 1 KB
/**
 * 商品促销controller
 * @author: yyq<yanqing.yang@yoho.cn>
 * @date: 2016/5/18
 */

'use strict';

const headerModel = require('../../../doraemon/models/header');
const mRoot = '../models';

// sale 页 model
const sale = require(`${mRoot}/sale`);

exports.index = (req, res) => {

    headerModel.requestHeaderData()
        .then(response => {
            response = headerModel.setHeaderData(response.data, 'boys');

            response.module = 'product';
            response.page = 'sale';
            response.footerTop = true;
            response.devEnv = true;

            res.render('sale/index', Object.assign(response, sale.outputDevData()));

            /* return sale.getSaleDate().then(result => {

                response.result = result;
                response.resultShow = JSON.stringify(result, null, 4);

                res.render('sale/index', response);
            });*/
        })
        .catch(() => {
            res.render('error', { devEnv: true, pageErr: true });
        });
};