| 1 | import type { MaterialMedia } from '../_shared/material.types' |
| 2 | import type { DraftGenerationRequest, ImageTextDraftType, VideoDraftType } from '@/api/ai/ai.types' |
| 3 | import type { PlatType } from '@/app/config/platConfig' |
| 4 | import type { PubType } from '@/app/config/publishConfig' |
| 5 | |
| 6 | // Source: types/assets.ts |
| 7 | |
| 8 | /** |
| 9 | * ThumbnailVo 响应数据。 |
| 10 | */ |
| 11 | export interface ThumbnailVo { |
| 12 | thumbnailUrl: string |
| 13 | } |
| 14 | |
| 15 | // Source: types/oss.ts |
| 16 | |
| 17 | /** |
| 18 | * UploadToOssOptions 数据结构。 |
| 19 | */ |
| 20 | export interface UploadToOssOptions { |
| 21 | onProgress?: (prog: number) => void |
| 22 | publicUploadId?: string |
| 23 | signal?: AbortSignal |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * UploadSignData 数据结构。 |
| 28 | */ |
| 29 | export interface UploadSignData { |
| 30 | id: string |
| 31 | url: string |
| 32 | uploadUrl: string |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * ConfirmUploadData 数据结构。 |
| 37 | */ |
| 38 | export interface ConfirmUploadData { |
| 39 | url?: string |
| 40 | } |
| 41 | |
| 42 | // Source: types/media.ts |
| 43 | |
| 44 | /** |
| 45 | * MediaMetadata 类型。 |
| 46 | */ |
| 47 | export interface MediaMetadata { |
| 48 | size: number |
| 49 | |
| 50 | mimeType: string |
| 51 | |
| 52 | duration?: number |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * MediaItem 数据结构。 |
| 57 | */ |
| 58 | export interface MediaItem { |
| 59 | _id: string |
| 60 | userId: string |
| 61 | userType: string |
| 62 | groupId: string |
| 63 | type: 'video' | 'img' |
| 64 | |
| 65 | url: string |
| 66 | |
| 67 | thumbUrl: string |
| 68 | |
| 69 | title: string |
| 70 | |
| 71 | desc: string |
| 72 | |
| 73 | useCount: number |
| 74 | |
| 75 | metadata: MediaMetadata |
| 76 | createdAt: string |
| 77 | updatedAt: string |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * MediaGroup 类型。 |
| 82 | */ |
| 83 | export interface MediaGroup { |
| 84 | _id: string |
| 85 | userId: string |
| 86 | userType: string |
| 87 | |
| 88 | type: 'video' | 'img' |
| 89 | |
| 90 | title: string |
| 91 | |
| 92 | desc?: string |
| 93 | |
| 94 | isDefault?: boolean |
| 95 | createdAt: string |
| 96 | updatedAt: string |
| 97 | |
| 98 | mediaList?: { |
| 99 | total: number |
| 100 | list: MediaItem[] |
| 101 | } |
| 102 | |
| 103 | // ===== 前端处理后添加的字段 ===== |
| 104 | |
| 105 | cover?: string |
| 106 | |
| 107 | count?: number |
| 108 | |
| 109 | previewMedia?: { |
| 110 | type: 'video' | 'img' |
| 111 | url: string |
| 112 | thumbUrl: string |
| 113 | } | null |
| 114 | } |
| 115 | |
| 116 | // Source: types/material.ts |
| 117 | |
| 118 | /** |
| 119 | * MaterialGroupUseScene 类型。 |
| 120 | */ |
| 121 | export type MaterialGroupUseScene = string |
| 122 | |
| 123 | /** |
| 124 | * CreateMaterialGroupParams 请求参数。 |
| 125 | */ |
| 126 | export interface CreateMaterialGroupParams { |
| 127 | name: string |
| 128 | desc?: string |
| 129 | platforms?: PlatType[] |
| 130 | useScene?: MaterialGroupUseScene |
| 131 | useSceneRelId?: string |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * MaterialGroupListFilters 类型。 |
| 136 | */ |
| 137 | export interface MaterialGroupListFilters { |
| 138 | title?: string |
| 139 | useScene?: MaterialGroupUseScene |
| 140 | useSceneRelId?: string |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * MaterialGroupSceneVo 响应数据。 |
| 145 | */ |
| 146 | export interface MaterialGroupSceneVo { |
| 147 | id: string |
| 148 | name: string |
| 149 | useScene?: MaterialGroupUseScene |
| 150 | useSceneRelId?: string |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | * PlanStatistics 数据结构。 |
| 155 | */ |
| 156 | export interface PlanStatistics { |
| 157 | materialCount: number |
| 158 | publishCount: number |
| 159 | viewCount: number |
| 160 | likeCount: number |
| 161 | commentCount: number |
| 162 | shareCount: number |
| 163 | favoriteCount: number |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * PromotionPlan 类型。 |
| 168 | */ |
| 169 | export interface PromotionPlan { |
| 170 | id: string |
| 171 | name: string |
| 172 | title?: string |
| 173 | type: PubType |
| 174 | platform?: PlatType |
| 175 | desc?: string |
| 176 | createdAt?: string |
| 177 | updatedAt?: string |
| 178 | mediaCount?: number |
| 179 | isDefault?: boolean |
| 180 | useScene?: MaterialGroupUseScene |
| 181 | useSceneRelId?: string |
| 182 | statistics?: PlanStatistics |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * MaterialGenerationParams 请求参数。 |
| 187 | */ |
| 188 | export interface MaterialGenerationParams extends DraftGenerationRequest { |
| 189 | platforms?: PlatType[] |
| 190 | draftType?: VideoDraftType | ImageTextDraftType |
| 191 | videoUrls?: string[] |
| 192 | audioUrls?: string[] |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * PromotionMaterial 类型。 |
| 197 | */ |
| 198 | export interface PromotionMaterial { |
| 199 | id: string |
| 200 | groupId: string |
| 201 | title: string |
| 202 | desc?: string |
| 203 | coverUrl?: string |
| 204 | mediaList: MaterialMedia[] |
| 205 | type?: PubType |
| 206 | status: 0 | 1 |
| 207 | location?: [number, number] |
| 208 | option?: Record<string, unknown> |
| 209 | createdAt?: string |
| 210 | useCount?: number |
| 211 | useCountByAccountType?: Partial<Record<PlatType, number>> |
| 212 | maxUseCount?: number |
| 213 | maxUseCountByAccountType?: Partial<Record<PlatType, number>> |
| 214 | topics?: string[] |
| 215 | model?: string |
| 216 | generationParams?: MaterialGenerationParams |
| 217 | accountTypes?: string[] |
| 218 | } |
| 219 | |
| 220 | /** |
| 221 | * PublishRecord 数据结构。 |
| 222 | */ |
| 223 | export interface PublishRecord { |
| 224 | id: string |
| 225 | materialGroupId: string |
| 226 | dataId: string |
| 227 | accountId: string |
| 228 | accountType: string |
| 229 | uid: string |
| 230 | title: string |
| 231 | desc: string |
| 232 | coverUrl: string |
| 233 | videoUrl: string |
| 234 | imgUrlList?: string[] |
| 235 | workLink: string |
| 236 | publishTime: string |
| 237 | status: number |
| 238 | createdAt: string |
| 239 | viewCount: number |
| 240 | likeCount: number |
| 241 | commentCount: number |
| 242 | shareCount: number |
| 243 | favoriteCount: number |
| 244 | insightUpdatedAt: string |
| 245 | platformName?: string |
| 246 | platformIcon?: string |
| 247 | } |
| 248 | |
| 249 | /** |
| 250 | * 素材分页信息。 |
| 251 | */ |
| 252 | export interface MaterialPagination { |
| 253 | current: number |
| 254 | pageSize: number |
| 255 | total: number |
| 256 | hasMore: boolean |
| 257 | } |
| 258 | |
| 259 | /** |
| 260 | * TransferMediaParams 请求参数。 |
| 261 | */ |
| 262 | export interface TransferMediaParams { |
| 263 | ids: string[] |
| 264 | targetGroupId: string |
| 265 | mode: 'move' | 'copy' |
| 266 | } |
| 267 | |
| 268 | /** |
| 269 | * MaterialListFilters 类型。 |
| 270 | */ |
| 271 | export interface MaterialListFilters { |
| 272 | title?: string |
| 273 | useCount?: number |
| 274 | } |
| 275 | |
| 276 | /** |
| 277 | * MaterialFilterDeleteParams 请求参数。 |
| 278 | */ |
| 279 | export interface MaterialFilterDeleteParams { |
| 280 | title?: string |
| 281 | groupId?: string |
| 282 | useCount?: number |
| 283 | } |
| 284 | |
| 285 | /** |
| 286 | * TransferMaterialParams 请求参数。 |
| 287 | */ |
| 288 | export interface TransferMaterialParams { |
| 289 | ids: string[] |
| 290 | targetGroupId: string |
| 291 | mode: 'move' | 'copy' |
| 292 | } |
| 293 | |
| 294 | /** |
| 295 | * 公开推广码最优素材响应数据。 |
| 296 | */ |
| 297 | export interface OptimalMaterialVo { |
| 298 | _id: string |
| 299 | groupId?: string |
| 300 | title?: string |
| 301 | desc?: string |
| 302 | topics?: string[] |
| 303 | coverUrl?: string |
| 304 | mediaList?: MaterialMedia[] |
| 305 | useCount: number |
| 306 | useCountByAccountType?: Partial<Record<PlatType, number>> |
| 307 | maxUseCount?: number |
| 308 | maxUseCountByAccountType?: Partial<Record<PlatType, number>> |
| 309 | option: any |
| 310 | platform: PlatType |
| 311 | } |
| 312 | |
| 313 | /** |
| 314 | * 公开素材接口响应包装。 |
| 315 | */ |
| 316 | export type MaterialOpenApiResponse<T> = { |
| 317 | code: string | number |
| 318 | data: T |
| 319 | message: string |
| 320 | url: string |
| 321 | } | null |
| 322 | |
| 323 | /** |
| 324 | * 按使用场景查询素材组请求参数。 |
| 325 | */ |
| 326 | export interface GetMaterialGroupBySceneParams { |
| 327 | useScene: MaterialGroupUseScene |
| 328 | useSceneRelId: string |
| 329 | } |
| 330 | |
| 331 | /** |
| 332 | * 按使用场景查询素材组原始响应数据。 |
| 333 | */ |
| 334 | export type MaterialGroupBySceneData = MaterialGroupSceneVo | MaterialGroupSceneVo[] | null |
| 335 | |
| 336 | /** |
| 337 | * 素材转移结果。 |
| 338 | */ |
| 339 | export interface TransferMediaResult { |
| 340 | count: number |
| 341 | } |
| 342 | |
| 343 | /** |
| 344 | * 媒体列表查询参数。 |
| 345 | */ |
| 346 | export interface MediaListFilters { |
| 347 | groupId?: string |
| 348 | materialGroupId?: string |
| 349 | } |
| 350 | |
| 351 | /** |
| 352 | * 媒体列表响应。 |
| 353 | */ |
| 354 | export interface MediaListResponse { |
| 355 | list: MediaItem[] |
| 356 | total: number |
| 357 | } |
| 358 | |
| 359 | /** |
| 360 | * 创建素材组响应。 |
| 361 | */ |
| 362 | export interface CreateMaterialGroupVo { |
| 363 | id: string |
| 364 | } |
| 365 | |
| 366 | /** |
| 367 | * 素材组更新请求参数。 |
| 368 | */ |
| 369 | export interface UpdateMaterialGroupParams { |
| 370 | name?: string |
| 371 | } |
| 372 | |
| 373 | /** |
| 374 | * 素材组列表响应。 |
| 375 | */ |
| 376 | export interface MaterialGroupListVo { |
| 377 | list: PromotionPlan[] |
| 378 | total: number |
| 379 | } |
| 380 | |
| 381 | /** |
| 382 | * 创建草稿请求参数。 |
| 383 | */ |
| 384 | export interface CreateMaterialParams { |
| 385 | groupId: string |
| 386 | coverUrl?: string |
| 387 | mediaList: MaterialMedia[] |
| 388 | title: string |
| 389 | desc?: string |
| 390 | topics?: string[] |
| 391 | type: PubType |
| 392 | option?: Record<string, unknown> |
| 393 | location?: number[] |
| 394 | accountTypes?: string[] |
| 395 | maxUseCountByAccountType?: Partial<Record<PlatType, number>> |
| 396 | } |
| 397 | |
| 398 | /** |
| 399 | * 素材列表查询参数。 |
| 400 | */ |
| 401 | export interface MaterialListQueryParams { |
| 402 | groupId: string |
| 403 | title?: string |
| 404 | useCount?: number |
| 405 | } |
| 406 | |
| 407 | /** |
| 408 | * 素材列表响应。 |
| 409 | */ |
| 410 | export interface MaterialListVo { |
| 411 | list: PromotionMaterial[] |
| 412 | total: number |
| 413 | } |
| 414 | |
| 415 | /** |
| 416 | * 更新草稿请求参数。 |
| 417 | */ |
| 418 | export interface UpdateMaterialParams { |
| 419 | coverUrl?: string |
| 420 | mediaList?: MaterialMedia[] |
| 421 | title?: string |
| 422 | desc?: string |
| 423 | topics?: string[] |
| 424 | location?: number[] |
| 425 | option?: Record<string, unknown> |
| 426 | accountTypes?: string[] |
| 427 | maxUseCountByAccountType?: Partial<Record<PlatType, number>> |
| 428 | } |
| 429 |