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
7d533bab
Commit
7d533bab
authored
Jul 04, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
24e272c4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
5 deletions
+43
-5
center-manage/app/base/controller/ctl.base.js
+30
-1
center-manage/app/base/system.js
+12
-4
center-manage/app/config/settings.js
+1
-0
No files found.
center-manage/app/base/controller/ctl.base.js
View file @
7d533bab
...
@@ -7,6 +7,11 @@ class CtlBase {
...
@@ -7,6 +7,11 @@ class CtlBase {
this
.
service
=
system
.
getObject
(
"service."
+
gname
+
"."
+
sname
);
this
.
service
=
system
.
getObject
(
"service."
+
gname
+
"."
+
sname
);
this
.
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
this
.
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
}
}
getUUID
()
{
var
uuid
=
uuidv4
();
var
u
=
uuid
.
replace
(
/
\-
/g
,
""
);
return
u
;
}
static
getServiceName
(
ClassObj
)
{
static
getServiceName
(
ClassObj
)
{
return
ClassObj
[
"name"
].
substring
(
0
,
ClassObj
[
"name"
].
lastIndexOf
(
"Ctl"
)).
toLowerCase
()
+
"Sve"
;
return
ClassObj
[
"name"
].
substring
(
0
,
ClassObj
[
"name"
].
lastIndexOf
(
"Ctl"
)).
toLowerCase
()
+
"Sve"
;
...
@@ -50,7 +55,8 @@ class CtlBase {
...
@@ -50,7 +55,8 @@ class CtlBase {
credid
:
req
.
headers
[
"x-credential-identifier"
],
credid
:
req
.
headers
[
"x-credential-identifier"
],
regrole
:
req
.
headers
[
"xregrole"
],
regrole
:
req
.
headers
[
"xregrole"
],
bizpath
:
req
.
headers
[
"xbizpath"
],
bizpath
:
req
.
headers
[
"xbizpath"
],
codetitle
:
req
.
headers
[
"codetitle"
],
codetitle
:
req
.
headers
[
"xcodename"
],
codetitle
:
req
.
headers
[
"xcodetitle"
]?
decodeURI
(
req
.
headers
[
"xcodetitle"
]):
''
,
}
}
if
(
!
req
.
xctx
.
appkey
){
if
(
!
req
.
xctx
.
appkey
){
return
[
-
200
,
"请求头缺少应用x-app-key"
]
return
[
-
200
,
"请求头缺少应用x-app-key"
]
...
@@ -97,8 +103,31 @@ class CtlBase {
...
@@ -97,8 +103,31 @@ class CtlBase {
// }
// }
//req.session=redis缓存的上下文对象
//req.session=redis缓存的上下文对象
var
rtn
=
await
this
[
methodname
](
pobj
,
query
,
req
);
var
rtn
=
await
this
[
methodname
](
pobj
,
query
,
req
);
rtn
.
requestId
=
this
.
getUUID
()
req
.
params
.
param
=
pobj
system
.
execLogs
(
req
.
xctx
.
codetitle
,
req
.
params
,
null
,
rtn
,
null
).
then
(
res
=>
{
if
(
res
&&
res
.
status
==
1
){
console
.
log
(
"log.....success"
)
}
else
{
console
.
log
(
"log.....fail"
)
}
}).
catch
(
e
=>
{
console
.
log
(
"log.....fail"
)
})
return
rtn
;
return
rtn
;
}
catch
(
e
)
{
}
catch
(
e
)
{
let
rtn
=
{}
rtn
.
requestId
=
this
.
getUUID
()
req
.
params
.
param
=
pobj
system
.
execLogs
(
req
.
xctx
.
codetitle
,
req
.
params
,
null
,
rtn
,
e
).
then
(
res
=>
{
if
(
res
&&
res
.
status
==
1
){
console
.
log
(
"log.....success"
)
}
else
{
console
.
log
(
"log.....fail"
)
}
}).
catch
(
e
=>
{
console
.
log
(
"log.....fail"
)
})
console
.
log
(
e
.
stack
,
"出现异常,请联系管理员......."
);
console
.
log
(
e
.
stack
,
"出现异常,请联系管理员......."
);
return
system
.
getResultFail
(
-
200
,
"出现异常,请联系管理员"
);
return
system
.
getResultFail
(
-
200
,
"出现异常,请联系管理员"
);
}
}
...
...
center-manage/app/base/system.js
View file @
7d533bab
...
@@ -277,10 +277,18 @@ class System {
...
@@ -277,10 +277,18 @@ class System {
errorInfo
:
errorInfo
,
//错误信息
errorInfo
:
errorInfo
,
//错误信息
requestId
:
resultInfo
.
requestId
||
""
requestId
:
resultInfo
.
requestId
||
""
}
}
};
};
this
.
postJsonTypeReq
(
reqUrl
,
param
).
then
(
res
=>
{
let
P
=
new
Promise
((
resv
,
rej
)
=>
{
console
.
log
(
res
)
this
.
postJsonTypeReq
(
reqUrl
,
param
).
then
(
res
=>
{
});
if
(
res
.
statusCode
==
200
){
resv
(
res
.
data
)
}
else
{
rej
(
null
)
}
});
})
return
P
}
}
}
}
...
...
center-manage/app/config/settings.js
View file @
7d533bab
...
@@ -60,6 +60,7 @@ var settings = {
...
@@ -60,6 +60,7 @@ var settings = {
database
:
function
()
{
database
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
if
(
this
.
env
==
"dev"
)
{
var
localsettings
=
require
(
"./localsettings"
);
var
localsettings
=
require
(
"./localsettings"
);
console
.
log
(
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>...."
)
return
localsettings
.
database
;
return
localsettings
.
database
;
}
else
{
}
else
{
return
{
return
{
...
...
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