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
d052fb34
Commit
d052fb34
authored
Aug 14, 2020
by
王勇飞
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ic-deliver' of gitlab.gongsibao.com:jiangyong/zhichan into ic-deliver
parents
794affbd
f5ed17b7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
28 deletions
+34
-28
ic-deliver/app/base/controller/impl/bizchance/deliverybillCtl.js
+0
-0
ic-deliver/app/base/system.js
+34
-28
No files found.
ic-deliver/app/base/controller/impl/bizchance/deliverybillCtl.js
View file @
d052fb34
This diff is collapsed.
Click to expand it.
ic-deliver/app/base/system.js
View file @
d052fb34
...
...
@@ -5,7 +5,7 @@ const request = require('request');
const
cryptoJS
=
require
(
'crypto-js'
);
class
System
{
static
declare
(
ns
)
{
static
declare
(
ns
)
{
var
ar
=
ns
.
split
(
'.'
);
var
root
=
System
;
for
(
var
i
=
0
,
len
=
ar
.
length
;
i
<
len
;
++
i
)
{
...
...
@@ -18,7 +18,7 @@ class System {
}
}
}
static
async
delReq
(
url
,
qdata
)
{
static
async
delReq
(
url
,
qdata
)
{
let
rtn
=
{}
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
request
.
del
({
...
...
@@ -41,7 +41,7 @@ class System {
})
return
promise
;
}
static
async
getReq
(
url
,
qdata
)
{
static
async
getReq
(
url
,
qdata
)
{
let
rtn
=
{}
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
request
.
get
({
...
...
@@ -64,7 +64,7 @@ class System {
})
return
promise
;
}
static
async
postJsonTypeReq
(
url
,
data
,
md
=
"POST"
)
{
static
async
postJsonTypeReq
(
url
,
data
,
md
=
"POST"
)
{
let
rtn
=
{}
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
request
({
...
...
@@ -92,7 +92,7 @@ class System {
})
return
promise
;
}
static
async
post3wFormTypeReq
(
url
,
data
)
{
static
async
post3wFormTypeReq
(
url
,
data
)
{
let
rtn
=
{}
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
request
.
post
({
...
...
@@ -111,7 +111,7 @@ class System {
})
return
promise
;
}
static
async
postMpFormTypeReq
(
url
,
formdata
)
{
static
async
postMpFormTypeReq
(
url
,
formdata
)
{
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
request
.
post
({
url
:
url
,
...
...
@@ -133,7 +133,7 @@ class System {
* @param {*} okmsg 操作成功的描述
* @param {*} req 请求头信息
*/
static
getResult
(
data
,
opmsg
=
"操作成功"
,
req
)
{
static
getResult
(
data
,
opmsg
=
"操作成功"
,
req
)
{
return
{
status
:
!
data
?
-
1
:
0
,
msg
:
opmsg
,
...
...
@@ -146,7 +146,7 @@ class System {
* @param {*} data 操作成功返回的数据
* @param {*} okmsg 操作成功的描述
*/
static
getResultSuccess
(
data
,
okmsg
=
"success"
)
{
static
getResultSuccess
(
data
,
okmsg
=
"success"
)
{
return
{
status
:
0
,
msg
:
okmsg
,
...
...
@@ -159,7 +159,7 @@ class System {
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} data 操作失败返回的数据
*/
static
getResultFail
(
status
=
-
1
,
errmsg
=
"fail"
,
data
=
null
)
{
static
getResultFail
(
status
=
-
1
,
errmsg
=
"fail"
,
data
=
null
)
{
return
{
status
:
status
,
msg
:
errmsg
,
...
...
@@ -171,14 +171,14 @@ class System {
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} data 操作失败返回的数据
*/
static
getResultError
(
errmsg
=
"fail"
,
data
=
null
)
{
static
getResultError
(
errmsg
=
"fail"
,
data
=
null
)
{
return
{
status
:
-
200
,
msg
:
errmsg
,
data
:
data
,
};
}
static
register
(
key
,
ClassObj
,
groupName
,
filename
)
{
static
register
(
key
,
ClassObj
,
groupName
,
filename
)
{
if
(
System
.
objTable
[
key
]
!=
null
)
{
throw
new
Error
(
"相同key的对象已经存在"
);
}
else
{
...
...
@@ -193,7 +193,7 @@ class System {
return
System
.
objTable
[
key
];
}
static
getObject
(
objpath
)
{
static
getObject
(
objpath
)
{
var
pathArray
=
objpath
.
split
(
"."
);
var
packageName
=
pathArray
[
0
];
var
groupName
=
pathArray
[
1
];
...
...
@@ -234,7 +234,7 @@ class System {
}
}
static
getSysConfig
()
{
static
getSysConfig
()
{
var
configPath
=
settings
.
basepath
+
"/app/base/db/metadata/index.js"
;
// if(settings.env=="dev"){
// console.log("delete "+configPath+"cache config");
...
...
@@ -244,7 +244,7 @@ class System {
var
configValue
=
require
(
configPath
);
return
configValue
.
config
;
}
static
get_client_ip
(
req
)
{
static
get_client_ip
(
req
)
{
var
ip
=
req
.
headers
[
'x-forwarded-for'
]
||
req
.
ip
||
req
.
connection
.
remoteAddress
||
...
...
@@ -267,7 +267,7 @@ class System {
* @param {*} resultInfo 返回结果
* @param {*} errorInfo 错误信息
*/
static
execLogs
(
opTitle
,
params
,
identifyCode
,
resultInfo
,
errorInfo
)
{
static
execLogs
(
opTitle
,
params
,
identifyCode
,
resultInfo
,
errorInfo
)
{
var
reqUrl
=
settings
.
logUrl
();
let
isLogData
=
true
if
(
params
.
method
&&
(
params
.
method
.
indexOf
(
"find"
)
>=
0
||
params
.
method
.
indexOf
(
"get"
)
>=
0
))
{
...
...
@@ -304,9 +304,9 @@ class System {
* 加密信息
* @param {*} opStr
*/
static
encryptStr
(
opStr
)
{
static
encryptStr
(
opStr
)
{
if
(
!
opStr
)
{
return
"opStr is empty"
;
return
opStr
;
}
let
keyHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
settings
.
encrypt_key
);
let
ivHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
settings
.
encrypt_secret
.
substring
(
0
,
8
));
...
...
@@ -317,17 +317,21 @@ class System {
* 解密信息
* @param {*} opStr
*/
static
decryptStr
(
opStr
)
{
static
decryptStr
(
opStr
)
{
if
(
!
opStr
)
{
return
"opStr is empty"
;
return
opStr
;
}
try
{
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
plaintext
||
opStr
;
}
catch
(
error
)
{
return
opStr
;
}
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
plaintext
;
}
...
...
@@ -390,4 +394,6 @@ module.exports = System;
// }catch(e){
// console.log(e);
// }
// })()
\ No newline at end of file
// })()
// console.log(System.decryptStr("13381139519"))
\ No newline at end of file
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