Skip to content

Let's use AI to Earn!

异常问题

zhang767653317b25d7b65f314
diff --git a/electron/main/interaction/service.ts b/electron/main/interaction/service.ts
index 0b060d67..e2b2d693 100644
--- a/electron/main/interaction/service.ts
+++ b/electron/main/interaction/service.ts
@@ -104,6 +104,7 @@ export class InteractionService {
});
try {
+ console.log('------ 开始执行互动任务,作品数量:', worksList.length);
scheduleEvent({
tag: AutorWorksInteractionScheduleEvent.Start,
status: 0,
@@ -111,6 +112,7 @@ export class InteractionService {
// 1. 循环AI回复评论
for (const works of worksList) {
+ console.log('------ 开始处理作品:', works.dataId);
sleep(5);
const oldRecord = await this.getInteractionRecord(
userInfo.id,
@@ -171,11 +173,16 @@ export class InteractionService {
// ----- 2-点赞作品 -----
let isLike: 0 | 1 = 0;
try {
- const isLikeRes = await platController.dianzanDyOther(
+ console.log('------ 开始点赞作品:', works.dataId);
+ const isLikeRes = await platController.dianzanDyOther(
account,
works.dataId,
+ {
+ authid: works.author?.id,
+ }
);
isLike = isLikeRes ? 1 : 0;
+ console.log('------ 点赞结果:', isLikeRes);
} catch (error) {
scheduleEvent({
tag: AutorWorksInteractionScheduleEvent.Error,
@@ -204,7 +211,7 @@ export class InteractionService {
isLike,
},
});
- }
+ }
// 创建互动记录
this.createInteractionRecord(
@@ -217,15 +224,18 @@ export class InteractionService {
},
option.commentContent,
isLike,
- isCollect,
+ 0, // 收藏状态设为0
);
+ console.log('------ 作品处理完成:', works.dataId);
}
+ console.log('------ 所有作品处理完成');
scheduleEvent({
tag: AutorWorksInteractionScheduleEvent.ReplyCommentEnd,
status: 0,
});
} catch (error) {
+ console.error('------ 任务执行出错:', error);
scheduleEvent({
tag: AutorWorksInteractionScheduleEvent.Error,
status: -1,
diff --git a/electron/main/plat/platforms/Kwai/index.ts b/electron/main/plat/platforms/Kwai/index.ts
index e3d506ba..12a3e0a9 100644
--- a/electron/main/plat/platforms/Kwai/index.ts
+++ b/electron/main/plat/platforms/Kwai/index.ts
@@ -554,6 +554,7 @@ export class Kwai extends PlatformBase {
const cookie: CookiesType = JSON.parse(account.loginCookie);
const res = await kwaiPub.dianzanDyOther(cookie, dataId, option);
console.log('------ dianzanDyOther -- Kwai --- res: ', res);
+
return res.data;
}
diff --git a/electron/main/plat/platforms/douyin/index.ts b/electron/main/plat/platforms/douyin/index.ts
index d01d970a..ea8e5a96 100644
--- a/electron/main/plat/platforms/douyin/index.ts
+++ b/electron/main/plat/platforms/douyin/index.ts
@@ -357,7 +357,7 @@ export class Douyin extends PlatformBase {
};
}
- async dianzanDyOther(
+ async dianzanDyOther(
account: AccountModel,
dataId: string, // 作品ID
): Promise<boolean> {
diff --git a/electron/plat/xiaohongshu/index.ts b/electron/plat/xiaohongshu/index.ts
index 2b1ceab4..d8daa0b8 100644
--- a/electron/plat/xiaohongshu/index.ts
+++ b/electron/plat/xiaohongshu/index.ts
@@ -1571,6 +1571,7 @@ export class XiaohongshuService {
* @returns
*/
async likeNote(cookie: Electron.Cookie[], noteId: string) {
+ console.log('------ likeNote --- noteId', noteId);
const url = `/api/sns/web/v1/note/like`;
const body = {
note_oid: noteId,
diff --git a/src/views/replyother/replyother.tsx b/src/views/replyother/replyother.tsx
index 7db712aa..278962cf 100644
--- a/src/views/replyother/replyother.tsx
+++ b/src/views/replyother/replyother.tsx
@@ -54,6 +54,8 @@ import WebView from '../../components/WebView';
// @ts-ignore
import { useInView } from 'react-intersection-observer';
import { icpCreatorList } from '@/icp/reply';
+import { icpCreateInteractionOneKey } from '@/icp/replyother';
+import { forEach } from 'lodash';
export default function Page() {
const [wordList, setWordList] = useState<WorkData[]>([]);
@@ -195,50 +197,73 @@ export default function Page() {
message.success('任务已下发');
setTaskModalVisible(false);
setIsSelectMode(false);
-
- // 创建任务队列
- const taskQueue = selectedPosts.map(postId => {
+
+ forEach(postList, (postId) => {
const post = postList.find(item => item.dataId === postId);
- if (!post) return null;
+ if (!post) return;
+ likePost(post);
+ });
+
+ if (!selectedPosts.length) return;
+
+ // 从postList中提取选中的帖子数据
+ const selectedPostData = selectedPosts.map(postId => {
+ return postList.find(item => item.dataId === postId);
+ }); // 过滤掉undefined的值
+
+ console.log('------ selectedPostData', selectedPostData);
+
+ // 调用icpCreateInteractionOneKey函数
+
+ const res = await icpCreateInteractionOneKey(activeAccountId, selectedPostData, {
- return async () => {
- try {
- // 根据概率决定是否执行点赞
- // if (Math.random() * 100 <= values.likeProb) {
- await likePost(post);
- // }
+ commentContent: '不错啊!',
+ });
+ console.log('------ res', res);
+
+ // // 创建任务队列
+ // const taskQueue = selectedPosts.map(postId => {
+ // const post = postList.find(item => item.dataId === postId);
+ // if (!post) return null;
+
+ // return async () => {
+ // try {
+ // // 根据概率决定是否执行点赞
+ // // if (Math.random() * 100 <= values.likeProb) {
+ // await likePost(post);
+ // // }
- // 根据概率决定是否执行收藏
- if(activeAccountType != 'KWAI'){
- if (Math.random() * 100 <= values.collectProb) {
- await collectPost(post);
- }
- }
+ // // 根据概率决定是否执行收藏
+ // if(activeAccountType != 'KWAI'){
+ // if (Math.random() * 100 <= values.collectProb) {
+ // await collectPost(post);
+ // }
+ // }
- // // 根据概率决定是否执行评论
- // if (Math.random() * 100 <= values.commentProb) {
- // if (values.commentType === 'ai') {
- // // AI评论逻辑
- // await openReplyWorks(post);
- // } else {
- // // 自定义评论逻辑
- // const randomComment = customComments[Math.floor(Math.random() * customComments.length)];
- // // TODO: 实现自定义评论发送逻辑
- // }
- // }
- } catch (error) {
- console.error('执行任务失败:', error);
- }
- };
- }).filter(Boolean);
-
- // 按顺序执行任务,每个任务间隔3秒
- for (const task of taskQueue) {
- if (task) {
- await task();
- await new Promise(resolve => setTimeout(resolve, 3000)); // 等待3秒
- }
- }
+ // // // 根据概率决定是否执行评论
+ // // if (Math.random() * 100 <= values.commentProb) {
+ // // if (values.commentType === 'ai') {
+ // // // AI评论逻辑
+ // // await openReplyWorks(post);
+ // // } else {
+ // // // 自定义评论逻辑
+ // // const randomComment = customComments[Math.floor(Math.random() * customComments.length)];
+ // // // TODO: 实现自定义评论发送逻辑
+ // // }
+ // // }
+ // } catch (error) {
+ // console.error('执行任务失败:', error);
+ // }
+ // };
+ // }).filter(Boolean);
+
+ // // 按顺序执行任务,每个任务间隔3秒
+ // for (const task of taskQueue) {
+ // if (task) {
+ // await task();
+ // await new Promise(resolve => setTimeout(resolve, 3000)); // 等待3秒
+ // }
+ // }
setSelectedPosts([]);
};
@@ -470,6 +495,7 @@ export default function Page() {
});
console.log('------ likePost', res);
if (
+ res === true ||
res.status_code == 0 ||
res.data?.code == 0 ||
res.data?.visionVideoLike.result == 1