feat: 接口改为返回JSON
All checks were successful
CI Monitor CI/CD / build-image (push) Successful in 22s
CI Monitor CI/CD / deploy (push) Successful in 24s

This commit is contained in:
zhaoyingbo 2024-03-08 19:15:14 +08:00
parent f25c9aaa37
commit f387806924
2 changed files with 13 additions and 15 deletions

View File

@ -97,8 +97,7 @@ const getProjDiffInfo = async () => {
return group.slice(0, 5);
};
const sendRobotMsg = async () => {
const msgContent = {
const getRobotMsg = async () => JSON.stringify({
type: "template",
data: {
template_id: "ctp_AAyVLS6Q37cL",
@ -108,13 +107,12 @@ const sendRobotMsg = async () => {
group_table: await getProjDiffInfo(),
},
},
};
})
const res = await service.sendMessage(JSON.stringify(msgContent));
console.log(res);
};
const sendRobotMsg = async () => await service.sendMessage(await getRobotMsg())
const manageRobot = {
getRobotMsg,
sendRobotMsg,
};

View File

@ -28,7 +28,7 @@ Bun.serve({
async fetch(req) {
const url = new URL(req.url);
if (url.pathname === '/ci') {
await manageRobot.sendRobotMsg();
return Response.json(await manageRobot.getRobotMsg());
}
return new Response("OK");
},