argument('user_id'); $this->info("开始测试PlayerDataHandler,用户ID: {$userId}"); // 创建测试请求 $request = new RequestPublicPlayerData(); $request->setUserId($userId); // 创建响应对象 $response = new Response(); // 创建Handler实例 $handler = new PlayerDataHandler($response); // 模拟登录状态 $handler->user_id = $userId; try { // 执行Handler $result = $handler->handle($request); $this->info("Handler执行成功!"); $this->info("响应类型: " . get_class($result)); // 检查用户信息 if ($result->hasUserInfo()) { $userInfo = $result->getUserInfo(); $this->info("=== 用户信息 ==="); $this->info("用户ID: " . $userInfo->getUserD()); $this->info("皮肤ID: " . $userInfo->getSkinId()); $this->info("头像: " . $userInfo->getAvatar()); $this->info("昵称: " . $userInfo->getNickName()); } else { $this->warn("未获取到用户信息"); } // 检查神像信息 $godsInfo = $result->getGodsInfo(); $this->info("=== 神像信息 ==="); $this->info("神像数量: " . count($godsInfo)); foreach ($godsInfo as $god) { $this->info("神像ID: " . $god->getId() . ", 状态: " . ($god->getStatus() ? '激活' : '未激活')); } // 检查土地信息 $landInfo = $result->getLandInfo(); $this->info("=== 土地信息 ==="); $this->info("土地数量: " . count($landInfo)); foreach ($landInfo as $land) { $this->info("土地ID: " . $land->getId() . ", 位置: " . $land->getIndex() . ", 等级: " . $land->getLevel() . ", 状态: " . $land->getStatus()); if ($land->getSeedId() > 0) { $this->info(" - 种子ID: " . $land->getSeedId()); $this->info(" - 果实ID: " . $land->getFruitId()); $this->info(" - 植株ID: " . $land->getPlantId()); $this->info(" - 种子状态: " . $land->getSeedStatus()); $this->info(" - 种植时间: " . date('Y-m-d H:i:s', $land->getSeedPlantingTimes())); $this->info(" - 阶段开始时间: " . date('Y-m-d H:i:s', $land->getStageStartTimes())); $this->info(" - 阶段结束时间: " . date('Y-m-d H:i:s', $land->getStageNextTimes())); } } // 检查宠物信息 if ($result->hasPetInfo()) { $petInfo = $result->getPetInfo(); $this->info("=== 宠物信息 ==="); $this->info("宠物种族ID: " . $petInfo->getTypeId()); $this->info("宠物名称: " . $petInfo->getName()); $this->info("宠物等级: " . $petInfo->getLevel()); $this->info("宠物体力: " . $petInfo->getPower()); } else { $this->info("=== 宠物信息 ==="); $this->info("用户没有宠物"); } $this->info("测试完成!"); } catch (\Exception $e) { $this->error("Handler执行失败: " . $e->getMessage()); $this->error("错误堆栈: " . $e->getTraceAsString()); } } }