Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat: 调试点赞和收藏
牛文政5f743c7a8721
diff --git a/electron/main/interaction/service.ts b/electron/main/interaction/service.tsindex e7a96f22..74f2a34d 100644--- a/electron/main/interaction/service.ts+++ b/electron/main/interaction/service.ts@@ -46,8 +46,8 @@ export class InteractionService {@Inject(AutoRunService)private readonly autoRunService!: AutoRunService;- // 创建评论记录- async create(+ // 创建互动记录+ async createInteractionRecord(userId: string,account: AccountModel,works: {@@ -218,7 +218,7 @@ export class InteractionService {}// 创建评论记录- this.create(+ this.createInteractionRecord(userInfo.id,account,{@@ -376,8 +376,8 @@ export class InteractionService {});}- // 创建评论记录- this.create(+ // 创建互动记录+ this.createInteractionRecord(userInfo.id,account,{diff --git a/electron/main/plat/PlatformBase.ts b/electron/main/plat/PlatformBase.tsindex fef8fbdd..6c75066a 100644--- a/electron/main/plat/PlatformBase.ts+++ b/electron/main/plat/PlatformBase.ts@@ -82,11 +82,11 @@ export abstract class PlatformBase {* @param dataId 数据ID* @param option 配置项*/- abstract dianzanDyOther(+ abstract dianzanDyOther(account: AccountModel,dataId: string,option?: any,- ): Promise<any>;+ ): Promise<boolean>;/*** 收藏@@ -96,7 +96,7 @@ export abstract class PlatformBase {abstract shoucangDyOther(account: AccountModel,pcursor?: string,- ): Promise<any>;+ ): Promise<boolean>;/*** 获取作品列表@@ -192,7 +192,7 @@ export abstract class PlatformBase {account: AccountModel,dataId: string, // 作品IDcontent: string,- authorId?: string+ authorId?: string,): Promise<any>;/**diff --git a/electron/main/plat/index.ts b/electron/main/plat/index.tsindex 7acb54e6..7e4e17fc 100644--- a/electron/main/plat/index.ts+++ b/electron/main/plat/index.ts@@ -310,10 +310,15 @@ class PlatController {account: AccountModel,dataId: string,content: string,- authorId?: string+ authorId?: string,) {const platform = this.platforms.get(account.type)!;- return await platform.createCommentByOther(account, dataId, content, authorId);+ 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.tsindex 45c1810c..e3d506ba 100644--- a/electron/main/plat/platforms/Kwai/index.ts+++ b/electron/main/plat/platforms/Kwai/index.ts@@ -16,7 +16,6 @@ import {IGetTopicsParams,IGetTopicsResponse,IGetUsersParams,- ResponsePageInfo,VideoCallbackType,WorkData,} from '../../plat.type';@@ -223,7 +222,6 @@ export class Kwai extends PlatformBase {orgList: any[];pageInfo: any;}> {-const cookie: CookiesType = JSON.parse(account.loginCookie);const res = await kwaiPub.getsearchNodeList(cookie, qe, pageInfo);// console.log('----------- getsearchNodeList --- res: ', res.data);@@ -260,12 +258,12 @@ export class Kwai extends PlatformBase {data: s,});}-+return {- list: list,+ list: list,orgList: res.data.data?.visionSearchPhoto,pageInfo: {- hasMore: (photoList.length > 1) ? true : false,+ hasMore: photoList.length > 1 ? true : false,count: res.data.data?.visionSearchPhoto.length,pcursor: Number(res.data.data?.visionSearchPhoto?.pcursor) + 1 || 1,},@@ -358,15 +356,10 @@ export class Kwai extends PlatformBase {pcursor?: string,) {const cookie: CookiesType = JSON.parse(account.loginCookie);- const res = await kwaiPub.getVideoCommentList(- cookie,- data.dataId,- pcursor,- );+ const res = await kwaiPub.getVideoCommentList(cookie, data.dataId, pcursor);const list: CommentData[] = [];for (const v of res.data.data.visionCommentList?.rootComments || []) {-list.push({userId: v.authorId + '',dataId: data.dataId + '',@@ -400,16 +393,20 @@ export class Kwai extends PlatformBase {return new Promise((resolve, reject) => {});}-// 创建其他视频评论async createCommentByOther(account: AccountModel,dataId: string, // 作品IDcontent: string,- authorId?: string+ authorId?: string,) {const cookie: CookiesType = JSON.parse(account.loginCookie);- const res = await kwaiPub.videoCommentByOther(cookie, dataId, content, authorId);+ const res = await kwaiPub.videoCommentByOther(+ cookie,+ dataId,+ content,+ authorId,+ );console.log('------ kaishou createComment res ----', res);return res.data;@@ -428,7 +425,6 @@ export class Kwai extends PlatformBase {) {const cookie: CookiesType = JSON.parse(account.loginCookie);-const res = await kwaiPub.replyCommentByOther(cookie, content, {photoId: option.dataId,replyToCommentId: commentId,@@ -436,14 +432,9 @@ export class Kwai extends PlatformBase {photoAuthorId: option.videoAuthId,});-return res;}----async createComment(account: AccountModel,dataId: string, // 作品ID@@ -555,7 +546,11 @@ export class Kwai extends PlatformBase {/*** 点赞*/- async dianzanDyOther(account: AccountModel, dataId: string, option?: any): Promise<any> {+ async dianzanDyOther(+ account: AccountModel,+ dataId: string,+ option?: any,+ ): Promise<any> {const cookie: CookiesType = JSON.parse(account.loginCookie);const res = await kwaiPub.dianzanDyOther(cookie, dataId, option);console.log('------ dianzanDyOther -- Kwai --- res: ', res);diff --git a/electron/main/plat/platforms/douyin/index.ts b/electron/main/plat/platforms/douyin/index.tsindex 93b465b3..d01d970a 100644--- a/electron/main/plat/platforms/douyin/index.ts+++ b/electron/main/plat/platforms/douyin/index.ts@@ -360,18 +360,20 @@ export class Douyin extends PlatformBase {async dianzanDyOther(account: AccountModel,dataId: string, // 作品ID- ) {- console.log('------ dianzanDyOther3333', dataId);+ ): Promise<boolean> {const cookie: CookiesType = JSON.parse(account.loginCookie);- const res = await douyinService.creatorDianzanOther(cookie, {- aweme_id: dataId,- item_type: 0,- type: 1,- });-- console.log('------ res', res);+ try {+ const res = await douyinService.creatorDianzanOther(cookie, {+ aweme_id: dataId,+ item_type: 0,+ type: 1,+ });- return res;+ return res.status_code === 0;+ } catch (error) {+ console.log('------ error douyin dianzanDyOther ---- ', error);+ return false;+ }}async shoucangDyOther(diff --git a/electron/main/plat/platforms/xhs/index.ts b/electron/main/plat/platforms/xhs/index.tsindex 41a56341..6cd2d3ed 100644--- a/electron/main/plat/platforms/xhs/index.ts+++ b/electron/main/plat/platforms/xhs/index.ts@@ -415,27 +415,27 @@ export class Xhs extends PlatformBase {async dianzanDyOther(account: AccountModel,dataId: string, // 作品ID- ) {+ ): Promise<boolean> {console.log('------ dianzanDyOther3333', dataId);const cookie: CookiesType = JSON.parse(account.loginCookie);const res = await xiaohongshuService.likeNote(cookie, dataId);console.log('------ res', res);- return res;+ return !!res;}async shoucangDyOther(account: AccountModel,dataId: string, // 作品ID- ) {+ ): Promise<boolean> {console.log('------ dianzanDyOther5555', dataId);const cookie: CookiesType = JSON.parse(account.loginCookie);const res = await xiaohongshuService.shoucangNote(cookie, dataId);console.log('------ res', res);- return res;+ return !!res;}async replyCommentByOther(diff --git a/electron/plat/douyin/index.ts b/electron/plat/douyin/index.tsindex 6d490857..c9ea05a5 100644--- a/electron/plat/douyin/index.ts+++ b/electron/plat/douyin/index.ts@@ -2465,7 +2465,21 @@ export class DouyinService {}// 点赞- async creatorDianzanOther(cookie: Electron.Cookie[], data: any) {+ async creatorDianzanOther(+ cookie: Electron.Cookie[],+ data: any,+ ): Promise<{+ extra: {+ fatal_item_ids: string[];+ logid: string; // '2025040322304072588F91E9D7AE3AA42B';+ now: number; // 1743690640000;+ };+ log_pb: {+ impr_id: string; // '2025040322304072588F91E9D7AE3AA42B'+ };+ status_code: number; // 0;+ is_digg: number; // 0;+ }> {console.log('------ creatorDianzanOther-data@@@@@');const thisUri = `https://www.douyin.com/aweme/v1/web/commit/item/digg/?${jsonToQueryString({diff --git a/src/icp/replyother.ts b/src/icp/replyother.tsindex 4496ba02..eb3ac18e 100644--- a/src/icp/replyother.ts+++ b/src/icp/replyother.ts@@ -220,7 +220,7 @@ export async function icpCreateInteractionOneKey(}/**- * 创建一键回复自动进程+ * 创建一键互动自动进程* @param accountId* @param dataId* @param cycleTypediff --git a/src/views/interaction/index.tsx b/src/views/interaction/index.tsxindex 15e7348b..936d773e 100644--- a/src/views/interaction/index.tsx+++ b/src/views/interaction/index.tsx@@ -17,7 +17,11 @@ import {import InteractionOneKey, {InteractionOneKeyRef,} from './components/oneKeyInteraction';-import { getCommentSearchNotes, icpInteractionOneData } from '@/icp/replyother';+import {+ getCommentSearchNotes,+ icpDianzanDyOther,+ icpInteractionOneData,+} from '@/icp/replyother';export default function Page() {const [wordList, setWordList] = useState<WorkData[]>([]);@@ -59,6 +63,20 @@ export default function Page() {*/function openAddAutoRun(data: WorkData) {}+ function commentWorks(works: WorkData) {+ console.log('---- interactionOneData ----', works);+ }++ async function likeWorks(works: WorkData) {+ console.log('---- interactionOneData ----', works);+ const res = await icpDianzanDyOther(activeAccountId, works.dataId);+ console.log('----- res ---', res);+ }++ async function collectWorks(works: WorkData) {+ console.log('---- interactionOneData ----', works);+ }+return (<div><AccountSidebar@@ -113,13 +131,23 @@ export default function Page() {<p className="mb-2">{item.title || '无标题'}</p><div className="w-full mt-auto"><Row justify="space-evenly">- <Col span={8}></Col>- <Col span={8}></Col>+ <Col span={8}>+ <Button onClick={() => commentWorks(item)}>+ 评论作品+ </Button>+ </Col>+ <Col span={8}>+ <Button onClick={() => likeWorks(item)}>+ 点赞作品+ </Button>+ </Col></Row><Row justify="space-evenly"><Col span={8}>- <Tooltip title="一键评论"></Tooltip>+ <Button onClick={() => collectWorks(item)}>+ 收藏作品+ </Button></Col><Col span={8}><Tooltip title="自动评论">