argument('fund_log_id'); $this->info("🔍 测试资金日志收集器优化效果"); $this->line("📝 测试记录ID: {$fundLogId}"); $this->line(""); try { // 获取fund_log记录 $fundLog = FundLogModel::find($fundLogId); if (!$fundLog) { $this->error("❌ 未找到ID为 {$fundLogId} 的fund_log记录"); return 1; } $this->line("📊 原始记录信息:"); $this->line(" 用户ID: {$fundLog->user_id}"); $this->line(" 资金类型: " . (is_object($fundLog->fund_id) ? $fundLog->fund_id->value : $fundLog->fund_id)); $this->line(" 金额: {$fundLog->amount}"); $this->line(" 操作类型: " . (is_object($fundLog->operate_type) ? $fundLog->operate_type->value : $fundLog->operate_type)); $this->line(" 操作ID: {$fundLog->operate_id}"); $this->line(" 备注: {$fundLog->remark}"); $this->line(" 创建时间: " . date('Y-m-d H:i:s', $fundLog->create_time)); $this->line(""); // 创建收集器实例 $collector = new FundLogCollector(); // 测试转换方法 $userLogData = $collector->convertToUserLogPublic($fundLog); if ($userLogData) { $this->info("✅ 转换成功!"); $this->line("📝 生成的用户日志信息:"); $this->line(" 用户ID: {$userLogData['user_id']}"); $this->line(" 消息: {$userLogData['message']}"); $this->line(" 来源类型: {$userLogData['source_type']}"); $this->line(" 来源ID: {$userLogData['source_id']}"); $this->line(" 来源表: {$userLogData['source_table']}"); $this->line(" 原始时间: {$userLogData['original_time']}"); } else { $this->warning("⚠️ 记录被跳过(可能不符合收集条件)"); } $this->line(""); $this->info("🎉 测试完成!"); return 0; } catch (\Exception $e) { $this->error("❌ 测试失败: {$e->getMessage()}"); $this->line("🚨 错误详情: " . $e->getTraceAsString()); return 1; } } }