系统优化

This commit is contained in:
hahwu 2025-03-07 15:43:44 +08:00
parent 780f501941
commit fe15155400
2 changed files with 12 additions and 20 deletions

View File

@ -6,30 +6,22 @@ import (
"fmt" "fmt"
"net/http" "net/http"
"server/conf" "server/conf"
"time"
) )
const ( const (
FEISHU_WEBHOOK = "https://open.feishu.cn/open-apis/bot/v2/hook/70e24a79-b019-434a-b4d1-4592bbf7c311" FEISHU_WEBHOOK = "https://gadmin.bywaystudios.com/api/feishu/notify"
) )
// AAqFpbuPhFSEx // AAqFpbuPhFSEx
func SendFeishuFatal(PlayerId int, FuncName string, msg string) error { func SendFeishuFatal(PlayerId int, FuncName string, msg string) error {
// 创建请求体 // 创建请求体
payload := map[string]interface{}{ payload := map[string]interface{}{
"msg_type": "interactive", "notify_msg": fmt.Sprintf("游戏接口出错 %s:%d", conf.Server.GameName, PlayerId),
"card": map[string]interface{}{ "host": FuncName,
"type": "template", "event_name": msg,
"data": map[string]interface{}{ "severity": "High",
"template_id": "AAqFpbuPhFSEx", "alarm_time": time.Unix(time.Now().Unix(), 0).Format("2006-01-02 15:04:05"),
"template_version_name": "1.0.0",
"template_variable": map[string]interface{}{
"appName": conf.Server.GameName,
"playerId": PlayerId,
"funcName": FuncName,
"fatal_msg": msg,
},
},
},
} }
payloadBytes, err := json.Marshal(payload) payloadBytes, err := json.Marshal(payload)
if err != nil { if err != nil {

View File

@ -31,11 +31,11 @@ func ReqGmCommand(player *Player, buf []byte) error {
return ReqGmCommand_(player, detail.Command) return ReqGmCommand_(player, detail.Command)
} }
func ReqGmCommand_(player *Player, Command string) error { func ReqGmCommand_(player *Player, Command string) error {
defer func() { // defer func() {
if err := recover(); err != nil { // if err := recover(); err != nil {
log.Error("ReqGmCommand panic: %v", err) // log.Error("ReqGmCommand panic: %v", err)
} // }
}() // }()
arg := strings.Split(Command, " ") arg := strings.Split(Command, " ")
switch arg[0] { switch arg[0] {
case "additem": case "additem":