notification功能开发

This commit is contained in:
hahwu 2026-02-25 17:24:24 +08:00
parent d310ce93f6
commit d1111725ef
3 changed files with 30 additions and 6 deletions

View File

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

View File

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

View File

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