Commit 3869d967 authored by Hsinli's avatar Hsinli

Merge branch 'master' of t-git.51gjj.com:fangbin/51business

parents ac7820d8 0cb2faf0
Pipeline #14346 passed with stage
in 6 seconds
......@@ -61,18 +61,18 @@ class OrderService extends Service {
async updateOrderStateToOverdue(order) {
const { ctx } = this;
const { id, order_time, state, pay_status } = order;
let { id, order_time, state, pay_status, state_time } = order;
if (!id || !order_time || !state || typeof (pay_status) === 'undefined') {
return order;
}
const expire_time = moment(order_time).valueOf() + 24 * 3600 * 1000;
const now_time = moment().valueOf();
const state_time = moment().format('YYYY-MM-DD HH:mm:ss');
if (state === '支付中' && pay_status === 0 && moment(order_time).valueOf() * 300 < now_time) {
if (['支付中'].includes(state) && moment(state_time).valueOf() + 300 < now_time) {
await this.logOrder(id);
await ctx.prometheusModel.CreditOrder.update({ state: '待支付', state_time: state_time }, { where: { id } });
}
if (expire_time < now_time && (state === '待支付' || state === '已取消' || state === '支付中') && pay_status === 0) {
state_time = moment().format('YYYY-MM-DD HH:mm:ss');
if (expire_time < now_time && ['待支付', '已取消', '支付中'].includes(state)) {
await this.logOrder(id);
const ret = await ctx.prometheusModel.CreditOrder.update({ state: '已失效', state_time: state_time }, { where: { id } });
if (ret && ret[0]) {
......@@ -210,7 +210,7 @@ class OrderService extends Service {
const price = await this.updateOrderPrice(order);
const type = order.type;
const countdown = moment(order.state_time).format('X') - moment(new Date()).format('X') + 86400;
const countdown = moment(order.order_time).format('X') - moment(new Date()).format('X') + 86400;
const ret = {
price,
original_price: order.price,
......
......@@ -150,13 +150,13 @@ module.exports = appInfo => {
//我的信用-通化检测
config.YYS_APP_KEY = process.env.YYS_APP_KEY;
config.YYS_APPLY_APPSECRET = 'a695e9b3c0f1e3f15fb0b958fd3a4b67';
config.YYS_APPLY_APPSECRET = process.env.YYS_APPLY_APPSECRET;
//运营商报告
config.YYS_REPORT_KEY = 'F4E0CA710F484CFFB1756741696E29A3';
config.YYS_REPORT_APPSECRET = '233B8E10E31B4C899EE6FEB3AEC22F140B6528BF';
config.YYS_REPORT_URL = 'http://47.96.253.64:8049/mycredit/thxdReport';
config.YYS_REPORT_KEY = process.env.YYS_REPORT_KEY;
config.YYS_REPORT_APPSECRET = process.env.YYS_REPORT_APPSECRET;
config.YYS_REPORT_URL = process.env.YYS_REPORT_URL;
return config;
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment