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
d36061b7
Commit
d36061b7
authored
Sep 10, 2019
by
Hsinli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
addd
parent
3e285ab1
Pipeline
#13539
passed with stage
in 4 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
177 additions
and
8 deletions
+177
-8
blacklist.js
app/controller/credit/blacklist.js
+9
-0
credit.js
app/router/credit.js
+5
-3
apply.js
app/service/credit/apply.js
+91
-4
order.js
app/service/credit/order.js
+72
-1
No files found.
app/controller/credit/blacklist.js
View file @
d36061b7
...
@@ -18,6 +18,15 @@ class BlacklistController extends Controller {
...
@@ -18,6 +18,15 @@ class BlacklistController extends Controller {
}
}
/**
/**
* 进入黑名单检测页面
*/
async
blacklistInit
()
{
const
{
ctx
}
=
this
;
let
ret
=
await
ctx
.
service
.
credit
.
apply
.
blacklistInit
();
ctx
.
success
(
ret
);
}
/**
* 获取验证码
* 获取验证码
*/
*/
async
getBlacklistReportVerificationCode
()
{
async
getBlacklistReportVerificationCode
()
{
...
...
app/router/credit.js
View file @
d36061b7
...
@@ -9,9 +9,11 @@ module.exports = app => {
...
@@ -9,9 +9,11 @@ module.exports = app => {
router
.
post
(
'third'
,
'/order/pay_notice'
,
'credit.order.payNotice'
);
router
.
post
(
'third'
,
'/order/pay_notice'
,
'credit.order.payNotice'
);
//我的信用-黑名单报告
//我的信用-黑名单报告
router
.
get
(
'third'
,
'/blacklist/report/:report_id'
,
'credit.blacklist.getBlacklistReport'
);
//获取报告信息
router
.
get
(
'/blacklist/report/:report_id'
,
'credit.blacklist.getBlacklistReport'
);
//获取报告信息
router
.
post
(
'third'
,
'/blacklist/report'
,
'credit.blacklist.applyBlacklistReport'
);
//查询个人黑名单报告
router
.
post
(
'/blacklist/report'
,
'credit.blacklist.applyBlacklistReport'
);
//查询个人黑名单报告
router
.
post
(
'third'
,
'/blacklist/verification_code'
,
'credit.blacklist.getBlacklistReportVerificationCode'
);
//获取短信验证码
router
.
get
(
'/blacklist/init'
,
'credit.blacklist.blacklistInit'
);
//进入黑名单检测页面
router
.
post
(
'/blacklist/verification_code'
,
'credit.blacklist.getBlacklistReportVerificationCode'
);
//获取短信验证码
//我的信用-个人通话风险
//我的信用-个人通话风险
...
...
app/service/credit/apply.js
View file @
d36061b7
...
@@ -91,11 +91,65 @@ class ApplyService extends Service {
...
@@ -91,11 +91,65 @@ class ApplyService extends Service {
/**
/**
* 进入黑名单查询页面
*/
async
blacklistInit
()
{
const
{
ctx
}
=
this
;
let
ret
=
{
have_be_pay_order
:
false
,
order_id
:
null
,
placeholder
:
{
name
:
''
,
id_card
:
''
}
}
if
(
!
ctx
.
userId
)
{
return
ret
;
}
let
bePayOrder
=
await
ctx
.
service
.
order
.
getBePayOrder
(
1
);
if
(
bePayOrder
.
length
!=
0
)
{
ret
.
have_be_pay_order
=
true
;
ret
.
order_id
=
bePayOrder
[
0
].
id
;
}
//第一次查询成功的订单,反显姓名和身份证
let
filter
=
{
where
:
{
user_id
:
ctx
.
userId
,
type
:
1
,
valid
:
1
,
},
order
:
[[
'id'
,
'asc'
]]
}
let
orderInfo
=
await
ctx
.
prometheusModel
.
CreditOrder
.
findOne
(
filter
);
if
(
orderInfo
!=
null
)
{
let
applyFilter
=
{
where
:
{
id
:
orderInfo
.
apply_id
}
}
let
applyInfo
=
await
ctx
.
prometheusModel
.
CreditApply
.
findOne
(
applyFilter
);
if
(
applyInfo
!=
null
)
{
ret
.
placeholder
.
name
=
applyInfo
.
name
;
ret
.
placeholder
.
id_card
=
applyInfo
.
id_card
;
}
}
return
ret
;
}
/**
* 从数据接口获取用户的黑名单报告信息
* 从数据接口获取用户的黑名单报告信息
* @param {*} inputParams
* @param {*} inputParams
*/
*/
async
applyBlacklist
(
inputParams
)
{
async
applyBlacklist
(
inputParams
)
{
const
{
ctx
,
app
}
=
this
;
const
{
ctx
,
app
}
=
this
;
let
ret
=
{
order_id
:
null
,
report_id
:
null
,
first
:
false
,
//首次通过三要素验证后:报告生成后,将无法查询其他人的报告
second
:
false
,
//再次查询的是待支付中的订单
}
//验证码校验
//验证码校验
let
codeKey
=
'mine:credit:black:code'
+
inputParams
.
phone
;
let
codeKey
=
'mine:credit:black:code'
+
inputParams
.
phone
;
let
code
=
await
app
.
redis
.
get
(
codeKey
);
let
code
=
await
app
.
redis
.
get
(
codeKey
);
...
@@ -103,6 +157,31 @@ class ApplyService extends Service {
...
@@ -103,6 +157,31 @@ class ApplyService extends Service {
ctx
.
failed
(
'验证码错误,请重试'
);
ctx
.
failed
(
'验证码错误,请重试'
);
}
}
//判断用户是否第一次三要素核验成功
let
applyFilter
=
{
where
:
{
name
:
inputParams
.
name
,
phone
:
inputParams
.
phone
,
id_card
:
inputParams
.
id_card
,
type
:
1
,
valid
:
1
}
}
let
applyInfo
=
await
ctx
.
prometheusModel
.
CreditApply
.
findOne
(
applyFilter
);
if
(
applyInfo
===
null
)
{
ret
.
first
=
true
;
}
//判断用户当前三要素是否是二次查询未支付订单
let
bePayOrderInfo
=
await
ctx
.
service
.
credit
.
order
.
getBePayOrderByThree
(
1
,
inputParams
);
if
(
bePayOrderInfo
.
have
)
{
ret
.
second
=
true
;
ret
.
order_id
=
bePayOrderInfo
.
order
.
id
;
ret
.
report_id
=
bePayOrderInfo
.
order
.
report_id
;
return
ret
;
}
//调用数据接口获取黑名单数据
let
params
=
{
let
params
=
{
sign
:
""
,
sign
:
""
,
signParams
:
{
signParams
:
{
...
@@ -140,7 +219,7 @@ class ApplyService extends Service {
...
@@ -140,7 +219,7 @@ class ApplyService extends Service {
r_msg
:
result
.
data
.
msg
,
r_msg
:
result
.
data
.
msg
,
r_order_id
:
result
.
data
.
data
.
order_id
,
r_order_id
:
result
.
data
.
data
.
order_id
,
}
}
let
applyI
d
=
await
ctx
.
prometheusModel
.
CreditApply
.
create
(
applyData
);
let
applyI
nfo
=
await
ctx
.
prometheusModel
.
CreditApply
.
create
(
applyData
);
if
(
result
.
data
.
code
===
0
)
{
if
(
result
.
data
.
code
===
0
)
{
let
blacklistInfo
=
result
.
data
.
data
.
blackList
;
let
blacklistInfo
=
result
.
data
.
data
.
blackList
;
let
reportData
=
{
let
reportData
=
{
...
@@ -211,12 +290,20 @@ class ApplyService extends Service {
...
@@ -211,12 +290,20 @@ class ApplyService extends Service {
relevant_other_app_count_6month
:
blacklistInfo
.
related_app
.
relevant_other_app_count_6month
,
relevant_other_app_count_6month
:
blacklistInfo
.
related_app
.
relevant_other_app_count_6month
,
overdue
:
JSON
.
stringify
(
blacklistInfo
.
overdue_analysis
)
overdue
:
JSON
.
stringify
(
blacklistInfo
.
overdue_analysis
)
}
}
let
reportId
=
await
ctx
.
prometheusModel
.
CreditBlacklistReport
.
create
(
reportData
);
let
report
=
await
ctx
.
prometheusModel
.
CreditBlacklistReport
.
create
(
reportData
);
ret
.
report_id
=
report
.
id
;
}
if
(
!
ret
.
report_id
)
{
ctx
.
failed
(
'数据获取异常'
);
}
return
ret
;
}
}
return
true
;
}
...
...
app/service/credit/order.js
View file @
d36061b7
...
@@ -134,12 +134,83 @@ class OrderService extends Service {
...
@@ -134,12 +134,83 @@ class OrderService extends Service {
const
{
ctx
}
=
this
;
const
{
ctx
}
=
this
;
const
order
=
await
ctx
.
prometheusModel
.
CreditOrder
.
findOne
({
where
:
{
id
:
order_id
}
});
const
order
=
await
ctx
.
prometheusModel
.
CreditOrder
.
findOne
({
where
:
{
id
:
order_id
}
});
if
(
order
&&
order
.
pay_status
===
1
)
{
if
(
order
&&
order
.
pay_status
===
1
)
{
return
true
;
return
true
;
}
}
}
}
/**
* 获得当前三要素是否有待支付的订单
* @param {*} params name,phone,id_card
*/
async
getBePayOrderByThree
(
type
,
threeParams
)
{
const
{
ctx
}
=
this
;
let
ret
=
{
have
:
false
,
order
:
{}
}
if
([
1
,
2
].
includes
(
type
))
{
return
ret
;
}
let
orderFilter
=
{
where
:
{
user_id
:
ctx
.
userId
,
type
:
type
,
state
:
'待支付'
,
valid
:
1
,
state_time
:
{
$gte
:
moment
().
substract
(
1
,
'days'
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
}
}
}
let
list
=
await
ctx
.
prometheusModel
.
CreditOrder
.
findAll
(
orderFilter
);
if
(
list
!==
undefined
)
{
for
(
let
i
in
list
)
{
let
filter
=
{
where
:
{
id
:
list
[
i
].
apply_id
,
type
:
1
,
valid
:
1
}
}
let
applyInfo
=
await
ctx
.
prometheusModel
.
CreditApply
.
findOne
(
filter
);
if
(
applyInfo
!==
null
)
{
ret
.
have
=
true
;
ret
.
order
=
list
[
i
];
break
;
}
}
}
return
ret
;
}
/**
* 获取用户的待支付订单,时间倒序
* @param {*} type 1黑名单2通话
*/
async
getBePayOrder
(
type
)
{
const
{
ctx
}
=
this
;
let
ret
=
[];
if
([
1
,
2
].
includes
(
type
))
{
return
ret
;
}
let
filter
=
{
where
:
{
user_id
:
ctx
.
userId
,
type
:
type
,
state
:
'待支付'
,
valid
:
1
,
state_time
:
{
$gte
:
moment
().
substract
(
1
,
'days'
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
}
},
order
:
[[
'state_time'
,
'desc'
]]
}
let
list
=
await
ctx
.
prometheusModel
.
CreditOrder
.
findAll
(
filter
);
if
(
list
===
undefined
)
{
return
ret
;
}
ret
=
list
;
return
ret
;
}
}
}
...
...
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