feat(v3.4.15): HQ store media edit and package images up to 20
Allow HQ to replace/delete store photos; support multi-image packages with a 20-image cap. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -5,7 +5,10 @@ export interface StorePackageItemDto {
|
||||
dishes: string;
|
||||
usableTime?: string | null;
|
||||
otherNotes?: string | null;
|
||||
/** 首图(兼容旧字段;多图时等于 imageUrls[0]) */
|
||||
imageUrl?: string | null;
|
||||
/** 套餐图片列表,最多 STORE_PACKAGE_IMAGE_MAX_COUNT 张 */
|
||||
imageUrls?: string[] | null;
|
||||
sortOrder: number;
|
||||
}
|
||||
|
||||
@@ -25,6 +28,32 @@ export const STORE_PACKAGE_CHANGE_STATUS_LABELS: Record<StorePackageChangeStatus
|
||||
|
||||
export const STORE_PACKAGE_MAX_COUNT = 10;
|
||||
|
||||
/** 单条套餐最多上传图片数 */
|
||||
export const STORE_PACKAGE_IMAGE_MAX_COUNT = 20;
|
||||
|
||||
/** 门店环境照最多张数(总部/合伙人上传) */
|
||||
export const STORE_ENV_PHOTO_MAX_COUNT = 20;
|
||||
|
||||
/** 归一化套餐图片:兼容 imageUrl / imageUrls,去重后截断上限 */
|
||||
export function normalizeStorePackageImageUrls(input: {
|
||||
imageUrl?: string | null;
|
||||
imageUrls?: unknown;
|
||||
}): string[] {
|
||||
const seen = new Set<string>();
|
||||
const out: string[] = [];
|
||||
const push = (raw: unknown) => {
|
||||
const url = String(raw ?? '').trim();
|
||||
if (!url || seen.has(url)) return;
|
||||
seen.add(url);
|
||||
out.push(url);
|
||||
};
|
||||
if (Array.isArray(input.imageUrls)) {
|
||||
for (const item of input.imageUrls) push(item);
|
||||
}
|
||||
if (out.length === 0) push(input.imageUrl);
|
||||
return out.slice(0, STORE_PACKAGE_IMAGE_MAX_COUNT);
|
||||
}
|
||||
|
||||
export interface StorePackagesResponse {
|
||||
live: StorePackageViewDto[];
|
||||
pendingRequest?: {
|
||||
|
||||
Reference in New Issue
Block a user