Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat: 自动评论通知反馈和记录
yikaJasonMicfde56870424c
diff --git a/electron/main/reply/controller.ts b/electron/main/reply/controller.tsindex b7d4eca5..8ac0d0b5 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-23 21:53:31+ * @LastEditTime: 2025-03-24 09:34:03* @LastEditors: nevin* @Description: reply Reply*/@@ -168,6 +168,9 @@ export class ReplyController {const account = await this.accountService.getAccountById(accountId);if (!account) return null;- this.replyService.addReplyQueue(account, dataId);+ this.replyService.addReplyQueue(account, dataId, autoRunData);++ // 创建记录+ this.autoRunService.createAutoRunRecord(autoRunData);}}diff --git a/electron/main/reply/service.ts b/electron/main/reply/service.tsindex a2813e17..fd4a6549 100644--- a/electron/main/reply/service.ts+++ b/electron/main/reply/service.ts@@ -4,12 +4,14 @@* @LastEditors: nevin* @Description: Reply reply*/-import { Injectable } from '../core/decorators';+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 { AutorReplyCommentScheduleEvent } from './comment';+import { AutoRunService } from '../autoRun/service';+import { AutoRunModel } from '../../db/models/autoRun';@Injectable()export class ReplyService {@@ -18,6 +20,9 @@ export class ReplyService {this.replyQueue = new PQueue({ concurrency: 2 });}+ @Inject(AutoRunService)+ private readonly autoRunService!: AutoRunService;+/*** 自动一键评论* 规则:评论所有的一级评论,已有自己的评论的不评论@@ -124,7 +129,7 @@ export class ReplyService {* @param account* @param dataId*/- addReplyQueue(account: AccountModel, dataId: string) {+ addReplyQueue(account: AccountModel, dataId: string, autoRun: AutoRunModel) {this.replyQueue.add(() => {this.autorReplyComment(account,@@ -134,7 +139,11 @@ export class ReplyService {status: -1 | 0 | 1;error?: any;}) => {- // TODO: 调用自动任务的通知+ this.autoRunService.sendAutoRunProgress(+ autoRun.id,+ e.status,+ e.error,+ );},);});