material.js 1.48 KB
'use strict';

const Model = require('../models/material');

exports.index = (req, res, next) => {
    if (req.user.uid) {
        Model.index(req).then(data => {
            let result = {};

            if (data.code == 200) {
                result.product_list = data.data.product_list;
            } else {
                result.product_list = '';
            }
            res.render('material', Object.assign({ page: 'material', layout: false }, result));
        }).catch(next);
    } else {
        res.send(500);
    }

};
exports.newBrandList = (req, res, next) => {
    Model.newBrandList(req).then(data => {
        res.send(data);
    }).catch(next);
};
exports.getCategory = (req, res, next) => {
    Model.getHeaderNavAsync().then(data => {
        res.send(data);
    }).catch(next);
};

// exports.getIndexGuide = (req, res, next) => {
//     channelModel.getIndexGuideData().then(data => {
//         if (data.code !== 200) {
//             const err = new Error('异常');

//             throw err;
//         }
//         return channelModel.formatIndexGuideData(data.data);
//     }).then(data => {
//         return channelModel.getResourceData(data);
//     }).then(data => {
//         let result = {list: data, layout: false};

//         res.render('guide', result);
//     }).catch(next);
// };

// exports.hasNewUserFloor = (req, res, next) => {

//     channelModel.hasNewUserFloor(req.yoho.channel, req.user.uid).then(data => {
//         res.send(data);
//     }).catch(next);
// };