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

Fix

parent 0dbf6727
......@@ -72,7 +72,7 @@ class CommonService extends Service {
const mch_id = this.config.MCH_ID;
const trade_type = 'MWEB';
const nonce_str = ctx.helper.createNoncestr();
const time_expire = expire_time ? expire_time : moment().add(1, 'days').format('YYYYMMDDHHmmss');
// const time_expire = expire_time ? expire_time : moment().add(1, 'days').format('YYYYMMDDHHmmss');
// const spbill_create_ip = ctx.helper.getClientIP();
const spbill_create_ip = '122.224.130.226';
let json_data = {
......@@ -87,7 +87,7 @@ class CommonService extends Service {
scene_info,
trade_type,
nonce_str,
time_expire,
// time_expire,
};
const sign = this.getWexinSign(json_data);
json_data.sign = sign;
......
......@@ -12,14 +12,19 @@ class OrderService extends Service {
const { ctx } = this;
const user_id = ctx.userId;
const app_type_id = ctx.appTypeId;
const app_user_id = ctx.appUserId;
const app_id = ctx.appId;
const type_obj = {
'blacklist': 1,
'callrisk': 2,
}
const type = type_obj[order_type];
const order_records = await ctx.prometheusModel.CreditOrder.all({ where: { type } });
// const where = { user_id };
const order_records = await ctx.prometheusModel.CreditOrder.all({ where: { user_id, type, valid: 1 } });
const worth_h = [];
const worth_l = [];
......@@ -72,7 +77,14 @@ class OrderService extends Service {
}
//检查订单报告是否 还在规定的时间内 是否具有高价值 0:具有高价值 1:生成时间过长-低价值
async updateOrderPreferential() {
const { ctx } = this;
await this.getPreferential();
}
//检查订单报告是否 还在规定的时间内 是否具有高价值 0:高价值 1:低价值-生成时间过长-
async checkOrderExpire(order) {
const { ctx } = this;
......@@ -82,7 +94,7 @@ class OrderService extends Service {
}
const worth_time = type === 1 ? 15 : 30;
const expire_time = moment(state_time).valueOf() + worth_time * 86400;
const expire_time = moment(state_time).valueOf() + worth_time * 86400 * 1000;
const now_time = moment().valueOf();
if (pay_status === 1 && state === '已支付' && expire_time > now_time) {//还在规定的有效期内 高价值报告
return 0;
......@@ -132,7 +144,8 @@ class OrderService extends Service {
async getOrderPayInfo(order_id) {
const { ctx } = this;
const order = await ctx.prometheusModel.CreditOrder.findOne({ where: { id: order_id } });
const user_id = ctx.userId;
const order = await ctx.prometheusModel.CreditOrder.findOne({ where: { id: order_id, user_id } });
if (!order || !order.id) {
ctx.failed('error order');
}
......@@ -151,6 +164,8 @@ class OrderService extends Service {
1: 'blacklist',
2: 'callrisk',
}
const type = order.type;
const countdown = moment(order.state_time).format('X') + 86400 - moment().format('X');
const ret = {
price,
original_price: order.price,
......@@ -158,8 +173,10 @@ class OrderService extends Service {
preferential_price,
preferential_title,
order_no: order.order_no,
type: type_obj[order.type],
type_title: order.type === 1 ? '黑名单检测' : '个人通话风险检测',
type: type_obj[type],
type_title: type === 1 ? '黑名单检测' : '个人通话风险检测',
notice: type === 1 ? '温馨提示:15天内无需重复付费查询' : '温馨提示:30天内无需重复付费查询',
countdown,
}
return ret;
......@@ -168,7 +185,8 @@ class OrderService extends Service {
async checkOrderPay(order_id) {
const { ctx } = this;
const order = await ctx.prometheusModel.CreditOrder.findOne({ where: { id: order_id } });
const user_id = ctx.userId;
const order = await ctx.prometheusModel.CreditOrder.findOne({ where: { id: order_id, user_id } });
if (order && order.pay_status === 1) {
return true;
}
......@@ -239,6 +257,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