From f743f95567c8dad812660aee672d91510b66e55d Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Sat, 17 Sep 2022 17:03:14 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=91=E5=AE=9A=E5=85=B3=E7=B3=BB=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/project/bind.js | 26 ++++++++++++++++++++++++- api/app/lib/routes/project/index.js | 3 +++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/api/app/lib/controllers/project/bind.js b/api/app/lib/controllers/project/bind.js index 7985ee2..8a0981a 100644 --- a/api/app/lib/controllers/project/bind.js +++ b/api/app/lib/controllers/project/bind.js @@ -153,7 +153,31 @@ async function bindAnxin2pep (ctx) { } } +async function del (ctx) { + try { + const models = ctx.fs.dc.models; + const { bindId } = ctx.query + + await models.ProjectCorrelation.update({ + del: true + }, { + where: { + id: bindId + } + }) + + ctx.status = 20; + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: error`); + ctx.status = 400; + ctx.body = { + message: typeof error == 'string' ? error : undefined + } + } +} + module.exports = { - bindAnxin2pep + bindAnxin2pep, + del }; \ No newline at end of file diff --git a/api/app/lib/routes/project/index.js b/api/app/lib/routes/project/index.js index ec27061..241aaf3 100644 --- a/api/app/lib/routes/project/index.js +++ b/api/app/lib/routes/project/index.js @@ -10,6 +10,9 @@ module.exports = function (app, router, opts) { app.fs.api.logAttr['POST/project/bind'] = { content: '绑定安心云、项目管理项目', visible: true }; router.post('/project/bind', projectBind.bindAnxin2pep); + app.fs.api.logAttr['DEL/project/bind/:bindId'] = { content: '删除安心云、项目管理项目绑定关系', visible: true }; + router.delete('/project/bind/:bindId', projectBind.del); + app.fs.api.logAttr['GET/project/anxincloud'] = { content: '获取安心云项目', visible: true }; router.get('/project/anxincloud', project.projectAnxincloud);