feat: 优化简报收集器请求参数,添加用户Id和chat_id
All checks were successful
Egg CI/CD / build-image (push) Successful in 19s
Egg CI/CD / deploy (push) Successful in 23s

This commit is contained in:
zhaoyingbo 2024-05-21 03:10:38 +00:00
parent e047b97d90
commit bf8df7a1b7
2 changed files with 17 additions and 17 deletions

View File

@ -75,20 +75,6 @@ const manageCIMsg = async (chatId: string) => {
lark.sendMsg("chat_id", chatId, "interactive", await fetchCIMonitor());
};
/**
*
* @param chatId - chatId
* @param msg -
*/
const manageReportMsg = async (chatId: string, msg: string, user: string) => {
lark.sendMsg(
"chat_id",
chatId,
"interactive",
await fetchReportCollector(msg, user)
);
};
/**
* ID消息
* @param chatId - chatId
@ -126,7 +112,7 @@ const manageCMDMsg = (body: LarkMessageEvent) => {
return true;
}
if (text.includes("share") && text.includes("简报")) {
manageReportMsg(chatId, text, getUserId(body));
fetchReportCollector(text, getUserId(body), chatId);
return true;
}
return false;

View File

@ -1,3 +1,6 @@
/**
* CI
*/
export const fetchCIMonitor = async () => {
try {
const res = await fetch("https://ci-monitor.xiaomiwh.cn/ci");
@ -7,8 +10,19 @@ export const fetchCIMonitor = async () => {
}
};
export const fetchReportCollector = async (msg: string, user: string) => {
const url = `https://report.imoaix.cn/report?msg=${msg}&user=${user}`;
/**
*
* @param msg
* @param user
* @param chat_id
* @returns
*/
export const fetchReportCollector = async (
msg: string,
user: string,
chat_id: string
) => {
const url = `https://report.imoaix.cn/report?msg=${msg}&user=${user}&chat_id=${chat_id}`;
try {
const res = await fetch(url);
return ((await res.json()) as string) || "";