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
770ccfd2
Commit
770ccfd2
authored
Aug 04, 2020
by
王勇飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pp
parent
a3afd5ce
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
25 deletions
+68
-25
center-manage/app/base/service/impl/auth/userSve.js
+10
-2
center-manage/app/base/service/impl/common/channelhandlers/tx.js
+4
-4
center-manage/app/base/system.js
+46
-15
center-manage/app/config/settings.js
+8
-4
No files found.
center-manage/app/base/service/impl/auth/userSve.js
View file @
770ccfd2
...
@@ -420,12 +420,16 @@ class UserService extends ServiceBase {
...
@@ -420,12 +420,16 @@ class UserService extends ServiceBase {
let
users
=
companyFind
.
us
let
users
=
companyFind
.
us
let
cansels
=
users
.
filter
(
u
=>
{
let
cansels
=
users
.
filter
(
u
=>
{
if
(
regionName
&&
regionName
!=
""
&&
u
.
regiontags
)
{
if
(
regionName
&&
regionName
!=
""
&&
u
.
regiontags
)
{
if
(
u
.
isAllocated
&&
u
.
isSalesman
&&
u
.
skilltags
.
indexOf
(
productCatName
)
>=
0
&&
u
.
regiontags
.
indexOf
(
regionName
)
>=
0
)
{
if
(
u
.
isAllocated
&&
u
.
isSalesman
&&
u
.
skilltags
.
indexOf
(
productCatName
)
>=
0
)
{
if
(
u
.
regiontags
.
indexOf
(
regionName
)
>=
0
||
u
.
isAllArea
)
{
return
true
return
true
}
else
{
}
else
{
return
false
return
false
}
}
}
else
{
}
else
{
return
false
}
}
else
{
if
(
u
.
isAllocated
&&
u
.
isSalesman
&&
u
.
isAllArea
&&
u
.
skilltags
.
indexOf
(
productCatName
)
>=
0
)
{
if
(
u
.
isAllocated
&&
u
.
isSalesman
&&
u
.
isAllArea
&&
u
.
skilltags
.
indexOf
(
productCatName
)
>=
0
)
{
return
true
return
true
}
else
{
}
else
{
...
@@ -519,12 +523,16 @@ class UserService extends ServiceBase {
...
@@ -519,12 +523,16 @@ class UserService extends ServiceBase {
let
users
=
companyFind
.
us
let
users
=
companyFind
.
us
let
cansels
=
users
.
filter
(
u
=>
{
let
cansels
=
users
.
filter
(
u
=>
{
if
(
regionName
&&
regionName
!=
""
&&
u
.
regiontags
)
{
if
(
regionName
&&
regionName
!=
""
&&
u
.
regiontags
)
{
if
(
u
.
isAllocated
&&
u
.
isDelivery
&&
u
.
skilltags
.
indexOf
(
productCatName
)
>=
0
&&
u
.
regiontags
.
indexOf
(
regionName
)
>=
0
)
{
if
(
u
.
isAllocated
&&
u
.
isDelivery
&&
u
.
skilltags
.
indexOf
(
productCatName
)
>=
0
)
{
if
(
u
.
regiontags
.
indexOf
(
regionName
)
>=
0
||
u
.
isAllArea
)
{
return
true
return
true
}
else
{
}
else
{
return
false
return
false
}
}
}
else
{
}
else
{
return
false
}
}
else
{
if
(
u
.
isAllocated
&&
u
.
isDelivery
&&
u
.
isAllArea
&&
u
.
skilltags
.
indexOf
(
productCatName
)
>=
0
)
{
if
(
u
.
isAllocated
&&
u
.
isDelivery
&&
u
.
isAllArea
&&
u
.
skilltags
.
indexOf
(
productCatName
)
>=
0
)
{
return
true
return
true
}
else
{
}
else
{
...
...
center-manage/app/base/service/impl/common/channelhandlers/tx.js
View file @
770ccfd2
...
@@ -67,7 +67,7 @@ class TxHandler {
...
@@ -67,7 +67,7 @@ class TxHandler {
var
j
=
JSON
.
parse
(
rtn
.
stdout
);
var
j
=
JSON
.
parse
(
rtn
.
stdout
);
console
.
log
(
JSON
.
stringify
(
j
),
"RRRRRRRRRRRRRRR"
);
console
.
log
(
JSON
.
stringify
(
j
),
"RRRRRRRRRRRRRRR"
);
if
(
j
.
status
==
1
)
{
if
(
j
.
status
==
1
)
{
await
this
.
cacheManager
[
"TxCache"
].
cache
(
cachestr
,
null
,
120000
0
);
//插入redis缓存
await
this
.
cacheManager
[
"TxCache"
].
cache
(
cachestr
,
JSON
.
stringify
({
cachestr
:
cachestr
}),
18
0
);
//插入redis缓存
//给业务员发信息
//给业务员发信息
var
msg
=
{
var
msg
=
{
"title"
:
"你有新的商机,请尽快处理"
,
"title"
:
"你有新的商机,请尽快处理"
,
...
@@ -126,7 +126,7 @@ class TxHandler {
...
@@ -126,7 +126,7 @@ class TxHandler {
var
rtn
=
await
rc
.
execPost3
(
params
,
requrl
);
var
rtn
=
await
rc
.
execPost3
(
params
,
requrl
);
var
j
=
JSON
.
parse
(
rtn
.
stdout
);
var
j
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
j
.
status
==
0
)
{
if
(
j
.
status
==
0
)
{
await
this
.
cacheManager
[
"TxCache"
].
cache
(
cachestr
,
null
,
120000
0
);
//插入缓存
await
this
.
cacheManager
[
"TxCache"
].
cache
(
cachestr
,
JSON
.
stringify
({
cachestr
:
cachestr
}),
18
0
);
//插入缓存
//给业务员发信息
//给业务员发信息
var
selUrl
=
this
.
icUrl
+
"/schemeCtl/findInfoByDemandCode"
;
var
selUrl
=
this
.
icUrl
+
"/schemeCtl/findInfoByDemandCode"
;
...
@@ -422,7 +422,7 @@ class TxHandler {
...
@@ -422,7 +422,7 @@ class TxHandler {
var
j1
=
JSON
.
parse
(
rtn
.
stdout
);
var
j1
=
JSON
.
parse
(
rtn
.
stdout
);
console
.
log
(
"j1---------------------------------"
+
rtn
.
stdout
);
console
.
log
(
"j1---------------------------------"
+
rtn
.
stdout
);
if
(
j
.
status
==
0
&&
j1
.
status
==
0
)
{
if
(
j
.
status
==
0
&&
j1
.
status
==
0
)
{
await
this
.
cacheManager
[
"TxCache"
].
cache
(
cachestr
,
null
,
120000
0
);
await
this
.
cacheManager
[
"TxCache"
].
cache
(
cachestr
,
JSON
.
stringify
({
cachestr
:
cachestr
}),
18
0
);
//给业务员发信息
//给业务员发信息
var
msg
=
{
var
msg
=
{
"title"
:
"你有新的交付单,请尽快处理"
,
"title"
:
"你有新的交付单,请尽快处理"
,
...
@@ -487,7 +487,7 @@ class TxHandler {
...
@@ -487,7 +487,7 @@ class TxHandler {
var
rtn
=
await
rc
.
execPost3
(
params
,
requrl
);
var
rtn
=
await
rc
.
execPost3
(
params
,
requrl
);
var
j
=
JSON
.
parse
(
rtn
.
stdout
);
var
j
=
JSON
.
parse
(
rtn
.
stdout
);
if
(
j
.
status
==
0
)
{
if
(
j
.
status
==
0
)
{
await
this
.
cacheManager
[
"TxCache"
].
cache
(
cachestr
,
null
,
120000
0
);
//插入缓存
await
this
.
cacheManager
[
"TxCache"
].
cache
(
cachestr
,
JSON
.
stringify
({
cachestr
:
cachestr
}),
18
0
);
//插入缓存
//给业务员发信息
//给业务员发信息
var
selUrl
=
this
.
icUrl
+
"/deliverybillCtl/findInfoByDeliverCode"
;
var
selUrl
=
this
.
icUrl
+
"/deliverybillCtl/findInfoByDeliverCode"
;
...
...
center-manage/app/base/system.js
View file @
770ccfd2
...
@@ -2,8 +2,9 @@ var fs = require("fs");
...
@@ -2,8 +2,9 @@ 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
request
=
require
(
'request'
);
const
request
=
require
(
'request'
);
const
cryptoJS
=
require
(
'crypto-js'
);
class
System
{
class
System
{
static
declare
(
ns
)
{
static
declare
(
ns
)
{
var
ar
=
ns
.
split
(
'.'
);
var
ar
=
ns
.
split
(
'.'
);
var
root
=
System
;
var
root
=
System
;
for
(
var
i
=
0
,
len
=
ar
.
length
;
i
<
len
;
++
i
)
{
for
(
var
i
=
0
,
len
=
ar
.
length
;
i
<
len
;
++
i
)
{
...
@@ -16,7 +17,7 @@ class System {
...
@@ -16,7 +17,7 @@ class System {
}
}
}
}
}
}
static
async
delReq
(
url
,
qdata
)
{
static
async
delReq
(
url
,
qdata
)
{
let
rtn
=
{}
let
rtn
=
{}
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
request
.
del
({
request
.
del
({
...
@@ -39,7 +40,7 @@ class System {
...
@@ -39,7 +40,7 @@ class System {
})
})
return
promise
;
return
promise
;
}
}
static
async
getReq
(
url
,
qdata
)
{
static
async
getReq
(
url
,
qdata
)
{
let
rtn
=
{}
let
rtn
=
{}
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
request
.
get
({
request
.
get
({
...
@@ -62,7 +63,7 @@ class System {
...
@@ -62,7 +63,7 @@ class System {
})
})
return
promise
;
return
promise
;
}
}
static
async
postJsonTypeReq
(
url
,
data
,
md
=
"POST"
)
{
static
async
postJsonTypeReq
(
url
,
data
,
md
=
"POST"
)
{
let
rtn
=
{}
let
rtn
=
{}
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
request
({
request
({
...
@@ -91,7 +92,7 @@ class System {
...
@@ -91,7 +92,7 @@ class System {
})
})
return
promise
;
return
promise
;
}
}
static
async
post3wFormTypeReq
(
url
,
data
)
{
static
async
post3wFormTypeReq
(
url
,
data
)
{
let
rtn
=
{}
let
rtn
=
{}
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
request
.
post
({
request
.
post
({
...
@@ -110,7 +111,7 @@ class System {
...
@@ -110,7 +111,7 @@ class System {
})
})
return
promise
;
return
promise
;
}
}
static
async
postMpFormTypeReq
(
url
,
formdata
)
{
static
async
postMpFormTypeReq
(
url
,
formdata
)
{
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
let
promise
=
new
Promise
(
function
(
resv
,
rej
)
{
request
.
post
({
request
.
post
({
url
:
url
,
url
:
url
,
...
@@ -132,7 +133,7 @@ class System {
...
@@ -132,7 +133,7 @@ class System {
* @param {*} okmsg 操作成功的描述
* @param {*} okmsg 操作成功的描述
* @param {*} req 请求头信息
* @param {*} req 请求头信息
*/
*/
static
getResult
(
data
,
opmsg
=
"操作成功"
,
req
)
{
static
getResult
(
data
,
opmsg
=
"操作成功"
,
req
)
{
return
{
return
{
status
:
!
data
?
-
1
:
0
,
status
:
!
data
?
-
1
:
0
,
msg
:
opmsg
,
msg
:
opmsg
,
...
@@ -145,7 +146,7 @@ class System {
...
@@ -145,7 +146,7 @@ class System {
* @param {*} data 操作成功返回的数据
* @param {*} data 操作成功返回的数据
* @param {*} okmsg 操作成功的描述
* @param {*} okmsg 操作成功的描述
*/
*/
static
getResultSuccess
(
data
,
okmsg
=
"success"
)
{
static
getResultSuccess
(
data
,
okmsg
=
"success"
)
{
return
{
return
{
status
:
0
,
status
:
0
,
msg
:
okmsg
,
msg
:
okmsg
,
...
@@ -158,7 +159,7 @@ class System {
...
@@ -158,7 +159,7 @@ class System {
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} data 操作失败返回的数据
* @param {*} data 操作失败返回的数据
*/
*/
static
getResultFail
(
status
=
-
1
,
errmsg
=
"fail"
,
data
=
null
)
{
static
getResultFail
(
status
=
-
1
,
errmsg
=
"fail"
,
data
=
null
)
{
return
{
return
{
status
:
status
,
status
:
status
,
msg
:
errmsg
,
msg
:
errmsg
,
...
@@ -170,14 +171,14 @@ class System {
...
@@ -170,14 +171,14 @@ class System {
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} data 操作失败返回的数据
* @param {*} data 操作失败返回的数据
*/
*/
static
getResultError
(
errmsg
=
"fail"
,
data
=
null
)
{
static
getResultError
(
errmsg
=
"fail"
,
data
=
null
)
{
return
{
return
{
status
:
-
200
,
status
:
-
200
,
msg
:
errmsg
,
msg
:
errmsg
,
data
:
data
,
data
:
data
,
};
};
}
}
static
register
(
key
,
ClassObj
,
groupName
,
filename
)
{
static
register
(
key
,
ClassObj
,
groupName
,
filename
)
{
if
(
System
.
objTable
[
key
]
!=
null
)
{
if
(
System
.
objTable
[
key
]
!=
null
)
{
throw
new
Error
(
"相同key的对象已经存在"
);
throw
new
Error
(
"相同key的对象已经存在"
);
}
else
{
}
else
{
...
@@ -192,7 +193,7 @@ class System {
...
@@ -192,7 +193,7 @@ class System {
return
System
.
objTable
[
key
];
return
System
.
objTable
[
key
];
}
}
static
getObject
(
objpath
)
{
static
getObject
(
objpath
)
{
var
pathArray
=
objpath
.
split
(
"."
);
var
pathArray
=
objpath
.
split
(
"."
);
var
packageName
=
pathArray
[
0
];
var
packageName
=
pathArray
[
0
];
var
groupName
=
pathArray
[
1
];
var
groupName
=
pathArray
[
1
];
...
@@ -233,7 +234,7 @@ class System {
...
@@ -233,7 +234,7 @@ class System {
}
}
}
}
static
getSysConfig
()
{
static
getSysConfig
()
{
var
configPath
=
settings
.
basepath
+
"/app/base/db/metadata/index.js"
;
var
configPath
=
settings
.
basepath
+
"/app/base/db/metadata/index.js"
;
// if(settings.env=="dev"){
// if(settings.env=="dev"){
// console.log("delete "+configPath+"cache config");
// console.log("delete "+configPath+"cache config");
...
@@ -243,7 +244,7 @@ class System {
...
@@ -243,7 +244,7 @@ class System {
var
configValue
=
require
(
configPath
);
var
configValue
=
require
(
configPath
);
return
configValue
.
config
;
return
configValue
.
config
;
}
}
static
get_client_ip
(
req
)
{
static
get_client_ip
(
req
)
{
var
ip
=
req
.
headers
[
'x-forwarded-for'
]
||
var
ip
=
req
.
headers
[
'x-forwarded-for'
]
||
req
.
ip
||
req
.
ip
||
req
.
connection
.
remoteAddress
||
req
.
connection
.
remoteAddress
||
...
@@ -265,7 +266,7 @@ class System {
...
@@ -265,7 +266,7 @@ class System {
* @param {*} resultInfo 返回结果
* @param {*} resultInfo 返回结果
* @param {*} errorInfo 错误信息
* @param {*} errorInfo 错误信息
*/
*/
static
execLogs
(
opTitle
,
params
,
identifyCode
,
resultInfo
,
errorInfo
)
{
static
execLogs
(
opTitle
,
params
,
identifyCode
,
resultInfo
,
errorInfo
)
{
var
reqUrl
=
settings
.
logUrl
();
var
reqUrl
=
settings
.
logUrl
();
let
isLogData
=
true
let
isLogData
=
true
if
(
params
.
method
&&
(
params
.
method
.
indexOf
(
"find"
)
>=
0
||
params
.
method
.
indexOf
(
"get"
)
>=
0
))
{
if
(
params
.
method
&&
(
params
.
method
.
indexOf
(
"find"
)
>=
0
||
params
.
method
.
indexOf
(
"get"
)
>=
0
))
{
...
@@ -297,6 +298,36 @@ class System {
...
@@ -297,6 +298,36 @@ class System {
}
}
/**
* 加密信息
* @param {*} opStr
*/
static
encryptStr
(
opStr
)
{
if
(
!
opStr
)
{
return
"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
cipherStr
;
}
/**
* 解密信息
* @param {*} opStr
*/
static
decryptStr
(
opStr
)
{
if
(
!
opStr
)
{
return
"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
plaintext
;
}
}
}
Date
.
prototype
.
Format
=
function
(
fmt
)
{
//author: meizz
Date
.
prototype
.
Format
=
function
(
fmt
)
{
//author: meizz
var
o
=
{
var
o
=
{
...
...
center-manage/app/config/settings.js
View file @
770ccfd2
...
@@ -10,16 +10,20 @@ var ENVINPUT = {
...
@@ -10,16 +10,20 @@ var ENVINPUT = {
REDIS_PORT
:
process
.
env
.
REDIS_PORT
,
REDIS_PORT
:
process
.
env
.
REDIS_PORT
,
REDIS_PWD
:
process
.
env
.
REDIS_PWD
,
REDIS_PWD
:
process
.
env
.
REDIS_PWD
,
REDIS_DB
:
process
.
env
.
PAAS_REDIS_DB
,
REDIS_DB
:
process
.
env
.
PAAS_REDIS_DB
,
APP_ENV
:
process
.
env
.
APP_ENV
?
process
.
env
.
APP_ENV
:
"dev"
APP_ENV
:
process
.
env
.
APP_ENV
?
process
.
env
.
APP_ENV
:
"dev"
,
ENCRYPT_KEY
:
process
.
env
.
ENCRYPT_KEY
?
process
.
env
.
ENCRYPT_KEY
:
"202007211106"
,
ENCRYPT_SECRET
:
process
.
env
.
ENCRYPT_SECRET
?
process
.
env
.
ENCRYPT_SECRET
:
"scbb846246874887b5c7e01cd0816c66"
};
};
var
settings
=
{
var
settings
=
{
env
:
ENVINPUT
.
APP_ENV
,
env
:
ENVINPUT
.
APP_ENV
,
encrypt_key
:
ENVINPUT
.
ENCRYPT_KEY
,
encrypt_secret
:
ENVINPUT
.
ENCRYPT_SECRET
,
salt
:
"%iatpD1gcxz7iF#B"
,
salt
:
"%iatpD1gcxz7iF#B"
,
defaultpwd
:
"gsb2020"
,
defaultpwd
:
"gsb2020"
,
basepath
:
path
.
normalize
(
path
.
join
(
__dirname
,
'../..'
)),
basepath
:
path
.
normalize
(
path
.
join
(
__dirname
,
'../..'
)),
port
:
process
.
env
.
NODE_PORT
||
80
,
port
:
process
.
env
.
NODE_PORT
||
80
,
logindex
:
"center_manage"
,
logindex
:
"center_manage"
,
appname
:
"center_manage"
,
appname
:
"center_manage"
,
kongurl
:
function
()
{
kongurl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
if
(
this
.
env
==
"dev"
)
{
var
localsettings
=
require
(
"./localsettings"
);
var
localsettings
=
require
(
"./localsettings"
);
...
@@ -35,7 +39,7 @@ var settings = {
...
@@ -35,7 +39,7 @@ var settings = {
return
"http://icdeliver-service"
;
return
"http://icdeliver-service"
;
}
}
},
},
logUrl
:
function
()
{
logUrl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
if
(
this
.
env
==
"dev"
)
{
return
"http://192.168.1.128:4019/api/queueAction/producer/springBoard"
;
return
"http://192.168.1.128:4019/api/queueAction/producer/springBoard"
;
}
else
{
}
else
{
...
...
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