Skip to content

Let's use AI to Earn!

评论其他人作品 包括id回传已完成

anaianaiff84f56bd9e6
diff --git a/electron/main/plat/PlatformBase.ts b/electron/main/plat/PlatformBase.ts
index 892b0ac0..a894dc57 100644
--- a/electron/main/plat/PlatformBase.ts
+++ b/electron/main/plat/PlatformBase.ts
@@ -82,7 +82,7 @@ export abstract class PlatformBase {
* @param dataId 数据ID
* @param option 配置项
*/
- abstract dianzanDyOther(
+ abstract dianzanDyOther(
account: AccountModel,
dataId: string,
option?: any,
@@ -192,6 +192,7 @@ export abstract class PlatformBase {
account: AccountModel,
dataId: string, // 作品ID
content: string,
+ authorId?: string
): Promise<any>;
/**
diff --git a/electron/main/plat/index.ts b/electron/main/plat/index.ts
index e73cd7b8..b85ed2c3 100644
--- a/electron/main/plat/index.ts
+++ b/electron/main/plat/index.ts
@@ -310,9 +310,10 @@ class PlatController {
account: AccountModel,
dataId: string,
content: string,
+ authorId?: string
) {
const platform = this.platforms.get(account.type)!;
- return await platform.createCommentByOther(account, dataId, content);
+ return await platform.createCommentByOther(account, dataId, content, authorId);
}
/**
diff --git a/electron/main/plat/platforms/Kwai/index.ts b/electron/main/plat/platforms/Kwai/index.ts
index d4a82ebe..afe8490c 100644
--- a/electron/main/plat/platforms/Kwai/index.ts
+++ b/electron/main/plat/platforms/Kwai/index.ts
@@ -375,9 +375,10 @@ export class Kwai extends PlatformBase {
account: AccountModel,
dataId: string, // 作品ID
content: string,
+ authorId?: string
) {
const cookie: CookiesType = JSON.parse(account.loginCookie);
- const res = await kwaiPub.videoCommentByOther(cookie, dataId, content);
+ const res = await kwaiPub.videoCommentByOther(cookie, dataId, content, authorId);
console.log('------ kaishou createComment res ----', res);
return res.data;
diff --git a/electron/main/reply/controller.ts b/electron/main/reply/controller.ts
index ca122d63..8c6742fc 100644
--- a/electron/main/reply/controller.ts
+++ b/electron/main/reply/controller.ts
@@ -204,6 +204,8 @@ export class ReplyController {
accountId: number,
dataId: string,
content: string,
+ authorId?: string
+
): Promise<any> {
const account = await this.accountService.getAccountById(accountId);
if (!account) return null;
@@ -212,6 +214,7 @@ export class ReplyController {
account,
dataId,
content,
+ authorId
);
return res;
}
diff --git a/electron/plat/Kwai/index.ts b/electron/plat/Kwai/index.ts
index 4192669a..e3025338 100644
--- a/electron/plat/Kwai/index.ts
+++ b/electron/plat/Kwai/index.ts
@@ -547,7 +547,7 @@ class KwaiPub {
method: 'POST',
body: {
"operationName":"visionVideoLike",
- "variables":{"photoId": dataId,"photoAuthorId":"3xg4kz5yqa2ce2c","cancel":0,"expTag":"1_i/2008189535617610417_xpcwebdetailxxnull0"},
+ "variables":{"photoId": dataId,"photoAuthorId": option.authid,"cancel":0,"expTag":"1_i/2008189535617610417_xpcwebdetailxxnull0"},
"query": `mutation visionVideoLike($photoId: String, $photoAuthorId: String, $cancel: Int, $expTag: String) {\n visionVideoLike(photoId: $photoId, photoAuthorId: $photoAuthorId, cancel: $cancel, expTag: $expTag) {\n result\n __typename\n }\n}\n`
},
headers: {
@@ -574,15 +574,17 @@ class KwaiPub {
cookie: Electron.Cookie[],
dataId: string,
content: string,
+ authorId?: string
) {
+ console.log('dataIddataId:' , dataId, authorId)
const res = await this.requestApi<CommentAddResponse>({
cookie: cookie,
apiUrl: 'https://www.kuaishou.com/graphql',
method: 'POST',
body: {"operationName":"visionAddComment",
"variables":{
- "photoId":'3xxdnfeyyjp2qck',
- "photoAuthorId":"3xya6h9q3j26d2g",
+ "photoId": dataId,
+ "photoAuthorId": authorId,
"content":content,
"expTag":"1_a/2004436422502146722_xpcwebdetailxxnull0"},
"query":"mutation visionAddComment($photoId: String, $photoAuthorId: String, $content: String, $replyToCommentId: ID, $replyTo: ID, $expTag: String) {\n visionAddComment(photoId: $photoId, photoAuthorId: $photoAuthorId, content: $content, replyToCommentId: $replyToCommentId, replyTo: $replyTo, expTag: $expTag) {\n result\n commentId\n content\n timestamp\n status\n __typename\n }\n}\n"},
diff --git a/src/icp/replyother.ts b/src/icp/replyother.ts
index 38161003..d60d1086 100644
--- a/src/icp/replyother.ts
+++ b/src/icp/replyother.ts
@@ -17,6 +17,7 @@ export type WorkData = {
desc?: string;
coverUrl?: string;
videoUrl?: string;
+ authorId?: string;
option?: {
xsec_token: string;
};
@@ -156,12 +157,14 @@ export async function icpCreateComment(
accountId: number,
dataId: string,
content: string,
+ authorId?: string,
) {
const res: any = await window.ipcRenderer.invoke(
'ICP_CREATE_COMMENT_BY_OTHER',
accountId,
dataId,
content,
+ authorId,
);
return res;
}
diff --git a/src/views/replyother/components/replyWorks.tsx b/src/views/replyother/components/replyWorks.tsx
index 10013251..dfce4a74 100644
--- a/src/views/replyother/components/replyWorks.tsx
+++ b/src/views/replyother/components/replyWorks.tsx
@@ -20,7 +20,7 @@ const Com = forwardRef<ReplyWorksRef>((props: any, ref) => {
async function init(accountId: number, inWorkData: WorkData) {
setAccountId(accountId);
console.log('------ init-inWorkData', inWorkData);
- setWorkData(inWorkData);
+ setWorkData(inWorkData);
setIsModalOpen(true);
}
@@ -41,9 +41,10 @@ const Com = forwardRef<ReplyWorksRef>((props: any, ref) => {
workData!.dataId,
// '67d624a2000000001d02c637',
content,
+ workData!.authorId
);
console.log('----- res', res);
- if (res.status_code == 0 || res.data.code == 0) {
+ if (res.status_code == 0 || res.data.code == 0 || res.data.visionAddComment?.commentId) {
message.success('评论成功');
setIsModalOpen(false);
} else {
diff --git a/src/views/replyother/index.tsx b/src/views/replyother/index.tsx
index 48d15232..819863cd 100644
--- a/src/views/replyother/index.tsx
+++ b/src/views/replyother/index.tsx
@@ -318,6 +318,7 @@ export default function Page() {
title: data.title || '',
coverUrl: data.cover || data.coverUrl || '',
// 添加其他必要的字段
+ authorId: data.author.id
};
Ref_ReplyWorks.current?.init(activeAccountId, workData);
}
@@ -410,7 +411,7 @@ export default function Page() {
return;
}
- const res = await icpDianzanDyOther(activeAccountId, post.dataId, {authid: 1});
+ const res = await icpDianzanDyOther(activeAccountId, post.dataId, {authid: post.author.id});
console.log('------ likePost', res);
if (res.status_code == 0 || res.data?.code == 0 || res.data?.visionVideoLike.result == 1) {
message.success('点赞成功');