消息机器人完成
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
},
|
||||
"author": "kubbo",
|
||||
"dependencies": {
|
||||
"axios": "^1.2.1",
|
||||
"dayjs": "^1.11.0",
|
||||
"express": "^4.17.3",
|
||||
"fs-extra": "^10.0.1",
|
||||
|
||||
26
src/rest/custom/webhook.js
Normal file
26
src/rest/custom/webhook.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const dbUtils = require("../../utils/dbUitls");
|
||||
const axios = require("axios");
|
||||
module.exports = {
|
||||
action: "/node/custom/webhook",
|
||||
method: "post",
|
||||
execute: (request, response) => {
|
||||
let id = request.query?.id
|
||||
dbUtils.detail({table: 'node_custom_config', id}).then(info => {
|
||||
if (info?.id) {
|
||||
axios.post("https://qyapi.weixin.qq.com/cgi-bin/webhook/send", {
|
||||
msgtype: "markdown",
|
||||
markdown: {
|
||||
content: `> 发布系统:${info.name}
|
||||
> 发布版本:${info.version}
|
||||
> 打包完成时间:${info.download}`
|
||||
}
|
||||
}, {params: {key: "a5971027-2dd3-4c23-a4e4-c99a962d25a7",}}).then(res => {
|
||||
response.send({code: 0, msg: res.data})
|
||||
})
|
||||
} else response.send({code: 1, err: "无法找到项目信息"})
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
response.send({code: 1, err: err.sqlMessage})
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user