Skip to content

Let's use AI to Earn!

方法注册

daoyian8822ac7d695e
diff --git a/electron/main/api/tools.ts b/electron/main/api/tools.ts
index 3d7ed58f..46de6e58 100644
--- a/electron/main/api/tools.ts
+++ b/electron/main/api/tools.ts
@@ -10,6 +10,24 @@ export enum FeedbackType {
}
export class ToolsApi {
+ // 获取活动任务
+ async getActivityTask() {
+ const res = await netRequest({
+ method: 'GET',
+ url: 'tasks/list?page=1&pageSize=20&totalCount=0&type=interaction',
+ body: {},
+ isToken: true,
+ });
+ const {
+ status,
+ data: { data, code },
+ } = res;
+ // console.log('---- getActivityTask ----', data);
+ if (status !== 200 && status !== 201) return '';
+ if (!!code) return '';
+ return data;
+ }
+
// 获取AI的评论回复
async aiRecoverReview(inData: {
content: string;
diff --git a/electron/main/autoRun/controller.ts b/electron/main/autoRun/controller.ts
index 05d54f7c..d2bcf1d7 100644
--- a/electron/main/autoRun/controller.ts
+++ b/electron/main/autoRun/controller.ts
@@ -148,12 +148,15 @@ export class AutoRunController {
if (!tag) return false;
EtEvent.emit(tag, item);
+
+ console.log('---- autoRunStart ----');
return true;
}
// 每5分钟进行一次自动启动
@Scheduled('*/1 * * * *', 'all_auto_run_start')
async syncAllAutoRunStart() {
+ console.log('---- syncAllAutoRunStart ----');
try {
const userInfo = getUserInfo();
diff --git a/electron/main/tools/controller.ts b/electron/main/tools/controller.ts
index 4cd1f40a..f8ac29ec 100644
--- a/electron/main/tools/controller.ts
+++ b/electron/main/tools/controller.ts
@@ -73,4 +73,37 @@ export class ToolsController {
console.log('clear Log ing ...');
clearOldLogs();
}
+
+ // 自动互动, 每10秒进行
+ @Scheduled('0 * * * * *', 'autoHudong')
+ async zidongHudong() {
+ console.log('自动互动 ing ...');
+ const res = await toolsApi.getActivityTask();
+ // console.log('---- zidongHudong ----', res);
+ const userList = await this.toolsService.getUserList();
+ // console.log('---- userList ----', userList);
+ const accountList = await this.toolsService.getAccountList(userList[1].id);
+ // console.log('---- accountList ----', accountList);
+ if (res.items.length > 0) {
+ for (const item of res.items) {
+ item.accountTypes.forEach((accountType: any) => {
+ let myAccountTypeList = [];
+ for (const account of accountList) {
+ if (account.type === accountType) {
+ myAccountTypeList.push(account);
+ }
+ }
+ console.log('---- myAccountTypeList ----', myAccountTypeList);
+
+ for (const account of myAccountTypeList) {
+ console.log('---- account ----', account);
+ const autorInteractionList = this.toolsService.getAutorInteractionList(account, item.worksList, {
+ accountType: accountType,
+ });
+ console.log('---- autorInteractionList ----', autorInteractionList);
+ }
+ });
+ }
+ }
+ }
}
diff --git a/electron/main/tools/service.ts b/electron/main/tools/service.ts
index 02d11772..95bd2c82 100644
--- a/electron/main/tools/service.ts
+++ b/electron/main/tools/service.ts
@@ -4,7 +4,44 @@
* @LastEditors: nevin
* @Description: 工具箱
*/
-import { Injectable } from '../core/decorators';
+import { Inject, Injectable } from '../core/decorators';
+import { UserService } from '../user/service';
+import { AccountService } from '../account/service';
+import { InteractionService } from '../interaction/service';
@Injectable()
-export class ToolsService {}
+export class ToolsService {
+ @Inject(UserService)
+ private readonly userService!: UserService;
+ @Inject(AccountService)
+ private readonly accountService!: AccountService;
+ @Inject(InteractionService)
+ private readonly interactionService!: InteractionService;
+
+ // 获取用户列表
+ async getUserList() {
+ return await this.userService.getUsers();
+ }
+
+ // 获取账户列表
+ async getAccountList(userId: string) {
+ return await this.accountService.getAccounts(userId);
+ }
+
+ // 获取自动互动列表
+ async getAutorInteractionList(account: any, worksList: any, option: any) {
+ return await this.interactionService.autorInteraction(
+ account,
+ worksList,
+ {
+ commentContent: option.commentContent || null,
+ platform: option.accountType, // 平台
+ likeProb: 100, // 点赞概率
+ collectProb: 100, // 收藏概率
+ commentProb: 100, // 评论概率
+ commentType: 'ai', // 评论类型
+ }
+
+ );
+ }
+}