From d1111725ef6714edfd5cbe437e8a65d45cf2ae06 Mon Sep 17 00:00:00 2001 From: hahwu <31872165+hahwu@users.noreply.github.com> Date: Wed, 25 Feb 2026 17:24:24 +0800 Subject: [PATCH] =?UTF-8?q?notification=E5=8A=9F=E8=83=BD=E5=BC=80?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../conf/notification/notification_cfg.go | 8 +++---- src/server/game/notification.go | 4 ++-- src/server/test/config_test.go | 24 +++++++++++++++++++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/server/conf/notification/notification_cfg.go b/src/server/conf/notification/notification_cfg.go index 22502efb..57880532 100644 --- a/src/server/conf/notification/notification_cfg.go +++ b/src/server/conf/notification/notification_cfg.go @@ -10,20 +10,20 @@ func init() { gamedata.InitCfg(CFG_NOTIFICATION) } -func GetFriendApplyNotificationColdown() int { +func GetFriendApplyNotificationCooldown() int { data, err := gamedata.GetDataByIntKey(CFG_NOTIFICATION, 2) if err != nil { return 0 } - return gamedata.GetIntValue(data, "Coldown") + return gamedata.GetIntValue(data, "Cooldown") } -func GetPetroomGameNotificationColdown() (int, int) { +func GetPetroomGameNotificationCooldown() (int, int) { data, err := gamedata.GetDataByIntKey(CFG_NOTIFICATION, 1) if err != nil { return 0, 0 } - return gamedata.GetIntValue(data, "Coldown"), gamedata.GetIntValue(data, "DailyLimit") + return gamedata.GetIntValue(data, "Cooldown"), gamedata.GetIntValue(data, "DailyLimit") } func GetPetroomGameNotificationMsg() (string, string) { diff --git a/src/server/game/notification.go b/src/server/game/notification.go index e41c754b..542b4d3d 100644 --- a/src/server/game/notification.go +++ b/src/server/game/notification.go @@ -19,11 +19,11 @@ func NotifyPetroomGame(PlayerId int) { return } count, last := GetPetroomGameNotification(PlayerId) - coldown, dailyLimit := notification_cfg.GetPetroomGameNotificationColdown() + cooldown, dailyLimit := notification_cfg.GetPetroomGameNotificationCooldown() if count >= dailyLimit { return } - if GoUtil.Now()-last < int64(coldown) { + if GoUtil.Now()-last < int64(cooldown) { return } titlekey, infokey := notification_cfg.GetPetroomGameNotificationMsg() diff --git a/src/server/test/config_test.go b/src/server/test/config_test.go index 7379d427..a92b4c8c 100644 --- a/src/server/test/config_test.go +++ b/src/server/test/config_test.go @@ -6,6 +6,7 @@ import ( baseCfg "server/conf/base" friendCfg "server/conf/friend" languageCfg "server/conf/language" + notification_cfg "server/conf/notification" playroomCfg "server/conf/playroom" userCfg "server/conf/user" GoUtil "server/game_util" @@ -42,3 +43,26 @@ func TestGetEnergyByADNum(t *testing.T) { r := baseCfg.GetEnergyByADNum() fmt.Println("r:", r) } + +func TestGetFriendApplyNotificationCooldown(t *testing.T) { + Cooldown := notification_cfg.GetFriendApplyNotificationCooldown() + fmt.Println("Cooldown:", Cooldown) +} + +func TestGetPetroomGameNotificationCooldown(t *testing.T) { + Cooldown, dailyLimit := notification_cfg.GetPetroomGameNotificationCooldown() + fmt.Println("Cooldown:", Cooldown) + fmt.Println("dailyLimit:", dailyLimit) +} + +func TestGetPetroomGameNotificationMsg(t *testing.T) { + titlekey, infokey := notification_cfg.GetPetroomGameNotificationMsg() + fmt.Println("titlekey:", titlekey) + fmt.Println("infokey:", infokey) +} + +func TestGetFriendApplyNotificationMsg(t *testing.T) { + titlekey, infokey := notification_cfg.GetFriendApplyNotificationMsg() + fmt.Println("titlekey:", titlekey) + fmt.Println("infokey:", infokey) +}