优化notification GM

This commit is contained in:
hahwu 2026-02-27 00:31:03 +08:00
parent f56121d9ee
commit 7b6ed80126
2 changed files with 23 additions and 1 deletions

View File

@ -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)

View File

@ -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"
)
@ -96,6 +99,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.")
}