From d10124fdb2f658c41b74b23dd5cdbe220ded23b6 Mon Sep 17 00:00:00 2001 From: hahwu <31872165+hahwu@users.noreply.github.com> Date: Fri, 27 Feb 2026 00:31:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96notification=20GM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/server/game/gm_handler.go | 11 +++++++++++ src/server/test/fix_test.go | 13 ++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/server/game/gm_handler.go b/src/server/game/gm_handler.go index b4327146..73d4eef7 100644 --- a/src/server/game/gm_handler.go +++ b/src/server/game/gm_handler.go @@ -11,7 +11,9 @@ import ( chargeCfg "server/conf/charge" emojiCfg "server/conf/emoji" faceCfg "server/conf/face" + languageCfg "server/conf/language" mergeDataCfg "server/conf/merge_data" + notification_cfg "server/conf/notification" playroomCfg "server/conf/playroom" "server/db" "server/game/mod/activity" @@ -602,6 +604,15 @@ func ReqGmCommand_(player *Player, Command string) error { NotifyPetroomGame(Id) case "notificationTest": Id, _ := strconv.Atoi(arg[1]) + PlayerSimpleData := G_GameLogicPtr.GetSimplePlayerByUid(Id) + if PlayerSimpleData == nil { + return nil + } + titlekey, infokey := notification_cfg.GetFriendApplyNotificationMsg() + title := languageCfg.GetLanguage(msg.LANG_TYPE(PlayerSimpleData.Lang), titlekey) + info := languageCfg.GetLanguage(msg.LANG_TYPE(PlayerSimpleData.Lang), infokey) + BaseMod := player.PlayMod.getBaseMod() + GoUtil.NotifyPlayer(GoUtil.Int(PlayerSimpleData.Account), 2, title, fmt.Sprintf(info, BaseMod.NickName)) GoUtil.NotifyPlayer(Id, 1, "Test Notification", "This is a test notification from the server.") default: return fmt.Errorf("Player %d ReqGmCommand:%v not found", player.M_DwUin, arg) diff --git a/src/server/test/fix_test.go b/src/server/test/fix_test.go index 36de50a4..6e51616e 100644 --- a/src/server/test/fix_test.go +++ b/src/server/test/fix_test.go @@ -3,9 +3,12 @@ package test import ( "fmt" decorateCfg "server/conf/decorate" + languageCfg "server/conf/language" + notification_cfg "server/conf/notification" "server/db" "server/game" GoUtil "server/game_util" + "server/msg" "server/pkg/github.com/name5566/leaf/log" "testing" ) @@ -94,6 +97,14 @@ func TestEndless(t *testing.T) { MailMod.BackData() } +// 10130 10165 func TestNotify(t *testing.T) { - GoUtil.NotifyPlayer(19246, 1, "Test Notification", "This is a test notification from the server.") + titlekey, infokey := notification_cfg.GetFriendApplyNotificationMsg() + title := languageCfg.GetLanguage(msg.LANG_TYPE(1), titlekey) + info := languageCfg.GetLanguage(msg.LANG_TYPE(1), infokey) + // titlekey, infokey := notification_cfg.GetPetroomGameNotificationMsg() + // title := languageCfg.GetLanguage(msg.LANG_TYPE(1), titlekey) + // info := languageCfg.GetLanguage(msg.LANG_TYPE(1), infokey) + GoUtil.NotifyPlayer(10130, 2, title, fmt.Sprintf(info, "猫猫")) + // GoUtil.NotifyPlayer(19246, 1, "Test Notification", "This is a test notification from the server.") }