Skip to content

Let's use AI to Earn!

feat: 互动模块

牛文政8bfdf4a60324
diff --git a/commont/types/interaction.ts b/commont/types/interaction.ts
new file mode 100644
index 00000000..fb23b285
--- /dev/null
+++ b/commont/types/interaction.ts
@@ -0,0 +1,18 @@
+// 自动任务的进度标识
+export enum AutorWorksInteractionScheduleEvent {
+ Start = 'start', // 开始
+ GetCommentListStart = 'getCommentListStart', // 获取评论列表开始
+ GetCommentListEnd = 'getCommentListEnd', // 获取评论列表结束
+ ReplyCommentStart = 'replyCommentStart', // 评论开始
+ ReplyCommentEnd = 'replyCommentEnd', // 评论结束
+ End = 'end', // 结束
+ Error = 'error', // 错误
+}
+
+export const AutorWorksInteractionScheduleEventMap = new Map([
+ [AutorWorksInteractionScheduleEvent.Start, '开始'],
+ [AutorWorksInteractionScheduleEvent.GetCommentListStart, '获取评论列表开始'],
+ [AutorWorksInteractionScheduleEvent.GetCommentListEnd, '获取评论列表结束'],
+ [AutorWorksInteractionScheduleEvent.ReplyCommentStart, '评论开始'],
+ [AutorWorksInteractionScheduleEvent.ReplyCommentEnd, '评论结束'],
+]);
diff --git a/electron/db/models/interactionRecord.ts b/electron/db/models/interactionRecord.ts
new file mode 100644
index 00000000..edad1853
--- /dev/null
+++ b/electron/db/models/interactionRecord.ts
@@ -0,0 +1,48 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-01-20 16:24:16
+ * @LastEditTime: 2025-03-23 09:27:54
+ * @LastEditors: nevin
+ * @Description: 互动记录记录 interactionRecord
+ */
+import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
+import { TempModel } from './temp';
+import { AccountType } from '../../../commont/AccountEnum';
+
+@Entity({ name: 'interactionRecord' })
+export class InteractionRecordModel extends TempModel {
+ @PrimaryGeneratedColumn({ type: 'int', comment: 'id' })
+ id!: number;
+
+ @Column({ type: 'varchar', nullable: false, comment: '用户id' })
+ userId!: string;
+
+ @Column({ type: 'int', nullable: false, comment: '账号id,对应account表id' })
+ accountId!: number;
+
+ @Column({
+ type: 'varchar',
+ enum: AccountType,
+ nullable: true,
+ comment: '平台类型',
+ })
+ type!: AccountType;
+
+ @Column({ type: 'varchar', nullable: false, comment: '作品Id' })
+ worksId!: string;
+
+ @Column({ type: 'varchar', nullable: true, comment: '作品标题' })
+ worksTitle?: string;
+
+ @Column({ type: 'varchar', nullable: true, comment: '封面' })
+ worksCover?: string;
+
+ @Column({ type: 'varchar', nullable: false, comment: '评论内容' })
+ commentContent!: string;
+
+ @Column({ type: 'tinyint', nullable: false, comment: '是否点赞' })
+ isLike!: 0 | 1;
+
+ @Column({ type: 'tinyint', nullable: false, comment: '是否收藏' })
+ isCollect!: 0 | 1;
+}
diff --git a/electron/main/interaction/controller.ts b/electron/main/interaction/controller.ts
new file mode 100644
index 00000000..ca794e33
--- /dev/null
+++ b/electron/main/interaction/controller.ts
@@ -0,0 +1,190 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-01-20 22:02:54
+ * @LastEditTime: 2025-03-24 09:34:03
+ * @LastEditors: nevin
+ * @Description: interaction Interaction 互动
+ */
+import windowOperate from '../../util/windowOperate';
+import { AutoRunModel, AutoRunType } from '../../db/models/autoRun';
+import { AccountService } from '../account/service';
+import { AutoRunService } from '../autoRun/service';
+import { Controller, Et, Icp, Inject } from '../core/decorators';
+import platController from '../plat';
+import { InteractionService } from './service';
+import { SendChannelEnum } from '../../../commont/UtilsEnum';
+import { AutorReplyCommentScheduleEvent } from '../../../commont/types/reply';
+import type { WorkData } from '../plat/plat.type';
+
+@Controller()
+export class InteractionController {
+ @Inject(InteractionService)
+ private readonly interactionService!: InteractionService;
+
+ @Inject(AccountService)
+ private readonly accountService!: AccountService;
+
+ @Inject(AutoRunService)
+ private readonly autoRunService!: AutoRunService;
+
+ /**
+ * 搜索列表
+ */
+ @Icp('ICP_INTERACTION_SEARCH_NODE_LIST')
+ async getSearchNodeList(
+ event: Electron.IpcMainInvokeEvent,
+ accountId: number,
+ qe?: string,
+ pageInfo?: any,
+ ) {
+ const account = await this.accountService.getAccountById(accountId);
+
+ if (!account)
+ return {
+ list: [],
+ count: 0,
+ };
+
+ const res = await platController.getsearchNodeList(account, qe, pageInfo);
+
+ return res;
+ }
+
+ /**
+ * 作品点赞
+ */
+ @Icp('ICP_DIANZAN_DY_OTHER')
+ async dianzanDyOther(
+ event: Electron.IpcMainInvokeEvent,
+ accountId: number,
+ dataId: string,
+ option?: any,
+ ) {
+ const account = await this.accountService.getAccountById(accountId);
+
+ if (!account)
+ return {
+ list: [],
+ count: 0,
+ };
+
+ const res = await platController.dianzanDyOther(account, dataId, option);
+
+ return res;
+ }
+
+ /**
+ * 作品收藏
+ */
+ @Icp('ICP_SHOUCANG_DY_OTHER')
+ async shoucangDyOther(
+ event: Electron.IpcMainInvokeEvent,
+ accountId: number,
+ pcursor?: string,
+ ) {
+ const account = await this.accountService.getAccountById(accountId);
+
+ if (!account)
+ return {
+ list: [],
+ count: 0,
+ };
+
+ const res = await platController.shoucangDyOther(account, pcursor);
+
+ return res;
+ }
+
+ /**
+ * 创建评论
+ */
+ @Icp('ICP_CREATE_COMMENT_BY_OTHER')
+ async createCommentByOther(
+ event: Electron.IpcMainInvokeEvent,
+ accountId: number,
+ dataId: string,
+ content: string,
+ ): Promise<any> {
+ const account = await this.accountService.getAccountById(accountId);
+ if (!account) return null;
+
+ const res = await platController.createCommentByOther(
+ account,
+ dataId,
+ content,
+ );
+ return res;
+ }
+
+ /**
+ * 一键AI互动
+ */
+ @Icp('ICP_REPLY_COMMENT_LIST_BY_AI')
+ async createCommentList(
+ event: Electron.IpcMainInvokeEvent,
+ accountId: number,
+ data: WorkData,
+ ): Promise<any> {
+ const account = await this.accountService.getAccountById(accountId);
+ if (!account) return null;
+
+ const res = await this.interactionService.autorReplyComment(
+ account,
+ data,
+ (e: {
+ tag: AutorReplyCommentScheduleEvent;
+ status: -1 | 0 | 1;
+ data?: any;
+ error?: any;
+ }) => {
+ windowOperate.sendRenderMsg(SendChannelEnum.CommentRelyProgress, e);
+ },
+ );
+
+ return res;
+ }
+
+ /**
+ * 创建自动一键评论任务
+ */
+ @Icp('ICP_AUTO_RUN_CREATE_REPLY')
+ async createReplyCommentAutoRun(
+ event: Electron.IpcMainInvokeEvent,
+ accountId: number,
+ data: WorkData,
+ cycleType: string,
+ ): Promise<AutoRunModel | null> {
+ const account = await this.accountService.getAccountById(accountId);
+ if (!account) return null;
+
+ const res = await this.autoRunService.createAutoRun(
+ {
+ accountId,
+ cycleType,
+ type: AutoRunType.ReplyComment,
+ userId: account.uid,
+ },
+ data,
+ );
+
+ return res;
+ }
+
+ // 运行自动评论任务
+ @Et('ET_AUTO_RUN_REPLY_COMMENT')
+ async runAutoReplyComment(autoRunData: AutoRunModel): Promise<boolean> {
+ const { accountId, dataInfo } = autoRunData;
+ if (!dataInfo) return false;
+
+ const account = await this.accountService.getAccountById(accountId);
+ if (!account) return false;
+
+ const res = await this.interactionService.addReplyQueue(
+ account,
+ dataInfo as WorkData,
+ autoRunData,
+ );
+
+ return res.status === 1;
+ }
+}
diff --git a/electron/main/interaction/module.ts b/electron/main/interaction/module.ts
new file mode 100644
index 00000000..c923ca8b
--- /dev/null
+++ b/electron/main/interaction/module.ts
@@ -0,0 +1,19 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-01-24 16:35:59
+ * @LastEditTime: 2025-03-20 22:26:30
+ * @LastEditors: nevin
+ * @Description: reply Reply 评论
+ */
+import { AccountModule } from '../account/module';
+import { AutoRunModule } from '../autoRun/module';
+import { Module } from '../core/decorators';
+import { InteractionController } from './controller';
+import { InteractionService } from './service';
+
+@Module({
+ imports: [AccountModule, AutoRunModule],
+ controllers: [InteractionController],
+ providers: [InteractionService],
+})
+export class InteractionModule {}
diff --git a/electron/main/interaction/service.ts b/electron/main/interaction/service.ts
new file mode 100644
index 00000000..9915e856
--- /dev/null
+++ b/electron/main/interaction/service.ts
@@ -0,0 +1,292 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-01-24 17:10:35
+ * @LastEditors: nevin
+ * @Description: interactionRecord InteractionRecord
+ */
+import { Inject, Injectable } from '../core/decorators';
+import PQueue from 'p-queue';
+import { AccountModel } from '../../db/models/account';
+import platController from '../plat';
+import { toolsApi } from '../api/tools';
+import { AutoRunService } from '../autoRun/service';
+import { AutoRunModel } from '../../db/models/autoRun';
+import { sysNotice } from '../../global/notice';
+import { Repository } from 'typeorm';
+import { AppDataSource } from '../../db';
+import { getUserInfo } from '../user/comment';
+import { AutoRunRecordStatus } from '../../db/models/autoRunRecord';
+import { WorkData } from '../plat/plat.type';
+import { GlobleCache } from '../../global/cache';
+import { sleep } from '../../util/time';
+import { InteractionRecordModel } from '../../db/models/interactionRecord';
+import { AutorWorksInteractionScheduleEvent } from '../../../commont/types/interaction';
+
+/**
+ * 获取缓存key
+ * @param account
+ * @returns
+ */
+function getCacheKey(account?: AccountModel) {
+ return `OneKeyInteractionWorksCacheKey_${account?.id || 0}`;
+}
+
+@Injectable()
+export class InteractionService {
+ replyQueue: PQueue;
+ private interactionRecordRepository: Repository<InteractionRecordModel>;
+
+ constructor() {
+ this.replyQueue = new PQueue({ concurrency: 2 });
+ this.interactionRecordRepository = AppDataSource.getRepository(
+ InteractionRecordModel,
+ );
+ }
+
+ @Inject(AutoRunService)
+ private readonly autoRunService!: AutoRunService;
+
+ // 创建评论记录
+ async create(
+ userId: string,
+ account: AccountModel,
+ works: {
+ worksId: string;
+ worksTitle?: string;
+ worksCover?: string;
+ },
+ commentContent: string,
+ isLike: 0 | 1,
+ isCollect: 0 | 1,
+ ) {
+ return await this.interactionRecordRepository.save({
+ userId,
+ accountId: account.id,
+ type: account.type,
+ worksId: works.worksId,
+ worksTitle: works.worksTitle,
+ worksCover: works.worksCover,
+ commentContent,
+ isLike: isLike,
+ replyContent: isCollect,
+ });
+ }
+
+ // 获互动记录
+ async getInteractionRecord(
+ userId: string,
+ account: AccountModel,
+ worksId: string,
+ ) {
+ return await this.interactionRecordRepository.findOne({
+ where: {
+ userId,
+ accountId: account.id,
+ type: account.type,
+ worksId: worksId + '',
+ },
+ });
+ }
+
+ /**
+ * 自动一键互动:作品评论,收藏,点赞
+ * 规则:评论作品,已经评论不评论
+ */
+ async autorInteraction(
+ account: AccountModel,
+ worksList: {
+ worksId: string;
+ desc: string; // 用来AI生成
+ title?: string;
+ cover?: string;
+ }[],
+ option: {
+ commentContent: string; // 评论内容
+ },
+ scheduleEvent: (data: {
+ tag: AutorWorksInteractionScheduleEvent;
+ status: -1 | 0 | 1; // -1 错误 0 进行中 1 完成
+ data?: any; // 数据
+ error?: any;
+ }) => void,
+ ) {
+ const userInfo = getUserInfo();
+ // 设置缓存
+ GlobleCache.setCache(getCacheKey(account), worksList, 60 * 15);
+
+ try {
+ scheduleEvent({
+ tag: AutorWorksInteractionScheduleEvent.Start,
+ status: 0,
+ });
+
+ // 重设缓存时间
+ GlobleCache.updateCacheTTL(getCacheKey(account), 60 * 15);
+
+ scheduleEvent({
+ tag: AutorWorksInteractionScheduleEvent.GetCommentListStart,
+ status: 0,
+ });
+
+ // 2. 循环AI回复评论
+ for (const works of worksList) {
+ sleep(5);
+ const oldRecord = await this.getInteractionRecord(
+ userInfo.id,
+ account,
+ works.worksId,
+ );
+ if (oldRecord) continue;
+
+ if (!option.commentContent) {
+ const aiRes = await toolsApi.aiRecoverReview({
+ content: works.desc,
+ });
+
+ // AI接口错误
+ if (!aiRes) {
+ scheduleEvent({
+ tag: AutorWorksInteractionScheduleEvent.Error,
+ status: -1,
+ error: '未获得AI产出内容',
+ });
+ return false;
+ }
+
+ scheduleEvent({
+ tag: AutorWorksInteractionScheduleEvent.ReplyCommentStart,
+ data: {
+ aiContent: aiRes,
+ },
+ status: 0,
+ });
+
+ // ----- 1-评论作品 -----
+ const commentWorksRes = await platController.createCommentByOther(
+ account,
+ works.worksId,
+ aiRes,
+ );
+
+ // 错误处理
+ if (!commentWorksRes) {
+ scheduleEvent({
+ tag: AutorWorksInteractionScheduleEvent.ReplyCommentEnd,
+ status: -1,
+ error: '回复评论失败',
+ });
+ continue;
+ }
+
+ scheduleEvent({
+ tag: AutorWorksInteractionScheduleEvent.ReplyCommentEnd,
+ status: 0,
+ });
+
+ // ----- 2-点赞作品 -----
+ let isLike: 0 | 1 = 0;
+ const isLikeRes = await platController.dianzanDyOther(
+ account,
+ works.worksId,
+ );
+
+ // ----- 3-收藏作品 -----
+ let isCollect: 0 | 1 = 0;
+
+ // 创建评论记录
+ this.create(
+ userInfo.id,
+ account,
+ {
+ worksId: works.worksId,
+ worksTitle: works.title,
+ worksCover: works.cover,
+ },
+ option.commentContent,
+ isLike,
+ isCollect,
+ );
+ }
+ }
+
+ scheduleEvent({
+ tag: AutorWorksInteractionScheduleEvent.ReplyCommentEnd,
+ status: 0,
+ });
+ } catch (error) {
+ scheduleEvent({
+ tag: AutorWorksInteractionScheduleEvent.Error,
+ status: -1,
+ error,
+ });
+ return false;
+ }
+
+ // 清除缓存
+ GlobleCache.delCache(getCacheKey(account));
+ }
+
+ /**
+ * 添加作品回复评论的任务到队列
+ * @param account
+ * @param dataId
+ */
+ async addReplyQueue(
+ account: AccountModel,
+ data: WorkData,
+ autoRun: AutoRunModel,
+ ): Promise<{
+ status: 0 | 1;
+ message?: string;
+ }> {
+ // 查看缓存,有的就不执行
+ if (GlobleCache.getCache(getCacheKey(account))) {
+ sysNotice('请勿重复执行', `该账户有正在执行的任务,任务ID:${autoRun.id}`);
+
+ return {
+ status: 0,
+ message: '该账户有正在执行的任务,请勿重复执行',
+ };
+ }
+
+ // 创建任务执行记录
+ const recordData = await this.autoRunService.createAutoRunRecord(autoRun);
+
+ // 添加到队列
+ this.replyQueue.add(() => {
+ this.autorReplyComment(
+ account,
+ data,
+ (e: {
+ tag: AutorReplyCommentScheduleEvent;
+ status: -1 | 0 | 1;
+ error?: any;
+ }) => {
+ if (e.tag === AutorReplyCommentScheduleEvent.Start) {
+ sysNotice('自动机评论回复任务执行开始', `任务ID:${autoRun.id}`);
+ }
+
+ if (e.tag === AutorReplyCommentScheduleEvent.End) {
+ sysNotice('自动机评论回复任务执行结束', `任务ID:${autoRun.id}`);
+ this.autoRunService.updateAutoRunRecordStatus(
+ recordData.id,
+ AutoRunRecordStatus.SUCCESS,
+ );
+ }
+
+ if (e.tag === AutorReplyCommentScheduleEvent.Error) {
+ sysNotice('自动机评论回复任务-错误!!!', `任务ID:${autoRun.id}`);
+ this.autoRunService.updateAutoRunRecordStatus(
+ recordData.id,
+ AutoRunRecordStatus.FAIL,
+ );
+ }
+ },
+ );
+ });
+
+ return {
+ status: 1,
+ };
+ }
+}
diff --git a/electron/main/plat/PlatformBase.ts b/electron/main/plat/PlatformBase.ts
index 813d4b3d..892b0ac0 100644
--- a/electron/main/plat/PlatformBase.ts
+++ b/electron/main/plat/PlatformBase.ts
@@ -79,7 +79,8 @@ export abstract class PlatformBase {
/**
* 点赞
* @param account 账户
- * @param pcursor 分页游标
+ * @param dataId 数据ID
+ * @param option 配置项
*/
abstract dianzanDyOther(
account: AccountModel,
diff --git a/electron/main/plat/index.ts b/electron/main/plat/index.ts
index 15285c7f..e73cd7b8 100644
--- a/electron/main/plat/index.ts
+++ b/electron/main/plat/index.ts
@@ -178,11 +178,16 @@ class PlatController {
}
/**
- * 获取作品列表
+ * 点赞
* @param account
- * @param pcursor
+ * @param dataId
+ * @param option
*/
- public async dianzanDyOther(account: AccountModel, dataId: string, option?: any) {
+ public async dianzanDyOther(
+ account: AccountModel,
+ dataId: string,
+ option?: any,
+ ) {
const platform = this.platforms.get(account.type)!;
return await platform.dianzanDyOther(account, dataId, option);
}
@@ -208,9 +213,10 @@ class PlatController {
}
/**
- * 获取作品列表
+ * 搜索作品列表
* @param account
- * @param pcursor
+ * @param qe
+ * @param pageInfo
*/
public async getsearchNodeList(
account: AccountModel,
diff --git a/electron/main/plat/platforms/douyin/index.ts b/electron/main/plat/platforms/douyin/index.ts
index 9c022b2f..93b465b3 100644
--- a/electron/main/plat/platforms/douyin/index.ts
+++ b/electron/main/plat/platforms/douyin/index.ts
@@ -16,7 +16,6 @@ import {
IGetTopicsParams,
IGetTopicsResponse,
IGetUsersParams,
- ResponsePageInfo,
VideoCallbackType,
WorkData,
} from '../../plat.type';
@@ -188,62 +187,58 @@ export class Douyin extends PlatformBase {
};
}
- /**
+ /**
* 获取搜索作品列表
* @param account
* @param data
* @param pcursor
* @returns
*/
- async getsearchNodeList(
- account: AccountModel,
- qe: string,
- pageInfo?: any,
- ) {
- const cookie: CookiesType = JSON.parse(account.loginCookie);
- const res = await douyinService.getSearchNodeList(cookie, qe, {
- count: pageInfo.count,
- pcursor: pageInfo.pcursor,
- postFirstId: pageInfo.postFirstId,
- });
-
- const list: WorkData[] = [];
- // console.log('------douyin getsearchNodeList res: ', res);
- // console.log('------douyin getsearchNodeList res.data.cursor: ', res.data.cursor);
- for (const s of res.data.data) {
- let v = s.aweme_info;
- list.push({
- dataId: v.aweme_id,
- readCount: v.note_card?.interact_info?.view_count,
- likeCount: v.note_card?.interact_info?.liked_count,
- collectCount: v.note_card?.interact_info?.collected_count,
- commentCount: v.note_card?.interact_info?.comment_count,
- title: v.desc,
- coverUrl: v.video.cover.url_list[0] || '',
- option: {
- xsec_token: v.xsec_token || '',
- },
- author: {
- name: v.author?.nickname,
- id: v.author?.uid,
- avatar: v.author?.avatar_thumb.url_list[0],
- },
- data: v,
- });
- }
-
- // console.log('------douyin getsearchNodeList !!res.data.has_more^^: ', !!res.data.has_more);
- return {
- list,
- orgList: res.data,
- pageInfo: {
- count: pageInfo.pcursor,
- pcursor: res.data.cursor + '',
- hasMore: !!res.data.has_more,
+ async getsearchNodeList(account: AccountModel, qe: string, pageInfo?: any) {
+ const cookie: CookiesType = JSON.parse(account.loginCookie);
+ const res = await douyinService.getSearchNodeList(cookie, qe, {
+ count: pageInfo.count,
+ pcursor: pageInfo.pcursor,
+ postFirstId: pageInfo.postFirstId,
+ });
+
+ const list: WorkData[] = [];
+ // console.log('------douyin getsearchNodeList res: ', res);
+ // console.log('------douyin getsearchNodeList res.data.cursor: ', res.data.cursor);
+ for (const s of res.data.data) {
+ const v = s.aweme_info;
+ list.push({
+ dataId: v.aweme_id,
+ readCount: v.note_card?.interact_info?.view_count,
+ likeCount: v.note_card?.interact_info?.liked_count,
+ collectCount: v.note_card?.interact_info?.collected_count,
+ commentCount: v.note_card?.interact_info?.comment_count,
+ title: v.desc,
+ coverUrl: v.video.cover.url_list[0] || '',
+ option: {
+ xsec_token: v.xsec_token || '',
},
- };
+ author: {
+ name: v.author?.nickname,
+ id: v.author?.uid,
+ avatar: v.author?.avatar_thumb.url_list[0],
+ },
+ data: v,
+ });
}
+ // console.log('------douyin getsearchNodeList !!res.data.has_more^^: ', !!res.data.has_more);
+ return {
+ list,
+ orgList: res.data,
+ pageInfo: {
+ count: pageInfo.pcursor,
+ pcursor: res.data.cursor + '',
+ hasMore: !!res.data.has_more,
+ },
+ };
+ }
+
/**
* 获取评论列表
* @param account
@@ -669,8 +664,6 @@ export class Douyin extends PlatformBase {
}),
};
}
-
-
}
const douyin = new Douyin();
diff --git a/electron/main/reply/service.ts b/electron/main/reply/service.ts
index 4ed31946..0d819125 100644
--- a/electron/main/reply/service.ts
+++ b/electron/main/reply/service.ts
@@ -27,8 +27,8 @@ import { sleep } from '../../util/time';
* @param account
* @returns
*/
-function getCacheKey(account: AccountModel) {
- return `OneKeyReplyCommentCacheKey_${account.id}`;
+function getCacheKey(account?: AccountModel) {
+ return `OneKeyReplyCommentCacheKey_${account?.id || 0}`;
}
@Injectable()
diff --git a/electron/plat/douyin/index.ts b/electron/plat/douyin/index.ts
index 18d532d0..6d490857 100644
--- a/electron/plat/douyin/index.ts
+++ b/electron/plat/douyin/index.ts
@@ -2221,27 +2221,28 @@ export class DouyinService {
postFirstId?: string;
},
) {
- let pcursor = (pageInfo.pcursor && Number(pageInfo.pcursor) < 16) ? 0 : pageInfo.pcursor;
- let count = (Number(pcursor) > 10) ? 10 : 16;
+ const pcursor =
+ pageInfo.pcursor && Number(pageInfo.pcursor) < 16 ? 0 : pageInfo.pcursor;
+ const count = Number(pcursor) > 10 ? 10 : 16;
- let gets:any = {
+ const gets: any = {
aid: '6383',
keyword: qe,
offset: pcursor,
- count: count
- }
- if(pageInfo.postFirstId){
+ count: count,
+ };
+ if (pageInfo.postFirstId) {
gets.search_id = pageInfo.postFirstId;
}
const thisUri = `https://www.douyin.com/aweme/v1/web/search/item/?${jsonToQueryString(
- gets
+ gets,
)}`;
console.log('------douyin getsearchNodeList uri: ', thisUri);
const res = await requestNet<any>({
url: thisUri,
headers: {
- cookie: CookieToString(cookie)
+ cookie: CookieToString(cookie),
},
method: 'GET',
});
diff --git a/src/router/index.tsx b/src/router/index.tsx
index c07152f3..6afb10dd 100644
--- a/src/router/index.tsx
+++ b/src/router/index.tsx
@@ -47,6 +47,7 @@ import Reply from '@/views/reply';
import Replyother from '@/views/replyother';
import ErrorBoundary from '../components/ErrorBoundary/ErrorBoundary';
import Test from '@/views/test';
+import Interaction from '@/views/interaction';
interface IRouterMeta {
// 路由名称
@@ -146,6 +147,11 @@ export const router: CustomRouteObject[] = [
{ path: 'userWalletAccount', element: <UserWalletAccount /> },
],
},
+ {
+ path: '/interaction',
+ element: <Interaction />,
+ meta: { name: '互动', icon: ShopOutlined },
+ },
{
path: '/test',
element: <Test />,
diff --git a/src/views/interaction/components/addAutoRun.tsx b/src/views/interaction/components/addAutoRun.tsx
new file mode 100644
index 00000000..7ce6014b
--- /dev/null
+++ b/src/views/interaction/components/addAutoRun.tsx
@@ -0,0 +1,61 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-18 21:02:38
+ * @LastEditTime: 2025-03-25 13:41:14
+ * @LastEditors: nevin
+ * @Description: 添加自动运行
+ */
+import { ipcCreateAutoRunOfReply, WorkData } from '@/icp/reply';
+import { Modal } from 'antd';
+import { forwardRef, useImperativeHandle, useState } from 'react';
+import { CronSchedule } from '@/components/CronSchedule';
+
+export interface AddAutoRunRef {
+ init: (accountId: number, data: WorkData) => Promise<void>;
+}
+
+const Com = forwardRef<AddAutoRunRef>((props: any, ref) => {
+ const [isModalOpen, setIsModalOpen] = useState(false);
+ const [accountId, setAccountId] = useState<number>(0);
+ const [workData, setWorkData] = useState<WorkData | null>(null);
+
+ // '周期类型 天 day-22 (例:每天22时) 周 week-2 (例:每周周二,周日0) 月 month-22 (例:每月22号)',
+ const [cycleType, setCycleType] = useState<string>('');
+ async function init(accountId: number, data: WorkData) {
+ setAccountId(accountId);
+ setWorkData(data);
+ setIsModalOpen(true);
+ }
+
+ useImperativeHandle(ref, () => ({
+ init: init,
+ }));
+
+ function handleCancel() {
+ setIsModalOpen(false);
+ }
+
+ async function handleCron(cron: string) {
+ console.log('生成的定时表达式:----', cron);
+ if (!workData) return;
+
+ setCycleType(cron);
+ const res = await ipcCreateAutoRunOfReply(accountId, workData, cron);
+ console.log('-------- res', res);
+ }
+
+ return (
+ <>
+ <Modal
+ title="创建自动回复评论任务"
+ open={isModalOpen}
+ onCancel={handleCancel}
+ footer={null}
+ width={400}
+ >
+ <CronSchedule onSubmit={handleCron} />
+ </Modal>
+ </>
+ );
+});
+export default Com;
diff --git a/src/views/interaction/components/autoRunRecord.tsx b/src/views/interaction/components/autoRunRecord.tsx
new file mode 100644
index 00000000..dc88a9ff
--- /dev/null
+++ b/src/views/interaction/components/autoRunRecord.tsx
@@ -0,0 +1,109 @@
+import { AutoRun, AutoRunRecord, ipcGetAutoRunRecordList } from '@/icp/autoRun';
+import { Modal, Table } from 'antd';
+import React from 'react';
+import { ParseCronSchedule } from '@/components/CronSchedule';
+
+const { Column } = Table;
+export interface AutoRunRecordRef {
+ init: (inAutoRun: AutoRun) => Promise<void>;
+}
+
+const Com = React.forwardRef<AutoRunRecordRef>((props: any, ref) => {
+ const [autoRunRecordList, setAutoRunRecordList] = React.useState<
+ AutoRunRecord[]
+ >([]);
+ const [autoRun, setAutoRun] = React.useState<AutoRun | null>(null);
+ const [pagination, setPagination] = React.useState({
+ page: 1,
+ pageSize: 10,
+ total: 0,
+ });
+ const [isModalOpen, setIsModalOpen] = React.useState(false);
+
+ async function init(inAutoRun: AutoRun) {
+ setAutoRun(inAutoRun);
+ getAutoRunRecordList(inAutoRun);
+ setIsModalOpen(true);
+ }
+
+ React.useImperativeHandle(ref, () => ({
+ init: init,
+ }));
+
+ /**
+ * 获取自动运行的列表
+ */
+ async function getAutoRunRecordList(inAutoRun: AutoRun) {
+ if (!inAutoRun) return;
+
+ const res = await ipcGetAutoRunRecordList(
+ {
+ page: pagination.page,
+ pageSize: pagination.pageSize,
+ },
+ {
+ autoRunId: inAutoRun.id,
+ },
+ );
+
+ console.log('----- res', res);
+
+ setAutoRunRecordList(res.list);
+ setPagination({
+ ...pagination,
+ total: res.total,
+ });
+ }
+
+ return (
+ <Modal
+ title="任务记录"
+ open={isModalOpen}
+ onCancel={() => {
+ setIsModalOpen(false);
+ }}
+ footer={null}
+ width={600}
+ >
+ <div style={{ width: '100%' }} className="bg-slate-500">
+ <Table
+ key={autoRun?.id}
+ dataSource={autoRunRecordList}
+ style={{ width: '100%' }}
+ className="bg-slate-500"
+ pagination={pagination}
+ onChange={(newPagination) => {
+ setPagination({
+ ...pagination,
+ page: newPagination.current!,
+ pageSize: newPagination.pageSize!,
+ });
+ }}
+ >
+ <Column title="ID" dataIndex="id" key="id" />
+ <Column title="任务DI" dataIndex="autoRunId" key="autoRunId" />
+ <Column title="状态" dataIndex="status" key="status" />
+ <Column title="类型" dataIndex="type" key="type" />
+ <Column
+ title="触发周期"
+ key="cycleType"
+ dataIndex="cycleType"
+ render={(cycleType: string) => (
+ <ParseCronSchedule cronExpression={cycleType} />
+ )}
+ />
+ <Column
+ title="创建时间"
+ key="createTime"
+ dataIndex="createTime"
+ render={(_: any, record: AutoRun) => (
+ <p>{new Date(record.createTime).toLocaleString()}</p>
+ )}
+ />
+ </Table>
+ </div>
+ </Modal>
+ );
+});
+
+export default Com;
diff --git a/src/views/interaction/components/commentList.tsx b/src/views/interaction/components/commentList.tsx
new file mode 100644
index 00000000..e8f8091d
--- /dev/null
+++ b/src/views/interaction/components/commentList.tsx
@@ -0,0 +1,150 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-18 21:02:38
+ * @LastEditTime: 2025-03-31 09:43:51
+ * @LastEditors: nevin
+ * @Description: 评论列表
+ */
+import { CommentData, icpGetCommentList, WorkData } from '@/icp/reply';
+import { Avatar, Button, Card, Col, Modal, Row, Tooltip } from 'antd';
+import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
+import Meta from 'antd/es/card/Meta';
+import ReplyComment, { ReplyCommentRef } from './replyComment';
+import { MessageOutlined } from '@ant-design/icons';
+
+export interface CommentListRef {
+ init: (accountId: number, workData: WorkData) => Promise<void>;
+}
+
+const Com = forwardRef<CommentListRef>((props: any, ref) => {
+ const [commentList, setCommentList] = useState<CommentData[]>([]);
+ const [isModalOpen, setIsModalOpen] = useState(false);
+ const [accountId, setAccountId] = useState<number>(0);
+ const [workData, setWorkData] = useState<WorkData | null>(null);
+ const Ref_ReplyComment = useRef<ReplyCommentRef>(null);
+ const [pageInfo, setPageInfo] = useState<{
+ count: number;
+ hasMore: boolean;
+ pcursor?: string;
+ }>({
+ count: 0,
+ hasMore: false,
+ });
+
+ async function init(accountId: number, workData: WorkData) {
+ setCommentList([]);
+ setPageInfo({
+ count: 0,
+ hasMore: false,
+ });
+
+ setAccountId(accountId);
+ setWorkData(workData);
+ await getCommentList(accountId, workData);
+ setIsModalOpen(true);
+ }
+
+ useImperativeHandle(ref, () => ({
+ init: init,
+ }));
+
+ function handleCancel() {
+ setCommentList([]);
+ setPageInfo({
+ count: 0,
+ hasMore: false,
+ });
+ setIsModalOpen(false);
+ }
+
+ /**
+ * 获取评论列表
+ */
+ async function getCommentList(inAccountId: number, data: WorkData) {
+ const res = await icpGetCommentList(inAccountId, data, pageInfo.pcursor);
+ if (!res) return;
+
+ setPageInfo(res.pageInfo);
+ setCommentList([...commentList, ...res.list]);
+ }
+
+ /**
+ * 打开评论回复
+ * @param data
+ */
+ function openReplyComment(data: CommentData) {
+ Ref_ReplyComment.current?.init(accountId, data);
+ }
+
+ /**
+ *
+ * @param param0
+ * @returns
+ */
+ function WorkDataDom() {
+ if (!workData) return <div>数据有误</div>;
+
+ return (
+ <Card
+ style={{ width: 200 }}
+ cover={<img alt="example" src={workData.coverUrl} />}
+ >
+ <Meta title={workData.title} />
+ </Card>
+ );
+ }
+
+ return (
+ <>
+ <Modal
+ title="评论列表"
+ open={isModalOpen}
+ onCancel={handleCancel}
+ footer={null}
+ width={1200}
+ >
+ <Row>
+ <Col span={6}>{WorkDataDom()}</Col>
+ <Col span={18}>
+ {commentList.map((item) => (
+ <Card key={item.commentId} className="mb-3">
+ <p>
+ <Avatar src={item.headUrl} />
+ {/* <p>{item.nikeName}</p> */}
+ {item.content}
+ &nbsp;&nbsp;
+ <Tooltip title="回复">
+ <MessageOutlined onClick={() => openReplyComment(item)} />
+ </Tooltip>
+ </p>
+ <div className="ml-6">
+ {item.subCommentList.map((subItem) => (
+ <p key={subItem.commentId}>
+ <Avatar src={subItem.headUrl} />
+ &nbsp;&nbsp;
+ {subItem.content}
+ </p>
+ ))}
+ </div>
+ </Card>
+ ))}
+
+ {commentList.length > 0 && (
+ <p className="text-center">
+ <Button
+ type="link"
+ onClick={() => getCommentList(accountId, workData!)}
+ >
+ 加载更多
+ </Button>
+ </p>
+ )}
+ </Col>
+ </Row>
+ </Modal>
+
+ <ReplyComment ref={Ref_ReplyComment} />
+ </>
+ );
+});
+export default Com;
diff --git a/src/views/interaction/components/oneKeyReply.tsx b/src/views/interaction/components/oneKeyReply.tsx
new file mode 100644
index 00000000..a25d3640
--- /dev/null
+++ b/src/views/interaction/components/oneKeyReply.tsx
@@ -0,0 +1,123 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-18 21:02:38
+ * @LastEditTime: 2025-03-31 11:02:12
+ * @LastEditors: nevin
+ * @Description: 一键评论
+ */
+import { icpReplyCommentList, WorkData } from '@/icp/reply';
+import { message, Modal } from 'antd';
+import { forwardRef, useImperativeHandle, useState } from 'react';
+import { SendChannelEnum } from '@@/UtilsEnum';
+import {
+ AutorReplyCommentScheduleEvent,
+ AutorReplyCommentScheduleEventTagStrMap,
+} from '@@/types/reply';
+
+export interface OneKeyReplyRef {
+ init: (accountId: number, data: WorkData) => Promise<void>;
+}
+
+const Com = forwardRef<OneKeyReplyRef>((props: any, ref) => {
+ const [isModalOpen, setIsModalOpen] = useState(false);
+ const [infoText, setInfoText] = useState('');
+ const [errorText, setErrorText] = useState('');
+ const [workData, setWorkData] = useState<WorkData | null>(null);
+ async function init(accountId: number, data: WorkData) {
+ window.ipcRenderer.on(SendChannelEnum.CommentRelyProgress, onGetNotice);
+ setWorkData(data);
+ setIsModalOpen(true);
+
+ replyCommentList(accountId, data);
+ }
+
+ /**
+ * 一键AI评论
+ */
+ async function replyCommentList(inAccountId: number, inWorkData: WorkData) {
+ if (!inWorkData?.dataId) return;
+ const res = await icpReplyCommentList(inAccountId, inWorkData);
+ console.log('------ res', res);
+ }
+
+ function closeShow() {
+ // 关闭界面
+ setTimeout(() => {
+ handleCancel();
+ }, 1000);
+
+ setTimeout(() => {
+ setErrorText('');
+ setInfoText('');
+ }, 2000);
+ }
+
+ /**
+ * 返回值处理
+ * @param e
+ * @param args
+ */
+ function onGetNotice(
+ e: any,
+ args: {
+ tag: AutorReplyCommentScheduleEvent;
+ status: -1 | 0 | 1;
+ data?: {
+ content: string;
+ aiContent: string;
+ };
+ error?: any;
+ },
+ ) {
+ switch (args.tag) {
+ case AutorReplyCommentScheduleEvent.Start:
+ setInfoText(`开始评论:${args.data?.content || ''}`);
+ break;
+ case AutorReplyCommentScheduleEvent.End:
+ setInfoText(`评论结束:${args.data?.aiContent || ''}`);
+ message.success(`部分平台评论需要审核,评论后的数据可能存在延时`);
+ closeShow();
+ break;
+ case AutorReplyCommentScheduleEvent.Error:
+ setErrorText(args.error?.message || '未知错误');
+ closeShow();
+ break;
+ default:
+ const tagStr =
+ AutorReplyCommentScheduleEventTagStrMap.get(args.tag) || '';
+ setInfoText(`${tagStr}`);
+ break;
+ }
+ }
+
+ useImperativeHandle(ref, () => ({
+ init: init,
+ }));
+
+ function handleCancel() {
+ window.ipcRenderer.off(SendChannelEnum.CommentRelyProgress, onGetNotice);
+ setIsModalOpen(false);
+ }
+
+ return (
+ <>
+ <Modal
+ title="一键评论"
+ open={isModalOpen}
+ onCancel={handleCancel}
+ footer={null}
+ width={400}
+ >
+ <div className="p-2 mb-4 border border-green-500 rounded-md shadow-md">
+ <p className="text-green-500">{infoText}</p>
+ </div>
+ {errorText && (
+ <div className="p-2 mb-4 border border-red-500 rounded-md shadow-md">
+ <p className="text-red-500">{errorText}</p>
+ </div>
+ )}
+ </Modal>
+ </>
+ );
+});
+export default Com;
diff --git a/src/views/interaction/components/replyComment.tsx b/src/views/interaction/components/replyComment.tsx
new file mode 100644
index 00000000..b10fadc9
--- /dev/null
+++ b/src/views/interaction/components/replyComment.tsx
@@ -0,0 +1,123 @@
+import { toolsApi } from '@/api/tools';
+import { CommentData, icpReplyComment } from '@/icp/reply';
+import { SendOutlined } from '@ant-design/icons';
+import { Button, Form, Input, Modal, Tooltip } from 'antd';
+import { forwardRef, useImperativeHandle, useState } from 'react';
+import logoAi from '@/assets/logoAi.png';
+
+export interface ReplyCommentRef {
+ init: (accountId: number, inInfo: CommentData) => Promise<void>;
+}
+
+interface FormData {
+ content: string;
+}
+
+const Com = forwardRef<ReplyCommentRef>((props: any, ref) => {
+ const [isModalOpen, setIsModalOpen] = useState(false);
+ const [accountId, setAccountId] = useState<number>(0);
+ const [commentData, setCommentData] = useState<CommentData | null>(null);
+ const [form] = Form.useForm<FormData>();
+ async function init(accountId: number, inInfo: CommentData) {
+ setAccountId(accountId);
+ setCommentData(inInfo);
+ setIsModalOpen(true);
+ }
+
+ useImperativeHandle(ref, () => ({
+ init: init,
+ }));
+
+ function handleCancel() {
+ setIsModalOpen(false);
+ }
+
+ /**
+ * 回复评论
+ */
+ async function replyComment(content: string) {
+ const res = await icpReplyComment(
+ accountId,
+ commentData!.commentId,
+ content,
+ {
+ dataId: commentData!.dataId,
+ comment: commentData!.data,
+ },
+ );
+ console.log('----- res', res);
+ }
+
+ async function onFinish(values: FormData) {
+ await replyComment(values.content);
+ console.log('Success:', values);
+ }
+
+ async function onFinishFailed(errorInfo: any) {
+ console.log('Failed:', errorInfo);
+ }
+
+ async function getAiContent() {
+ if (!commentData?.content) return;
+ const res = await toolsApi.apiReviewAiRecover({
+ content: commentData?.content,
+ });
+
+ form.setFieldsValue({
+ content: res,
+ });
+ }
+
+ return (
+ <>
+ <Modal
+ title={null}
+ open={isModalOpen}
+ onCancel={handleCancel}
+ footer={null}
+ width={400}
+ >
+ <div className="p-5">
+ <Form
+ form={form}
+ name="basic"
+ labelCol={{ span: 8 }}
+ wrapperCol={{ span: 16 }}
+ initialValues={{ remember: true }}
+ onFinish={onFinish}
+ onFinishFailed={onFinishFailed}
+ autoComplete="off"
+ >
+ <Form.Item
+ label="内容"
+ name="content"
+ rules={[{ required: true, message: '请输入评论!' }]}
+ >
+ <Input />
+ </Form.Item>
+
+ <p className="text-right">
+ <Tooltip title="获取AI建议">
+ <img
+ src={logoAi}
+ alt="logo"
+ width={40}
+ onClick={getAiContent}
+ />
+ </Tooltip>
+
+ <Tooltip title="发送">
+ <Button
+ shape="circle"
+ htmlType="submit"
+ icon={<SendOutlined />}
+ />
+ </Tooltip>
+ </p>
+ </Form>
+ </div>
+ </Modal>
+ </>
+ );
+});
+export default Com;
diff --git a/src/views/interaction/components/replyWorks.tsx b/src/views/interaction/components/replyWorks.tsx
new file mode 100644
index 00000000..9c1a4625
--- /dev/null
+++ b/src/views/interaction/components/replyWorks.tsx
@@ -0,0 +1,116 @@
+import { toolsApi } from '@/api/tools';
+import { icpCreateComment, WorkData } from '@/icp/reply';
+import { Button, Form, Input, Modal, Tooltip } from 'antd';
+import { forwardRef, useImperativeHandle, useState } from 'react';
+import logoAi from '@/assets/logoAi.png';
+import { SendOutlined } from '@ant-design/icons';
+
+export interface ReplyWorksRef {
+ init: (accountId: number, inWorkData: WorkData) => Promise<void>;
+}
+
+interface FormData {
+ content: string;
+}
+
+const Com = forwardRef<ReplyWorksRef>((props: any, ref) => {
+ const [isModalOpen, setIsModalOpen] = useState(false);
+ const [accountId, setAccountId] = useState<number>(0);
+ const [workData, setWorkData] = useState<WorkData | null>(null);
+ const [form] = Form.useForm<FormData>();
+
+ async function init(accountId: number, inWorkData: WorkData) {
+ setAccountId(accountId);
+ setWorkData(inWorkData);
+ setIsModalOpen(true);
+ }
+
+ useImperativeHandle(ref, () => ({
+ init: init,
+ }));
+
+ function handleCancel() {
+ setIsModalOpen(false);
+ }
+
+ /**
+ * 创建评论
+ */
+ async function createComment(content: string) {
+ const res = await icpCreateComment(accountId, workData!.dataId, content);
+ console.log('----- res', res);
+ }
+
+ async function onFinish(values: FormData) {
+ createComment(values.content);
+ }
+
+ async function onFinishFailed(errorInfo: any) {
+ console.log('Failed:', errorInfo);
+ }
+
+ async function getAiContent() {
+ if (!workData?.coverUrl) return;
+ const res = await toolsApi.apiReviewImgAi({
+ imgUrl: workData?.coverUrl,
+ });
+
+ console.log('----- res', res);
+
+ form.setFieldsValue({
+ content: res,
+ });
+ }
+
+ return (
+ <>
+ <Modal
+ title="作品评论"
+ open={isModalOpen}
+ onCancel={handleCancel}
+ footer={null}
+ width={400}
+ >
+ <div className="p-5">
+ <Form
+ form={form}
+ name="basic"
+ labelCol={{ span: 8 }}
+ wrapperCol={{ span: 16 }}
+ initialValues={{ remember: true }}
+ onFinish={onFinish}
+ onFinishFailed={onFinishFailed}
+ autoComplete="off"
+ >
+ <Form.Item
+ label="评论"
+ name="content"
+ rules={[{ required: true, message: '请输入评论!' }]}
+ >
+ <Input />
+ </Form.Item>
+ <p className="text-right">
+ <Tooltip title="获取AI建议">
+ <img
+ src={logoAi}
+ alt="logo"
+ width={40}
+ onClick={getAiContent}
+ />
+ </Tooltip>
+
+ <Tooltip title="发送">
+ <Button
+ shape="circle"
+ htmlType="submit"
+ icon={<SendOutlined />}
+ />
+ </Tooltip>
+ </p>
+ </Form>
+ </div>
+ </Modal>
+ </>
+ );
+});
+export default Com;
diff --git a/src/views/interaction/index.tsx b/src/views/interaction/index.tsx
new file mode 100644
index 00000000..01d9e493
--- /dev/null
+++ b/src/views/interaction/index.tsx
@@ -0,0 +1,185 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-02-10 22:20:15
+ * @LastEditTime: 2025-03-25 16:01:56
+ * @LastEditors: nevin
+ * @Description: 评论页面 reply
+ */
+import { WorkData } from '@/icp/reply';
+import { Button, Col, Popconfirm, Row, Tabs, Tooltip } from 'antd';
+import { useCallback, useRef, useState } from 'react';
+import AccountSidebar from '../account/components/AccountSidebar/AccountSidebar';
+import ReplyWorks, { ReplyWorksRef } from './components/replyWorks';
+import CommentList, { CommentListRef } from './components/commentList';
+import {
+ AliwangwangOutlined,
+ CommentOutlined,
+ FieldTimeOutlined,
+ MenuUnfoldOutlined,
+ QuestionCircleOutlined,
+} from '@ant-design/icons';
+import OneKeyReply, { OneKeyReplyRef } from './components/oneKeyReply';
+
+export default function Page() {
+ const [wordList, setWordList] = useState<WorkData[]>([]);
+ const [activeAccountId, setActiveAccountId] = useState<number>(-1);
+ const [pageInfo, setPageInfo] = useState<{
+ count: number;
+ hasMore: boolean;
+ pcursor?: string;
+ }>({
+ count: 0,
+ hasMore: false,
+ });
+ const Ref_ReplyWorks = useRef<ReplyWorksRef>(null);
+ const Ref_CommentList = useRef<CommentListRef>(null);
+ const Ref_OneKeyReply = useRef<OneKeyReplyRef>(null);
+
+ async function getCreatorList(accountId: number) {
+ // const res = await getCommentSearchNotes(thisid, qe, {
+ // ...pageInfo,
+ // postFirstId: postFirstId,
+ // });
+ }
+
+ /**
+ * 打开作品评论
+ * @param data
+ */
+ function openReplyWorks(data: WorkData) {
+ Ref_ReplyWorks.current?.init(activeAccountId, data);
+ }
+
+ /**
+ * 打开评论列表
+ * @param data
+ */
+ function openCommentList(data: WorkData) {
+ Ref_CommentList.current?.init(activeAccountId, data);
+ }
+
+ /**
+ * 打开创建自动任务
+ * @param data
+ */
+ function openAddAutoRun(data: WorkData) {}
+
+ return (
+ <div className={styles.account}>
+ <AccountSidebar
+ activeAccountId={activeAccountId}
+ onAccountChange={useCallback((info) => {
+ setWordList([]);
+ setActiveAccountId(info.id);
+ getCreatorList(info.id);
+ }, [])}
+ />
+
+ <div className="w-full p-4 text-gray-500">
+ <Tabs defaultActiveKey="1" className="w-full">
+ <Tabs.TabPane tab="作品列表" key="1">
+ {activeAccountId === -1 ? (
+ <div className="flex items-center justify-center h-[300px]">
+ <Tooltip title="请先在左侧侧边栏选择账户">
+ <QuestionCircleOutlined className="mr-2 text-3xl" />
+ </Tooltip>
+ 请选择账户
+ </div>
+ ) : (
+ <div className="grid grid-cols-5 p-4 account-con bg-slate-300">
+ {wordList.map((item) => (
+ <div
+ className="bg-white w-[200px] h-[200px] border border-gray-300 p-4 rounded-lg hover:shadow-lg transition-shadow duration-300 m-4"
+ key={item.dataId}
+ >
+ <Row>
+ <Col span={12}>
+ <div className="w-[100px] h-[200px]">
+ <img
+ alt="example"
+ src={item.coverUrl}
+ className="object-cover w-full h-full rounded"
+ />
+ </div>
+ </Col>
+ <Col span={12}>
+ <div className="flex flex-col h-full">
+ <p className="mb-2">{item.title || '无标题'}</p>
+ <div className="w-full mt-auto">
+ <Row justify="space-evenly">
+ <Col span={8}>
+ <Tooltip title="评论列表">
+ <MenuUnfoldOutlined
+ onClick={() => openCommentList(item)}
+ />
+ </Tooltip>
+ </Col>
+ <Col span={8}>
+ <Tooltip title="评论作品">
+ <CommentOutlined
+ onClick={() => openReplyWorks(item)}
+ />
+ </Tooltip>
+ </Col>
+ </Row>
+
+ <Row justify="space-evenly">
+ <Col span={8}>
+ <Tooltip title="一键评论">
+ <Popconfirm
+ title="确认进行一键评论"
+ onConfirm={(
+ e?: React.MouseEvent<HTMLElement>,
+ ) => {
+ Ref_OneKeyReply.current?.init(
+ activeAccountId,
+ item,
+ );
+ }}
+ okText="是"
+ cancelText="否"
+ >
+ <AliwangwangOutlined />
+ </Popconfirm>
+ </Tooltip>
+ </Col>
+ <Col span={8}>
+ <Tooltip title="自动评论">
+ <FieldTimeOutlined
+ onClick={() => openAddAutoRun(item)}
+ />
+ </Tooltip>
+ </Col>
+ </Row>
+ </div>
+ </div>
+ </Col>
+ </Row>
+ </div>
+ ))}
+ </div>
+ )}
+
+ {wordList.length > 0 && (
+ <p className="text-center">
+ <Button
+ type="link"
+ onClick={() => getCreatorList(activeAccountId)}
+ >
+ 加载更多
+ </Button>
+ </p>
+ )}
+ </Tabs.TabPane>
+ <Tabs.TabPane tab="自动任务" key="2">
+ <div style={{ width: '100%' }}></div>
+ </Tabs.TabPane>
+ </Tabs>
+ </div>
+
+ <ReplyWorks ref={Ref_ReplyWorks} />
+ <CommentList ref={Ref_CommentList} />
+ <OneKeyReply ref={Ref_OneKeyReply} />
+ </div>
+ );
+}