feat: 接口改为返回JSON
This commit is contained in:
parent
f25c9aaa37
commit
f387806924
@ -97,24 +97,22 @@ const getProjDiffInfo = async () => {
|
|||||||
return group.slice(0, 5);
|
return group.slice(0, 5);
|
||||||
};
|
};
|
||||||
|
|
||||||
const sendRobotMsg = async () => {
|
const getRobotMsg = async () => JSON.stringify({
|
||||||
const msgContent = {
|
type: "template",
|
||||||
type: "template",
|
data: {
|
||||||
data: {
|
template_id: "ctp_AAyVLS6Q37cL",
|
||||||
template_id: "ctp_AAyVLS6Q37cL",
|
template_variable: {
|
||||||
template_variable: {
|
...(await getNewCicdStatus()),
|
||||||
...(await getNewCicdStatus()),
|
...(await getStatisticsInfo()),
|
||||||
...(await getStatisticsInfo()),
|
group_table: await getProjDiffInfo(),
|
||||||
group_table: await getProjDiffInfo(),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
|
})
|
||||||
|
|
||||||
const res = await service.sendMessage(JSON.stringify(msgContent));
|
const sendRobotMsg = async () => await service.sendMessage(await getRobotMsg())
|
||||||
console.log(res);
|
|
||||||
};
|
|
||||||
|
|
||||||
const manageRobot = {
|
const manageRobot = {
|
||||||
|
getRobotMsg,
|
||||||
sendRobotMsg,
|
sendRobotMsg,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
2
index.ts
2
index.ts
@ -28,7 +28,7 @@ Bun.serve({
|
|||||||
async fetch(req) {
|
async fetch(req) {
|
||||||
const url = new URL(req.url);
|
const url = new URL(req.url);
|
||||||
if (url.pathname === '/ci') {
|
if (url.pathname === '/ci') {
|
||||||
await manageRobot.sendRobotMsg();
|
return Response.json(await manageRobot.getRobotMsg());
|
||||||
}
|
}
|
||||||
return new Response("OK");
|
return new Response("OK");
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user