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
3ba20050
Commit
3ba20050
authored
Mar 08, 2021
by
zhijie.xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复eslint报错
parent
11b647d5
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
19 deletions
+26
-19
dbsync.js
app/controller/dbsync.js
+5
-3
user.js
app/controller/user.js
+1
-1
ProConfig.js
app/model/mongo/qa_api/ProConfig.js
+10
-5
mqService.js
app/service/mqService.js
+9
-9
prod.config.js
src/prod.config.js
+1
-1
No files found.
app/controller/dbsync.js
View file @
3ba20050
...
@@ -9,6 +9,8 @@ const { DBConfig } = require('../service/mongoService')
...
@@ -9,6 +9,8 @@ const { DBConfig } = require('../service/mongoService')
const
{
api
}
=
require
(
'
../../src
'
)
const
{
api
}
=
require
(
'
../../src
'
)
const
{
StatisticsLog
}
=
require
(
'
../service/mongoService
'
);
const
{
StatisticsLog
}
=
require
(
'
../service/mongoService
'
);
const
config
=
require
(
global
.
configPath
)
const
domain
=
'
liangkebang.com
'
const
domain
=
'
liangkebang.com
'
let
domainTKE
=
'
liangkebang.net
'
let
domainTKE
=
'
liangkebang.net
'
...
@@ -112,13 +114,13 @@ const dbSyncTke = async function (ctx) {
...
@@ -112,13 +114,13 @@ const dbSyncTke = async function (ctx) {
ctx
.
body
=
ctx
.
ok
({
location
:
res
.
location
})
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
)
{
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
'
])
if
(
user
)
{
if
(
user
)
{
const
body
=
ctx
.
request
.
body
const
body
=
ctx
.
request
.
body
const
data
=
{
const
data
=
{
namespace
:
body
.
namespace
,
namespace
:
body
.
namespace
,
active
:
'
同步
'
+
body
.
mysqlName
,
active
:
`同步
${
body
.
mysqlName
}
`
,
microservice_name
:
body
.
dbname
,
microservice_name
:
body
.
dbname
,
user
:
user
.
cn
,
user
:
user
.
cn
,
user_mail
:
user
.
mail
,
user_mail
:
user
.
mail
,
...
...
app/controller/user.js
View file @
3ba20050
...
@@ -12,7 +12,7 @@ const authenticate = require('../service/authenticate')
...
@@ -12,7 +12,7 @@ const authenticate = require('../service/authenticate')
const
router
=
new
Router
()
const
router
=
new
Router
()
const
admin
=
[
'
qiaoling.yu
'
,
'
zhijie.xue
'
,
'
luoyong.meng
'
,
'
qiuyue.gui
'
,
'
bo.li
'
,
'
haiyuan.wen
'
,
'
jinsong.zhu
'
]
const
admin
=
[
'
qiaoling.yu
'
,
'
zhijie.xue
'
,
'
luoyong.meng
'
,
'
qiuyue.gui
'
,
'
bo.li
'
,
'
haiyuan.wen
'
,
'
jinsong.zhu
'
]
const
login
=
async
function
(
ctx
)
{
const
login
=
async
function
(
ctx
)
{
...
...
app/model/mongo/qa_api/ProConfig.js
View file @
3ba20050
...
@@ -46,12 +46,17 @@ schema.statics.getActiveProjectsHostName = function () {
...
@@ -46,12 +46,17 @@ schema.statics.getActiveProjectsHostName = function () {
const
reg
=
/^
([\w
-
\.]
+
)\.[\w
-
]
+
\.[
a-z
]
+$/
const
reg
=
/^
([\w
-
\.]
+
)\.[\w
-
]
+
\.[
a-z
]
+$/
// 转为对象形式
// 转为对象形式
const
o
=
res
.
reduce
((
prev
,
next
)
=>
{
const
o
=
res
.
reduce
((
prev
,
next
)
=>
{
if
(
next
.
type
)
{
const
regRes
=
reg
.
exec
(
next
.
host_name
)
const
regRes
=
reg
.
exec
(
next
.
host_name
)
prev
[
next
.
project_name
]
=
{
prev
[
next
.
project_name
]
=
{
hostname
:
next
.
host_name
,
hostname
:
next
.
host_name
,
domain
:
regRes
?
regRes
[
1
]
:
''
,
domain
:
regRes
?
regRes
[
1
]
:
''
,
type
:
next
.
type
,
type
:
next
.
type
,
}
}
}
else
{
console
.
error
(
`项目缺少类型,
${
res
}
`
);
}
return
prev
return
prev
},
{})
},
{})
return
o
return
o
...
...
app/service/mqService.js
View file @
3ba20050
...
@@ -15,20 +15,20 @@ exports.getDefinitionsOfHost = function (host) {
...
@@ -15,20 +15,20 @@ exports.getDefinitionsOfHost = function (host) {
exports
.
setDefinitions
=
function
(
host
,
data
)
{
exports
.
setDefinitions
=
function
(
host
,
data
)
{
// 将rabbit_admin的权限同步给qa
// 将rabbit_admin的权限同步给qa
le
t
permissions
=
data
.
permissions
cons
t
permissions
=
data
.
permissions
var
temp_p
ermissions
=
[]
const
tempP
ermissions
=
[]
permissions
.
forEach
(
item
=>
{
permissions
.
forEach
(
(
item
)
=>
{
if
(
item
.
user
===
'
rabbit_admin
'
)
{
if
(
item
.
user
===
'
rabbit_admin
'
)
{
le
t
tmp
=
JSON
.
stringify
(
item
)
cons
t
tmp
=
JSON
.
stringify
(
item
)
le
t
result
=
JSON
.
parse
(
tmp
)
cons
t
result
=
JSON
.
parse
(
tmp
)
result
.
user
=
'
qa
'
result
.
user
=
'
qa
'
temp
_p
ermissions
.
push
(
item
)
temp
P
ermissions
.
push
(
item
)
temp
_p
ermissions
.
push
(
result
)
temp
P
ermissions
.
push
(
result
)
}
else
if
(
item
.
user
!==
'
qa
'
&&
item
.
user
!==
'
rabbit_admin
'
)
{
}
else
if
(
item
.
user
!==
'
qa
'
&&
item
.
user
!==
'
rabbit_admin
'
)
{
temp
_p
ermissions
.
push
(
item
)
temp
P
ermissions
.
push
(
item
)
}
}
})
})
data
.
permissions
=
temp
_p
ermissions
data
.
permissions
=
temp
P
ermissions
return
http
.
post
(
`http://
${
host
}
/api/definitions`
,
data
,
{
return
http
.
post
(
`http://
${
host
}
/api/definitions`
,
data
,
{
headers
:
{
headers
:
{
Authorization
:
qaAuth
,
Authorization
:
qaAuth
,
...
...
src/prod.config.js
View file @
3ba20050
...
@@ -34,7 +34,7 @@ module.exports = {
...
@@ -34,7 +34,7 @@ module.exports = {
auth
:
'
Basic cWE6cWF0ZXN0
'
,
auth
:
'
Basic cWE6cWF0ZXN0
'
,
},
},
//
qahome的账户一般没人动。密码的话可能一年失效一次。到时候需要重新改下密码。
//
qahome的账户一般没人动。密码的话可能一年失效一次。到时候需要重新改下密码。
jenkins
:
{
jenkins
:
{
api
:
'
http://qahome:Quantgroup123@192.168.4.96:8080
'
,
api
:
'
http://qahome:Quantgroup123@192.168.4.96:8080
'
,
},
},
...
...
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