Showing
1 changed file
with
34 additions
and
0 deletions
apps/home/controllers/qrcode.js
0 → 100644
1 | +/** | ||
2 | + * 个人中心二维码 controller | ||
3 | + * @author: weiqingting<qingting.wei@yoho.cn> | ||
4 | + * @date: 2016/05/16 | ||
5 | + */ | ||
6 | + | ||
7 | +'use strict'; | ||
8 | + | ||
9 | +const QRcodeModel = require('../models/qrcode'); | ||
10 | +const helpers = global.yoho.helpers; | ||
11 | + | ||
12 | +exports.QRcode = (req, res, next) => { | ||
13 | + let id = req.query.orderCode || 0; | ||
14 | + | ||
15 | + QRcodeModel.getQRcodeData(id,req.user.uid).then((result)=>{ | ||
16 | + if (result) { | ||
17 | + result.ticks = result.ticks.map(item=>{ | ||
18 | + if (+item.ticket_type === 2) { | ||
19 | + item.isgroup = true; | ||
20 | + } | ||
21 | + return item; | ||
22 | + }); | ||
23 | + } | ||
24 | + | ||
25 | + let vm = { | ||
26 | + path: [{href: helpers.urlFormat('/'), name: 'YOHO!BUY 有货首页'}, {name: '个人中心'}, {name: '查看二维码'}], | ||
27 | + qrcodeData: result, | ||
28 | + code: id, | ||
29 | + returnOrder: helpers.urlFormat('/home/orders') | ||
30 | + }; | ||
31 | + | ||
32 | + res.render('QRcode', vm); | ||
33 | + }).catch(next); | ||
34 | +}; |
-
Please register or login to post a comment