```
feat(item_buy): 优化商品购买限额检查逻辑 - 修改购买黄金商品时的限额验证方式,直接检查单次购买数量是否超过限制 - 调整GoldLog.Cheak方法参数顺序,增加总量控制参数 - 更新错误返回条件,提高限额检查准确性 fix(player_service): 添加时间范围检查功能 - 引入utils工具包用于时间范围验证 - 在IsMatch方法中添加活动开始时间和结束时间的范围检查 - 如果当前时间不在活动时间内则返回匹配失败 refactor(gold_log):
This commit is contained in:
@@ -97,8 +97,12 @@ func (h Controller) BuyGoldItem(data *item.C2S_GOLD_BUY_PRODUCT, player *player.
|
||||
if pro == nil {
|
||||
return nil, errorcode.ErrorCodes.ErrTooManyProducts
|
||||
}
|
||||
|
||||
if pro.QuotaType != 0 {
|
||||
if player.Service.GoldLog.Cheak(data.ProductID, pro.QuotaType-1)+int(data.Count) > int(pro.QuotaLimit) {
|
||||
if data.Count > int64(pro.QuotaLimit) {
|
||||
return nil, errorcode.ErrorCodes.ErrExceedStock
|
||||
}
|
||||
if player.Service.GoldLog.Cheak(pro.QuotaLimit-uint32(data.Count), data.ProductID, pro.QuotaType-1) {
|
||||
return nil, errorcode.ErrorCodes.ErrExceedStock
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user