material.js
1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
'use strict';
const materialModel = require('../models/material');
const headerModel = require('../../../doraemon/models/header'); // 头部model
exports.list = (req, res, next) => {
let responseData = {
pageHeader: headerModel.setNav({
navTitle: '商品素材列表页',
}),
title: '商品素材列表页',
module: '3party',
page: 'material',
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', Object.assign(responseData, list));
}).catch(next);
}
}).catch(next);
};
exports.moreGoods = (req, res, next) => {
let params = {
page: req.query.page || 2,
isApp: req.yoho.isApp,
unionType: req.query.union_type
};
req.ctx(materialModel).list(params).then(result => {
res.json(result);
}).catch(next);
};