feat(item_buy): 优化商品购买限额检查逻辑

- 修改购买黄金商品时的限额验证方式,直接检查单次购买数量是否超过限制
- 调整GoldLog.Cheak方法参数顺序,增加总量控制参数
- 更新错误返回条件,提高限额检查准确性

fix(player_service): 添加时间范围检查功能

- 引入utils工具包用于时间范围验证
- 在IsMatch方法中添加活动开始时间和结束时间的范围检查
- 如果当前时间不在活动时间内则返回匹配失败

refactor(gold_log):
This commit is contained in:
昔念
2026-03-02 01:36:16 +08:00
parent 01c8c04df6
commit ae534a2e1e
3 changed files with 21 additions and 5 deletions

View File

@@ -11,7 +11,7 @@ type GoldService struct {
}
// 月 周 日限购检查
func (s *GoldService) Cheak(pid, ptye uint32) int {
func (s *GoldService) Cheak(allcount, pid, ptye uint32) bool {
now := time.Now()
var va int
@@ -24,9 +24,15 @@ func (s *GoldService) Cheak(pid, ptye uint32) int {
va = now.Day()
}
ret, _ := s.dbm_fix(s.Model).Where("year", now.Year()).Where("biz_id", pid).Wheref("consume ->> ?::integer = ?", ptye, va).Count()
ret, err := s.dbm_fix(s.Model).Where("year", now.Year()).Where("biz_id", pid).Wheref("consume ->> ?::integer = ?", ptye, va).Count()
if err != nil {
return false
}
if uint32(ret) < allcount {
return true
}
return ret
return false
}
func (s *GoldService) Log(pid, count uint32) {