fix(talk): 修改对话计数逻辑中的错误码返回值
将检查失败时的错误码返回值从 ErrResourceUnavailable 改为 0, 以确保在资源不可用时能正确处理返回结果。 feat(player): 增加玩家经验获取的时间限制判断 在 CanGetExp 方法中新增时间上限判断逻辑,当今日游戏时间已达
This commit is contained in:
@@ -13,7 +13,7 @@ func (h Controller) Talk(data *item.TalkCountInboundInfo, c *player.Player) (res
|
|||||||
result = &item.TalkCountOutboundInfo{}
|
result = &item.TalkCountOutboundInfo{}
|
||||||
cid, ok := c.Service.Talk.Cheak(c.Info.MapID, int(data.ID))
|
cid, ok := c.Service.Talk.Cheak(c.Info.MapID, int(data.ID))
|
||||||
if !ok {
|
if !ok {
|
||||||
return result, errorcode.ErrorCodes.ErrResourceUnavailable
|
return result, 0
|
||||||
}
|
}
|
||||||
result.GiftCount = uint32(cid)
|
result.GiftCount = uint32(cid)
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,12 @@ func (p *Player) Save() {
|
|||||||
|
|
||||||
// 是否可以获得经验
|
// 是否可以获得经验
|
||||||
func (p *Player) CanGetExp() bool {
|
func (p *Player) CanGetExp() bool {
|
||||||
|
if p.Info.TimeToday >= p.Info.TimeLimit {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
ttt := p.Info.TimeLimit - p.Info.TimeToday
|
ttt := p.Info.TimeLimit - p.Info.TimeToday
|
||||||
|
|
||||||
return (uint32(time.Now().Unix()) - uint32(p.Logintime)) <= ttt
|
return (uint32(time.Now().Unix()) - uint32(p.Logintime)) <= ttt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user