返回 AiToEarn
index.ts
1 /**
2 * 平台交互模块
3 *
4 * 目录结构:
5 * plats/
6 * ├── types.ts # 统一类型定义
7 * ├── manager.ts # 统一管理器
8 * ├── xhs/ # 小红书
9 * │ └── index.ts
10 * ├── douyin/ # 抖音
11 * │ └── index.ts
12 * └── index.ts
13 *
14 * 使用方式:
15 *
16 * 1. 通过管理器调用(推荐):
17 * import { platformManager } from '@/store/plugin/plats'
18 * await platformManager.likeWork(PlatType.Xhs, workId, true)
19 *
20 * 2. 直接使用平台实例:
21 * import { xhsInteraction } from '@/store/plugin/plats'
22 * await xhsInteraction.likeWork(workId, true)
23 *
24 * 扩展新平台:
25 * 1. 创建 plats/[platform]/index.ts,实现 IPlatformInteraction 接口
26 * 2. 在 manager.ts 中 register 新平台
27 * 3. 在 types.ts 中添加到 SupportedPlatformType
28 * 4. 在此文件中导出
29 */
30
31 export { douyinInteraction } from './douyin'
32
33 // 管理器
34 export { platformManager } from './manager'
35
36 // 类型导出
37 export type {
38 BaseResult,
39 CommentItem,
40 CommentListParams,
41 CommentListResult,
42 CommentParams,
43 CommentResult,
44 CommentUser,
45 DirectMessageParams,
46 DirectMessageResult,
47 FavoriteResult,
48 GetWorkDetailParams,
49 GetWorkDetailResult,
50 HomeFeedItem,
51 HomeFeedListParams,
52 HomeFeedListResult,
53 IPlatformInteraction,
54 LikeResult,
55 SubCommentListParams,
56 SupportedPlatformType,
57 TopicInfo,
58 WorkDetail,
59 } from './types'
60 // 平台实例
61 export { xhsInteraction } from './xhs'
62
62 lines TYPESCRIPT