From fa0777b6ae78151022c6b1e948a2d965c641b5e4 Mon Sep 17 00:00:00 2001 From: zhaoyingbo Date: Mon, 1 Jul 2024 12:40:38 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8E=A5=E5=8F=A3=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/manageRobot/index.ts | 7 ++----- service/index.ts | 4 ++-- service/{egg.ts => sendMessage.ts} | 8 ++------ 3 files changed, 6 insertions(+), 13 deletions(-) rename service/{egg.ts => sendMessage.ts} (82%) diff --git a/controllers/manageRobot/index.ts b/controllers/manageRobot/index.ts index fcb5a9f..ad1155b 100644 --- a/controllers/manageRobot/index.ts +++ b/controllers/manageRobot/index.ts @@ -121,7 +121,7 @@ const getRobotMsg = async () => * @param chat_id */ const sendCIReportByChatId = async (chat_id: string) => { - await service.egg.sendMessage.byChatId(chat_id, await getRobotMsg()); + await service.sendMessage.byChatId(chat_id, await getRobotMsg()); }; /** @@ -129,10 +129,7 @@ const sendCIReportByChatId = async (chat_id: string) => { * @returns */ const sendCIReportByCron = async () => - await service.egg.sendMessage.byGroupId( - "52usf3w8l6z4vs1", - await getRobotMsg() - ); + await service.sendMessage.byGroupId("52usf3w8l6z4vs1", await getRobotMsg()); const manageRobot = { sendCIReportByChatId, diff --git a/service/index.ts b/service/index.ts index efa591c..bf18c74 100644 --- a/service/index.ts +++ b/service/index.ts @@ -1,9 +1,9 @@ -import egg from "./egg"; +import sendMessage from "./sendMessage"; import gitlab from "./gitlab"; const service = { gitlab, - egg, + sendMessage, }; export default service; diff --git a/service/egg.ts b/service/sendMessage.ts similarity index 82% rename from service/egg.ts rename to service/sendMessage.ts index c266206..7392d3e 100644 --- a/service/egg.ts +++ b/service/sendMessage.ts @@ -3,7 +3,7 @@ import netTool from "./netTool"; const sendMessage = async (body: any) => { const URL = "https://egg.imoaix.cn/message"; try { - const res = await netTool.post(URL, JSON.stringify(body)); + const res = await netTool.post(URL, body); return res; } catch { return null; @@ -27,8 +27,4 @@ sendMessage.byChatId = async (chat_id: string, content: string) => { }); }; -const egg = { - sendMessage, -}; - -export default egg; +export default sendMessage;