增加维护页面

master
pan 4 years ago
parent bf9df15208
commit 12fae8c9a8
  1. 9
      routes/index.js

@ -41,6 +41,7 @@ function dingding(message){
//记录开始部署的时间 //记录开始部署的时间
const startDeploy={} const startDeploy={}
//web钩子事件 //web钩子事件
//git@gogs.kirito.cool:panqihua/RiskCloudMock.git push事件 //git@gogs.kirito.cool:panqihua/RiskCloudMock.git push事件
router.post('/deploy', function(req, res, next) { 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 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 name=req.body.repository.name
//仓库描述信息 //仓库描述信息
const description=req.body.repository.description const description=req.body.repository.description
try { try {
startDeploy[name] = { startDeploy[name] = {
startTime: moment(), 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)}`) dingding(`${req.body.name}|${deployInfo.description}自动部署成功,花费时间:${moment().diff(deployInfo.startTime, 'seconds', true)}`)
res.json({message:`仓库代码${req.body.name}部署成功`}) res.json({message:`仓库代码${req.body.name}部署成功`})
}else { }else {
error('参数异常,无法试别部署完毕事件') let msg='参数异常,无法试别部署完毕事件'
res.error() error(msg)
res.json({msg})
} }
}); });

Loading…
Cancel
Save