Merge branch 'main' of https://cnb.cool/blzing/blazing
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
昔念
2026-03-13 22:21:01 +08:00
21 changed files with 251 additions and 64 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!=0&&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 的记录
@@ -147,6 +152,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