gongxiangp2/lib/material-type-mapper.ts
chenpei cd6e40d9d2 优化:网络传输性能和稳定性 - TCP缓冲区+并发控制优化
主要改动:
1. TCP缓冲区优化(16MB)- 解决公网上传速度慢问题
2. 并发数降低到1-3 - 避免4并发导致ERR_CONNECTION_RESET
3. 动态并发控制 - 根据网络环境自动调整
4. Nginx超时增加到120s - 支持大分片上传
5. 上传进度修复 - 修复剩余时间计算
6. 新增任务-页面上传器和详情组件
7. 统一部署文档为deploy-remote-build.ps1

问题修复:
- 公网用户上传从200-900KB/s提升到预期3-5MB/s
- 内网用户上传更稳定,无连接重置错误
- UploadProgress组件剩余时间计算修正

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-27 09:33:09 +08:00

63 lines
1.8 KiB
TypeScript
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.

/**
* 素材类型映射工具
* 用于将老类型映射到新类型,确保代码兼容性
*/
/**
* 将老类型映射到新类型
*/
export function mapMaterialType(type: string): string {
const typeMap: Record<string, string> = {
'3DMAX': '3D场景',
'产品全案': '任务-详情',
'详情页': '详情模板',
};
return typeMap[type] || type;
}
/**
* 检查素材类型是否匹配(支持老类型和新类型)
* @param actualType 实际的素材类型(可能是老类型或新类型)
* @param expectedType 期望的类型(新类型)
*/
export function isMaterialType(actualType: string, expectedType: string): boolean {
const mappedActualType = mapMaterialType(actualType);
return mappedActualType === expectedType;
}
/**
* 检查素材类型是否为任务-详情
*/
export function isProductPackageType(materialType: string): boolean {
return isMaterialType(materialType, '任务-详情');
}
/**
* 检查素材类型是否为详情模板
*/
export function isDetailTemplateType(materialType: string): boolean {
return isMaterialType(materialType, '详情模板');
}
/**
* 检查素材类型是否为3D场景
*/
export function is3DSceneType(materialType: string): boolean {
return isMaterialType(materialType, '3D场景');
}
/**
* 检查素材类型是否为任务-3D原图/AI原图/实拍原图/视频截图/页面
*/
export function is3DOriginalType(materialType: string): boolean {
return ['任务-3D原图', '任务-AI原图', '任务-实拍原图', '任务-视频截图', '任务-页面'].includes(materialType);
}
/**
* 检查素材类型是否需要查询资产列表(任务-详情 或 任务-3D原图等)
*/
export function needsAssetsList(materialType: string): boolean {
return isProductPackageType(materialType) || is3DOriginalType(materialType);
}