egg_server/service/index.ts
zhaoyingbo dab5b18276
All checks were successful
Egg CI/CD / build-image (push) Successful in 38s
Egg CI/CD / deploy (push) Successful in 1m19s
feat: 修改请求report的方式为完整的Body
2024-05-24 12:01:51 +00:00

38 lines
841 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { LarkMessageEvent } from "../types";
/**
* 请求 CI 监控
*/
export const fetchCIMonitor = async (chat_id: string) => {
try {
const res = await fetch(
`https://ci-monitor.xiaomiwh.cn/ci?chat_id=${chat_id}`
);
return ((await res.json()) as string) || "";
} catch {
return "";
}
};
/**
* 请求简报收集器
* @param body
* @returns
*/
export const fetchReportCollector = async (body: LarkMessageEvent) => {
const url = "https://report.imoaix.cn/report";
// 将body作为请求体post到url
try {
const res = await fetch(url, {
method: "POST",
body: JSON.stringify(body),
headers: {
"Content-Type": "application/json",
},
});
return ((await res.json()) as string) || "";
} catch {
return "";
}
};