gongxiangp2/scripts/test-api-stages-3-4-shadow.ps1
chenpei ea9076df45 feat: 实现统一的下载错误处理系统并修复产品全案数据库Schema
- 创建统一的下载错误处理模块 (lib/download-errors.ts)
- 实现13种错误类型分类和中文错误消息
- 后端统一使用 createDownloadError 创建标准化错误响应
- 前端统一使用 parseDownloadError 解析错误并显示
- 修复正式系统数据库Schema,添加产品全案相关字段和表
- 执行数据库迁移:添加 task_no, task_status, task_fetched_at 字段
- 创建 material_assets, api_keys, api_call_logs 表
2026-01-05 17:52:42 +08:00

51 lines
2.0 KiB
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# API功能测试脚本:阶段三和阶段四
# 在影子系统上测试后端API功能
$ErrorActionPreference = "Stop"
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "API功能测试:阶段三和阶段四" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# 设置环境变量(影子系统)
$env:DATABASE_URL = "postgresql://gongxiangpan:gongxiangpan123@192.168.58.20:5432/lobechat_stage"
$env:SHADOW_SYSTEM_URL = "http://192.168.58.20:5320"
Write-Host "✅ 环境变量已设置" -ForegroundColor Green
Write-Host " 数据库: lobechat_stage (影子系统)" -ForegroundColor Cyan
Write-Host " API地址: $env:SHADOW_SYSTEM_URL" -ForegroundColor Cyan
Write-Host ""
# 切换到项目根目录
Set-Location $PSScriptRoot\..
$projectRoot = Get-Location
Write-Host "项目目录: $projectRoot" -ForegroundColor Cyan
Write-Host ""
# 执行API测试
Write-Host "📋 执行API功能测试..." -ForegroundColor Yellow
Write-Host " 执行: npx tsx scripts/test-api-stages-3-4.ts" -ForegroundColor Gray
try {
npx tsx scripts/test-api-stages-3-4.ts
if ($LASTEXITCODE -ne 0) {
Write-Host " ⚠️ 测试发现问题,请检查输出" -ForegroundColor Yellow
} else {
Write-Host " ✅ 所有测试通过" -ForegroundColor Green
}
} catch {
Write-Host " ⚠️ 测试过程出错: $_" -ForegroundColor Yellow
}
Write-Host ""
Write-Host "========================================" -ForegroundColor Green
Write-Host "✅ 测试执行完成" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green
Write-Host ""
Write-Host "📋 说明:" -ForegroundColor Yellow
Write-Host " 本测试主要验证后端数据结构和API逻辑" -ForegroundColor White
Write-Host " 部分需要认证的API测试为逻辑验证(不实际调用)" -ForegroundColor White
Write-Host " 如需测试完整的API功能,请在浏览器中登录后使用开发者工具测试" -ForegroundColor White
Write-Host ""