Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
deb9a017
Commit
deb9a017
authored
Mar 13, 2020
by
焦子成
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bpo-admin' of gitlab.gongsibao.com:jiangyong/zhichan into bpo-admin
parents
58bdb349
cf21a820
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
0 deletions
+58
-0
bpo-admin/app/base/api/impl/testApi.js
+17
-0
bpo-admin/app/base/system.js
+36
-0
bpo-admin/app/config/settings.js
+5
-0
No files found.
bpo-admin/app/base/api/impl/testApi.js
View file @
deb9a017
...
@@ -13,6 +13,23 @@ class TestApi {
...
@@ -13,6 +13,23 @@ class TestApi {
this
.
dkcontractSve
=
System
.
getObject
(
"service.dkcontractSve"
);
this
.
dkcontractSve
=
System
.
getObject
(
"service.dkcontractSve"
);
}
}
async
testaes
(
obj
)
{
let
str
=
'{"channel_id": "11111", "platform_channel_id": "1asdqqwdwqdwqdwqddqdwq", "channel_merchant_id": "211111", "origin_merchant_id": "11112312wqdwqdwqwqd", "data_id": "11221321321dwwqwqdwq1"}'
;
console
.
log
(
`字符串:
${
str
}
`
);
let
encry
=
System
.
encryption
(
str
);
console
.
log
(
`加密:
${
encry
}
`
);
let
params
=
encodeURIComponent
(
encry
);
console
.
log
(
`生成参数:
${
params
}
`
);
let
decry
=
System
.
decryption
(
encry
);
console
.
log
(
`解密:
${
decry
}
`
);
}
async
genPosterQrcodeImg
(
obj
)
{
async
genPosterQrcodeImg
(
obj
)
{
return
await
this
.
imghandleApi
.
genPosterQrcodeImg
(
obj
.
qrcode
,
obj
.
bakImg
);
return
await
this
.
imghandleApi
.
genPosterQrcodeImg
(
obj
.
qrcode
,
obj
.
bakImg
);
}
}
...
...
bpo-admin/app/base/system.js
View file @
deb9a017
var
fs
=
require
(
"fs"
);
var
fs
=
require
(
"fs"
);
var
objsettings
=
require
(
"../config/objsettings"
);
var
objsettings
=
require
(
"../config/objsettings"
);
var
settings
=
require
(
"../config/settings"
);
var
settings
=
require
(
"../config/settings"
);
const
crypto
=
require
(
'crypto'
);
class
System
{
class
System
{
static
declare
(
ns
)
{
static
declare
(
ns
)
{
var
ar
=
ns
.
split
(
'.'
);
var
ar
=
ns
.
split
(
'.'
);
...
@@ -271,6 +273,40 @@ class System {
...
@@ -271,6 +273,40 @@ class System {
}
}
}
}
}
}
static
encryption
(
data
)
{
if
(
!
data
)
{
return
""
;
}
let
AES_conf
=
settings
.
apiconfig
.
AES
;
let
key
=
AES_conf
.
key
;
let
iv
=
AES_conf
.
iv
;
// let padding = AES_conf.padding;
var
cipherChunks
=
[];
var
cipher
=
crypto
.
createCipheriv
(
'aes-128-cbc'
,
key
,
iv
);
cipher
.
setAutoPadding
(
true
);
cipherChunks
.
push
(
cipher
.
update
(
data
,
'utf8'
,
'base64'
));
cipherChunks
.
push
(
cipher
.
final
(
'base64'
));
return
cipherChunks
.
join
(
''
);
}
static
decryption
(
data
){
if
(
!
data
)
{
return
""
;
}
let
AES_conf
=
settings
.
apiconfig
.
AES
;
let
key
=
AES_conf
.
key
;
let
iv
=
AES_conf
.
iv
;
// let padding = AES_conf.padding;
var
cipherChunks
=
[];
var
decipher
=
crypto
.
createDecipheriv
(
'aes-128-cbc'
,
key
,
iv
);
decipher
.
setAutoPadding
(
true
);
cipherChunks
.
push
(
decipher
.
update
(
data
,
'base64'
,
'utf8'
));
cipherChunks
.
push
(
decipher
.
final
(
'utf8'
));
return
cipherChunks
.
join
(
''
);
}
}
}
Date
.
prototype
.
Format
=
function
(
fmt
)
Date
.
prototype
.
Format
=
function
(
fmt
)
{
//author: meizz
{
//author: meizz
...
...
bpo-admin/app/config/settings.js
View file @
deb9a017
...
@@ -30,6 +30,11 @@ var settings = {
...
@@ -30,6 +30,11 @@ var settings = {
}
}
},
},
apiconfig
:
{
apiconfig
:
{
AES
:
{
key
:
"qUPsMflPfgpPP1Ua"
,
//密钥
iv
:
'1012133205963708'
,
//偏移向量
padding
:
'PKCS7Padding'
//补全值
},
opLogUrl
:
function
()
{
opLogUrl
:
function
()
{
return
settings
.
reqEsAddr
()
+
"bigdata_zc_op_log/_doc?pretty"
;
return
settings
.
reqEsAddr
()
+
"bigdata_zc_op_log/_doc?pretty"
;
},
},
...
...
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