| 1 | /* |
| 2 | * @Author: nevin |
| 3 | * @Date: 2025-01-23 15:48:14 |
| 4 | * @LastEditTime: 2025-03-20 22:39:03 |
| 5 | * @LastEditors: nevin |
| 6 | * @Description: 评论他人 |
| 7 | */ |
| 8 | import { PlatType } from '@@/AccountEnum'; |
| 9 | export type WorkData = { |
| 10 | dataId: string; |
| 11 | readCount?: number; |
| 12 | likeCount?: number; |
| 13 | collectCount?: number; |
| 14 | forwardCount?: number; |
| 15 | commentCount?: number; // 评论数量 |
| 16 | income?: number; |
| 17 | title?: string; |
| 18 | desc?: string; |
| 19 | coverUrl?: string; |
| 20 | videoUrl?: string; |
| 21 | authorId?: string; |
| 22 | author?: { |
| 23 | id: string; |
| 24 | }; |
| 25 | option?: { |
| 26 | xsec_token: string; |
| 27 | }; |
| 28 | }; |
| 29 | |
| 30 | export type CommentData = { |
| 31 | dataId: string; |
| 32 | videoAuthId?: string; |
| 33 | commentId: string; |
| 34 | parentCommentId?: string; // 上级评论ID |
| 35 | content: string; |
| 36 | likeCount?: number; // 点赞次数 |
| 37 | nikeName?: string; |
| 38 | headUrl?: string; |
| 39 | data: any; // 原数据 |
| 40 | subCommentList: CommentData[]; // 子数据 |
| 41 | }; |
| 42 | |
| 43 | export enum PageType { |
| 44 | paging = 'paging', |
| 45 | cursor = 'cursor', |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * 点赞作品 |
| 50 | */ |
| 51 | export async function icpDianzanDyOther( |
| 52 | accountId: number, |
| 53 | dataId: string, |
| 54 | option?: any, |
| 55 | ) { |
| 56 | const res: any = await window.ipcRenderer.invoke( |
| 57 | 'ICP_DIANZAN_DY_OTHER', |
| 58 | accountId, |
| 59 | dataId, |
| 60 | option, |
| 61 | ); |
| 62 | return res; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * 收藏作品 |
| 67 | */ |
| 68 | export async function icpShoucangDyOther(accountId: number, dataId: string) { |
| 69 | const res: any = await window.ipcRenderer.invoke( |
| 70 | 'ICP_SHOUCANG_DY_OTHER', |
| 71 | accountId, |
| 72 | dataId, |
| 73 | ); |
| 74 | return res; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * 搜索各平台内容 |
| 79 | */ |
| 80 | export async function getCommentSearchNotes( |
| 81 | accountId: number, |
| 82 | qe?: string, |
| 83 | pageInfo?: any, |
| 84 | ) { |
| 85 | const res: { |
| 86 | list: WorkData[]; |
| 87 | orgList?: any; |
| 88 | pageInfo: { |
| 89 | pageType: PageType; |
| 90 | count?: number; |
| 91 | hasMore?: boolean; |
| 92 | pcursor?: string; |
| 93 | }; |
| 94 | } = await window.ipcRenderer.invoke( |
| 95 | 'ICP_SEARCH_NODE_LIST', |
| 96 | accountId, |
| 97 | qe, |
| 98 | pageInfo, |
| 99 | ); |
| 100 | return res; |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * 获取评论列表 |
| 105 | */ |
| 106 | export async function icpGetCommentListByOther( |
| 107 | accountId: number, |
| 108 | data: WorkData, |
| 109 | pcursor?: string, |
| 110 | ) { |
| 111 | const res: { |
| 112 | list: CommentData[]; |
| 113 | pageInfo: { |
| 114 | count?: number; |
| 115 | hasMore: boolean; |
| 116 | pcursor?: string; |
| 117 | }; |
| 118 | } = await window.ipcRenderer.invoke( |
| 119 | 'ICP_COMMENT_LIST_BY_OTHER', |
| 120 | accountId, |
| 121 | data, |
| 122 | pcursor, |
| 123 | ); |
| 124 | return res; |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * 获取二级评论列表 |
| 129 | */ |
| 130 | export async function icpGetSecondCommentListByOther( |
| 131 | accountId: number, |
| 132 | data: WorkData, |
| 133 | root_comment_id: string, |
| 134 | pcursor?: string, |
| 135 | ) { |
| 136 | const res: any = await window.ipcRenderer.invoke( |
| 137 | 'ICP_SECOND_COMMENT_LIST_BY_OTHER', |
| 138 | accountId, |
| 139 | data, |
| 140 | root_comment_id, |
| 141 | pcursor, |
| 142 | ); |
| 143 | return res; |
| 144 | } |
| 145 | |
| 146 | /** |
| 147 | * 创建评论 |
| 148 | */ |
| 149 | export async function icpCreateComment( |
| 150 | accountId: number, |
| 151 | dataId: string, |
| 152 | content: string, |
| 153 | authorId?: string, |
| 154 | ) { |
| 155 | const res: any = await window.ipcRenderer.invoke( |
| 156 | 'ICP_CREATE_COMMENT_BY_OTHER', |
| 157 | accountId, |
| 158 | dataId, |
| 159 | content, |
| 160 | authorId, |
| 161 | ); |
| 162 | return res; |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * 回复评论 |
| 167 | */ |
| 168 | export async function icpReplyCommentByOther( |
| 169 | accountId: number, |
| 170 | commentId: string, |
| 171 | content: string, |
| 172 | option: { |
| 173 | dataId?: string; // 作品ID |
| 174 | comment: any; // 辅助数据,原数据 |
| 175 | videoAuthId?: string; // 视频作者ID |
| 176 | }, |
| 177 | ) { |
| 178 | const res: boolean = await window.ipcRenderer.invoke( |
| 179 | 'ICP_REPLY_COMMENT_BY_OTHER', |
| 180 | accountId, |
| 181 | commentId, |
| 182 | content, |
| 183 | option, |
| 184 | ); |
| 185 | return res; |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * 作品互动 |
| 190 | */ |
| 191 | export async function icpInteractionOneData( |
| 192 | accountId: number, |
| 193 | works: WorkData, |
| 194 | option: { |
| 195 | commentContent: string; // 评论内容 |
| 196 | }, |
| 197 | ) { |
| 198 | const res: boolean = await window.ipcRenderer.invoke( |
| 199 | 'ICP_INTERACTION_ONE_DATA', |
| 200 | accountId, |
| 201 | works, |
| 202 | option, |
| 203 | ); |
| 204 | return res; |
| 205 | } |
| 206 | |
| 207 | /** |
| 208 | * 一键AI互动 |
| 209 | */ |
| 210 | export async function icpCreateInteractionOneKey( |
| 211 | accountId: number, |
| 212 | worksList: WorkData[], |
| 213 | option: any, |
| 214 | ) { |
| 215 | const res: boolean = await window.ipcRenderer.invoke( |
| 216 | 'ICP_INTERACTION_ONE_KEY', |
| 217 | accountId, |
| 218 | worksList, |
| 219 | option, |
| 220 | ); |
| 221 | return res; |
| 222 | } |
| 223 | |
| 224 | /** |
| 225 | * 创建AI评论截流自动进程 |
| 226 | * @param accountId |
| 227 | * @param dataId |
| 228 | * @param cycleType |
| 229 | */ |
| 230 | export async function ipcCreateAutoRunOfInteraction( |
| 231 | accountId: number, |
| 232 | dataId: string, // 作品ID |
| 233 | cycleType: string, |
| 234 | ) { |
| 235 | const res: string = await window.ipcRenderer.invoke( |
| 236 | 'ICP_AUTO_RUN_INTERACTION', |
| 237 | accountId, |
| 238 | dataId, |
| 239 | cycleType, |
| 240 | ); |
| 241 | return res; |
| 242 | } |
| 243 | |
| 244 | // 获取AI评论截流自动进程信息 |
| 245 | export async function ipcGetAutoRunOfInteractionInfo() { |
| 246 | const res: any = await window.ipcRenderer.invoke( |
| 247 | 'ICP_GET_AUTO_INTERACTION_INFO', |
| 248 | ); |
| 249 | return res; |
| 250 | } |
| 251 | |
| 252 | /** |
| 253 | * 获取AI评论截流的记录列表 |
| 254 | * @param page |
| 255 | * @param query |
| 256 | */ |
| 257 | export async function ipcGetInteractionRecordList( |
| 258 | page: { |
| 259 | page_size: number; |
| 260 | page_no: number; |
| 261 | }, |
| 262 | query: { |
| 263 | accountId?: number; |
| 264 | type?: PlatType; |
| 265 | }, |
| 266 | ) { |
| 267 | const res: string = await window.ipcRenderer.invoke( |
| 268 | 'ICP_GET_INTERACTION_RECORD_LIST', |
| 269 | page, |
| 270 | query, |
| 271 | ); |
| 272 | return res; |
| 273 | } |
| 274 |