From 6430de9c5d3f83c6c6a804df809bd2a896d544c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=94=E5=BF=B5?= <12574910+72wo@users.noreply.github.com> Date: Wed, 11 Mar 2026 01:30:31 +0800 Subject: [PATCH] =?UTF-8?q?```=20feat(pet):=20=E6=B7=BB=E5=8A=A0=E5=AE=A0?= =?UTF-8?q?=E7=89=A9=E6=98=AF=E5=90=A6=E5=8F=AF=E5=94=AE=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增is_sale字段用于控制宠物是否可售, 同时修改价格更新接口以支持设置销售状态 ``` --- modules/player/controller/admin/pet.go | 3 ++- modules/player/service/pet.go | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/player/controller/admin/pet.go b/modules/player/controller/admin/pet.go index 35723efd1..81daff4a2 100644 --- a/modules/player/controller/admin/pet.go +++ b/modules/player/controller/admin/pet.go @@ -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 diff --git a/modules/player/service/pet.go b/modules/player/service/pet.go index 1b978f1ca..197969bf0 100644 --- a/modules/player/service/pet.go +++ b/modules/player/service/pet.go @@ -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 {