| 1 | import type { SocialAccount } from '@/api/accounts/account.types' |
| 2 | |
| 3 | export interface IImgFile { |
| 4 | id: string |
| 5 | size: number |
| 6 | file: File |
| 7 | // 前端临时路径,注意不要存到数据库 |
| 8 | imgUrl: string |
| 9 | filename: string |
| 10 | // 图片在硬盘上的路径 |
| 11 | imgPath: string |
| 12 | // 图片宽度 |
| 13 | width: number |
| 14 | // 图片高度 |
| 15 | height: number |
| 16 | // 前端上传到oss后的url |
| 17 | ossUrl?: string |
| 18 | // 上传任务ID(用于取消/进度追踪) |
| 19 | uploadTaskId?: string |
| 20 | } |
| 21 | |
| 22 | export interface IVideoFile { |
| 23 | size: number |
| 24 | file: Blob |
| 25 | // 前端临时路径,注意不要存到数据库 |
| 26 | videoUrl: string |
| 27 | // 前端上传到oss后的url |
| 28 | ossUrl?: string |
| 29 | filename: string |
| 30 | // 视频宽度 |
| 31 | width: number |
| 32 | // 视频高度 |
| 33 | height: number |
| 34 | // 视频下取整的时长,单位秒 |
| 35 | duration: number |
| 36 | // 视频首帧图片 |
| 37 | cover: IImgFile |
| 38 | // 上传任务ID(用于取消/进度追踪) |
| 39 | uploadTaskIds?: { |
| 40 | video?: string |
| 41 | cover?: string |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | export interface IWxSphPoiInfo { |
| 46 | latitude?: number |
| 47 | longitude?: number |
| 48 | poiCity?: string |
| 49 | poiName?: string |
| 50 | poiAddress?: string |
| 51 | poiId?: string |
| 52 | province?: string |
| 53 | region?: string |
| 54 | fullAddress?: string |
| 55 | poiCheckSum?: string |
| 56 | } |
| 57 | |
| 58 | export interface IWxSphEventInfo { |
| 59 | eventTopicId: string |
| 60 | eventName: string |
| 61 | eventCreatorNickname?: string |
| 62 | eventAttendCount?: number |
| 63 | } |
| 64 | export type IXhsUserDeclarationOrigin = 1 | 2 | 3 |
| 65 | |
| 66 | export interface IXhsUserDeclarationBind { |
| 67 | origin: IXhsUserDeclarationOrigin |
| 68 | } |
| 69 | |
| 70 | export type PlatformPublishOption = Record<string, unknown> |
| 71 | |
| 72 | // 发布 每个平台的独有参数 |
| 73 | export interface IPlatOption { |
| 74 | bilibili?: PlatformPublishOption & { |
| 75 | // 分区ID,由获取分区信息接口得到 |
| 76 | tid?: number |
| 77 | // 1-原创,2-转载(转载时source必填) |
| 78 | copyright?: number |
| 79 | // 如果copyright为转载,则此字段表示转载来源 |
| 80 | source?: string |
| 81 | // 是否允许转载 0-允许,1-不允许 |
| 82 | no_reprint?: number |
| 83 | // 话题 ID |
| 84 | topic_id?: number |
| 85 | // 投稿活动 ID |
| 86 | mission_id?: number |
| 87 | } |
| 88 | wxGzh?: PlatformPublishOption & { |
| 89 | // 平台独立标题,仅用于微信公众号 |
| 90 | title?: string |
| 91 | // 图文作者 |
| 92 | author?: string |
| 93 | // 图文摘要 |
| 94 | digest?: string |
| 95 | // 是否开启评论 |
| 96 | open_comment?: number |
| 97 | // 是否仅粉丝可评论 |
| 98 | only_fans_can_comment?: number |
| 99 | // 是否显示封面 |
| 100 | showCoverPic?: boolean |
| 101 | // 原文链接 |
| 102 | sourceUrl?: string |
| 103 | } |
| 104 | facebook?: PlatformPublishOption & { |
| 105 | // 页面 ID |
| 106 | page_id?: string |
| 107 | // 是否发布为 Reels |
| 108 | isReel?: boolean |
| 109 | // Feed 链接 |
| 110 | link?: string |
| 111 | // 内容类型:post(Post)、reel(Reel)、story(Story) |
| 112 | content_category?: string |
| 113 | // 内容标签 |
| 114 | content_tags?: string[] |
| 115 | // 自定义标签 |
| 116 | custom_labels?: string[] |
| 117 | // 直接分享状态 |
| 118 | direct_share_status?: number |
| 119 | // 是否可嵌入 |
| 120 | embeddable?: boolean |
| 121 | // Feed 定向 |
| 122 | feed_targeting?: Record<string, unknown> |
| 123 | // Reels/视频发布状态 |
| 124 | video_state?: string |
| 125 | } |
| 126 | instagram?: PlatformPublishOption & { |
| 127 | // 内容类型:post(Post)、reel(Reel)、story(Story) |
| 128 | content_category?: string |
| 129 | // 是否发布为 Reels |
| 130 | isReel?: boolean |
| 131 | // 替代文本 |
| 132 | alt_text?: string |
| 133 | // 覆盖标题 |
| 134 | caption?: string |
| 135 | // 协作者 |
| 136 | collaborators?: string[] |
| 137 | // 封面 URL |
| 138 | cover_url?: string |
| 139 | // 图片 URL |
| 140 | image_url?: string |
| 141 | // 位置 ID |
| 142 | location_id?: string |
| 143 | // 媒体类型 |
| 144 | media_type?: string |
| 145 | // 商品标签 |
| 146 | product_tags?: Record<string, unknown>[] |
| 147 | // 用户标签 |
| 148 | user_tags?: Record<string, unknown>[] |
| 149 | } |
| 150 | youtube?: PlatformPublishOption & { |
| 151 | // 隐私状态:public、unlisted、private |
| 152 | privacyStatus?: string |
| 153 | // 标签列表 |
| 154 | tags?: string[] |
| 155 | // 许可证类型:youtube、creativeCommon |
| 156 | license?: string |
| 157 | // 视频分类ID |
| 158 | categoryId?: string |
| 159 | // 定时发布时间 |
| 160 | publishAt?: string |
| 161 | // 是否通知订阅者 |
| 162 | notifySubscribers?: boolean |
| 163 | // 是否允许嵌入 |
| 164 | embeddable?: boolean |
| 165 | // 是否为儿童内容 |
| 166 | selfDeclaredMadeForKids?: boolean |
| 167 | // YouTube 审核后的儿童内容标记 |
| 168 | madeForKids?: boolean |
| 169 | } |
| 170 | pinterest?: PlatformPublishOption & { |
| 171 | // Board ID,由获取Pinterest Board信息接口得到 |
| 172 | boardId?: string |
| 173 | // Pin 跳转链接 |
| 174 | link?: string |
| 175 | // 替代文本 |
| 176 | altText?: string |
| 177 | // 视频 Pin 封面 URL |
| 178 | coverImageUrl?: string |
| 179 | } |
| 180 | xhs?: PlatformPublishOption & { |
| 181 | // 小红书用户声明绑定:1=虚拟演绎,仅供娱乐、2=笔记含AI合成内容、3=内容包含营销广告 |
| 182 | userDeclarationBind?: IXhsUserDeclarationBind | null |
| 183 | } |
| 184 | wxSph?: PlatformPublishOption & { |
| 185 | // WeChat Channels location |
| 186 | poiInfo?: IWxSphPoiInfo |
| 187 | // WeChat Channels activity |
| 188 | activity?: IWxSphEventInfo |
| 189 | // WeChat Channels extension link |
| 190 | extLink?: string |
| 191 | // Declare original content |
| 192 | isOriginal?: boolean |
| 193 | } |
| 194 | tiktok?: PlatformPublishOption & { |
| 195 | // 隐私级别:PUBLIC_TO_EVERYONE、MUTUAL_FOLLOW_FRIENDS、SELF_ONLY |
| 196 | privacy_level?: string |
| 197 | // 是否禁用评论 |
| 198 | comment_disabled?: boolean |
| 199 | // 是否禁用合拍 |
| 200 | duet_disabled?: boolean |
| 201 | // 是否禁用拼接 |
| 202 | stitch_disabled?: boolean |
| 203 | // 品牌有机内容开关 |
| 204 | brand_organic_toggle?: boolean |
| 205 | // 品牌内容开关 |
| 206 | brand_content_toggle?: boolean |
| 207 | // 商业内容披露开关 |
| 208 | brand_disclosure_enabled?: boolean |
| 209 | // 图文发布自动配乐 |
| 210 | auto_add_music?: boolean |
| 211 | // 图文封面图片下标 |
| 212 | photo_cover_index?: number |
| 213 | // 视频上传来源 |
| 214 | source?: string |
| 215 | } |
| 216 | threads?: PlatformPublishOption & { |
| 217 | // 回复控制 |
| 218 | reply_control?: string |
| 219 | // 位置信息 |
| 220 | location_id?: string | null |
| 221 | // 允许的国家代码 |
| 222 | allowlisted_country_codes?: string[] |
| 223 | // 替代文本 |
| 224 | alt_text?: string |
| 225 | // 是否自动发布文本 |
| 226 | auto_publish_text?: boolean |
| 227 | // 话题标签 |
| 228 | topic_tag?: string |
| 229 | // 链接附件 URL |
| 230 | link_attachment_url?: string |
| 231 | // 回复的 Threads 帖子 ID |
| 232 | reply_to_id?: string |
| 233 | // 引用的 Threads 帖子 ID |
| 234 | quote_post_id?: string |
| 235 | } |
| 236 | twitter?: PlatformPublishOption & { |
| 237 | // 回复的推文 ID |
| 238 | reply_to_tweet_id?: string |
| 239 | // 回复权限 |
| 240 | replySettings?: 'following' | 'mentionedUsers' | 'subscribers' | 'verified' |
| 241 | // 后端回复权限字段 |
| 242 | reply_settings?: 'following' | 'mentionedUsers' | 'subscribers' | 'verified' |
| 243 | // 是否包含 AI 生成媒体 |
| 244 | madeWithAi?: boolean |
| 245 | // 后端 AI 内容字段 |
| 246 | made_with_ai?: boolean |
| 247 | // 投票配置 |
| 248 | poll?: { |
| 249 | options: string[] |
| 250 | durationMinutes: number |
| 251 | replySettings?: 'following' | 'mentionedUsers' | 'subscribers' | 'verified' |
| 252 | } |
| 253 | // 媒体标记用户 ID(仅图片帖,最多 10 个) |
| 254 | mediaTaggedUserIds?: string[] |
| 255 | // 媒体无障碍描述(顺序需与媒体上传顺序一致) |
| 256 | mediaMetadata?: { |
| 257 | altText?: string |
| 258 | }[] |
| 259 | // 引用推文 ID |
| 260 | quote_tweet_id?: string |
| 261 | // 是否为付费合作 |
| 262 | paid_partnership?: boolean |
| 263 | // 后端媒体替代文本字段 |
| 264 | alt_text?: string |
| 265 | } |
| 266 | douyin?: PlatformPublishOption & { |
| 267 | // 分享 ID |
| 268 | shareId?: string |
| 269 | // 话题标签列表 |
| 270 | hashtag_list?: string[] |
| 271 | // 标题 |
| 272 | title?: string |
| 273 | // 短标题 |
| 274 | short_title?: string |
| 275 | // 标题话题标签列表 |
| 276 | title_hashtag_list?: Record<string, unknown>[] |
| 277 | // 自定义封面 URL |
| 278 | custom_cover_image_url?: string |
| 279 | // 封面时间戳,单位毫秒 |
| 280 | cover_tsp?: number |
| 281 | // 下载类型 1-允许,2-不允许 |
| 282 | download_type?: number |
| 283 | // 私密状态 |
| 284 | private_status?: number |
| 285 | // 图片路径列表 |
| 286 | image_list_path?: string[] |
| 287 | // 视频路径 |
| 288 | video_path?: string |
| 289 | } |
| 290 | KWAI?: PlatformPublishOption & { |
| 291 | // 封面 URL |
| 292 | cover?: string |
| 293 | // 话题 |
| 294 | photo_topic?: string |
| 295 | // 视频类型 |
| 296 | stereo_type?: string |
| 297 | // 挂载商品 ID |
| 298 | merchant_product_id?: string |
| 299 | } |
| 300 | linkedin?: PlatformPublishOption & { |
| 301 | // 可见性 |
| 302 | visibility?: string |
| 303 | // 发帖主体 URN |
| 304 | authorUrn?: string |
| 305 | // 分发渠道 |
| 306 | distribution?: string |
| 307 | // 覆盖正文 |
| 308 | commentary?: string |
| 309 | // 账号类型 |
| 310 | accountType?: string |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | // 发布参数 |
| 315 | export interface IPubParams { |
| 316 | des: string |
| 317 | // 视频和图片不能同时存在,存在图片本次发布则为图文,存在视频则本次发布为视频发布 -------------- |
| 318 | // 图片 |
| 319 | images?: IImgFile[] |
| 320 | // 视频 |
| 321 | video?: IVideoFile |
| 322 | // 话题 |
| 323 | topics?: string[] |
| 324 | // 标题 |
| 325 | title?: string |
| 326 | // 发布 每个平台的独有参数 |
| 327 | option: IPlatOption |
| 328 | } |
| 329 | |
| 330 | // 发布数据 item |
| 331 | export interface PubItem { |
| 332 | account: SocialAccount |
| 333 | params: IPubParams |
| 334 | } |
| 335 | |
| 336 | // b站分区 item |
| 337 | export interface BiblPartItem { |
| 338 | description: string |
| 339 | id: number |
| 340 | name: string |
| 341 | parent: number |
| 342 | children: BiblPartItem[] |
| 343 | } |
| 344 | |
| 345 | // YouTube视频分类 item |
| 346 | export interface YouTubeCategoryItem { |
| 347 | id: string |
| 348 | snippet: { |
| 349 | title: string |
| 350 | description?: string |
| 351 | } |
| 352 | } |
| 353 |