myCurrency.js
1.96 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**
* 个人中心我的有货币
* @author: zxr<xiaoru.zhang@yoho.cn>
* @date: 2016/08/16
*/
'use strict';
const myCurrencyModel = require('../models/myCurrency');
const headerModel = require('../../../doraemon/models/header'); // 头部model
const _ = require('lodash');
const myCurrency = (req, res, next) => {
let uid = req.user.uid;
let contentCode = '05afedf76886d732573f10f7451a1703';
myCurrencyModel.myCurrency(uid, contentCode).then(result => {
res.render('currency-new', {
module: 'home',
page: 'currency-new',
pageHeader: _.assign(headerModel.setNav({
navTitle: '有货币'
}), {
currencyPage: true,
navBtn: false
}),
title: '有货币',
pageFooter: true,
yohoCoin: result.yohoCoin,
banner: result.banner
});
}).catch(next);
};
const currencyDetail = (req, res, next) => {
let uid = req.user.uid;
let page = 1;
let limit = 10;
myCurrencyModel.currencyDetail(uid, page, limit).then(result => {
res.render('currency-detail', {
module: 'home',
page: 'currency-detail',
pageHeader: _.assign(headerModel.setNav({
navTitle: '有货币明细'
}), {
currencyDetailPage: true,
navBtn: false
}),
title: '有货币明细',
pageFooter: true,
money: result.money
});
}).catch(next);
};
let ajaxCurrencyDetail = (req, res, next) => {
let uid = req.user.uid;
let page = req.body.page || 1;
let limit = 10;
myCurrencyModel.currencyDetail(uid, page, limit).then((result) => {
res.render('ajax-currency-detail', {
layout: false,
coinlist: _.get(result, 'coinlist', [])
});
}).catch(next);
};
module.exports = {
myCurrency,
currencyDetail,
ajaxCurrencyDetail
};