- 创建统一的下载错误处理模块 (lib/download-errors.ts) - 实现13种错误类型分类和中文错误消息 - 后端统一使用 createDownloadError 创建标准化错误响应 - 前端统一使用 parseDownloadError 解析错误并显示 - 修复正式系统数据库Schema,添加产品全案相关字段和表 - 执行数据库迁移:添加 task_no, task_status, task_fetched_at 字段 - 创建 material_assets, api_keys, api_call_logs 表
74 lines
2.1 KiB
TypeScript
74 lines
2.1 KiB
TypeScript
/**
|
|
* 检查上传状态 - 查看最近创建的素材的详细状态
|
|
*/
|
|
|
|
import { PrismaClient } from '@prisma/client'
|
|
|
|
const prisma = new PrismaClient()
|
|
|
|
async function checkUploadStatus() {
|
|
try {
|
|
console.log('=== 检查最近4个素材的详细状态 ===\n')
|
|
|
|
const materialIds = [
|
|
'03e5f439-86e5-4042-869d-3c497684b5a2',
|
|
'20cf837e-873a-4472-80b3-b431484a70be',
|
|
'e679c446-f7b2-4634-b4fa-00d34541267d',
|
|
'a4bb08b2-6029-4ecd-a2e7-ebde52e903ed',
|
|
]
|
|
|
|
for (const id of materialIds) {
|
|
const material = await prisma.material.findUnique({
|
|
where: { id },
|
|
include: {
|
|
user: {
|
|
select: {
|
|
username: true,
|
|
email: true,
|
|
},
|
|
},
|
|
},
|
|
})
|
|
|
|
if (!material) {
|
|
console.log(`素材 ${id}: 未找到\n`)
|
|
continue
|
|
}
|
|
|
|
console.log(`素材ID: ${material.id}`)
|
|
console.log(` SPU: ${material.productModel}`)
|
|
console.log(` 类型: ${material.materialType}`)
|
|
console.log(` 作者: ${material.authorName}`)
|
|
console.log(` 创建时间: ${material.createdAt.toLocaleString('zh-CN')}`)
|
|
console.log(` 更新时间: ${material.updatedAt.toLocaleString('zh-CN')}`)
|
|
console.log(` 文件路径: ${material.zipFilePath}`)
|
|
console.log(` 文件大小: ${material.zipFileSize.toString()} 字节 (${(Number(material.zipFileSize) / 1024 / 1024 / 1024).toFixed(2)} GB)`)
|
|
console.log(` 预览图: ${material.previewUrl ? '有' : '无'}`)
|
|
if (material.videoProcessingStatus) {
|
|
console.log(` 视频状态: ${material.videoProcessingStatus}`)
|
|
}
|
|
if (material.transcodeLastError) {
|
|
console.log(` 转码错误: ${material.transcodeLastError.substring(0, 200)}`)
|
|
}
|
|
console.log('')
|
|
}
|
|
|
|
} catch (error) {
|
|
console.error('查询失败:', error)
|
|
throw error
|
|
} finally {
|
|
await prisma.$disconnect()
|
|
}
|
|
}
|
|
|
|
checkUploadStatus()
|
|
.then(() => {
|
|
console.log('✅ 检查完成')
|
|
process.exit(0)
|
|
})
|
|
.catch((error) => {
|
|
console.error('\n❌ 检查失败:', error)
|
|
process.exit(1)
|
|
})
|
|
|