Browse Source

refactor(game): 重构游戏配置刷新逻辑

- 修改生成时间字段名从 generated_at 到 generated_ts
- 使用时间戳替代日期时间字符串,提高性能和可读性
- 重构配置刷新工具和命令,提高代码复用性- 移除不必要的文件写入逻辑,简化数据生成过程
Your Name 8 months ago
parent
commit
5573aeec95

+ 1 - 1
app/Console/Commands/GenerateProtoRouteCommand.php

@@ -151,7 +151,7 @@ class GenerateProtoRouteCommand extends Command
 
         return [
             'routes' => $routes,
-            'generated_at' => date('Y-m-d H:i:s'),
+            'generated_at' => date('P Y-m-d H:i:s'),
             'conventions' => [
                 'handler_namespace' => 'App\\Module\\AppGame\\Handler',
                 'request_namespace' => 'Uraus\\Kku\\Request',

+ 1 - 1
app/Module/Farm/AdminControllers/Tools/RefreshCheckTool.php

@@ -38,7 +38,7 @@ class RefreshCheckTool extends AbstractTool
         try {
             $json = FarmHouseJsonConfig::getData([],true);
 
-            $generatedAt = \Carbon\Carbon::parse($json['generated_at']);
+            $generatedAt = \Carbon\Carbon::createFromTimestamp($json['generated_ts']);
             $lastUpdated = \Carbon\Carbon::parse(\App\Module\Farm\Models\FarmHouseConfig::max('updated_at'));
 
             if ($generatedAt->lt($lastUpdated)) {

+ 4 - 6
app/Module/Farm/AdminControllers/Tools/SyncFarmHouseJsonTool.php

@@ -2,6 +2,7 @@
 
 namespace App\Module\Farm\AdminControllers\Tools;
 
+use App\Module\Game\DCache\FarmHouseJsonConfig;
 use Dcat\Admin\Grid\Tools\AbstractTool;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Log;
@@ -57,13 +58,10 @@ class SyncFarmHouseJsonTool extends AbstractTool
 
     public static function shouldDisplay(): bool
     {
-        $jsonPath = public_path('json/farm_house.json');
-        if (!file_exists($jsonPath)) {
-            return true;
-        }
 
-        $json = json_decode(file_get_contents($jsonPath), true);
-        $generatedAt = \Carbon\Carbon::parse($json['generated_at']);
+
+        $json = FarmHouseJsonConfig::getData();
+        $generatedAt = \Carbon\Carbon::parse($json['generated_ts']);
         $lastUpdated = \Carbon\Carbon::parse(\App\Module\Farm\Models\FarmHouseConfig::max('updated_at'));
 
         return $generatedAt->lt($lastUpdated);

+ 1 - 1
app/Module/Farm/Commands/GenerateFarmHouseConfigJson.php

@@ -46,7 +46,7 @@ class GenerateFarmHouseConfigJson extends Command
 
             // 准备JSON数据
             $jsonData = [
-                'generated_at' => now()->toDateTimeString(),
+                'generated_ts' => time(),
                 'house_configs' => []
             ];
 

+ 0 - 327
app/Module/Farm/Commands/RebuildFarmCacheCommand.php

@@ -1,327 +0,0 @@
-<?php
-
-namespace App\Module\Farm\Commands;
-
-use App\Module\Farm\Models\FarmHouseConfig;
-use App\Module\Farm\Models\FarmLandType;
-use App\Module\Farm\Models\FarmLandUpgradeConfig;
-use App\Module\Farm\Models\FarmSeed;
-use App\Module\Farm\Models\FarmSeedOutput;
-use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
-use Illuminate\Support\Facades\Log;
-
-/**
- * 重建农场缓存命令
- */
-class RebuildFarmCacheCommand extends Command
-{
-    /**
-     * 命令名称
-     *
-     * @var string
-     */
-    protected $signature = 'farm:rebuild-cache';
-
-    /**
-     * 命令描述
-     *
-     * @var string
-     */
-    protected $description = '重建农场模块的缓存数据';
-
-    /**
-     * 缓存键前缀
-     *
-     * @var string
-     */
-    protected $cachePrefix = 'farm:';
-
-    /**
-     * 缓存过期时间(秒)
-     *
-     * @var int
-     */
-    protected $cacheExpiration = 86400; // 24小时
-
-    /**
-     * 执行命令
-     *
-     * @return int
-     */
-    public function handle()
-    {
-        $this->info('开始重建农场缓存...');
-
-        try {
-            // 清除所有农场相关缓存
-            $this->clearCache();
-
-            // 重建种子配置缓存
-            $this->rebuildSeedCache();
-
-            // 重建种子产出配置缓存
-            $this->rebuildSeedOutputCache();
-
-            // 重建房屋配置缓存
-            $this->rebuildHouseConfigCache();
-
-            // 重建土地类型配置缓存
-            $this->rebuildLandTypeCache();
-
-            // 重建土地升级配置缓存
-            $this->rebuildLandUpgradeConfigCache();
-
-            $this->info('农场缓存重建完成');
-            $this->info('农场配置JSON文件已生成到 public/json/ 目录');
-
-            Log::info('农场缓存重建成功');
-
-            return 0;
-        } catch (\Exception $e) {
-            $this->error('农场缓存重建失败: ' . $e->getMessage());
-
-            Log::error('农场缓存重建失败', [
-                'error' => $e->getMessage(),
-                'trace' => $e->getTraceAsString()
-            ]);
-
-            return 1;
-        }
-    }
-
-    /**
-     * 清除所有农场相关缓存
-     *
-     * @return void
-     */
-    private function clearCache()
-    {
-        $this->info('清除现有缓存...');
-
-        // 获取所有缓存键
-        $keys = Cache::get($this->cachePrefix . 'keys', []);
-
-        // 清除每个缓存
-        foreach ($keys as $key) {
-            Cache::forget($key);
-        }
-
-        // 清除缓存键列表
-        Cache::forget($this->cachePrefix . 'keys');
-
-        $this->info('现有缓存已清除');
-    }
-
-    /**
-     * 重建种子配置缓存
-     *
-     * @return void
-     */
-    private function rebuildSeedCache()
-    {
-        $this->info('重建种子配置缓存...');
-
-        // 获取所有种子
-        $seeds = FarmSeed::all();
-
-        // 缓存所有种子
-        $this->cacheData($this->cachePrefix . 'seeds:all', $seeds);
-
-        // 按类型缓存种子
-        $seedsByType = $seeds->groupBy('type');
-        foreach ($seedsByType as $type => $typeSeeds) {
-            $this->cacheData($this->cachePrefix . 'seeds:type:' . $type, $typeSeeds);
-        }
-
-        // 单独缓存每个种子
-        foreach ($seeds as $seed) {
-            $this->cacheData($this->cachePrefix . 'seeds:id:' . $seed->id, $seed);
-        }
-
-        // 生成JSON文件
-        $this->saveJsonToFile('farm_seed.json', [
-            'generated_at' => now()->toDateTimeString(),
-            'seeds' => $seeds->toArray()
-        ]);
-
-        $this->info('种子配置缓存重建完成');
-    }
-
-    /**
-     * 重建种子产出配置缓存
-     *
-     * @return void
-     */
-    private function rebuildSeedOutputCache()
-    {
-        $this->info('重建种子产出配置缓存...');
-
-        // 获取所有种子产出
-        $seedOutputs = FarmSeedOutput::all();
-
-        // 缓存所有种子产出
-        $this->cacheData($this->cachePrefix . 'seed_outputs:all', $seedOutputs);
-
-        // 按种子ID缓存产出
-        $outputsBySeedId = $seedOutputs->groupBy('seed_id');
-        foreach ($outputsBySeedId as $seedId => $outputs) {
-            $this->cacheData($this->cachePrefix . 'seed_outputs:seed_id:' . $seedId, $outputs);
-        }
-
-        // 生成JSON文件
-        $this->saveJsonToFile('farm_seed_output.json', [
-            'generated_at' => now()->toDateTimeString(),
-            'seed_outputs' => $seedOutputs->toArray()
-        ]);
-
-        $this->info('种子产出配置缓存重建完成');
-    }
-
-    /**
-     * 重建房屋配置缓存
-     *
-     * @return void
-     */
-    private function rebuildHouseConfigCache()
-    {
-        $this->info('重建房屋配置缓存...');
-
-        // 获取所有房屋配置
-        $houseConfigs = FarmHouseConfig::all();
-
-        // 缓存所有房屋配置
-        $this->cacheData($this->cachePrefix . 'house_configs:all', $houseConfigs);
-
-        // 按等级缓存房屋配置
-        foreach ($houseConfigs as $config) {
-            $this->cacheData($this->cachePrefix . 'house_configs:level:' . $config->level, $config);
-        }
-
-        // 生成JSON文件
-        $this->saveJsonToFile('farm_house.json', [
-            'generated_at' => now()->toDateTimeString(),
-            'house_configs' => $houseConfigs->toArray()
-        ]);
-
-        $this->info('房屋配置缓存重建完成');
-    }
-
-    /**
-     * 重建土地类型配置缓存
-     *
-     * @return void
-     */
-    private function rebuildLandTypeCache()
-    {
-        $this->info('重建土地类型配置缓存...');
-
-        // 获取所有土地类型
-        $landTypes = FarmLandType::all();
-
-        // 缓存所有土地类型
-        $this->cacheData($this->cachePrefix . 'land_types:all', $landTypes);
-
-        // 按特殊类型缓存
-        $specialTypes = $landTypes->where('is_special', true);
-        $normalTypes = $landTypes->where('is_special', false);
-        $this->cacheData($this->cachePrefix . 'land_types:special', $specialTypes);
-        $this->cacheData($this->cachePrefix . 'land_types:normal', $normalTypes);
-
-        // 单独缓存每个土地类型
-        foreach ($landTypes as $type) {
-            $this->cacheData($this->cachePrefix . 'land_types:id:' . $type->id, $type);
-        }
-
-        // 生成JSON文件
-        $this->saveJsonToFile('farm_land_type.json', [
-            'generated_at' => now()->toDateTimeString(),
-            'land_types' => $landTypes->toArray()
-        ]);
-
-        $this->info('土地类型配置缓存重建完成');
-    }
-
-    /**
-     * 重建土地升级配置缓存
-     *
-     * @return void
-     */
-    private function rebuildLandUpgradeConfigCache()
-    {
-        $this->info('重建土地升级配置缓存...');
-
-        // 获取所有土地升级配置
-        $upgradeConfigs = FarmLandUpgradeConfig::all();
-
-        // 缓存所有升级配置
-        $this->cacheData($this->cachePrefix . 'land_upgrade_configs:all', $upgradeConfigs);
-
-        // 按起始类型缓存
-        $configsByFromType = $upgradeConfigs->groupBy('from_type_id');
-        foreach ($configsByFromType as $fromTypeId => $configs) {
-            $this->cacheData($this->cachePrefix . 'land_upgrade_configs:from:' . $fromTypeId, $configs);
-        }
-
-        // 按目标类型缓存
-        $configsByToType = $upgradeConfigs->groupBy('to_type_id');
-        foreach ($configsByToType as $toTypeId => $configs) {
-            $this->cacheData($this->cachePrefix . 'land_upgrade_configs:to:' . $toTypeId, $configs);
-        }
-
-        // 生成JSON文件
-        $this->saveJsonToFile('farm_land_upgrade.json', [
-            'generated_at' => now()->toDateTimeString(),
-            'upgrade_configs' => $upgradeConfigs->toArray()
-        ]);
-
-        $this->info('土地升级配置缓存重建完成');
-    }
-
-    /**
-     * 缓存数据并记录缓存键
-     *
-     * @param string $key
-     * @param mixed $data
-     * @return void
-     */
-    private function cacheData(string $key, $data)
-    {
-        // 缓存数据
-        Cache::put($key, $data, $this->cacheExpiration);
-
-        // 记录缓存键
-        $keys = Cache::get($this->cachePrefix . 'keys', []);
-        $keys[] = $key;
-        Cache::put($this->cachePrefix . 'keys', array_unique($keys), $this->cacheExpiration);
-    }
-
-    /**
-     * 将JSON数据保存到文件
-     *
-     * @param string $filename 文件名
-     * @param array $data 要保存的数据
-     * @return bool 是否保存成功
-     */
-    private function saveJsonToFile(string $filename, array $data): bool
-    {
-        try {
-            // 确保目录存在
-            $directory = 'public/json';
-            if (!file_exists($directory)) {
-                mkdir($directory, 0755, true);
-            }
-
-            // 将数据保存为JSON文件
-            $jsonContent = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
-            $filePath = $directory . '/' . $filename;
-            file_put_contents($filePath, $jsonContent);
-
-            Log::info('Farm JSON file saved to: ' . $filePath);
-            return true;
-        } catch (\Exception $e) {
-            Log::error('Save farm JSON to file failed: ' . $e->getMessage());
-            return false;
-        }
-    }
-}

+ 4 - 4
app/Module/Farm/Dtos/DisasterInfoDto.php

@@ -28,7 +28,7 @@ class DisasterInfoDto
      *
      * @var string
      */
-    public $generatedAt;
+    public $generatedTs;
 
     /**
      * 状态
@@ -55,10 +55,10 @@ class DisasterInfoDto
         $dto = new self();
         $dto->type = $disasterInfo['type'] ?? 0;
         $dto->typeName = DISASTER_TYPE::getName($dto->type);
-        $dto->generatedAt = $disasterInfo['generated_at'] ?? '';
+        $dto->generatedAt = $disasterInfo['generated_ts'] ?? '';
         $dto->status = $disasterInfo['status'] ?? 'active';
         $dto->clearedAt = $disasterInfo['cleared_at'] ?? null;
-        
+
         return $dto;
     }
 
@@ -72,7 +72,7 @@ class DisasterInfoDto
         return [
             'type' => $this->type,
             'type_name' => $this->typeName,
-            'generated_at' => $this->generatedAt,
+            'generated_ts' => $this->generatedAt,
             'status' => $this->status,
             'cleared_at' => $this->clearedAt,
         ];

+ 19 - 19
app/Module/Farm/Listeners/GenerateDisasterListener.php

@@ -13,7 +13,7 @@ use Illuminate\Support\Facades\Log;
 
 /**
  * 生成灾害监听器
- * 
+ *
  * 监听作物生长阶段变更事件,随机生成灾害
  */
 class GenerateDisasterListener implements ShouldQueue
@@ -33,71 +33,71 @@ class GenerateDisasterListener implements ShouldQueue
             if (!in_array($event->newStage, [GROWTH_STAGE::SPROUT, GROWTH_STAGE::GROWTH])) {
                 return;
             }
-            
+
             $crop = $event->crop;
             $land = $crop->land;
             $seed = $crop->seed;
-            
+
             // 获取种子的灾害抵抗属性
             $disasterResistance = $seed->disaster_resistance ?? [];
-            
+
             // 获取土地的灾害抵抗属性
             $landDisasterResistance = $land->landType->disaster_resistance ?? 0;
-            
+
             // 检查用户是否有有效的神灵加持
             $activeBuffs = $crop->user->buffs()
                 ->where('expire_time', '>', now())
                 ->pluck('buff_type')
                 ->toArray();
-            
+
             // 灾害类型及其基础概率
             $disasterTypes = [
                 DISASTER_TYPE::DROUGHT => 0.1, // 干旱
                 DISASTER_TYPE::PEST => 0.1,    // 虫害
                 DISASTER_TYPE::WEED => 0.1,    // 杂草
             ];
-            
+
             // 随机选择一种灾害类型
             $randomDisasterType = array_rand($disasterTypes);
             $baseProb = $disasterTypes[$randomDisasterType];
-            
+
             // 计算最终概率,考虑种子抵抗、土地抵抗和神灵加持
             $seedResistance = $disasterResistance[$this->getDisasterKey($randomDisasterType)] ?? 0;
             $finalProb = $baseProb - $seedResistance - $landDisasterResistance;
-            
+
             // 如果有对应的神灵加持,则不生成该类型的灾害
             $buffType = DISASTER_TYPE::getPreventBuffType($randomDisasterType);
             if ($buffType && in_array($buffType, $activeBuffs)) {
                 $finalProb = 0;
             }
-            
+
             // 确保概率在有效范围内
             $finalProb = max(0, min(1, $finalProb));
-            
+
             // 随机决定是否生成灾害
             if (mt_rand(1, 100) <= $finalProb * 100) {
                 // 生成灾害
                 $disasterInfo = [
                     'type' => $randomDisasterType,
-                    'generated_at' => now()->toDateTimeString(),
+                    'generated_ts' => time(),
                     'status' => 'active'
                 ];
-                
+
                 // 更新作物灾害信息
                 $disasters = $crop->disasters ?? [];
                 $disasters[] = $disasterInfo;
                 $crop->disasters = $disasters;
-                
+
                 // 更新土地状态为灾害
                 $land->status = LAND_STATUS::DISASTER;
-                
+
                 // 保存更改
                 $crop->save();
                 $land->save();
-                
+
                 // 触发灾害生成事件
                 event(new DisasterGeneratedEvent($event->userId, $crop, $randomDisasterType, $disasterInfo));
-                
+
                 Log::info('灾害生成成功', [
                     'user_id' => $event->userId,
                     'crop_id' => $crop->id,
@@ -115,7 +115,7 @@ class GenerateDisasterListener implements ShouldQueue
             ]);
         }
     }
-    
+
     /**
      * 获取灾害类型对应的键名
      *
@@ -129,7 +129,7 @@ class GenerateDisasterListener implements ShouldQueue
             DISASTER_TYPE::PEST => 'pest',
             DISASTER_TYPE::WEED => 'weed',
         ];
-        
+
         return $keys[$disasterType] ?? '';
     }
 }

+ 36 - 36
app/Module/Farm/Logics/DisasterLogic.php

@@ -28,13 +28,13 @@ class DisasterLogic
     {
         try {
             $crop = FarmCrop::find($cropId);
-            
+
             if (!$crop || empty($crop->disasters)) {
                 return collect();
             }
-            
+
             $disasters = collect($crop->disasters);
-            
+
             return $disasters->map(function ($disaster) {
                 return DisasterInfoDto::fromArray($disaster);
             });
@@ -44,11 +44,11 @@ class DisasterLogic
                 'error' => $e->getMessage(),
                 'trace' => $e->getTraceAsString()
             ]);
-            
+
             return collect();
         }
     }
-    
+
     /**
      * 获取作物的活跃灾害
      *
@@ -59,15 +59,15 @@ class DisasterLogic
     {
         try {
             $crop = FarmCrop::find($cropId);
-            
+
             if (!$crop || empty($crop->disasters)) {
                 return collect();
             }
-            
+
             $disasters = collect($crop->disasters)->filter(function ($disaster) {
                 return ($disaster['status'] ?? '') === 'active';
             });
-            
+
             return $disasters->map(function ($disaster) {
                 return DisasterInfoDto::fromArray($disaster);
             });
@@ -77,11 +77,11 @@ class DisasterLogic
                 'error' => $e->getMessage(),
                 'trace' => $e->getTraceAsString()
             ]);
-            
+
             return collect();
         }
     }
-    
+
     /**
      * 生成灾害
      *
@@ -92,100 +92,100 @@ class DisasterLogic
     {
         try {
             $crop = FarmCrop::find($cropId);
-            
+
             if (!$crop) {
                 throw new \Exception('作物不存在');
             }
-            
+
             $land = $crop->land;
-            
+
             if (!$land) {
                 throw new \Exception('土地不存在');
             }
-            
+
             // 只在发芽期和生长期生成灾害
             if (!in_array($crop->growth_stage, [GROWTH_STAGE::SPROUT, GROWTH_STAGE::GROWTH])) {
                 return null;
             }
-            
+
             // 跳过已经有灾害的土地
             if ($land->status === LAND_STATUS::DISASTER) {
                 return null;
             }
-            
+
             $userId = $crop->user_id;
             $seed = $crop->seed;
-            
+
             // 获取种子的灾害抵抗属性
             $disasterResistance = $seed->disaster_resistance ?? [];
-            
+
             // 获取土地的灾害抵抗属性
             $landDisasterResistance = $land->landType->disaster_resistance ?? 0;
-            
+
             // 检查用户是否有有效的神灵加持
             $activeBuffs = FarmGodBuff::where('user_id', $userId)
                 ->where('expire_time', '>', now())
                 ->pluck('buff_type')
                 ->toArray();
-            
+
             // 灾害类型及其基础概率
             $disasterTypes = [
                 DISASTER_TYPE::DROUGHT => 0.1, // 干旱
                 DISASTER_TYPE::PEST => 0.1,    // 虫害
                 DISASTER_TYPE::WEED => 0.1,    // 杂草
             ];
-            
+
             // 随机选择一种灾害类型
             $randomDisasterType = array_rand($disasterTypes);
             $baseProb = $disasterTypes[$randomDisasterType];
-            
+
             // 计算最终概率,考虑种子抵抗、土地抵抗和神灵加持
             $seedResistance = $disasterResistance[$this->getDisasterKey($randomDisasterType)] ?? 0;
             $finalProb = $baseProb - $seedResistance - $landDisasterResistance;
-            
+
             // 如果有对应的神灵加持,则不生成该类型的灾害
             $buffType = DISASTER_TYPE::getPreventBuffType($randomDisasterType);
             if ($buffType && in_array($buffType, $activeBuffs)) {
                 $finalProb = 0;
             }
-            
+
             // 确保概率在有效范围内
             $finalProb = max(0, min(1, $finalProb));
-            
+
             // 随机决定是否生成灾害
             if (mt_rand(1, 100) <= $finalProb * 100) {
                 // 生成灾害
                 $disasterInfo = [
                     'type' => $randomDisasterType,
-                    'generated_at' => now()->toDateTimeString(),
+                    'generated_ts' => now()->toDateTimeString(),
                     'status' => 'active'
                 ];
-                
+
                 // 更新作物灾害信息
                 $disasters = $crop->disasters ?? [];
                 $disasters[] = $disasterInfo;
                 $crop->disasters = $disasters;
-                
+
                 // 更新土地状态为灾害
                 $land->status = LAND_STATUS::DISASTER;
-                
+
                 // 保存更改
                 $crop->save();
                 $land->save();
-                
+
                 // 触发灾害生成事件
                 event(new DisasterGeneratedEvent($userId, $crop, $randomDisasterType, $disasterInfo));
-                
+
                 Log::info('灾害生成成功', [
                     'user_id' => $userId,
                     'crop_id' => $crop->id,
                     'land_id' => $land->id,
                     'disaster_type' => $randomDisasterType
                 ]);
-                
+
                 return DisasterInfoDto::fromArray($disasterInfo);
             }
-            
+
             return null;
         } catch (\Exception $e) {
             Log::error('灾害生成失败', [
@@ -193,11 +193,11 @@ class DisasterLogic
                 'error' => $e->getMessage(),
                 'trace' => $e->getTraceAsString()
             ]);
-            
+
             return null;
         }
     }
-    
+
     /**
      * 获取灾害类型对应的键名
      *
@@ -211,7 +211,7 @@ class DisasterLogic
             DISASTER_TYPE::PEST => 'pest',
             DISASTER_TYPE::WEED => 'weed',
         ];
-        
+
         return $keys[$disasterType] ?? '';
     }
 }

+ 24 - 56
app/Module/Farm/Providers/FarmServiceProvider.php

@@ -48,43 +48,11 @@ class FarmServiceProvider extends ServiceProvider
             Commands\GenerateDisastersCommand::class,
             Commands\CheckHouseDowngradeCommand::class,
             Commands\CleanExpiredLogsCommand::class,
-            Commands\RebuildFarmCacheCommand::class,
             Commands\GenerateFarmHouseConfigJson::class,
-            Commands\GenerateFarmHouseJson::class,
-        ]);
-
-        // 注册服务
-        $this->app->singleton(Logics\FarmLogic::class, function ($app) {
-            return new Logics\FarmLogic();
-        });
-
-        $this->app->singleton(Logics\LandLogic::class, function ($app) {
-            return new Logics\LandLogic();
-        });
-
-        $this->app->singleton(Logics\CropLogic::class, function ($app) {
-            return new Logics\CropLogic();
-        });
 
-        $this->app->singleton(Logics\SeedLogic::class, function ($app) {
-            return new Logics\SeedLogic();
-        });
-
-        $this->app->singleton(Logics\DisasterLogic::class, function ($app) {
-            return new Logics\DisasterLogic();
-        });
-
-        $this->app->singleton(Logics\HouseLogic::class, function ($app) {
-            return new Logics\HouseLogic();
-        });
+        ]);
 
-        $this->app->singleton(Logics\BuffLogic::class, function ($app) {
-            return new Logics\BuffLogic();
-        });
 
-        $this->app->singleton(Logics\TeamLogic::class, function ($app) {
-            return new Logics\TeamLogic();
-        });
     }
 
     /**
@@ -102,28 +70,28 @@ class FarmServiceProvider extends ServiceProvider
         }
 
         // 注册定时任务监听器
-        $this->app->booted(function () {
-            $schedule = $this->app->make(\Illuminate\Console\Scheduling\Schedule::class);
-
-            // 每5分钟更新作物生长状态
-            $schedule->command('farm:update-crop-growth')->everyFiveMinutes();
-
-            // 每小时随机生成灾害
-            $schedule->command('farm:generate-disasters')->hourly();
-
-            // 每天凌晨2点检查房屋降级
-            $schedule->command('farm:check-house-downgrade')->dailyAt('02:00');
-
-            // 每天凌晨3点更新达人等级
-            $schedule->call(function () {
-                app()->make(UpdateTalentLevelListener::class)->handle();
-            })->dailyAt('03:00');
-
-            // 每周一凌晨4点清理过期日志
-            $schedule->command('farm:clean-expired-logs')->weekly()->mondays()->at('04:00');
-
-            // 每天凌晨5点重建缓存
-            $schedule->command('farm:rebuild-cache')->dailyAt('05:00');
-        });
+//        $this->app->booted(function () {
+//            $schedule = $this->app->make(\Illuminate\Console\Scheduling\Schedule::class);
+//
+//            // 每5分钟更新作物生长状态
+//            $schedule->command('farm:update-crop-growth')->everyFiveMinutes();
+//
+//            // 每小时随机生成灾害
+//            $schedule->command('farm:generate-disasters')->hourly();
+//
+//            // 每天凌晨2点检查房屋降级
+//            $schedule->command('farm:check-house-downgrade')->dailyAt('02:00');
+//
+//            // 每天凌晨3点更新达人等级
+//            $schedule->call(function () {
+//                app()->make(UpdateTalentLevelListener::class)->handle();
+//            })->dailyAt('03:00');
+//
+//            // 每周一凌晨4点清理过期日志
+//            $schedule->command('farm:clean-expired-logs')->weekly()->mondays()->at('04:00');
+//
+//            // 每天凌晨5点重建缓存
+//            $schedule->command('farm:rebuild-cache')->dailyAt('05:00');
+//        });
     }
 }

+ 23 - 153
app/Module/Game/AdminControllers/GameConfigController.php

@@ -6,6 +6,9 @@ use App\Module\Game\DCache\ChestJsonConfig;
 use App\Module\Game\DCache\FarmHouseJsonConfig;
 use App\Module\Game\DCache\ItemJsonConfig;
 use App\Module\Game\DCache\PetJsonConfig;
+use App\Module\GameItems\AdminControllers\Tools\RefreshCheckTool;
+use App\Module\GameItems\AdminControllers\Tools\SyncItemsJsonTool;
+use Carbon\Carbon;
 use Dcat\Admin\Layout\Content;
 use Dcat\Admin\Layout\Row;
 use Dcat\Admin\Widgets\Card;
@@ -22,8 +25,10 @@ use Spatie\RouteAttributes\Attributes\Post;
  *
  * 用于显示和管理游戏中的各种配置表
  */
+#[Resource('game-jsonconfigs', names: 'dcat.admin.game-jsonconfigs')]
 class GameConfigController extends AdminController
 {
+
     /**
      * 页面标题
      *
@@ -55,7 +60,7 @@ class GameConfigController extends AdminController
                     '物品配置表',
                     'items.json',
                     'gameitems:generate-json',
-                    'game/configs/refresh-items',
+                    SyncItemsJsonTool::make(),
                     $this->getItemConfigInfo()
                 ));
 
@@ -64,7 +69,7 @@ class GameConfigController extends AdminController
                     '宝箱配置表',
                     'chest.json',
                     'gameitems:generate-chest-json',
-                    'game/configs/refresh-chests',
+                    'game-jsonconfigs/refresh-chests',
                     $this->getChestConfigInfo()
                 ));
             })
@@ -74,7 +79,7 @@ class GameConfigController extends AdminController
                     '宠物配置表',
                     'pet_config.json, pet_level_config.json, pet_skill_config.json',
                     'pet:generate-json',
-                    'game/configs/refresh-pets',
+                    'game-jsonconfigs/refresh-pets',
                     $this->getPetConfigInfo()
                 ));
 
@@ -83,7 +88,7 @@ class GameConfigController extends AdminController
                     '农场房屋配置表',
                     'farm_house.json',
                     'farm:generate-house-json',
-                    'game/configs/refresh-farm-house',
+                    'game-jsonconfigs/refresh-farm-house',
                     $this->getFarmHouseConfigInfo()
                 ));
             });
@@ -99,17 +104,17 @@ class GameConfigController extends AdminController
      * @param array $info 配置信息
      * @return Card
      */
-    protected function createConfigCard($title, $filename, $command, $refreshUrl, $info)
+    protected function createConfigCard($title, $filename, $command, $refresh, $info)
     {
-        $headers = ['属性', '值'];
-        $rows = [];
+        $headers = [ '属性', '值' ];
+        $rows    = [];
 
         foreach ($info as $key => $value) {
-            $rows[] = [$key, $value];
+            $rows[] = [ $key, $value ];
         }
 
         $card = new Card($title, Table::make($headers, $rows));
-        $card->tool('<a href="' . admin_url($refreshUrl) . '" class="btn btn-primary btn-sm"><i class="fa fa-refresh"></i> 刷新配置</a>');
+        $card->tool($refresh);
         $card->footer("<code>文件: {$filename}</code><br><code>命令: php artisan {$command}</code>");
 
         return $card;
@@ -124,9 +129,9 @@ class GameConfigController extends AdminController
     {
         $data = ItemJsonConfig::getData();
         $info = [
-            '生成时间' => $data['generated_at'] ?? '未知',
+            '生成时间' => Carbon::createFromTimestamp($data['generated_ts'])->toDateTimeString(),
             '物品数量' => isset($data['items']) ? count($data['items']) : 0,
-            '文件路径' => public_path('json/items.json'),
+
         ];
 
         return $info;
@@ -141,9 +146,9 @@ class GameConfigController extends AdminController
     {
         $data = ChestJsonConfig::getData();
         $info = [
-            '生成时间' => $data['generated_at'] ?? '未知',
+            '生成时间' => Carbon::createFromTimestamp($data['generated_ts'])->toDateTimeString(),
             '宝箱数量' => isset($data['chest']) ? count($data['chest']) : 0,
-            '文件路径' => public_path('json/chest.json'),
+
         ];
 
         return $info;
@@ -156,14 +161,14 @@ class GameConfigController extends AdminController
      */
     protected function getPetConfigInfo()
     {
-        $data = PetJsonConfig::getData();
-        $petConfig = $data['pet_config'] ?? [];
+        $data           = PetJsonConfig::getData();
+        $petConfig      = $data['pet_config'] ?? [];
         $petLevelConfig = $data['pet_level_config'] ?? [];
         $petSkillConfig = $data['pet_skill_config'] ?? [];
 
         $info = [
-            '生成时间' => $petConfig['generated_at'] ?? '未知',
-            '宠物数量' => isset($petConfig['pets']) ? count($petConfig['pets']) : 0,
+            '生成时间'     => Carbon::createFromTimestamp($data['generated_ts'])->toDateTimeString(),
+            '宠物数量'     => isset($petConfig['pets']) ? count($petConfig['pets']) : 0,
             '等级配置数量' => isset($petLevelConfig['pet_levels']) ? count($petLevelConfig['pet_levels']) : 0,
             '技能配置数量' => isset($petSkillConfig['pet_skills']) ? count($petSkillConfig['pet_skills']) : 0,
         ];
@@ -180,147 +185,12 @@ class GameConfigController extends AdminController
     {
         $data = FarmHouseJsonConfig::getData();
         $info = [
-            '生成时间' => $data['generated_at'] ?? '未知',
+            '生成时间'     => Carbon::createFromTimestamp($data['generated_ts'])->toDateTimeString(),
             '房屋配置数量' => isset($data['house_configs']) ? count($data['house_configs']) : 0,
-            '文件路径' => public_path('json/farm_house.json'),
         ];
 
         return $info;
     }
 
-    /**
-     * 刷新物品配置表
-     *
-     * @param Content $content
-     * @return Content
-     */
-    #[Get('game/configs/refresh-items')]
-    public function refreshItems(Content $content)
-    {
-        try {
-            Artisan::call('gameitems:generate-json');
-            $output = Artisan::output();
-
-            // 强制刷新缓存
-            ItemJsonConfig::getData([], true);
-
-            admin_success('刷新成功', '物品配置表已成功刷新');
 
-            return $content
-                ->title($this->title)
-                ->description('刷新物品配置表')
-                ->body(Card::make('命令输出', "<pre>{$output}</pre>"))
-                ->body("<script>setTimeout(function(){ window.location.href = '" . admin_url('game/configs') . "'; }, 2000);</script>");
-        } catch (\Exception $e) {
-            admin_error('刷新失败', '物品配置表刷新失败: ' . $e->getMessage());
-
-            return $content
-                ->title($this->title)
-                ->description('刷新物品配置表')
-                ->body(Card::make('错误信息', "<pre>{$e->getMessage()}</pre>"))
-                ->body("<script>setTimeout(function(){ window.location.href = '" . admin_url('game/configs') . "'; }, 3000);</script>");
-        }
-    }
-
-    /**
-     * 刷新宝箱配置表
-     *
-     * @param Content $content
-     * @return Content
-     */
-    #[Get('game/configs/refresh-chests')]
-    public function refreshChests(Content $content)
-    {
-        try {
-            Artisan::call('gameitems:generate-chest-json');
-            $output = Artisan::output();
-
-            // 强制刷新缓存
-            ChestJsonConfig::getData([], true);
-
-            admin_success('刷新成功', '宝箱配置表已成功刷新');
-
-            return $content
-                ->title($this->title)
-                ->description('刷新宝箱配置表')
-                ->body(Card::make('命令输出', "<pre>{$output}</pre>"))
-                ->body("<script>setTimeout(function(){ window.location.href = '" . admin_url('game/configs') . "'; }, 2000);</script>");
-        } catch (\Exception $e) {
-            admin_error('刷新失败', '宝箱配置表刷新失败: ' . $e->getMessage());
-
-            return $content
-                ->title($this->title)
-                ->description('刷新宝箱配置表')
-                ->body(Card::make('错误信息', "<pre>{$e->getMessage()}</pre>"))
-                ->body("<script>setTimeout(function(){ window.location.href = '" . admin_url('game/configs') . "'; }, 3000);</script>");
-        }
-    }
-
-    /**
-     * 刷新宠物配置表
-     *
-     * @param Content $content
-     * @return Content
-     */
-    #[Get('game/configs/refresh-pets')]
-    public function refreshPets(Content $content)
-    {
-        try {
-            Artisan::call('pet:generate-json');
-            $output = Artisan::output();
-
-            // 强制刷新缓存
-            PetJsonConfig::getData([], true);
-
-            admin_success('刷新成功', '宠物配置表已成功刷新');
-
-            return $content
-                ->title($this->title)
-                ->description('刷新宠物配置表')
-                ->body(Card::make('命令输出', "<pre>{$output}</pre>"))
-                ->body("<script>setTimeout(function(){ window.location.href = '" . admin_url('game/configs') . "'; }, 2000);</script>");
-        } catch (\Exception $e) {
-            admin_error('刷新失败', '宠物配置表刷新失败: ' . $e->getMessage());
-
-            return $content
-                ->title($this->title)
-                ->description('刷新宠物配置表')
-                ->body(Card::make('错误信息', "<pre>{$e->getMessage()}</pre>"))
-                ->body("<script>setTimeout(function(){ window.location.href = '" . admin_url('game/configs') . "'; }, 3000);</script>");
-        }
-    }
-
-    /**
-     * 刷新农场房屋配置表
-     *
-     * @param Content $content
-     * @return Content
-     */
-    #[Get('game/configs/refresh-farm-house')]
-    public function refreshFarmHouse(Content $content)
-    {
-        try {
-            Artisan::call('farm:generate-house-json');
-            $output = Artisan::output();
-
-            // 强制刷新缓存
-            FarmHouseJsonConfig::getData([], true);
-
-            admin_success('刷新成功', '农场房屋配置表已成功刷新');
-
-            return $content
-                ->title($this->title)
-                ->description('刷新农场房屋配置表')
-                ->body(Card::make('命令输出', "<pre>{$output}</pre>"))
-                ->body("<script>setTimeout(function(){ window.location.href = '" . admin_url('game/configs') . "'; }, 2000);</script>");
-        } catch (\Exception $e) {
-            admin_error('刷新失败', '农场房屋配置表刷新失败: ' . $e->getMessage());
-
-            return $content
-                ->title($this->title)
-                ->description('刷新农场房屋配置表')
-                ->body(Card::make('错误信息', "<pre>{$e->getMessage()}</pre>"))
-                ->body("<script>setTimeout(function(){ window.location.href = '" . admin_url('game/configs') . "'; }, 3000);</script>");
-        }
-    }
 }

+ 1 - 1
app/Module/Game/DCache/FarmHouseJsonConfig.php

@@ -23,7 +23,7 @@ class FarmHouseJsonConfig extends DQueueJob
         } catch (\Exception $e) {
             // 如果生成失败,返回空数组
             return [
-                'generated_at' => now()->toDateTimeString(),
+                'generated_ts' => time(),
                 'house_configs' => []
             ];
         }

+ 1 - 1
app/Module/GameItems/AdminControllers/Tools/RefreshCheckTool.php

@@ -45,7 +45,7 @@ class RefreshCheckTool extends AbstractTool
         $json = ItemJsonConfig::getData([],false);
         $lastUpdated = \Carbon\Carbon::parse(\App\Module\GameItems\Models\Item::max('updated_at'));
 //        dd($json);
-        $generatedAt = \Carbon\Carbon::parse($json['generated_at']);
+        $generatedAt = \Carbon\Carbon::createFromTimestamp($json['generated_ts']);
         $isSynced = $generatedAt->gte($lastUpdated);
 
         return [

+ 3 - 6
app/Module/GameItems/AdminControllers/Tools/SyncItemsJsonTool.php

@@ -2,6 +2,7 @@
 
 namespace App\Module\GameItems\AdminControllers\Tools;
 
+use App\Module\Game\DCache\ItemJsonConfig;
 use Dcat\Admin\Grid\Tools\AbstractTool;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Log;
@@ -54,13 +55,9 @@ class SyncItemsJsonTool extends AbstractTool
 
     public static function shouldDisplay(): bool
     {
-        $jsonPath = public_path('json/items.json');
-        if (!file_exists($jsonPath)) {
-            return true;
-        }
 
-        $json = json_decode(file_get_contents($jsonPath), true);
-        $generatedAt = \Carbon\Carbon::parse($json['generated_at']);
+        $json =ItemJsonConfig::getData();
+        $generatedAt = \Carbon\Carbon::createFromTimestamp($json['generated_ts']);
         $lastUpdated = \Carbon\Carbon::parse(\App\Module\GameItems\Models\Item::max('updated_at'));
 
         return $generatedAt->lt($lastUpdated);

+ 5 - 41
app/Module/GameItems/Commands/GenerateChestJsonCommand.php

@@ -44,7 +44,7 @@ class GenerateChestJsonCommand extends Command
      * @param bool $saveToFile 是否保存到文件
      * @return array|bool 生成的数据或失败标志
      */
-    public static function generateJson(bool $saveToFile = true)
+    public static function generateJson()
     {
         try {
             // 查询Item表中的宝箱数据
@@ -78,7 +78,7 @@ class GenerateChestJsonCommand extends Command
                         ]);
                     }
                 ])
-                ->select(['id', 'name', 'item_id','numeric_attributes'])
+                ->select(['id', 'name','numeric_attributes'])
                 ->get();
 
             // 处理数据,去除不必要的字段
@@ -143,14 +143,12 @@ class GenerateChestJsonCommand extends Command
 
             // 准备完整数据,包含生成时间
             $data = [
-                'generated_at' => now()->toDateTimeString(),
+                'generated_ts' => time(),
                 'chests' => $processedChests
             ];
 
-            // 如果需要保存到文件
-            if ($saveToFile) {
-                self::saveJsonToFile($data);
-            }
+
+
 
             return $data;
         } catch (\Exception $e) {
@@ -162,41 +160,7 @@ class GenerateChestJsonCommand extends Command
         }
     }
 
-    /**
-     * 将JSON数据保存到文件
-     *
-     * @param array $data 要保存的数据
-     * @return bool 是否保存成功
-     */
-    protected static function saveJsonToFile(array $data): bool
-    {
-        try {
-            // 确保目录存在
-            $directory = 'public/json';
-            if (!File::exists($directory)) {
-                File::makeDirectory($directory, 0755, true);
-            }
-
-            // 将数据保存为JSON文件
-            $jsonContent = json_encode($data, JSON_UNESCAPED_UNICODE);
-            $filePath = $directory . '/chest.json';
-            File::put($filePath, $jsonContent);
-
-            // 同时生成一个格式化的版本供开发者查看
-            $prettyJsonContent = json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
-            $prettyFilePath = $directory . '/chest_pretty.json';
-            File::put($prettyFilePath, $prettyJsonContent);
 
-            // 不使用Log,直接输出到控制台
-            echo 'Chest JSON files saved to: ' . $filePath . ' and ' . $prettyFilePath . "\n";
-            return true;
-        } catch (\Exception $e) {
-            // 不使用Log,直接输出到控制台
-            echo 'Save chest.json to file failed: ' . $e->getMessage() . "\n";
-            echo $e->getTraceAsString() . "\n";
-            return false;
-        }
-    }
 
     /**
      * 执行命令

+ 5 - 6
app/Module/GameItems/Commands/GenerateItemsJsonCommand.php

@@ -4,6 +4,7 @@ namespace App\Module\GameItems\Commands;
 
 use App\Module\Game\DCache\ItemJsonConfig;
 use App\Module\Game\Services\JsonConfigService;
+use Carbon\Carbon;
 use Illuminate\Console\Command;
 use App\Module\GameItems\Models\Item;
 use Illuminate\Support\Facades\File;
@@ -43,7 +44,7 @@ class GenerateItemsJsonCommand extends Command
      * @param bool $saveToFile 是否保存到文件
      * @return array|bool 生成的数据或失败标志
      */
-    public static function generateJson(bool $saveToFile = true)
+    public static function generateJson()
     {
         try {
             // 查询Item表中的数据
@@ -71,14 +72,12 @@ class GenerateItemsJsonCommand extends Command
 
             // 准备完整数据,包含生成时间
             $data = [
-                'generated_at' => now()->toDateTimeString(),
+                'generated_ts' => time(),
                 'items'        => $items
             ];
 
-            // 如果需要保存到文件
-            if ($saveToFile) {
-                self::saveJsonToFile($data);
-            }
+
+
 
             return $data;
         } catch (\Exception $e) {

+ 0 - 106
app/Module/GameItems/Commands/TestJsonGenerationCommand.php

@@ -1,106 +0,0 @@
-<?php
-
-namespace App\Module\GameItems\Commands;
-
-use Illuminate\Console\Command;
-use Illuminate\Support\Facades\File;
-
-/**
- * 测试JSON生成和文件输出功能
- */
-class TestJsonGenerationCommand extends Command
-{
-    /**
-     * 命令名称和签名
-     *
-     * @var string
-     */
-    protected $signature = 'gameitems:test-json-generation';
-
-    /**
-     * 命令描述
-     *
-     * @var string
-     */
-    protected $description = 'Test JSON generation and file output functionality';
-
-    /**
-     * 执行命令
-     */
-    public function handle()
-    {
-        $this->info('开始测试物品配置表JSON生成和文件输出功能...');
-
-        // 测试物品配置表生成
-        $this->info('1. 生成物品配置表...');
-        $itemsData = GenerateItemsJsonCommand::generateJson(true);
-
-        if ($itemsData) {
-            $this->info('   物品配置表生成成功!');
-            $this->info('   物品数量: ' . count($itemsData['items']));
-            $this->info('   生成时间: ' . $itemsData['generated_at']);
-        } else {
-            $this->error('   物品配置表生成失败!');
-            return 1;
-        }
-
-        // 测试宝箱配置表生成
-        $this->info('2. 生成宝箱配置表...');
-        $chestData = GenerateChestJsonCommand::generateJson(true);
-
-        if ($chestData) {
-            $this->info('   宝箱配置表生成成功!');
-            $this->info('   宝箱数量: ' . count($chestData['chest']));
-            $this->info('   生成时间: ' . $chestData['generated_at']);
-        } else {
-            $this->error('   宝箱配置表生成失败!');
-            return 1;
-        }
-
-        // 验证文件是否存在
-        $this->info('3. 验证配置文件是否存在...');
-        $itemsJsonPath = 'public/json/items.json';
-        $chestJsonPath = 'public/json/chest.json';
-
-        if (File::exists($itemsJsonPath)) {
-            $this->info('   物品配置文件存在: ' . $itemsJsonPath);
-            $fileSize = File::size($itemsJsonPath);
-            $this->info('   文件大小: ' . $this->formatBytes($fileSize));
-        } else {
-            $this->error('   物品配置文件不存在: ' . $itemsJsonPath);
-            return 1;
-        }
-
-        if (File::exists($chestJsonPath)) {
-            $this->info('   宝箱配置文件存在: ' . $chestJsonPath);
-            $fileSize = File::size($chestJsonPath);
-            $this->info('   文件大小: ' . $this->formatBytes($fileSize));
-        } else {
-            $this->error('   宝箱配置文件不存在: ' . $chestJsonPath);
-            return 1;
-        }
-
-        $this->info('测试完成,所有功能正常!');
-        return 0;
-    }
-
-    /**
-     * 格式化字节数为可读格式
-     *
-     * @param int $bytes 字节数
-     * @param int $precision 精度
-     * @return string 格式化后的字符串
-     */
-    protected function formatBytes($bytes, $precision = 2)
-    {
-        $units = ['B', 'KB', 'MB', 'GB', 'TB'];
-
-        $bytes = max($bytes, 0);
-        $pow = floor(($bytes ? log($bytes) : 0) / log(1024));
-        $pow = min($pow, count($units) - 1);
-
-        $bytes /= pow(1024, $pow);
-
-        return round($bytes, $precision) . ' ' . $units[$pow];
-    }
-}

+ 3 - 3
app/Module/Pet/Commands/GeneratePetJsonCommand.php

@@ -93,7 +93,7 @@ class GeneratePetJsonCommand extends Command
 
         // 准备完整数据,包含生成时间
         return [
-            'generated_at' => now()->toDateTimeString(),
+            'generated_ts' => time(),
             'pets' => $petConfigs
         ];
     }
@@ -119,7 +119,7 @@ class GeneratePetJsonCommand extends Command
 
         // 准备完整数据,包含生成时间
         return [
-            'generated_at' => now()->toDateTimeString(),
+            'generated_ts' => time(),
             'pet_levels' => $petLevelConfigs
         ];
     }
@@ -145,7 +145,7 @@ class GeneratePetJsonCommand extends Command
 
         // 准备完整数据,包含生成时间
         return [
-            'generated_at' => now()->toDateTimeString(),
+            'generated_ts' => time(),
             'pet_skills' => $petSkills
         ];
     }

+ 1 - 1
config/proto_route.php

@@ -88,7 +88,7 @@ return array (
       6 => 'query_data',
     ),
   ),
-  'generated_at' => '2025-05-13 02:57:24',
+  'generated_at' => '+00:00 2025-05-13 08:51:05',
   'conventions' => 
   array (
     'handler_namespace' => 'App\\Module\\AppGame\\Handler',

+ 4 - 1
vendor/autoload.php

@@ -14,7 +14,10 @@ if (PHP_VERSION_ID < 50600) {
             echo $err;
         }
     }
-    throw new RuntimeException($err);
+    trigger_error(
+        $err,
+        E_USER_ERROR
+    );
 }
 
 require_once __DIR__ . '/composer/autoload_real.php';

+ 0 - 2
vendor/composer/LICENSE

@@ -1,4 +1,3 @@
-
 Copyright (c) Nils Adermann, Jordi Boggiano
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -18,4 +17,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
-

+ 4 - 7
vendor/composer/autoload_classmap.php

@@ -124,9 +124,7 @@ return array(
     'App\\Module\\AppGame\\Service\\UserService' => $baseDir . '/app/Module/AppGame/Service/UserService.php',
     'App\\Module\\AppGame\\Service\\WalletService' => $baseDir . '/app/Module/AppGame/Service/WalletService.php',
     'App\\Module\\AppGame\\SessionApp' => $baseDir . '/app/Module/AppGame/SessionApp.php',
-    'App\\Module\\AppGame\\Test\\Blockchain\\BlockchainMinerTest' => $baseDir . '/app/Module/AppGame/Test/Blockchain/BlockchainMinerTest.php',
-    'App\\Module\\AppGame\\Test\\Blockchain\\LoginOkTest' => $baseDir . '/app/Module/AppGame/Test/Blockchain/LoginOkTest.php',
-    'App\\Module\\AppGame\\Test\\Blockchain\\LoginTest' => $baseDir . '/app/Module/AppGame/Test/Blockchain/LoginTest.php',
+    'App\\Module\\AppGame\\Tests\\Public\\PublicTokenTest' => $baseDir . '/app/Module/AppGame/Tests/Public/PublicTokenTest.php',
     'App\\Module\\AppGame\\Tools\\Protobuf' => $baseDir . '/app/Module/AppGame/Tools/Protobuf.php',
     'App\\Module\\AppGame\\UserService' => $baseDir . '/app/Module/AppGame/UserService.php',
     'App\\Module\\AppGame\\Validations\\PetEatValidation' => $baseDir . '/app/Module/AppGame/Validations/PetEatValidation.php',
@@ -236,9 +234,8 @@ return array(
     'App\\Module\\Farm\\Commands\\CheckHouseDowngradeCommand' => $baseDir . '/app/Module/Farm/Commands/CheckHouseDowngradeCommand.php',
     'App\\Module\\Farm\\Commands\\CleanExpiredLogsCommand' => $baseDir . '/app/Module/Farm/Commands/CleanExpiredLogsCommand.php',
     'App\\Module\\Farm\\Commands\\GenerateDisastersCommand' => $baseDir . '/app/Module/Farm/Commands/GenerateDisastersCommand.php',
-    'App\\Module\\Farm\\Commands\\RebuildFarmCacheCommand' => $baseDir . '/app/Module/Farm/Commands/RebuildFarmCacheCommand.php',
+    'App\\Module\\Farm\\Commands\\GenerateFarmHouseConfigJson' => $baseDir . '/app/Module/Farm/Commands/GenerateFarmHouseConfigJson.php',
     'App\\Module\\Farm\\Commands\\UpdateCropGrowthCommand' => $baseDir . '/app/Module/Farm/Commands/UpdateCropGrowthCommand.php',
-    'App\\Module\\Farm\\DCache\\FarmHouseJsonConfig' => $baseDir . '/app/Module/Farm/DCache/FarmHouseJsonConfig.php',
     'App\\Module\\Farm\\Dtos\\CropInfoDto' => $baseDir . '/app/Module/Farm/Dtos/CropInfoDto.php',
     'App\\Module\\Farm\\Dtos\\DisasterInfoDto' => $baseDir . '/app/Module/Farm/Dtos/DisasterInfoDto.php',
     'App\\Module\\Farm\\Dtos\\FarmInfoDto' => $baseDir . '/app/Module/Farm/Dtos/FarmInfoDto.php',
@@ -481,7 +478,6 @@ return array(
     'App\\Module\\GameItems\\Casts\\TransactionDetailsCast' => $baseDir . '/app/Module/GameItems/Casts/TransactionDetailsCast.php',
     'App\\Module\\GameItems\\Commands\\GenerateChestJsonCommand' => $baseDir . '/app/Module/GameItems/Commands/GenerateChestJsonCommand.php',
     'App\\Module\\GameItems\\Commands\\GenerateItemsJsonCommand' => $baseDir . '/app/Module/GameItems/Commands/GenerateItemsJsonCommand.php',
-    'App\\Module\\GameItems\\Commands\\TestJsonGenerationCommand' => $baseDir . '/app/Module/GameItems/Commands/TestJsonGenerationCommand.php',
     'App\\Module\\GameItems\\Dtos\\ItemChestOpenCostDto' => $baseDir . '/app/Module/GameItems/Dtos/ItemChestOpenCostDto.php',
     'App\\Module\\GameItems\\Enums\\CHEST_COST_TYPE' => $baseDir . '/app/Module/GameItems/Enums/CHEST_COST_TYPE.php',
     'App\\Module\\GameItems\\Enums\\ITEM_BIND_TYPE' => $baseDir . '/app/Module/GameItems/Enums/ITEM_BIND_TYPE.php',
@@ -553,6 +549,7 @@ return array(
     'App\\Module\\GameItems\\Validation\\ItemQuantityValidation' => $baseDir . '/app/Module/GameItems/Validation/ItemQuantityValidation.php',
     'App\\Module\\GameItems\\Validators\\IsExpiredValidator' => $baseDir . '/app/Module/GameItems/Validators/IsExpiredValidator.php',
     'App\\Module\\GameItems\\Validators\\ItemQuantityValidator' => $baseDir . '/app/Module/GameItems/Validators/ItemQuantityValidator.php',
+    'App\\Module\\Game\\AdminControllers\\GameConfigController' => $baseDir . '/app/Module/Game/AdminControllers/GameConfigController.php',
     'App\\Module\\Game\\AdminControllers\\GameRewardGroupController' => $baseDir . '/app/Module/Game/AdminControllers/GameRewardGroupController.php',
     'App\\Module\\Game\\AdminControllers\\GameRewardItemController' => $baseDir . '/app/Module/Game/AdminControllers/GameRewardItemController.php',
     'App\\Module\\Game\\AdminControllers\\GameRewardLogController' => $baseDir . '/app/Module/Game/AdminControllers/GameRewardLogController.php',
@@ -565,11 +562,11 @@ return array(
     'App\\Module\\Game\\AdminControllers\\Helper\\ShowHelper' => $baseDir . '/app/Module/Game/AdminControllers/Helper/ShowHelper.php',
     'App\\Module\\Game\\AdminControllers\\Helper\\ShowHelperTrait' => $baseDir . '/app/Module/Game/AdminControllers/Helper/ShowHelperTrait.php',
     'App\\Module\\Game\\AdminControllers\\LazyRenderable\\RewardGroupLazyRenderable' => $baseDir . '/app/Module/Game/AdminControllers/LazyRenderable/RewardGroupLazyRenderable.php',
-    'App\\Module\\Game\\AdminControllers\\TestController' => $baseDir . '/app/Module/Game/AdminControllers/TestController.php',
     'App\\Module\\Game\\Commands\\CleanExpiredRewardLogsCommand' => $baseDir . '/app/Module/Game/Commands/CleanExpiredRewardLogsCommand.php',
     'App\\Module\\Game\\Commands\\ImportRewardGroupsCommand' => $baseDir . '/app/Module/Game/Commands/ImportRewardGroupsCommand.php',
     'App\\Module\\Game\\Commands\\TestItemTempCommand' => $baseDir . '/app/Module/Game/Commands/TestItemTempCommand.php',
     'App\\Module\\Game\\DCache\\ChestJsonConfig' => $baseDir . '/app/Module/Game/DCache/ChestJsonConfig.php',
+    'App\\Module\\Game\\DCache\\FarmHouseJsonConfig' => $baseDir . '/app/Module/Game/DCache/FarmHouseJsonConfig.php',
     'App\\Module\\Game\\DCache\\ItemJsonConfig' => $baseDir . '/app/Module/Game/DCache/ItemJsonConfig.php',
     'App\\Module\\Game\\DCache\\PetJsonConfig' => $baseDir . '/app/Module/Game/DCache/PetJsonConfig.php',
     'App\\Module\\Game\\Dtos\\ItemChangeTempDto' => $baseDir . '/app/Module/Game/Dtos/ItemChangeTempDto.php',

+ 1 - 1
vendor/composer/autoload_psr4.php

@@ -59,7 +59,7 @@ return array(
     'Psy\\' => array($vendorDir . '/psy/psysh/src'),
     'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
     'Psr\\Log\\' => array($vendorDir . '/psr/log/src'),
-    'Psr\\Http\\Server\\' => array($vendorDir . '/psr/http-server-middleware/src', $vendorDir . '/psr/http-server-handler/src'),
+    'Psr\\Http\\Server\\' => array($vendorDir . '/psr/http-server-handler/src', $vendorDir . '/psr/http-server-middleware/src'),
     'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'),
     'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
     'Psr\\EventDispatcher\\' => array($vendorDir . '/psr/event-dispatcher/src'),

+ 6 - 9
vendor/composer/autoload_static.php

@@ -439,8 +439,8 @@ class ComposerStaticInita2207959542f13e6e79e83f2b0d9a425
         ),
         'Psr\\Http\\Server\\' => 
         array (
-            0 => __DIR__ . '/..' . '/psr/http-server-middleware/src',
-            1 => __DIR__ . '/..' . '/psr/http-server-handler/src',
+            0 => __DIR__ . '/..' . '/psr/http-server-handler/src',
+            1 => __DIR__ . '/..' . '/psr/http-server-middleware/src',
         ),
         'Psr\\Http\\Message\\' => 
         array (
@@ -844,9 +844,7 @@ class ComposerStaticInita2207959542f13e6e79e83f2b0d9a425
         'App\\Module\\AppGame\\Service\\UserService' => __DIR__ . '/../..' . '/app/Module/AppGame/Service/UserService.php',
         'App\\Module\\AppGame\\Service\\WalletService' => __DIR__ . '/../..' . '/app/Module/AppGame/Service/WalletService.php',
         'App\\Module\\AppGame\\SessionApp' => __DIR__ . '/../..' . '/app/Module/AppGame/SessionApp.php',
-        'App\\Module\\AppGame\\Test\\Blockchain\\BlockchainMinerTest' => __DIR__ . '/../..' . '/app/Module/AppGame/Test/Blockchain/BlockchainMinerTest.php',
-        'App\\Module\\AppGame\\Test\\Blockchain\\LoginOkTest' => __DIR__ . '/../..' . '/app/Module/AppGame/Test/Blockchain/LoginOkTest.php',
-        'App\\Module\\AppGame\\Test\\Blockchain\\LoginTest' => __DIR__ . '/../..' . '/app/Module/AppGame/Test/Blockchain/LoginTest.php',
+        'App\\Module\\AppGame\\Tests\\Public\\PublicTokenTest' => __DIR__ . '/../..' . '/app/Module/AppGame/Tests/Public/PublicTokenTest.php',
         'App\\Module\\AppGame\\Tools\\Protobuf' => __DIR__ . '/../..' . '/app/Module/AppGame/Tools/Protobuf.php',
         'App\\Module\\AppGame\\UserService' => __DIR__ . '/../..' . '/app/Module/AppGame/UserService.php',
         'App\\Module\\AppGame\\Validations\\PetEatValidation' => __DIR__ . '/../..' . '/app/Module/AppGame/Validations/PetEatValidation.php',
@@ -956,9 +954,8 @@ class ComposerStaticInita2207959542f13e6e79e83f2b0d9a425
         'App\\Module\\Farm\\Commands\\CheckHouseDowngradeCommand' => __DIR__ . '/../..' . '/app/Module/Farm/Commands/CheckHouseDowngradeCommand.php',
         'App\\Module\\Farm\\Commands\\CleanExpiredLogsCommand' => __DIR__ . '/../..' . '/app/Module/Farm/Commands/CleanExpiredLogsCommand.php',
         'App\\Module\\Farm\\Commands\\GenerateDisastersCommand' => __DIR__ . '/../..' . '/app/Module/Farm/Commands/GenerateDisastersCommand.php',
-        'App\\Module\\Farm\\Commands\\RebuildFarmCacheCommand' => __DIR__ . '/../..' . '/app/Module/Farm/Commands/RebuildFarmCacheCommand.php',
+        'App\\Module\\Farm\\Commands\\GenerateFarmHouseConfigJson' => __DIR__ . '/../..' . '/app/Module/Farm/Commands/GenerateFarmHouseConfigJson.php',
         'App\\Module\\Farm\\Commands\\UpdateCropGrowthCommand' => __DIR__ . '/../..' . '/app/Module/Farm/Commands/UpdateCropGrowthCommand.php',
-        'App\\Module\\Farm\\DCache\\FarmHouseJsonConfig' => __DIR__ . '/../..' . '/app/Module/Farm/DCache/FarmHouseJsonConfig.php',
         'App\\Module\\Farm\\Dtos\\CropInfoDto' => __DIR__ . '/../..' . '/app/Module/Farm/Dtos/CropInfoDto.php',
         'App\\Module\\Farm\\Dtos\\DisasterInfoDto' => __DIR__ . '/../..' . '/app/Module/Farm/Dtos/DisasterInfoDto.php',
         'App\\Module\\Farm\\Dtos\\FarmInfoDto' => __DIR__ . '/../..' . '/app/Module/Farm/Dtos/FarmInfoDto.php',
@@ -1201,7 +1198,6 @@ class ComposerStaticInita2207959542f13e6e79e83f2b0d9a425
         'App\\Module\\GameItems\\Casts\\TransactionDetailsCast' => __DIR__ . '/../..' . '/app/Module/GameItems/Casts/TransactionDetailsCast.php',
         'App\\Module\\GameItems\\Commands\\GenerateChestJsonCommand' => __DIR__ . '/../..' . '/app/Module/GameItems/Commands/GenerateChestJsonCommand.php',
         'App\\Module\\GameItems\\Commands\\GenerateItemsJsonCommand' => __DIR__ . '/../..' . '/app/Module/GameItems/Commands/GenerateItemsJsonCommand.php',
-        'App\\Module\\GameItems\\Commands\\TestJsonGenerationCommand' => __DIR__ . '/../..' . '/app/Module/GameItems/Commands/TestJsonGenerationCommand.php',
         'App\\Module\\GameItems\\Dtos\\ItemChestOpenCostDto' => __DIR__ . '/../..' . '/app/Module/GameItems/Dtos/ItemChestOpenCostDto.php',
         'App\\Module\\GameItems\\Enums\\CHEST_COST_TYPE' => __DIR__ . '/../..' . '/app/Module/GameItems/Enums/CHEST_COST_TYPE.php',
         'App\\Module\\GameItems\\Enums\\ITEM_BIND_TYPE' => __DIR__ . '/../..' . '/app/Module/GameItems/Enums/ITEM_BIND_TYPE.php',
@@ -1273,6 +1269,7 @@ class ComposerStaticInita2207959542f13e6e79e83f2b0d9a425
         'App\\Module\\GameItems\\Validation\\ItemQuantityValidation' => __DIR__ . '/../..' . '/app/Module/GameItems/Validation/ItemQuantityValidation.php',
         'App\\Module\\GameItems\\Validators\\IsExpiredValidator' => __DIR__ . '/../..' . '/app/Module/GameItems/Validators/IsExpiredValidator.php',
         'App\\Module\\GameItems\\Validators\\ItemQuantityValidator' => __DIR__ . '/../..' . '/app/Module/GameItems/Validators/ItemQuantityValidator.php',
+        'App\\Module\\Game\\AdminControllers\\GameConfigController' => __DIR__ . '/../..' . '/app/Module/Game/AdminControllers/GameConfigController.php',
         'App\\Module\\Game\\AdminControllers\\GameRewardGroupController' => __DIR__ . '/../..' . '/app/Module/Game/AdminControllers/GameRewardGroupController.php',
         'App\\Module\\Game\\AdminControllers\\GameRewardItemController' => __DIR__ . '/../..' . '/app/Module/Game/AdminControllers/GameRewardItemController.php',
         'App\\Module\\Game\\AdminControllers\\GameRewardLogController' => __DIR__ . '/../..' . '/app/Module/Game/AdminControllers/GameRewardLogController.php',
@@ -1285,11 +1282,11 @@ class ComposerStaticInita2207959542f13e6e79e83f2b0d9a425
         'App\\Module\\Game\\AdminControllers\\Helper\\ShowHelper' => __DIR__ . '/../..' . '/app/Module/Game/AdminControllers/Helper/ShowHelper.php',
         'App\\Module\\Game\\AdminControllers\\Helper\\ShowHelperTrait' => __DIR__ . '/../..' . '/app/Module/Game/AdminControllers/Helper/ShowHelperTrait.php',
         'App\\Module\\Game\\AdminControllers\\LazyRenderable\\RewardGroupLazyRenderable' => __DIR__ . '/../..' . '/app/Module/Game/AdminControllers/LazyRenderable/RewardGroupLazyRenderable.php',
-        'App\\Module\\Game\\AdminControllers\\TestController' => __DIR__ . '/../..' . '/app/Module/Game/AdminControllers/TestController.php',
         'App\\Module\\Game\\Commands\\CleanExpiredRewardLogsCommand' => __DIR__ . '/../..' . '/app/Module/Game/Commands/CleanExpiredRewardLogsCommand.php',
         'App\\Module\\Game\\Commands\\ImportRewardGroupsCommand' => __DIR__ . '/../..' . '/app/Module/Game/Commands/ImportRewardGroupsCommand.php',
         'App\\Module\\Game\\Commands\\TestItemTempCommand' => __DIR__ . '/../..' . '/app/Module/Game/Commands/TestItemTempCommand.php',
         'App\\Module\\Game\\DCache\\ChestJsonConfig' => __DIR__ . '/../..' . '/app/Module/Game/DCache/ChestJsonConfig.php',
+        'App\\Module\\Game\\DCache\\FarmHouseJsonConfig' => __DIR__ . '/../..' . '/app/Module/Game/DCache/FarmHouseJsonConfig.php',
         'App\\Module\\Game\\DCache\\ItemJsonConfig' => __DIR__ . '/../..' . '/app/Module/Game/DCache/ItemJsonConfig.php',
         'App\\Module\\Game\\DCache\\PetJsonConfig' => __DIR__ . '/../..' . '/app/Module/Game/DCache/PetJsonConfig.php',
         'App\\Module\\Game\\Dtos\\ItemChangeTempDto' => __DIR__ . '/../..' . '/app/Module/Game/Dtos/ItemChangeTempDto.php',