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
cf21a820
Commit
cf21a820
authored
Mar 13, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
57841628
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
0 deletions
+53
-0
bpo-admin/app/base/api/impl/testApi.js
+17
-0
bpo-admin/app/base/system.js
+36
-0
No files found.
bpo-admin/app/base/api/impl/testApi.js
View file @
cf21a820
...
@@ -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 @
cf21a820
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
...
...
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