Commit 3ba20050 authored by zhijie.xue's avatar zhijie.xue

修复eslint报错

parent 11b647d5
...@@ -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'
...@@ -48,7 +50,7 @@ const dbSync = async function (ctx) { ...@@ -48,7 +50,7 @@ const dbSync = async function (ctx) {
not_delete_business_data: req.not_delete_business_data, not_delete_business_data: req.not_delete_business_data,
use_cache: req.use_cache, use_cache: req.use_cache,
domain, domain,
}) })
ctx.body = ctx.ok({ location: res.location }) ctx.body = ctx.ok({ location: res.location })
} }
...@@ -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,
......
...@@ -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) {
......
...@@ -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) => {
const regRes = reg.exec(next.host_name) if (next.type) {
prev[next.project_name] = { const regRes = reg.exec(next.host_name)
hostname: next.host_name, prev[next.project_name] = {
domain: regRes ? regRes[1] : '', hostname: next.host_name,
type: next.type, domain: regRes ? regRes[1] : '',
type: next.type,
}
} else {
console.error(`项目缺少类型, ${res}`);
} }
return prev return prev
}, {}) }, {})
return o return o
......
...@@ -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
let permissions = data.permissions const permissions = data.permissions
var temp_permissions = [] const tempPermissions = []
permissions.forEach(item => { permissions.forEach((item) => {
if (item.user === 'rabbit_admin') { if (item.user === 'rabbit_admin') {
let tmp = JSON.stringify(item) const tmp = JSON.stringify(item)
let result = JSON.parse(tmp) const result = JSON.parse(tmp)
result.user = 'qa' result.user = 'qa'
temp_permissions.push(item) tempPermissions.push(item)
temp_permissions.push(result) tempPermissions.push(result)
} else if (item.user !== 'qa' && item.user !== 'rabbit_admin') { } else if (item.user !== 'qa' && item.user !== 'rabbit_admin') {
temp_permissions.push(item) tempPermissions.push(item)
} }
}) })
data.permissions = temp_permissions data.permissions = tempPermissions
return http.post(`http://${host}/api/definitions`, data, { return http.post(`http://${host}/api/definitions`, data, {
headers: { headers: {
Authorization: qaAuth, Authorization: qaAuth,
......
...@@ -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',
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment