Authored by 陈峰

fix pay api pay_expire

... ... @@ -2,6 +2,7 @@
* @author: weiqingting<qingting.wei@yoho.cn>
*/
'use strict';
const moment = require('moment');
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
... ... @@ -41,7 +42,23 @@ module.exports = class extends global.yoho.BaseModel {
order_code: orderCode
};
return this.get({data: options});
return this.get({data: options}).then(result => {
if (result.code === 200 && result.data) {
if (result.data.pay_lefttime) {
result.data.pay_lefttime = +result.data.pay_lefttime - 3600;
if (result.data.pay_lefttime < 0) {
result.data.pay_lefttime = 0;
}
}
if (result.data.pay_expire) {
result.data.pay_expire = moment(result.data.pay_expire)
.subtract(1, 'hour')
.format('YYYY-MM-DD HH:mm:ss');
}
}
return result;
});
}
/**
... ...
... ... @@ -39,13 +39,6 @@ const online = (req, res, next) => {
return next();
}
if (order.pay_lefttime) {
order.pay_lefttime = +order.pay_lefttime - 3600;
if (order.pay_lefttime < 0) {
order.pay_lefttime = 0;
}
}
order.payment_type = parseInt(order.payment_type, 10);
... ...
... ... @@ -5,6 +5,7 @@
*/
'use strict';
const moment = require('moment');
module.exports = class extends global.yoho.BaseModel {
constructor(ctx) {
... ... @@ -100,7 +101,23 @@ module.exports = class extends global.yoho.BaseModel {
order_code: orderCode
};
return this.get({data: options});
return this.get({data: options}).then(result => {
if (result.code === 200 && result.data) {
if (result.data.pay_lefttime) {
result.data.pay_lefttime = +result.data.pay_lefttime - 3600;
if (result.data.pay_lefttime < 0) {
result.data.pay_lefttime = 0;
}
}
if (result.data.pay_expire) {
result.data.pay_expire = moment(result.data.pay_expire)
.subtract(1, 'hour')
.format('YYYY-MM-DD HH:mm:ss');
}
}
return result;
});
}
/**
... ...