Răsfoiți Sursa

宠物限制

Your Name 5 luni în urmă
părinte
comite
07b1f8ae11

+ 2 - 4
CLAUDE.md

@@ -30,15 +30,13 @@ KK-U 是一个基于 Laravel 的农场游戏系统,集成了 URS 推广系统
 - **ModelCore**: 带属性管理的模型基类
 - **Validation**: 综合验证系统
 - **Queue**: 增强队列管理
-- **NumberWan**: 高精度小数处理
+
 
 ## 开发命令
 
 ### 环境搭建
 ```bash
-docker-compose -f docker-compose.dev.yml up -d
-composer install && npm install
-php artisan proto:route --force
+docker compose -f docker-compose.dev.yml up -d
 php artisan ucore:generate-model-annotation
 ```
 

+ 3 - 3
app/Module/Pet/Logic/PetLogic.php

@@ -63,12 +63,12 @@ class PetLogic
             throw new Exception("宠物名称不能为空且不能超过20个字符");
         }
 
-        // 检查用户宠物数量限制
+        // 检查用户宠物数量限制 - 一人一宠限制
         $petCount = PetUser::where('user_id', $userId)->count();
-        $maxPets  = config('pet.max_pets_per_user', 3);
+        $maxPets  = 1; // 强制限制为1只宠物
 
         if ($petCount >= $maxPets) {
-            throw new Exception("已达到最大宠物数量限制: {$maxPets}");
+            throw new Exception("每人只能拥有一只宠物");
         }
 
 

+ 3 - 3
app/Module/Pet/Validators/PetCreateValidator.php

@@ -36,12 +36,12 @@ class PetCreateValidator extends Validator
             return false;
         }
 
-        // 检查用户宠物数量限制
+        // 检查用户宠物数量限制 - 一人一宠
         $petCount = PetUser::where('user_id', $userId)->count();
-        $maxPets = config('pet.max_pets_per_user', 3);
+        $maxPets = 1;
 
         if ($petCount >= $maxPets) {
-            $this->addError("已达到最大宠物数量限制: " . $maxPets);
+            $this->addError("每人只能拥有一只宠物");
             return false;
         }
 

+ 2 - 2
app/Module/Pet/Validators/PetGetValidator.php

@@ -135,10 +135,10 @@ class PetGetValidator extends Validator
     private function validatePetCountLimit(int $userId): bool
     {
         $petCount = PetUser::where('user_id', $userId)->count();
-        $maxPets = config('pet.max_pets_per_user', 3);
+        $maxPets = 1; // 一人一宠限制
 
         if ($petCount >= $maxPets) {
-            $this->addError("已达到最大宠物数量限制: {$maxPets}");
+            $this->addError("每人只能拥有一只宠物");
             return false;
         }
 

+ 3 - 3
docker-compose.dev.yml

@@ -1,5 +1,5 @@
 networks:
-    ggggg:
+    aaaaa:
         external: true
 services:
   dev:
@@ -15,6 +15,6 @@ services:
     environment:
     - VIRTUAL_HOST=kku_laravel.local.gd
     ports:
-       - 80
+       - 36014:80
     networks:
-        - ggggg
+        - aaaaa