From 3b35ec6cf96f8c6dfed9e752dc41aa0ac25aacd2 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Thu, 15 Sep 2022 17:06:38 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E5=88=A4=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/project/index.js | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/api/app/lib/controllers/project/index.js b/api/app/lib/controllers/project/index.js index df0008f..70af536 100644 --- a/api/app/lib/controllers/project/index.js +++ b/api/app/lib/controllers/project/index.js @@ -20,7 +20,44 @@ async function appList (ctx) { } } +async function projectAnxincloud (ctx) { + try { + const models = ctx.fs.dc.models; + const { clickHouse } = ctx.app.fs + + const projectRes = await clickHouse.anxinyun.query(`SELECT * FROM t_project WHERE project_state = 4 ORDER BY id DESC`).toPromise() + + ctx.status = 200; + ctx.body = projectRes + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: error`); + ctx.status = 400; + ctx.body = { + message: typeof error == 'string' ? error : undefined + } + } +} + +async function projectPManage (ctx) { + try { + const models = ctx.fs.dc.models; + const { clickHouse } = ctx.app.fs + + const projectRes = await clickHouse.projectManage.query(`SELECT * FROM t_project WHERE project_state = 4 ORDER BY id DESC`).toPromise() + + ctx.status = 200; + ctx.body = projectRes + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: error`); + ctx.status = 400; + ctx.body = { + message: typeof error == 'string' ? error : undefined + } + } +} module.exports = { appList, + projectAnxincloud, + projectPManage, }; \ No newline at end of file