|
|
/**
|
|
|
* 个人中心二维码 controller
|
|
|
* @author: weiqingting<qingting.wei@yoho.cn>
|
|
|
* @date: 2016/05/16
|
|
|
*/
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
const QRcodeModel = require('../models/qrcode');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
|
|
|
exports.QRcode = (req, res, next) => {
|
|
|
let id = req.query.orderCode || 0;
|
|
|
|
|
|
QRcodeModel.getQRcodeData(id,req.user.uid).then((result)=>{
|
|
|
if (result) {
|
|
|
result.ticks = result.ticks.map(item=>{
|
|
|
if (+item.ticket_type === 2) {
|
|
|
item.isgroup = true;
|
|
|
}
|
|
|
return item;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
let vm = {
|
|
|
path: [{href: helpers.urlFormat('/'), name: 'YOHO!BUY 有货首页'}, {name: '个人中心'}, {name: '查看二维码'}],
|
|
|
qrcodeData: result,
|
|
|
code: id,
|
|
|
returnOrder: helpers.urlFormat('/home/orders')
|
|
|
};
|
|
|
|
|
|
res.render('QRcode', vm);
|
|
|
}).catch(next);
|
|
|
}; |
...
|
...
|
|