```
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

feat(utils): 添加切片元素计数功能

新增CountSliceElements函数用于统计切片中各元素的出现次数,
返回map[元素]出现次数的映射关系,支持任意可比较类型的切片元素。

fix(config): 调整地图配置模型默认值设置

修改MapPit结构体中的MinLevel和MaxLevel字段设置,
将数据库约束改为非空并设置默认值为1,确保等级范围配置的有效性。

ref
This commit is contained in:
昔念
2026-02-26 22:32:15 +08:00
parent 21ae004979
commit bfafd5789d
4 changed files with 36 additions and 34 deletions

View File

@@ -31,9 +31,9 @@ type MapPit struct {
RefreshID []int `gorm:"type:int[];comment:'精灵ID列表'" json:"refresh_id"`
Pos []int `gorm:"type:int[];comment:'坑位位置'" json:"pos"`
//最小等级
MinLevel int `gorm:"type:int;default:0;comment:'最小等级'" json:"min_level"`
MinLevel int `gorm:"type:int;not null;default:1;comment:'最小等级'" json:"min_level"`
//最大等级
MaxLevel int `gorm:"type:int;default:0;comment:'最大等级'" json:"max_level"`
MaxLevel int `gorm:"type:int;not null;default:1;comment:'最大等级'" json:"max_level"`
//是否可捕捉MapPit
IsCapture int `gorm:"type:int;default:0;comment:'是否可捕捉'" json:"is_capture"`
}