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

feat(pet): 添加宠物自由状态管理功能

- 在ServiceList和ServicePage方法中添加WhereNot条件支持
- 将宠物销售状态改为自由状态,新增free字段来标识三种状态:
  0为放入仓库,1为放生,2为上架
- 修改PetInfo、UPdateFree、UPdatePrice等方法以支持新的状态逻辑
- 更新BuyPet方法中的验证逻辑
- 调整查询操作中的字段过滤条件
```
This commit is contained in:
昔念
2026-03-19 20:54:52 +08:00
parent 8929a17c97
commit 75c599b5b3
4 changed files with 22 additions and 21 deletions

View File

@@ -90,7 +90,7 @@ type PriseReq struct {
g.Meta `path:"/modpirse" method:"POST"`
Ctime uint32 `json:"catch_time"`
Price uint32 `json:"sale_price"`
IsSale uint32 `json:"is_sale"`
Free uint32 `json:"free"`
}
func (c *PetBagController) ModPrise(ctx context.Context, req *PriseReq) (res *cool.BaseRes, err error) {
@@ -100,7 +100,7 @@ func (c *PetBagController) ModPrise(ctx context.Context, req *PriseReq) (res *co
if req.Price < 5 {
req.Price = 5
}
if req.IsSale == 1 {
if req.Free == 2 {
if base.NewBaseSysUserService().GetFreeGold(admin.UserId) < 0 {
err = fmt.Errorf("金币不足")
@@ -108,7 +108,7 @@ func (c *PetBagController) ModPrise(ctx context.Context, req *PriseReq) (res *co
}
}
err = service.NewPetService(uint32(admin.UserId)).UPdatePrice(req.Ctime, req.Price, req.IsSale)
err = service.NewPetService(uint32(admin.UserId)).UPdatePrice(req.Ctime, req.Price, req.Free)
return