qrcode.js 679 Bytes
/**
 * 个人中心二维码 controller
 * @author: weiqingting<qingting.wei@yoho.cn>
 * @date: 2016/05/16
 */

'use strict';

const QRcodeModel = require('../models/qrcode');

exports.QRcode = (req, res, next) => {
    let id = req.params.id || 0;

    req.ctx(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 = {
            qrcodeData: result
        };

        res.render('QRcode', vm);
    }).catch(next);
};