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
12745049
Commit
12745049
authored
Jun 11, 2020
by
孙亚楠
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
c3008706
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
2 deletions
+42
-2
xgg-saas-merchant/app/base/api/impl/h5/merchantApi.js
+3
-2
xgg-saas-merchant/app/base/system.js
+34
-0
xgg-saas-merchant/app/config/settings.js
+5
-0
No files found.
xgg-saas-merchant/app/base/api/impl/h5/merchantApi.js
View file @
12745049
...
@@ -77,7 +77,7 @@ class TestAPI extends APIBase {
...
@@ -77,7 +77,7 @@ class TestAPI extends APIBase {
}
}
let
openID
=
"gtbh5_"
+
obj
.
mobile
;
let
openID
=
"gtbh5_"
+
obj
.
mobile
;
let
merchant_id
=
decodeURIComponent
(
obj
.
merchant_id
);
let
merchant_id
=
system
.
decryption
(
obj
.
merchant_id
);
let
params
=
{
let
params
=
{
saas_merchant_id
:
merchant_id
,
saas_merchant_id
:
merchant_id
,
saas_id
:
null
,
saas_id
:
null
,
...
@@ -102,7 +102,8 @@ class TestAPI extends APIBase {
...
@@ -102,7 +102,8 @@ class TestAPI extends APIBase {
//验证登录
//验证登录
async
loginUser
(
obj
)
{
async
loginUser
(
obj
)
{
let
merchant_id
=
decodeURIComponent
(
obj
.
merchant_id
);
// let merchant_id = decodeURIComponent(obj.merchant_id);
let
merchant_id
=
system
.
decryption
(
obj
.
merchant_id
);
let
user
=
await
this
.
getLoginUser
(
merchant_id
,
obj
.
openid
);
let
user
=
await
this
.
getLoginUser
(
merchant_id
,
obj
.
openid
);
return
this
.
returnSuccess
(
user
);
return
this
.
returnSuccess
(
user
);
}
}
...
...
xgg-saas-merchant/app/base/system.js
View file @
12745049
...
@@ -217,6 +217,40 @@ class System {
...
@@ -217,6 +217,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
)
{
//author: meizz
Date
.
prototype
.
Format
=
function
(
fmt
)
{
//author: meizz
...
...
xgg-saas-merchant/app/config/settings.js
View file @
12745049
...
@@ -60,6 +60,11 @@ var settings = {
...
@@ -60,6 +60,11 @@ var settings = {
opLogEsIsAdd
:
function
()
{
opLogEsIsAdd
:
function
()
{
return
1
;
return
1
;
},
},
AES
:
{
key
:
"qUPsMflPfgpPP1Ua"
,
//密钥
iv
:
'1012133205963708'
,
//偏移向量
padding
:
'PKCS7Padding'
//补全值
}
},
},
indexPage
:
function
()
{
indexPage
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
if
(
this
.
env
==
"dev"
)
{
...
...
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