material-new.js 946 Bytes

'use strict';

const materialModel = require('../models/material-new');
const headerModel = require('../../../doraemon/models/header'); // 头部model

exports.list = (req, res, next) => {
    let responseData = {
        pageHeader: headerModel.setNav({
            navTitle: '商品素材列表页',
        }),
        title: '商品素材列表页',
        module: '3party',
        page: 'material-new',
        width750: true,
        localCss: true
    };

    let params = {
        uid: req.user.uid,
        page: 1,
        isApp: req.yoho.isApp,
        unionType: req.query.union_type
    };

    req.ctx(materialModel).canLogin(params).then(result => {
        if (result === 'N') {
            return next();
        } else {
            req.ctx(materialModel).list(params).then(list => {
                res.render('material-new', Object.assign(responseData, list));
            }).catch(next);
        }
    }).catch(next);
};