argument('user_id'); $this->info("开始测试推广信息重构功能..."); $this->info("测试用户ID: {$userId}"); try { // 检查用户映射关系 $ursUserId = UrsUserMappingService::getUrsUserId($userId); if (!$ursUserId) { $this->error("用户 {$userId} 未映射到URS系统"); return 1; } $this->info("URS用户ID: {$ursUserId}"); // 创建模拟响应对象 $response = new Response(); // 创建Handler实例并设置用户ID $handler = new InfoHandler($response); $handler->user_id = $userId; // 创建请求对象 $request = new RequestPromotionInfo(); $request->setTimes(time()); // 调用处理方法 $result = $handler->handle($request); // 输出结果 $this->info("=== 推广团队信息 ==="); $this->info("总人数: " . $result->getTotalCount()); $this->info("直推人数: " . $result->getDirectCount()); $this->info("间推人数: " . $result->getIndirectCount()); $this->info("今日新增: " . $result->getDayRecentCount()); $this->info("今日直推: " . $result->getDayDirectCount()); $this->info("活跃人数: " . $result->getActiveCount()); $this->info("直推活跃: " . $result->getDirectActiveCount()); $this->info("达人等级: " . $result->getStarLevel()); // 输出收益信息 $this->info("=== 收益信息 ==="); $todayReward = $result->getTodayReward(); if ($todayReward) { $coins = $todayReward->getCoins(); $items = $todayReward->getItems(); if (!empty($coins)) { foreach ($coins as $coin) { $this->info("今日收益(代币): {$coin->getQuantity()} (类型: {$coin->getType()})"); } } if (!empty($items)) { foreach ($items as $item) { $this->info("今日收益(物品): 物品ID {$item->getItemId()} x{$item->getQuantity()}"); } } if (empty($coins) && empty($items)) { $this->info("今日收益: 无"); } } else { $this->info("今日收益: 无"); } $totalReward = $result->getTotalReward(); if ($totalReward) { $coins = $totalReward->getCoins(); $items = $totalReward->getItems(); if (!empty($coins)) { foreach ($coins as $coin) { $this->info("总收益(代币): {$coin->getQuantity()} (类型: {$coin->getType()})"); } } if (!empty($items)) { foreach ($items as $item) { $this->info("总收益(物品): 物品ID {$item->getItemId()} x{$item->getQuantity()}"); } } if (empty($coins) && empty($items)) { $this->info("总收益: 无"); } } else { $this->info("总收益: 无"); } $this->info("✅ 推广信息重构功能测试完成!"); } catch (\Exception $e) { $this->error("测试失败: " . $e->getMessage()); $this->error("错误堆栈: " . $e->getTraceAsString()); return 1; } return 0; } }