notification功能开发
This commit is contained in:
parent
41ee2e48d4
commit
2c8af266b7
@ -13,9 +13,13 @@ const (
|
|||||||
NOTIFY_TYPE_PETROOM_GAME = 2
|
NOTIFY_TYPE_PETROOM_GAME = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
对方来petroom游戏的通知
|
||||||
|
每天最多通知3次
|
||||||
|
*/
|
||||||
func NotifyPetroomGame(PlayerId int) {
|
func NotifyPetroomGame(PlayerId int) {
|
||||||
PlayerSimpleData := G_GameLogicPtr.GetSimplePlayerByUid(PlayerId)
|
PlayerSimpleData := G_GameLogicPtr.GetSimplePlayerByUid(PlayerId)
|
||||||
if PlayerSimpleData == nil {
|
if !checkLogout(PlayerSimpleData) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
count, last := GetPetroomGameNotification(PlayerId)
|
count, last := GetPetroomGameNotification(PlayerId)
|
||||||
@ -33,9 +37,13 @@ func NotifyPetroomGame(PlayerId int) {
|
|||||||
SetPetroomGameNotification(PlayerId, count+1)
|
SetPetroomGameNotification(PlayerId, count+1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
好友申请通知
|
||||||
|
好友申请累计两次
|
||||||
|
*/
|
||||||
func NotifyFriendApply(PlayerId, FriendId int) {
|
func NotifyFriendApply(PlayerId, FriendId int) {
|
||||||
PlayerSimpleData := G_GameLogicPtr.GetSimplePlayerByUid(PlayerId)
|
PlayerSimpleData := G_GameLogicPtr.GetSimplePlayerByUid(PlayerId)
|
||||||
if PlayerSimpleData == nil {
|
if !checkLogout(PlayerSimpleData) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
FriendSimpleData := G_GameLogicPtr.GetSimplePlayerByUid(FriendId)
|
FriendSimpleData := G_GameLogicPtr.GetSimplePlayerByUid(FriendId)
|
||||||
@ -52,3 +60,25 @@ func NotifyFriendApply(PlayerId, FriendId int) {
|
|||||||
GoUtil.NotifyPlayer(GoUtil.Int(PlayerSimpleData.Account), NOTIFY_TYPE_FRIEND_APPLY, title, fmt.Sprintf(info, FriendSimpleData.Name))
|
GoUtil.NotifyPlayer(GoUtil.Int(PlayerSimpleData.Account), NOTIFY_TYPE_FRIEND_APPLY, title, fmt.Sprintf(info, FriendSimpleData.Name))
|
||||||
SetFriendApplyNotification(PlayerId, count+1)
|
SetFriendApplyNotification(PlayerId, count+1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
玩家需处于离线状态
|
||||||
|
玩家离线时间少于10分钟时,不发送消息
|
||||||
|
若用户已连续7天未登入游戏,不再发送通知
|
||||||
|
*/
|
||||||
|
func checkLogout(PlayerSimpleData *PlayerSimpleData) bool {
|
||||||
|
if PlayerSimpleData == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if PlayerSimpleData.Loginout == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
now := GoUtil.Now()
|
||||||
|
if now-PlayerSimpleData.Loginout > 7*24*3600 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if now-PlayerSimpleData.Loginout < 600 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user