Files
gaoYuJournal/miniprogram/types/Attachment.ts
2026-01-04 17:41:02 +08:00

66 lines
942 B
TypeScript

import { Model } from "./Model";
/** 附件 */
export type Attachment = {
/** 业务类型 */
bizType: string;
/** 业务 ID */
bizId: number;
/** 附件类型 */
attachType?: MediaAttachType;
/** 文件名 */
name: string;
mimeType?: string;
metadata?: string | ImageMetadata | PreviewImageMetadata;
/** 文件 MD5 */
md5: string;
/** 访问 mongoId */
mongoId: string;
/** 大小 */
size: number;
} & Model;
/** 媒体附件类型 */
export enum MediaAttachType {
/** 原图 */
SOURCE = "SOURCE",
/** 缩略图 */
THUMB = "THUMB"
}
/** 图片附件元数据 */
export type ImageMetadata = {
/** 宽度 */
width: number;
/** 高度 */
height: number;
}
export type PreviewImageMetadata = {
/** 原文件附件 ID */
sourceId: number;
/** 原文件访问 mongoId */
sourceMongoId: string;
/** true 为图片 */
isImage: boolean;
/** true 为视频 */
isVideo: boolean;
} & ImageMetadata;