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
d3df0bbb
Commit
d3df0bbb
authored
Sep 26, 2019
by
Hsinli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
a1001d14
Pipeline
#14306
passed with stage
in 23 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
2 deletions
+63
-2
credit_id_card_city.js
app/model/prometheus/credit_id_card_city.js
+22
-0
credit.js
app/router/credit.js
+1
-1
blacklist.js
app/service/credit/blacklist.js
+3
-1
common.js
app/service/credit/common.js
+37
-0
No files found.
app/model/prometheus/credit_id_card_city.js
0 → 100644
View file @
d3df0bbb
'use strict'
;
const
moment
=
require
(
'moment'
);
module
.
exports
=
app
=>
{
const
{
INTEGER
,
STRING
}
=
app
.
Sequelize
;
const
CreditIdCardCity
=
app
.
prometheusModel
.
define
(
'credit_id_card_city'
,
{
id
:
{
type
:
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
},
code
:
STRING
,
name
:
STRING
,
},
{
timestamps
:
false
,
tableName
:
'credit_id_card_city'
,
});
return
CreditIdCardCity
;
};
app/router/credit.js
View file @
d3df0bbb
...
@@ -23,7 +23,7 @@ module.exports = app => {
...
@@ -23,7 +23,7 @@ module.exports = app => {
//我的信用-个人通话风险
//我的信用-个人通话风险
router
.
get
(
'/callrisk/report/:report_id'
,
'credit.callrisk.getReport'
);
//获取报告信息
router
.
get
(
'/callrisk/report/:report_id'
,
'credit.callrisk.getReport'
);
//获取报告信息
router
.
post
(
'/callrisk/report'
,
'credit.callrisk.applyCallriskReport'
);
//查询个人通话信息
router
.
post
(
'/callrisk/report'
,
'credit.callrisk.applyCallriskReport'
);
//查询个人通话信息
router
.
get
(
'/callrisk/init'
,
'credit.callrisk.callriskInit'
);
//进入个人通话风险检测页面
router
.
get
(
'/callrisk/init'
,
'credit.callrisk.callriskInit'
);
//进入个人通话风险检测页面
router
.
post
(
'/callrisk/confirm_captcha'
,
'credit.callrisk.confirmCaptcha'
);
//获取短信验证码
router
.
post
(
'/callrisk/confirm_captcha'
,
'credit.callrisk.confirmCaptcha'
);
//获取短信验证码
...
...
app/service/credit/blacklist.js
View file @
d3df0bbb
...
@@ -359,12 +359,14 @@ class BlacklistService extends Service {
...
@@ -359,12 +359,14 @@ class BlacklistService extends Service {
let
birth
=
parseInt
(
inputParams
.
id_card
.
substring
(
6
,
10
));
let
birth
=
parseInt
(
inputParams
.
id_card
.
substring
(
6
,
10
));
let
age
=
parseInt
(
moment
().
format
(
'YYYY'
))
-
birth
;
let
age
=
parseInt
(
moment
().
format
(
'YYYY'
))
-
birth
;
let
city
=
await
ctx
.
service
.
credit
.
common
.
getIdCardCity
(
inputParams
.
id_card
);
let
reportData
=
{
let
reportData
=
{
name
:
inputParams
.
name
,
name
:
inputParams
.
name
,
id_card
:
inputParams
.
id_card
,
id_card
:
inputParams
.
id_card
,
phone
:
inputParams
.
phone
,
phone
:
inputParams
.
phone
,
age
:
age
,
age
:
age
,
city
:
''
,
city
:
city
,
blacklist_of_internet_loans
:
blacklistInfo
.
pre_loan_risk
.
blacklist_of_internet_loans
,
blacklist_of_internet_loans
:
blacklistInfo
.
pre_loan_risk
.
blacklist_of_internet_loans
,
blacklist_of_court_dishonesty
:
blacklistInfo
.
pre_loan_risk
.
blacklist_of_court_dishonesty
,
blacklist_of_court_dishonesty
:
blacklistInfo
.
pre_loan_risk
.
blacklist_of_court_dishonesty
,
blacklist_of_industry
:
blacklistInfo
.
pre_loan_risk
.
blacklist_of_industry
,
blacklist_of_industry
:
blacklistInfo
.
pre_loan_risk
.
blacklist_of_industry
,
...
...
app/service/credit/common.js
View file @
d3df0bbb
...
@@ -373,6 +373,43 @@ class CommonService extends Service {
...
@@ -373,6 +373,43 @@ class CommonService extends Service {
}
}
}
}
/**
* 根据身份证获取对应的省市区
* @param {*} idCard 身份证
*/
async
getIdCardCity
(
idCard
)
{
const
{
ctx
}
=
this
;
let
ret
=
'--'
;
let
prefix3
=
idCard
.
substring
(
0
,
3
)
+
'000'
;
let
prefix6
=
idCard
.
substring
(
0
,
6
);
let
taskList
=
[
ctx
.
prometheusModel
.
CreditIdCardCity
.
findOne
({
where
:
{
code
:
prefix3
}
}),
ctx
.
prometheusModel
.
CreditIdCardCity
.
findOne
({
where
:
{
code
:
prefix6
}
}),
];
let
retList
=
await
Promise
.
all
(
taskList
).
then
(
result
=>
{
return
result
;
}).
catch
(
error
=>
{
ctx
.
failed
(
error
);
});
let
provinece
=
retList
[
0
];
let
city
=
retList
[
1
];
//数据获取
if
(
provinece
===
null
&&
city
===
null
)
{
return
ret
;
}
//省和市
let
provineceName
=
provinece
===
null
?
''
:
provinece
.
name
;
let
cityName
=
city
===
null
?
''
:
city
.
name
;
if
(
provineceName
===
cityName
)
{
ret
=
provineceName
;
}
else
{
ret
=
!
provineceName
?
(
!
cityName
?
'--'
:
cityName
)
:
(
!
cityName
||
cityName
===
'县'
)
?
provineceName
:
(
provineceName
+
'-'
+
cityName
);
}
return
ret
;
}
}
}
module
.
exports
=
CommonService
;
module
.
exports
=
CommonService
;
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