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
538ac76c
Commit
538ac76c
authored
Jul 28, 2020
by
王勇飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gyq
parent
082308c2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
0 deletions
+33
-0
ic-deliver/app/base/system.js
+33
-0
No files found.
ic-deliver/app/base/system.js
View file @
538ac76c
...
...
@@ -298,6 +298,37 @@ class System {
}
/**
* 加密信息
* @param {*} opStr
*/
static
async
encryptStr
(
opStr
)
{
if
(
!
opStr
)
{
return
this
.
getResult
(
null
,
"opStr is empty"
);
}
let
keyHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
settings
.
encrypt_key
);
let
ivHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
settings
.
encrypt_secret
.
substring
(
0
,
8
));
var
cipherStr
=
cryptoJS
.
TripleDES
.
encrypt
(
opStr
,
keyHex
,
{
iv
:
ivHex
}).
toString
();
return
this
.
getResultSuccess
(
cipherStr
);
}
/**
* 解密信息
* @param {*} opStr
*/
static
async
decryptStr
(
opStr
)
{
if
(
!
opStr
)
{
return
this
.
getResult
(
null
,
"opStr is empty"
);
}
let
keyHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
settings
.
encrypt_key
);
let
ivHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
settings
.
encrypt_secret
.
substring
(
0
,
8
));
var
bytes
=
cryptoJS
.
TripleDES
.
decrypt
(
opStr
,
keyHex
,
{
iv
:
ivHex
});
var
plaintext
=
bytes
.
toString
(
cryptoJS
.
enc
.
Utf8
);
return
this
.
getResultSuccess
(
plaintext
);
}
}
Date
.
prototype
.
Format
=
function
(
fmt
)
{
//author: meizz
var
o
=
{
...
...
@@ -316,6 +347,8 @@ Date.prototype.Format = function (fmt) { //author: meizz
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
RegExp
.
$1
.
length
==
1
)
?
(
o
[
k
])
:
((
"00"
+
o
[
k
]).
substr
((
""
+
o
[
k
]).
length
)));
return
fmt
;
}
/*
编码说明,
1000----1999 为请求参数验证和app权限验证
...
...
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