From 12fae8c9a862c7894f0dddb08fc5c836beff1e20 Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Sun, 11 Oct 2020 05:41:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=B4=E6=8A=A4=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/routes/index.js b/routes/index.js index 8c7ef3c..c51c366 100644 --- a/routes/index.js +++ b/routes/index.js @@ -41,6 +41,7 @@ function dingding(message){ //记录开始部署的时间 const startDeploy={} + //web钩子事件 //git@gogs.kirito.cool:panqihua/RiskCloudMock.git push事件 router.post('/deploy', function(req, res, next) { @@ -48,13 +49,14 @@ router.post('/deploy', function(req, res, next) { //提交日志,多次提交只取第一个 const commitsMsg=req.body.commits[0].message //更新时间 - const updated_at=req.body.repository.updated_at + const updated_at= moment(req.body.repository.updated_at).utcOffset(480).format('yyyy-MM-DD HH:mm:ss') //仓库名字 const name=req.body.repository.name //仓库描述信息 const description=req.body.repository.description + try { startDeploy[name] = { startTime: moment(), @@ -96,8 +98,9 @@ router.post('/finsh', function(req, res, next) { dingding(`${req.body.name}|${deployInfo.description}自动部署成功,花费时间:${moment().diff(deployInfo.startTime, 'seconds', true)}秒`) res.json({message:`仓库代码${req.body.name}部署成功`}) }else { - error('参数异常,无法试别部署完毕事件') - res.error() + let msg='参数异常,无法试别部署完毕事件' + error(msg) + res.json({msg}) } });