Commit 7d07cb4e authored by Hsinli's avatar Hsinli

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

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