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

'use strict';

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

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

    QRcodeModel.getQRcodeData(id).then((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((err) => {
        res.send(err);
    });
};