|
|
@@ -0,0 +1,79 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace App\Console\Commands;
|
|
|
+
|
|
|
+use App\Module\Game\Services\LandTempService;
|
|
|
+use App\Module\Game\Services\HouseTempService;
|
|
|
+use Illuminate\Console\Command;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 检查暂存区数据命令
|
|
|
+ */
|
|
|
+class CheckTempDataCommand extends Command
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * 命令签名
|
|
|
+ *
|
|
|
+ * @var string
|
|
|
+ */
|
|
|
+ protected $signature = 'test:check-temp {user_id}';
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 命令描述
|
|
|
+ *
|
|
|
+ * @var string
|
|
|
+ */
|
|
|
+ protected $description = '检查用户的暂存区数据';
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 执行命令
|
|
|
+ *
|
|
|
+ * @return int
|
|
|
+ */
|
|
|
+ public function handle()
|
|
|
+ {
|
|
|
+ $userId = (int) $this->argument('user_id');
|
|
|
+
|
|
|
+ $this->info("检查用户 {$userId} 的暂存区数据");
|
|
|
+
|
|
|
+ // 检查土地暂存数据
|
|
|
+ $this->info("\n=== 土地暂存数据 ===");
|
|
|
+ try {
|
|
|
+ $landChanges = LandTempService::getUserLandChanges($userId);
|
|
|
+ if (empty($landChanges)) {
|
|
|
+ $this->warn("没有土地变更暂存数据");
|
|
|
+ } else {
|
|
|
+ $this->info("找到 " . count($landChanges) . " 条土地变更记录:");
|
|
|
+ foreach ($landChanges as $landId => $change) {
|
|
|
+ $this->line("土地ID: {$landId}");
|
|
|
+ $this->line(" - 变更类型: " . ($change->changeType ?? 'N/A'));
|
|
|
+ $this->line(" - 土地类型: " . ($change->landType ?? 'N/A'));
|
|
|
+ $this->line(" - 更新时间: " . ($change->updatedAt ?? 'N/A'));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ $this->error("获取土地暂存数据失败: " . $e->getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查房屋暂存数据
|
|
|
+ $this->info("\n=== 房屋暂存数据 ===");
|
|
|
+ try {
|
|
|
+ $houseChange = HouseTempService::getUserHouseChange($userId);
|
|
|
+ if (!$houseChange) {
|
|
|
+ $this->warn("没有房屋变更暂存数据");
|
|
|
+ } else {
|
|
|
+ $this->info("找到房屋变更记录:");
|
|
|
+ $this->line(" - 旧等级: " . ($houseChange->oldLevel ?? 'N/A'));
|
|
|
+ $this->line(" - 新等级: " . ($houseChange->newLevel ?? 'N/A'));
|
|
|
+ $this->line(" - 是否升级: " . ($houseChange->isUpgrade ? '是' : '否'));
|
|
|
+ $this->line(" - 产出加成: " . ($houseChange->outputBonus ?? 'N/A'));
|
|
|
+ $this->line(" - 特殊土地上限: " . ($houseChange->specialLandLimit ?? 'N/A'));
|
|
|
+ $this->line(" - 更新时间: " . ($houseChange->updatedAt ?? 'N/A'));
|
|
|
+ }
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ $this->error("获取房屋暂存数据失败: " . $e->getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+}
|