38 lines
841 B
TypeScript
38 lines
841 B
TypeScript
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 "";
|
||
}
|
||
};
|