fix: 修复PVP赛季数据结构及相关逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-03-13 12:04:35 +08:00
committed by cnb
parent b9985bff3b
commit 0d44de2ea7
7 changed files with 35 additions and 28 deletions

View File

@@ -1,6 +1,7 @@
package service
import (
"blazing/common/utils"
"blazing/cool"
basemodel "blazing/modules/base/model"
"blazing/modules/base/service"
@@ -56,7 +57,11 @@ func (s *PetService) UPdatePrice(ctime uint32, Price uint32, is_sale uint32) err
return fmt.Errorf("精灵数量已满")
}
}
var p model.Pet
s.dbm(s.Model).Where("catch_time", ctime).Scan(&p)
if p.SalePrice != Price && utils.IsToday(p.UpdateTime) { //说明要修改价格
return fmt.Errorf("一天只允许改价一次")
}
res0, err := s.dbm(s.Model).
Where("catch_time", ctime). // 限定 ctime避免全表更新
Where("sale_price = ?", 0). // 只筛选 sale_price=0 的记录
@@ -145,6 +150,7 @@ RETURNING max_ts;
player.Data = tt.Data
player.CatchTime = tt.CatchTime
player.Free = 0
player.SalePrice = tt.SalePrice
player.SaleCount = tt.SaleCount + 1
player.IsVip = cool.Config.ServerInfo.IsVip