refactor: 将物品和货币相关字段从uint32改为int64以支持更大数值范围
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
@@ -29,12 +29,12 @@ func (s *ItemService) GetItemCount(id uint32) data.ItemInfo {
|
||||
res.ItemCnt = item.ItemMinCount
|
||||
|
||||
if item.ItemMaxCount != 0 {
|
||||
res.ItemCnt = uint32(grand.N(int(item.ItemMinCount), int(item.ItemMaxCount)))
|
||||
res.ItemCnt = int64(grand.N(int(item.ItemMinCount), int(item.ItemMaxCount)))
|
||||
|
||||
}
|
||||
return res
|
||||
}
|
||||
func (s *ItemService) GetEgg(count int32) []data.ItemInfo {
|
||||
func (s *ItemService) GetEgg(count int64) []data.ItemInfo {
|
||||
var item []model.ItemGift
|
||||
cool.DBM(s.Model).Where("is_egg", 1).Where("is_enabled", 1).Cache(gdb.CacheOption{
|
||||
// Duration: time.Hour,
|
||||
@@ -46,7 +46,7 @@ func (s *ItemService) GetEgg(count int32) []data.ItemInfo {
|
||||
var res = make([]data.ItemInfo, len(rr))
|
||||
for _, v := range rr {
|
||||
if v.ItemMaxCount != 0 {
|
||||
v.ItemMinCount = uint32(grand.N(int(v.ItemMinCount), int(v.ItemMaxCount)))
|
||||
v.ItemMinCount = int64(grand.N(int(v.ItemMinCount), int(v.ItemMaxCount)))
|
||||
|
||||
}
|
||||
res = append(res, data.ItemInfo{ItemId: v.ItemID, ItemCnt: v.ItemMinCount})
|
||||
|
||||
Reference in New Issue
Block a user