From 46bc05ab29519f63e82165f13caa6f7cd4d124e9 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:48:46 +0800 Subject: [PATCH] =?UTF-8?q?```=20feat(pet):=20=E6=B7=BB=E5=8A=A0=E7=B2=BE?= =?UTF-8?q?=E7=81=B5=E5=8F=AF=E7=94=A8=E6=80=A7=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增Free字段验证,确保购买时精灵确实存在 ``` --- modules/player/service/pet.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/player/service/pet.go b/modules/player/service/pet.go index 57b371c8..b5a69471 100644 --- a/modules/player/service/pet.go +++ b/modules/player/service/pet.go @@ -63,6 +63,9 @@ func (s *PetService) BuyPet(pid uint32) error { if tt.IsSale == 0 { return fmt.Errorf("未上架") } + if tt.Free == 0 { + return fmt.Errorf("没有此精灵") + } if tt.SalePrice == 0 { return fmt.Errorf("未设置价格") }