Browse Source

clickhouse params

release_0.0.2
巴林闲侠 2 years ago
parent
commit
9794a829d5
  1. 5
      api/.vscode/launch.json
  2. 17
      api/app/lib/controllers/organization/index.js
  3. 32
      api/config.js

5
api/.vscode/launch.json

@ -31,8 +31,9 @@
"--clickHouseUrl http://10.8.30.71", "--clickHouseUrl http://10.8.30.71",
"--clickHousePort 30123", "--clickHousePort 30123",
"--clickHouseAnxincloud anxinyun", "--clickHouseAnxincloud anxinyun",
"--clickHousePepEmis ssanxinyun1", "--clickHousePepEmis pepca",
"--clickHouseProjectManage anxinyun2", "--clickHouseProjectManage peppm",
"--clickHouseVcmp video_accrss1",
] ]
}, },
{ {

17
api/app/lib/controllers/organization/index.js

@ -44,10 +44,10 @@ async function editUser (ctx) {
// 存在且传递id 或者 不传id也存在 // 存在且传递id 或者 不传id也存在
// 修改 update // 修改 update
storageData.deleted = false storageData.deleted = false
storageData.role = [...new Set([...existUserRes.role, ...role])]
if ( if (
role.includes('admin') storageData.role.includes('admin')
) { ) {
storageData.role = [...new Set([...existUserRes.role, ...role])]
storageData.disabled = false storageData.disabled = false
} }
await models.User.update(storageData, { await models.User.update(storageData, {
@ -75,6 +75,16 @@ async function putUser (ctx) {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { pomsUserId } = ctx.params const { pomsUserId } = ctx.params
const { disabled = undefined, deleted = undefined } = ctx.request.body const { disabled = undefined, deleted = undefined } = ctx.request.body
const existUserRes = await models.User.findOne({
where: {
id: pomsUserId
}
})
if (existUserRes && existUserRes.role.includes('admin')) {
throw '已是管理员,请先解除管理员权限'
}
const updateData = { const updateData = {
disabled, disabled,
deleted, deleted,
@ -84,6 +94,7 @@ async function putUser (ctx) {
delete updateData[k] delete updateData[k]
} }
} }
await models.User.update(updateData, { await models.User.update(updateData, {
where: { where: {
id: pomsUserId id: pomsUserId
@ -94,7 +105,7 @@ async function putUser (ctx) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400; ctx.status = 400;
ctx.body = { ctx.body = {
message: typeof error == 'string' ? error : undefined
} }
} }
} }

32
api/config.js

@ -73,20 +73,14 @@ const CLICKHOUST_PEP_EMIS = process.env.CLICKHOUST_PEP_EMIS || flags.clickHouseP
const CLICKHOUST_PROJECT_MANAGE = process.env.CLICKHOUST_PROJECT_MANAGE || flags.clickHouseProjectManage const CLICKHOUST_PROJECT_MANAGE = process.env.CLICKHOUST_PROJECT_MANAGE || flags.clickHouseProjectManage
if ( if (
!POMS_DB || !POMS_DB
!IOTA_REDIS_SERVER_HOST || !IOTA_REDIS_SERVER_PORT || || !IOTA_REDIS_SERVER_HOST || !IOTA_REDIS_SERVER_PORT
!GOD_KEY || || !GOD_KEY
!API_ANXINYUN_URL || || !API_ANXINYUN_URL
!API_EMIS_URL || || !API_EMIS_URL
!QINIU_DOMAIN_QNDMN_RESOURCE || !QINIU_BUCKET_RESOURCE || !QINIU_AK || !QINIU_SK || !QINIU_DOMAIN_QNDMN_RESOURCE || !QINIU_BUCKET_RESOURCE || !QINIU_AK || !QINIU_SK
|| || !CLICKHOUST_URL || !CLICKHOUST_PORT
!CLICKHOUST_URL || !CLICKHOUST_ANXINCLOUD || !CLICKHOUST_PEP_EMIS || !CLICKHOUST_PROJECT_MANAGE
||
!CLICKHOUST_PORT ||
!CLICKHOUST_ANXINCLOUD ||
!CLICKHOUST_PEP_EMIS
||
!CLICKHOUST_PROJECT_MANAGE
) { ) {
console.log('缺少启动参数,异常退出'); console.log('缺少启动参数,异常退出');
args.showHelp(); args.showHelp();
@ -154,7 +148,15 @@ const product = {
key: GOD_KEY key: GOD_KEY
} }
} }
},] },],
clickHouse: {
url: CLICKHOUST_URL,
port: CLICKHOUST_PORT,
db:[{
name:'',
db:''
}]
}
} }
} }
], ],

Loading…
Cancel
Save