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

feat(pet): 添加精灵可用性检查

新增Free字段验证,确保购买时精灵确实存在
```
This commit is contained in:
昔念
2026-03-11 01:48:46 +08:00
parent baa75334ea
commit 46bc05ab29

View File

@@ -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("未设置价格")
}