currency.js
857 Bytes
/**
* 个人中心二维码 controller
* @author: weiqingting<qingting.wei@yoho.cn>
* @date: 2016/05/16
*/
'use strict';
const Promise = require('bluebird');
const co = Promise.coroutine;
const CurrencyModel = require('../models/currency-model');
const moment = require('moment');
const convertUnitTime = (src) => {
return moment.unix(src).format('YYYY-MM-DD');
};
const index = (req, res, next)=>{
let $uid = '8041246';
let $condition = {
page: req.query.page || 1,
queryType: req.query.type || 0,
beginTime: req.query.beginTime || convertUnitTime(new Date() / 1000 - 3600 * 24 * 90)
};
co(function*() {
let data = yield CurrencyModel.currencyData($uid, $condition);
res.render('currency', {
content: data
});
})().catch(next);
};
module.exports = {
index
};