Commit 284223c6 authored by 李尚科's avatar 李尚科

fix

parent 37a919f2
......@@ -118,7 +118,7 @@ class CommonService extends Service {
return ret;
}
async alipay() {
async alipay() {//TODO
}
......
......@@ -77,10 +77,29 @@ class OrderService extends Service {
}
async updateOrderPreferential() {
async updateOrderPrice(order_id) {
const { ctx } = this;
await this.getPreferential();
const user_id = ctx.userId;
const order = await ctx.service.credit.common.getOrderInfo(order_id);
if (!order || !order.id) {
ctx.failed('error order');
}
const type_obj = {
1: 'blacklistk',
2: 'callrisk',
}
const type = type_obj[order.type];
const preferential = await this.getPreferential(type);
let preferential_price = 0;
if (preferential && preferential.id) {
preferential_price = preferential.price;
}
const price = order.price - preferential_price;
await ctx.prometheusModel.CreditOrder.update({ price, preferential_price, preferential_id: preferential.id }, { where: { id: order.id } });
return true;
}
......@@ -152,13 +171,13 @@ class OrderService extends Service {
const preferential = await this.getPreferential(order.type);
let preferential_price = 0;
let preferential_title = '';
if (!preferential || !preferential.id) {
if (preferential && preferential.id) {
preferential_price = preferential.price;
preferential_title = preferential.title;
}
const price = order.price - preferential_price;
await ctx.prometheusModel.CreditOrder.update({ price, preferential_price, preferential_id: preferential.id }, { where: { id: order.id } });
await ctx.prometheusModel.CreditOrder.update({ price, preferential_price, preferential_id: preferential.id }, { where: { id: order.id, pay_status: 0 } });
const type_obj = {
1: 'blacklist',
......@@ -257,7 +276,7 @@ class OrderService extends Service {
async unifiedOrder(type, order_id) {
const { ctx } = this;
const order = await ctx.service.credit.order.getOrderInfo(order_id);
if (order && order.pay_status === 1) {
ctx.failed('订单已支付无需重复支付');
......
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