gongxiangp2/scripts/verify-deployment.ts

51 lines
1.5 KiB
TypeScript

import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function main() {
console.log('\n========== 验证部署 ==========');
console.log('检查下载错误码定义...\n');
// 检查数据库中是否有 FILE_MISSING 错误的素材记录
const materialWithMissingFile = await prisma.material.findFirst({
where: {
AND: [
{ zipFilePath: null },
{ zipFileName: null },
],
},
select: {
id: true,
productModel: true,
materialType: true,
zipFilePath: true,
zipFileName: true,
},
});
if (materialWithMissingFile) {
console.log('✅ 找到没有源文件的素材(测试用):');
console.log(` ID: ${materialWithMissingFile.id}`);
console.log(` 产品型号: ${materialWithMissingFile.productModel}`);
console.log(` 类型: ${materialWithMissingFile.materialType}`);
console.log(` 本地路径: ${materialWithMissingFile.zipFilePath || 'N/A'}`);
console.log(` ZIP文件名: ${materialWithMissingFile.zipFileName || 'N/A'}`);
} else {
console.log('⚠️ 未找到没有源文件的素材');
}
console.log('\n检查 lib/download-errors.ts 中的 FILE_MISSING 定义...');
// 这个检查需要在服务器端进行,这里只是提示
console.log('\n========== 检查完成 ==========');
}
main()
.catch((e) => {
console.error('验证失败:', e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});