Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qa-api
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
1
Merge Requests
1
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
qa-api
Commits
c3f135a0
Commit
c3f135a0
authored
Sep 01, 2020
by
黎博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
打印日志
parent
9bd6e83b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
dbsync.js
app/controller/dbsync.js
+16
-12
No files found.
app/controller/dbsync.js
View file @
c3f135a0
...
@@ -97,9 +97,25 @@ const dbSyncTke = async function (ctx) {
...
@@ -97,9 +97,25 @@ const dbSyncTke = async function (ctx) {
ctx
.
body
=
ctx
.
fail
(
'
获取mysql服务端口号失败
'
)
ctx
.
body
=
ctx
.
fail
(
'
获取mysql服务端口号失败
'
)
return
return
}
}
res
=
await
jenkinsService
.
build_with_params
(
'
sync_database_schema
'
,
{
depth
:
1
,
sync_db_name
:
req
.
dbname
,
target_db_host
:
publicIp
,
target_db_port
:
port
,
re_replace_ip
:
req
.
namespace
,
not_delete_business_data
:
req
.
not_delete_business_data
,
use_cache
:
req
.
use_cache
,
domain
:
domainTKE
,
})
ctx
.
body
=
ctx
.
ok
({
location
:
res
.
location
})
// 数据库同步时新增行为记录
// 数据库同步时新增行为记录
if
(
ctx
.
request
.
method
===
'
POST
'
&&
ctx
.
response
.
status
===
200
)
{
if
(
ctx
.
request
.
method
===
'
POST
'
&&
ctx
.
response
.
status
===
200
)
{
logger
.
info
(
'
已进入记录日志里
'
)
logger
.
info
(
'
ctx.request:
'
+
ctx
.
request
)
const
user
=
await
ctx
.
redisGet
(
config
.
QA_TOKEN
,
ctx
.
request
.
header
[
'
x-token
'
])
const
user
=
await
ctx
.
redisGet
(
config
.
QA_TOKEN
,
ctx
.
request
.
header
[
'
x-token
'
])
logger
.
info
(
'
user:
'
+
user
)
if
(
user
)
{
if
(
user
)
{
const
body
=
ctx
.
request
.
body
const
body
=
ctx
.
request
.
body
const
data
=
{
const
data
=
{
...
@@ -113,18 +129,6 @@ const dbSyncTke = async function (ctx) {
...
@@ -113,18 +129,6 @@ const dbSyncTke = async function (ctx) {
await
StatisticsLog
.
saveLog
(
data
);
await
StatisticsLog
.
saveLog
(
data
);
}
}
}
}
res
=
await
jenkinsService
.
build_with_params
(
'
sync_database_schema
'
,
{
depth
:
1
,
sync_db_name
:
req
.
dbname
,
target_db_host
:
publicIp
,
target_db_port
:
port
,
re_replace_ip
:
req
.
namespace
,
not_delete_business_data
:
req
.
not_delete_business_data
,
use_cache
:
req
.
use_cache
,
domain
:
domainTKE
,
})
ctx
.
body
=
ctx
.
ok
({
location
:
res
.
location
})
}
}
const
dbSyncQuery
=
async
function
(
ctx
)
{
const
dbSyncQuery
=
async
function
(
ctx
)
{
...
...
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