Commit 9a9bab06 authored by 李尚科's avatar 李尚科

fix

parent 493d83c6
Pipeline #13751 passed with stage
in 7 seconds
......@@ -244,16 +244,19 @@ class OrderService extends Service {
if (!credit_pay || !credit_pay.id) {
ctx.failed('error credit pay');
}
const { transaction_id, trade_no } = credit_pay;
const wexin_check_pay_ret = await ctx.service.credit.common.WexinCheckPay({ transaction_id, trade_no });
const price = ((order.price - order.preferential_price) * 100).toFixed();
if (price === wexin_check_pay_ret.total_fee) {
await ctx.prometheusModel.CreditPay.edit({ where: { id: credit_pay.id }, params: { pay_result: JSON.stringify(wexin_check_pay_ret), status: 1 } });
const state_time = moment().format('YYYY-MM-DD HH:mm:ss');
await ctx.prometheusModel.CreditOrder.update({ state: '已支付', state_time, pay_status: 1 }, { where: { id: order.id, pay_status: 0 } })
return true;
if (order.pay_method === 'wxpay') {
const { transaction_id, trade_no } = credit_pay;
const wexin_check_pay_ret = await ctx.service.credit.common.WexinCheckPay({ transaction_id, trade_no });
const price = ((order.price - order.preferential_price) * 100).toFixed();
if (price === wexin_check_pay_ret.total_fee) {
await ctx.prometheusModel.CreditPay.edit({ where: { id: credit_pay.id }, params: { pay_result: JSON.stringify(wexin_check_pay_ret), status: 1 } });
const state_time = moment().format('YYYY-MM-DD HH:mm:ss');
await ctx.prometheusModel.CreditOrder.update({ state: '已支付', state_time, pay_status: 1 }, { where: { id: order.id, pay_status: 0 } })
return true;
}
}
return false;
}
......
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