feat: 优化简报收集器请求参数,添加用户Id和chat_id
This commit is contained in:
parent
e047b97d90
commit
bf8df7a1b7
@ -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;
|
||||
|
@ -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) || "";
|
||||
|
Loading…
x
Reference in New Issue
Block a user