Authored by 李靖

二维码

... ... @@ -20,7 +20,7 @@ exports.index = (req, res, next) => {
} catch (e) {
uname = params.uname;
}
model.getQr({
req.ctx(model).getQr({
token: params.token,
}).then(result => {
params.token = result;
... ...
... ... @@ -11,7 +11,7 @@ const QRcodeModel = require('../models/qrcode');
exports.QRcode = (req, res, next) => {
let id = req.params.id || 0;
QRcodeModel.getQRcodeData(id, req.user.uid).then((result)=>{
req.ctx(QRcodeModel).getQRcodeData(id, req.user.uid).then((result)=>{
if (result) {
result.ticks = result.ticks.map(item=>{
if (+item.ticket_type === 2) {
... ...
... ... @@ -4,7 +4,12 @@ const api = global.yoho.API;
const crypto = global.yoho.crypto;
const PASSWORD = 'yoho9646yoho9646';
exports.getQr = (params) => {
class qrcodeModel extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
getQr(params) {
let uid = '';
try {
... ... @@ -20,4 +25,7 @@ exports.getQr = (params) => {
}).then(result => {
return (result && result.data && result.data.code) || '';
});
};
}
}
module.exports = qrcodeModel;
... ...
... ... @@ -8,7 +8,12 @@
const logger = global.yoho.logger;
var api = global.yoho.API;
exports.getQRcodeData = (id, uid) => {
class qrcodeModel extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
getQRcodeData(id, uid) {
return api.get('', {
method: 'app.SpaceOrders.getQrByOrderCode',
order_code: id,
... ... @@ -21,5 +26,7 @@ exports.getQRcodeData = (id, uid) => {
return false;
}
});
};
}
}
module.exports = qrcodeModel;
... ...