```
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed

feat(pet): 添加宠物是否可售状态字段

新增is_sale字段用于控制宠物是否可售,
同时修改价格更新接口以支持设置销售状态
```
This commit is contained in:
昔念
2026-03-11 01:30:31 +08:00
parent b0130f39d5
commit 6430de9c5d
2 changed files with 4 additions and 4 deletions

View File

@@ -88,6 +88,7 @@ type PriseReq struct {
g.Meta `path:"/modpirse" method:"POST"`
Ctime uint32 `json:"catch_time"`
Price float32 `json:"sale_price"`
IsSale uint32 `json:"is_sale"`
}
func (c *PetBagController) ModPrise(ctx context.Context, req *PriseReq) (res *cool.BaseRes, err error) {
@@ -97,7 +98,7 @@ func (c *PetBagController) ModPrise(ctx context.Context, req *PriseReq) (res *co
if req.Price < 5 {
req.Price = 5
}
service.NewPetService(uint32(admin.UserId)).UPdatePrice(req.Ctime, req.Price)
service.NewPetService(uint32(admin.UserId)).UPdatePrice(req.Ctime, req.Price, req.IsSale)
return

View File

@@ -46,9 +46,8 @@ func (s *PetService) UPdateFree(ctime uint32, free uint32) {
).Update()
}
func (s *PetService) UPdatePrice(ctime uint32, Price float32) {
s.dbm(s.Model).Where("catch_time", ctime).Data("sale_price", Price).Update()
func (s *PetService) UPdatePrice(ctime uint32, Price float32, is_sale uint32) {
s.dbm(s.Model).Where("catch_time", ctime).Data("sale_price", Price, "is_sale", is_sale).Update()
}
func (s *PetService) BuyPet(pid uint32) error {