门店开通流程

This commit is contained in:
2026-07-03 14:53:21 +08:00
parent c7dc6a2274
commit f2175b83f7
24 changed files with 1451 additions and 186 deletions
@@ -1,7 +1,20 @@
import { randomUUID } from 'crypto';
/** 门店资源上传目录(OSS object key 前缀) */
const STORE_UPLOAD_DIRS: Record<string, string> = {
STORE_TITLE: 'store/title',
STORE_ENV: 'store/env',
STORE_CONTRACT: 'store/contract',
};
export function resolveOssUploadDir(uploadPrefix: string, bizType: string): string {
const storeDir = STORE_UPLOAD_DIRS[bizType];
if (storeDir) return `${storeDir}/`;
return `${uploadPrefix.replace(/\/$/, '')}/${bizType.toLowerCase()}/`;
}
export function buildOssObjectKey(uploadPrefix: string, bizType: string, fileName: string): string {
const ext = fileName.includes('.') ? fileName.split('.').pop() : 'bin';
const dir = `${uploadPrefix.replace(/\/$/, '')}/${bizType.toLowerCase()}/`;
const dir = resolveOssUploadDir(uploadPrefix, bizType);
return `${dir}${Date.now()}-${randomUUID().slice(0, 8)}.${ext}`;
}