Commit 05589f97 authored by Hsinli's avatar Hsinli

addd

parent 589d067a
Pipeline #13457 passed with stage
in 4 seconds
......@@ -134,7 +134,8 @@ class BlacklistService extends Service {
relevant_other_app_count_6month: reportData.relevant_other_app_count_6month,//近6月关联的其他app个数
msg: '',
}
}
},
retport_valid: 0//报告是否失效
};
//风险分值计算
......@@ -237,9 +238,13 @@ class BlacklistService extends Service {
await ctx.prometheusModel.CreditBlacklistReport.update({ report_no: ret.basic.report_no }, { where: { id: reportData.id } });
}
//订单是否在有效期内
ret.report_valid = await ctx.service.credit.order.getReportValid(id);
return ret;
}
/**
* 获取多头借贷的分值
* @param {*} a 近6月消金机构注册笔数
......
......@@ -7,48 +7,72 @@ const _ = require('lodash');
class OrderService extends Service {
//历史订单
async getHistoryOrders(order_type) {
//历史订单
async getHistoryOrders(order_type) {
const { ctx } = this;
const type_obj = {
'blacklist': 1,
'callrisk': 2,
}
const { ctx } = this;
const type_obj = {
'blacklist': 1,
'callrisk': 2,
}
const type = type_obj[order_type];
const type = type_obj[order_type];
const order_records = await ctx.prometheusModel.CreditOrder.all({ where: { type } });
const worth_h = [];
const worth_l = [];
const worth_time = type === 1 ? 15 : 30;
const now_time = moment().format('X');
for (let i in order_records) {
const order_records = await ctx.prometheusModel.CreditOrder.all({ where: { type } });
const worth_h = [];
const worth_l = [];
const worth_time = type === 1 ? 15 : 30;
const now_time = moment().format('X');
for (let i in order_records) {
const order = order_records[i];
const expire_time = moment(state_time).format('X') + worth_time * 86400;
const order = order_records[i];
const expire_time = moment(state_time).format('X') + worth_time * 86400;
const apply = { phone: '15968762898', report_no: '51gjj201909050100001' };
const apply = { phone: '15968762898', report_no: '51gjj201909050100001' };
const item = {
order_no: order.order_no,
report_no: apply.report_no,
type: order_type,
created_time,
phone: apply.phone.replace(apply.phone.substring(3, 7), "****"),
state: order.state,
state_text: order.state === '已支付' ? '' : order.state,
};
if (order.pay_status === 1 && order.state === '已支付' && expire_time > now_time) {
worth_h.push(item);
} else {
worth_l.push(item);
const item = {
order_no: order.order_no,
report_no: apply.report_no,
type: order_type,
created_time,
phone: apply.phone.replace(apply.phone.substring(3, 7), "****"),
state: order.state,
state_text: order.state === '已支付' ? '' : order.state,
};
if (order.pay_status === 1 && order.state === '已支付' && expire_time > now_time) {
worth_h.push(item);
} else {
worth_l.push(item);
}
}
}
return { worth_h, worth_l }
return { worth_h, worth_l }
}
}
/**
*
* @param {*} type 报告类型(黑名单1通话2)
* @param {*} orderId 订单编号
*/
async getReportValid(type, orderId) {
const { ctx } = this;
let valid = 0;
let orderFilter = {
where: {
report_id: orderId,
valid: 1
}
};
let orderInfo = await ctx.prometheusModel.CreditOrder.findOne(orderFilter);
if (orderInfo != null) {
let timeLine = (type === 1) ? 15 : 30;
if (orderInfo.state === '已支付' && moment(orderInfo.state_time).add(timeLine, 'days').format('YYYY-MM-DD HH:ii:ss') > moment().format('YYYY-MM-DD HH:ii:ss')) {
valid = 1;
}
}
return valid;
}
}
......
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