Skip to content

Let's use AI to Earn!

feat: 任务触发

yikaJasonMic16b2caaab4d8
diff --git a/electron/db/models/autoRunRecord.ts b/electron/db/models/autoRunRecord.ts
index 4f0895dc..3a3f8f54 100644
--- a/electron/db/models/autoRunRecord.ts
+++ b/electron/db/models/autoRunRecord.ts
@@ -1,7 +1,7 @@
/*
* @Author: nevin
* @Date: 2025-01-20 16:24:16
- * @LastEditTime: 2025-03-18 22:13:35
+ * @LastEditTime: 2025-03-23 09:27:54
* @LastEditors: nevin
* @Description: 自动评论 autoComment
*/
@@ -46,4 +46,7 @@ export class AutoRunRecordModel extends TempModel {
'周期类型 天 day-22 (例:每天22时) 周 week-2 (例:每周周二,周日0) 月 month-22 (例:每月22号)',
})
cycleType!: string;
+
+ @Column({ type: 'varchar', nullable: true, comment: '记录描述' })
+ record?: string;
}
diff --git a/electron/main/reply/controller.ts b/electron/main/reply/controller.ts
index b8b40432..101ef213 100644
--- a/electron/main/reply/controller.ts
+++ b/electron/main/reply/controller.ts
@@ -1,7 +1,7 @@
/*
* @Author: nevin
* @Date: 2025-01-20 22:02:54
- * @LastEditTime: 2025-03-20 23:01:23
+ * @LastEditTime: 2025-03-23 09:44:54
* @LastEditors: nevin
* @Description: reply Reply
*/
@@ -93,7 +93,7 @@ export class ReplyController {
const res = await this.replyService.autorReplyComment(account, dataId);
- return true;
+ return res;
}
/**
@@ -149,6 +149,12 @@ export class ReplyController {
// 运行自动任务
@Et('ET_AUTO_RUN_REPLY_COMMENT')
async runAutoReplyComment(autoRunData: AutoRunModel): Promise<any> {
- console.log('------ runAutoReplyComment ------', autoRunData.createTime);
+ const { accountId, dataId } = autoRunData;
+ if (!dataId) return null;
+
+ const account = await this.accountService.getAccountById(accountId);
+ if (!account) return null;
+
+ this.replyService.addReplyQueue(account, dataId);
}
}
diff --git a/electron/main/reply/service.ts b/electron/main/reply/service.ts
index 60f96177..f52a7b14 100644
--- a/electron/main/reply/service.ts
+++ b/electron/main/reply/service.ts
@@ -35,9 +35,9 @@ export class ReplyService {
pageInfo: { pcursor, hasMore },
} = await platController.getCommentList(account, dataId, thePcursor);
- list.forEach((item) => {
+ for (const item of list) {
list.push(item);
- });
+ }
thePcursor = pcursor;
theHasMore = !!hasMore;
@@ -58,9 +58,9 @@ export class ReplyService {
return true;
}
- addReplyQueue(msg: string) {
+ addReplyQueue(account: AccountModel, dataId: string) {
this.replyQueue.add(() => {
- console.log(msg);
+ this.autorReplyComment(account, dataId);
});
}
}