Skip to content

Let's use AI to Earn!

feat: 获取一键互动的记录列表

牛文政92976e52f0f8
diff --git a/electron/main/reply/controller.ts b/electron/main/reply/controller.ts
index 8f756ae2..48bb54ab 100644
--- a/electron/main/reply/controller.ts
+++ b/electron/main/reply/controller.ts
@@ -17,7 +17,9 @@ import { AutorReplyCommentScheduleEvent } from '../../../commont/types/reply';
import type { WorkData } from '../plat/plat.type';
import { GlobleCache } from '../../global/cache';
import { AutoReplyCache } from './cacheData';
-
+import type { CorrectQuery } from '../../global/table';
+import { AccountType } from '../../../commont/AccountEnum';
+import { getUserInfo } from '../user/comment';
@Controller()
export class ReplyController {
@Inject(ReplyService)
@@ -106,8 +108,6 @@ export class ReplyController {
qe?: string, // 搜索内容
pageInfo?: any,
) {
- console.log('==== pageInfo -----', pageInfo);
-
const account = await this.accountService.getAccountById(accountId);
if (!account)
@@ -362,4 +362,25 @@ export class ReplyController {
): Promise<any | null> {
return AutoReplyCache.getInfo();
}
+
+ /**
+ * 获取回复评论的记录列表
+ */
+ @Icp('ICP_GET_REPLAY_COMMENT_RECORD_LIST')
+ async getReplyCommentRecordList(
+ event: Electron.IpcMainInvokeEvent,
+ page: CorrectQuery,
+ query: {
+ accountId?: number;
+ type?: AccountType;
+ },
+ ): Promise<any> {
+ const userInfo = getUserInfo();
+
+ return this.replyService.getReplyCommentRecordList(
+ userInfo.id,
+ page,
+ query,
+ );
+ }
}
diff --git a/electron/main/reply/service.ts b/electron/main/reply/service.ts
index 106a2bc2..b65933fc 100644
--- a/electron/main/reply/service.ts
+++ b/electron/main/reply/service.ts
@@ -13,7 +13,7 @@ import { AutoRunService } from '../autoRun/service';
import { AutoRunModel } from '../../db/models/autoRun';
import { sysNotice } from '../../global/notice';
import { AutorReplyCommentScheduleEvent } from '../../../commont/types/reply';
-import { Repository } from 'typeorm';
+import { FindOptionsWhere, Repository } from 'typeorm';
import { ReplyCommentRecordModel } from '../../db/models/replyCommentRecord';
import { AppDataSource } from '../../db';
import { getUserInfo } from '../user/comment';
@@ -22,6 +22,8 @@ import { WorkData } from '../plat/plat.type';
import { sleep } from '../../util/time';
import { AutoReplyCache, AutorReplyCacheStatus } from './cacheData';
import { logger } from '../../global/log';
+import { backPageData, CorrectQuery } from '../../global/table';
+import { AccountType } from '../../../commont/AccountEnum';
@Injectable()
export class ReplyService {
@@ -80,6 +82,29 @@ export class ReplyService {
});
}
+ // 获取评论回复记录列表
+ async getReplyCommentRecordList(
+ userId: string,
+ page: CorrectQuery,
+ query: {
+ accountId?: number;
+ type?: AccountType;
+ },
+ ) {
+ const filter: FindOptionsWhere<ReplyCommentRecordModel> = {
+ userId,
+ ...(query.accountId && { accountId: query.accountId }),
+ ...(query.type && { type: query.type }),
+ };
+
+ const [list, totalCount] =
+ await this.replyCommentRecordRepository.findAndCount({
+ where: filter,
+ });
+
+ return backPageData(list, totalCount, page);
+ }
+
/**
* 自动一键评论
* 规则:评论所有的一级评论,已经在评论记录的不评论
diff --git a/src/icp/reply.ts b/src/icp/reply.ts
index 598f87d8..ad98a895 100644
--- a/src/icp/reply.ts
+++ b/src/icp/reply.ts
@@ -1,3 +1,5 @@
+import { AccountType } from '@@/AccountEnum';
+
/*
* @Author: nevin
* @Date: 2025-01-23 15:48:14
@@ -162,3 +164,26 @@ export async function ipcGetAutoRunOfReplyInfo() {
} = await window.ipcRenderer.invoke('ICP_GET_AUTO_REPLY_INFO');
return res;
}
+
+/**
+ * 获取一键互动的记录列表
+ * @param page
+ * @param query
+ */
+export async function ipcGetReplyCommentRecordList(
+ page: {
+ page_size: number;
+ page_no: number;
+ },
+ query: {
+ accountId?: number;
+ type?: AccountType;
+ },
+) {
+ const res: string = await window.ipcRenderer.invoke(
+ 'ICP_GET_REPLAY_COMMENT_RECORD_LIST',
+ page,
+ query,
+ );
+ return res;
+}
diff --git a/src/icp/replyother.ts b/src/icp/replyother.ts
index 4f1af0e7..984fbc3d 100644
--- a/src/icp/replyother.ts
+++ b/src/icp/replyother.ts
@@ -250,9 +250,8 @@ export async function ipcGetAutoRunOfInteractionInfo() {
/**
* 获取一键互动的记录列表
- * @param accountId
- * @param dataId
- * @param cycleType
+ * @param page
+ * @param query
*/
export async function ipcGetInteractionRecordList(
page: {