```
feat(pet): 新增精灵可学习技能查询功能 新增 GetPetLearnableSkills 接口用于查询当前精灵可学习技能(包含等级技能和额外技能ExtSKill), 优化 SetPetSkill 和 SortPetSkills 方法中的技能处理逻辑,提升技能管理和排序的准确性。 同时修复了宠物存储信息查询时缺少参数验证的问题,在管理后台接口中增加 free 参数支持。 BREAKING CHANGE: 管理后台
This commit is contained in:
@@ -95,13 +95,17 @@ func (c *PetBagController) Level(ctx context.Context, req *PetLevelReq) (res *co
|
||||
type PetStorageReq struct {
|
||||
g.Meta `path:"/storage" method:"POST"`
|
||||
IsVIP int `json:"is_vip"`
|
||||
Free int `json:"free"`
|
||||
}
|
||||
|
||||
func (c *PetBagController) Storage(ctx context.Context, req *PetStorageReq) (res *cool.BaseRes, err error) {
|
||||
admin := cool.GetAdmin(ctx)
|
||||
|
||||
res = &cool.BaseRes{}
|
||||
res.Data = service.NewPetService(uint32(admin.UserId)).StorageInfo(req.IsVIP)
|
||||
if req.Free < 0 || req.Free > 2 {
|
||||
req.Free = 0
|
||||
}
|
||||
res.Data = service.NewPetService(uint32(admin.UserId)).StorageInfo(req.IsVIP, req.Free)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -58,9 +58,9 @@ func (s *PetService) PetInfo(flag int) []model.Pet {
|
||||
return tt
|
||||
}
|
||||
|
||||
func (s *PetService) StorageInfo(isVip int) []model.Pet {
|
||||
func (s *PetService) StorageInfo(isVip int, free int) []model.Pet {
|
||||
var tt []model.Pet
|
||||
if err := s.dbm_fix(s.Model).Where("free", 0).Where("is_vip", isVip).Scan(&tt); err != nil {
|
||||
if err := s.dbm_fix(s.Model).Where("free", free).Where("is_vip", isVip).Scan(&tt); err != nil {
|
||||
return nil
|
||||
}
|
||||
for i := range tt {
|
||||
|
||||
Reference in New Issue
Block a user