Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
5
51business
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
方斌
51business
Commits
05589f97
Commit
05589f97
authored
Sep 06, 2019
by
Hsinli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
addd
parent
589d067a
Pipeline
#13457
passed with stage
in 4 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
34 deletions
+63
-34
blacklist.js
app/service/credit/blacklist.js
+6
-1
order.js
app/service/credit/order.js
+57
-33
No files found.
app/service/credit/blacklist.js
View file @
05589f97
...
...
@@ -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月消金机构注册笔数
...
...
app/service/credit/order.js
View file @
05589f97
...
...
@@ -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
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment