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
2b1552f3
Commit
2b1552f3
authored
Sep 06, 2019
by
Hsinli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
6b9bafd0
Pipeline
#13481
passed with stage
in 9 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
2 deletions
+72
-2
apply.js
app/service/credit/apply.js
+40
-0
blacklist.js
app/service/credit/blacklist.js
+1
-1
common.js
app/service/credit/common.js
+26
-0
config.local.js
config/config.local.js
+5
-1
No files found.
app/service/credit/apply.js
0 → 100644
View file @
2b1552f3
'use strict'
;
const
Service
=
require
(
'egg'
).
Service
;
const
moment
=
require
(
'moment'
);
const
_
=
require
(
'lodash'
);
class
ApplyService
extends
Service
{
async
applyBlacklist
()
{
//demo
let
params
=
{
sign
:
""
,
signParams
:
{
appKey
:
this
.
config
.
BLACKLIST_APPLY_APPKEY
,
timestamp
:
String
(
new
Date
().
getTime
()),
},
phone
:
"18912345678"
,
name
:
"李四"
,
idcard
:
"150981197202284550"
}
ctx
.
logger
.
info
(
params
);
params
.
sign
=
await
ctx
.
service
.
credit
.
common
.
sign
(
params
.
signParams
,
this
.
config
.
BLACKLIST_APPLY_APPSECRET
);
ctx
.
logger
.
info
(
params
);
let
url
=
this
.
config
.
BLACKLIST_APPLY_URL
;
let
result
=
await
ctx
.
helper
.
send_request
(
url
,
params
,
{
method
:
'POST'
});
ctx
.
logger
.
info
(
result
);
}
}
module
.
exports
=
ApplyService
;
app/service/credit/blacklist.js
View file @
2b1552f3
...
...
@@ -38,7 +38,7 @@ const DeviceConfig = {
class
BlacklistService
extends
Service
{
/**
*
*
获取黑名单报告
* @param {*} id 报告编号
*/
async
getReport
(
id
)
{
...
...
app/service/credit/common.js
View file @
2b1552f3
...
...
@@ -38,6 +38,32 @@ class CommonService extends Service {
return
prefix
+
suffix
;
}
/**
* 签名函数
* @param {*} params 需要签名的参数
*/
async
sign
(
params
,
appSecret
)
{
const
{
ctx
}
=
this
;
let
sign
=
''
;
if
(
!
params
)
{
return
sign
;
}
//键名排序
const
sortParamsKey
=
Object
.
keys
(
params
).
sort
();
//键值拼接-升序
let
sortValues
=
''
;
for
(
let
i
in
sortParamsKey
)
{
if
(
sortParamsKey
[
i
]
===
'sign'
)
{
continue
;
}
sortValues
+=
sortParamsKey
[
i
]
+
'='
+
params
[
sortParamsKey
[
i
]]
+
'&'
;
}
sortValues
+=
'appSecret='
+
appSecret
;
sign
=
await
ctx
.
helper
.
md5
(
sortValues
).
toUpperCase
();
ctx
.
logger
.
info
({
sign
:
sign
});
return
sign
;
}
}
module
.
exports
=
CommonService
;
config/config.local.js
View file @
2b1552f3
...
...
@@ -18,7 +18,7 @@ module.exports = appInfo => {
};
// config.middleware = [ 'errorHandler', 'deviceLogin', 'deviceInit', 'responseSet' ];
config
.
middleware
=
[
];
config
.
middleware
=
[];
exports
.
multipart
=
{
// 不用steam用file
...
...
@@ -127,6 +127,10 @@ module.exports = appInfo => {
config
.
USER_CENTER_API_URI
=
'https://uat-nginx.jianbing.com/usercenter-service'
;
config
.
BLACKLIST_APPLY_APPKEY
=
'F4E0CA710F484CFFB1756741696E29A3'
;
config
.
BLACKLIST_APPLY_APPSECRET
=
'233B8E10E31B4C899EE6FEB3AEC22F140B6528BF'
;
config
.
BLACKLIST_APPLY_URL
=
'http://47.96.253.64:8049/mycredit/blackList'
;
return
config
;
};
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