Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qaHome
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
qaHome
Commits
2c75b1e6
Commit
2c75b1e6
authored
Jun 26, 2018
by
智勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配置管理增加日志
parent
e32078bb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
0 deletions
+86
-0
server.js
app/qa-home/controller/dbconfig/server.js
+51
-0
server.js
app/qa-home/controller/proconfig/server.js
+35
-0
No files found.
app/qa-home/controller/dbconfig/server.js
View file @
2c75b1e6
...
@@ -107,8 +107,48 @@ exports.save = async function () {
...
@@ -107,8 +107,48 @@ exports.save = async function () {
console
.
log
(
req
)
console
.
log
(
req
)
if
(
req
.
_id
)
{
if
(
req
.
_id
)
{
this
.
body
=
await
this
.
mongo
(
"
dbconfig
"
).
updateById
(
req
.
_id
,
new_db
);
this
.
body
=
await
this
.
mongo
(
"
dbconfig
"
).
updateById
(
req
.
_id
,
new_db
);
try
{
this
.
logger
.
info
(
{
active
:
"
update_dbconfig
"
,
microservice_name
:
req
.
dbname
.
trim
(),
user
:
`
${
this
.
user
.
name
}
`
,
user_mail
:
`
${
this
.
user
.
mail
}
`
,
detail
:
{
dbname
:
req
.
dbname
.
trim
(),
ip
:
req
.
ip
.
trim
(),
port
:
parseInt
(
req
.
port
),
username
:
req
.
username
.
trim
()
||
""
,
passwd
:
req
.
passwd
.
trim
()
||
""
,
table_list
:
req
.
table_list
.
trim
()
||
""
,
update_at
:
req
.
update_at
}
});
}
catch
(
error
)
{
console
.
log
(
error
)
}
}
else
{
}
else
{
this
.
body
=
await
this
.
mongo
(
"
dbconfig
"
,
new_db
).
saveByName
(
req
.
dbname
,
req
);
this
.
body
=
await
this
.
mongo
(
"
dbconfig
"
,
new_db
).
saveByName
(
req
.
dbname
,
req
);
try
{
this
.
logger
.
info
(
{
active
:
"
new_dbconfig
"
,
microservice_name
:
req
.
dbname
.
trim
(),
user
:
`
${
this
.
user
.
name
}
`
,
user_mail
:
`
${
this
.
user
.
mail
}
`
,
detail
:
{
dbname
:
req
.
dbname
.
trim
(),
ip
:
req
.
ip
.
trim
(),
port
:
parseInt
(
req
.
port
),
username
:
req
.
username
.
trim
()
||
""
,
passwd
:
req
.
passwd
.
trim
()
||
""
,
table_list
:
req
.
table_list
.
trim
()
||
""
,
update_at
:
req
.
update_at
}
});
}
catch
(
error
)
{
console
.
log
(
error
)
}
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
)
...
@@ -145,6 +185,17 @@ exports.delete = async function () {
...
@@ -145,6 +185,17 @@ exports.delete = async function () {
await
this
.
bindDefault
();
await
this
.
bindDefault
();
try
{
try
{
await
this
.
mongo
(
"
dbconfig
"
).
delete
(
this
.
request
.
query
.
_id
)
await
this
.
mongo
(
"
dbconfig
"
).
delete
(
this
.
request
.
query
.
_id
)
try
{
this
.
logger
.
info
(
{
active
:
"
delete_dbconfig
"
,
microservice_name
:
this
.
request
.
query
.
dbname
.
trim
(),
user
:
`
${
this
.
user
.
name
}
`
,
user_mail
:
`
${
this
.
user
.
mail
}
`
,
});
}
catch
(
error
)
{
console
.
log
(
error
)
}
this
.
body
=
{
code
:
"
0002
"
}
this
.
body
=
{
code
:
"
0002
"
}
}
catch
(
error
)
{
}
catch
(
error
)
{
//执行不到这里,即使删除前将要删除的记录手动删除了,也不会报错
//执行不到这里,即使删除前将要删除的记录手动删除了,也不会报错
...
...
app/qa-home/controller/proconfig/server.js
View file @
2c75b1e6
...
@@ -60,8 +60,32 @@ exports.save = async function () {
...
@@ -60,8 +60,32 @@ exports.save = async function () {
console
.
log
(
req
)
console
.
log
(
req
)
if
(
req
.
_id
)
{
if
(
req
.
_id
)
{
this
.
body
=
await
this
.
mongo
(
"
ProConfig
"
).
updateById
(
req
.
_id
,
new_pro
);
this
.
body
=
await
this
.
mongo
(
"
ProConfig
"
).
updateById
(
req
.
_id
,
new_pro
);
try
{
this
.
logger
.
info
(
{
active
:
"
update_proconfig
"
,
microservice_name
:
project_name
.
trim
(),
user
:
`
${
this
.
user
.
name
}
`
,
user_mail
:
`
${
this
.
user
.
mail
}
`
,
detail
:
new_pro
});
}
catch
(
error
)
{
console
.
log
(
error
)
}
}
else
{
}
else
{
this
.
body
=
await
this
.
mongo
(
"
ProConfig
"
,
new_pro
).
saveByPath
(
req
.
git_path
,
req
);
this
.
body
=
await
this
.
mongo
(
"
ProConfig
"
,
new_pro
).
saveByPath
(
req
.
git_path
,
req
);
try
{
this
.
logger
.
info
(
{
active
:
"
new_proconfig
"
,
microservice_name
:
project_name
.
trim
(),
user
:
`
${
this
.
user
.
name
}
`
,
user_mail
:
`
${
this
.
user
.
mail
}
`
,
detail
:
new_pro
});
}
catch
(
error
)
{
console
.
log
(
error
)
}
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
)
...
@@ -135,6 +159,17 @@ exports.delete = async function () {
...
@@ -135,6 +159,17 @@ exports.delete = async function () {
await
this
.
bindDefault
();
await
this
.
bindDefault
();
let
item
=
await
this
.
mongo
(
"
ProConfig
"
).
delete
(
this
.
request
.
query
.
_id
);
let
item
=
await
this
.
mongo
(
"
ProConfig
"
).
delete
(
this
.
request
.
query
.
_id
);
this
.
body
=
item
this
.
body
=
item
try
{
this
.
logger
.
info
(
{
active
:
"
delete_proconfig
"
,
microservice_name
:
this
.
request
.
query
.
project_name
.
trim
(),
user
:
`
${
this
.
user
.
name
}
`
,
user_mail
:
`
${
this
.
user
.
mail
}
`
,
});
}
catch
(
error
)
{
console
.
log
(
error
)
}
return
return
}
}
exports
.
delete
.
__method__
=
'
get
'
;
exports
.
delete
.
__method__
=
'
get
'
;
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