diff --git a/routes/index.js b/routes/index.js index d3dc25e..8630092 100644 --- a/routes/index.js +++ b/routes/index.js @@ -26,6 +26,7 @@ function dingding(message){ const url=`https://oapi.dingtalk.com/robot/send?access_token=${access_token}` info(url) fetch(url,{ + method:'POST', headers:{ 'Content-Type':'application/json' }, @@ -35,7 +36,7 @@ function dingding(message){ content:message } }) - }).then(res=>res.json()).then(res=>info(`钉钉推送结果:${JSON.stringify(res ,null, 2)}`)).catch(err=>error(err)) + }).then(res=>res.json()).then(res=>info(`钉钉推送结果:${JSON.stringify(res ,null, 2)}`)).catch(err=>error(`钉钉推送异常:${err}`)) } //记录开始部署的时间 const startDeploy={} @@ -91,7 +92,7 @@ router.post('/deploy', function(req, res, next) { //部署完毕事件 router.get('/finsh', function(req, res, next) { dingding(`${req.query.name}|${startDeploy[req.query.name].description}自动部署成功, - 花费时间:${moment().diff(startDeploy[req.query.name].startTime,'seconds')}秒`) + 花费时间:${moment().diff(startDeploy[req.query.name].startTime,'seconds',true)}秒`) res.json({message:`仓库代码${req.query.name}部署成功`}) });