- 迁移57个老素材到新逻辑(本地zip + S3预览图) - 优化文件命名:SPU_作者_店铺_类型.zip - PSD文件单独存储,不打包进all.zip - 修复下载接口,优先使用本地zip文件 - 修复预览图重复问题 - 添加迁移脚本和验证脚本 - 更新文档和迁移计划 迁移统计: - 总素材数:77个 - 成功迁移:57个 - 新逻辑上传:18个 - 空记录:2个
74 lines
1.7 KiB
TypeScript
74 lines
1.7 KiB
TypeScript
/**
|
|
* 检查所有"任务-详情"素材的状态
|
|
*/
|
|
|
|
import { PrismaClient } from '@prisma/client';
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function main() {
|
|
console.log('='.repeat(60));
|
|
console.log('检查"任务-详情"素材状态');
|
|
console.log('='.repeat(60));
|
|
|
|
try {
|
|
// 1. 总数
|
|
const totalCount = await prisma.material.count({
|
|
where: {
|
|
materialType: '任务-详情',
|
|
deletedAt: null,
|
|
},
|
|
});
|
|
|
|
console.log(`总素材数: ${totalCount}`);
|
|
|
|
// 2. 有资产记录的素材数
|
|
const withAssetsCount = await prisma.material.count({
|
|
where: {
|
|
materialType: '任务-详情',
|
|
deletedAt: null,
|
|
assets: {
|
|
some: {},
|
|
},
|
|
},
|
|
});
|
|
|
|
console.log(`有资产记录的素材数: ${withAssetsCount}`);
|
|
|
|
// 3. 查询前5个素材的详细信息
|
|
const materials = await prisma.material.findMany({
|
|
where: {
|
|
materialType: '任务-详情',
|
|
deletedAt: null,
|
|
},
|
|
include: {
|
|
assets: {
|
|
select: {
|
|
assetType: true,
|
|
fileUrl: true,
|
|
},
|
|
},
|
|
},
|
|
take: 5,
|
|
orderBy: { createdAt: 'desc' },
|
|
});
|
|
|
|
console.log('\n前5个素材的资产情况:');
|
|
materials.forEach((m) => {
|
|
console.log(`\n- ${m.productModel} (${m.id})`);
|
|
console.log(` 资产数: ${m.assets.length}`);
|
|
console.log(` 资产类型: ${m.assets.map((a) => a.assetType).join(', ')}`);
|
|
if (m.assets.length > 0) {
|
|
console.log(` 第一个资产URL: ${m.assets[0].fileUrl.substring(0, 80)}...`);
|
|
}
|
|
});
|
|
} catch (error) {
|
|
console.error('查询失败:', error);
|
|
process.exit(1);
|
|
} finally {
|
|
await prisma.$disconnect();
|
|
}
|
|
}
|
|
|
|
main();
|