From 862d885d2193566c294b17e8b07a62889d392568 Mon Sep 17 00:00:00 2001 From: hahwu <31872165+hahwu@users.noreply.github.com> Date: Wed, 12 Feb 2025 12:21:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=BB=E8=BE=91=E9=94=99=E8=AF=AF=E5=8F=91?= =?UTF-8?q?=E9=80=81=E5=88=B0=E9=A3=9E=E4=B9=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/GoUtil/feishu.go | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/server/GoUtil/feishu.go b/src/server/GoUtil/feishu.go index 36d6416b..c3b8aec4 100644 --- a/src/server/GoUtil/feishu.go +++ b/src/server/GoUtil/feishu.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "net/http" + "server/conf" ) const ( @@ -14,9 +15,35 @@ const ( func SendFeishuMsg(msg string) error { // 创建请求体 payload := map[string]interface{}{ - "msg_type": "text", - "content": map[string]string{ - "text": msg, + "msg_type": "post", + "content": map[string]interface{}{ + "post": map[string]interface{}{ + "zh_cn": map[string]interface{}{ + "title": "服务器报错提醒", + "content": [][]map[string]interface{}{ + { + { + "tag": "text", + "text": fmt.Sprintf("AppName:%s", conf.Server.GameName), + // "style": []string{"bold", "lineThrough"}, + }, + }, + { + { + "tag": "text", + "text": fmt.Sprintf("ServerName:%s", conf.Server.ServerName), + // "style": []string{"bold", "lineThrough"}, + }, + }, + { + { + "tag": "text", + "text": msg, + }, + }, + }, + }, + }, }, } payloadBytes, err := json.Marshal(payload)