Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
作品点赞收藏
DESKTOP-ZTS2NQJNAfd75c17da5a7
diff --git a/electron/main/reply/controller.ts b/electron/main/reply/controller.tsindex 8722fb47..904fb6a2 100644--- a/electron/main/reply/controller.ts+++ b/electron/main/reply/controller.ts@@ -26,6 +26,54 @@ export class ReplyController {@Inject(AutoRunService)private readonly autoRunService!: AutoRunService;++++ /**+ * 作品点赞+ */+ @Icp('ICP_DIANZAN_DY_OTHER')+ async dianzanDyOther(+ event: Electron.IpcMainInvokeEvent,+ accountId: number,+ pcursor?: string,+ ) {+ const account = await this.accountService.getAccountById(accountId);++ if (!account)+ return {+ list: [],+ count: 0,+ };++ const res = await platController.getWorkList(account, pcursor);++ return res;+ }+++ /**+ * 作品收藏+ */+ @Icp('ICP_SHOUCANG_DY_OTHER')+ async shoucangDyOther(+ event: Electron.IpcMainInvokeEvent,+ accountId: number,+ pcursor?: string,+ ) {+ const account = await this.accountService.getAccountById(accountId);++ if (!account)+ return {+ list: [],+ count: 0,+ };++ const res = await platController.getWorkList(account, pcursor);++ return res;+ }+/*** 作品列表*/diff --git a/src/icp/replyother.ts b/src/icp/replyother.tsindex c02901b0..b3bbf6c3 100644--- a/src/icp/replyother.ts+++ b/src/icp/replyother.ts@@ -36,6 +36,25 @@ export enum PageType {cursor = 'cursor',}+++/**+ * 点赞作品+ */+export async function icpDianzanDyOther(accountId: number, dataId: string) {+ const res: any = await window.ipcRenderer.invoke('ICP_DIANZAN_DY_OTHER', accountId, dataId);+ return res;+}+++/**+ * 收藏作品+ */+export async function icpShoucangDyOther(accountId: number, dataId: string) {+ const res: any = await window.ipcRenderer.invoke('ICP_SHOUCANG_DY_OTHER', accountId, dataId);+ return res;+}+/*** 获取作品列表*/diff --git a/src/views/replyother/index.tsx b/src/views/replyother/index.tsxindex e525a403..a6185af6 100644--- a/src/views/replyother/index.tsx+++ b/src/views/replyother/index.tsx@@ -12,7 +12,7 @@ import {CommentData,icpCreateCommentList,} from '@/icp/replyother';-import { Avatar, Button, Card, Col, Row } from 'antd';+import { Avatar, Button, Card, Col, Row, message } from 'antd';import { useCallback, useRef, useState } from 'react';import AccountSidebar from '../account/components/AccountSidebar/AccountSidebar';import styles from './reply.module.scss';@@ -20,6 +20,7 @@ import Meta from 'antd/es/card/Meta';import ReplyWorks, { ReplyWorksRef } from './components/replyWorks';import ReplyComment, { ReplyCommentRef } from './components/replyComment';import AddAutoRun, { AddAutoRunRef } from './components/addAutoRun';+import { icpDianzanDyOther, icpShoucangDyOther } from '@/icp/replyother';export default function Page() {const [wordList, setWordList] = useState<WorkData[]>([]);@@ -86,6 +87,34 @@ export default function Page() {Ref_AddAutoRun.current?.init(activeAccountId, data.dataId);}+ /**+ * 点赞+ */+ async function dianzanFunc(data: WorkData) {+ console.log('------ dianzanFunc', data);+ const res = await icpDianzanDyOther(activeAccountId, '7484585415068880139');+ console.log('----- res', res);+ if (res.status_code == 0) {+ message.success('评论成功');+ } else {+ message.error('评论失败');+ }+ }++ /**+ * 收藏+ */+ async function shoucangFunc(data: WorkData) {+ console.log('------ shoucangFunc', data);+ const res = await icpShoucangDyOther(activeAccountId, '7484585415068880139');+ console.log('----- res', res);+ if (res.status_code == 0) {+ message.success('收藏成功');+ } else {+ message.error('收藏失败');+ }+ }+return (<div className={styles.reply}><Row>@@ -124,21 +153,38 @@ export default function Page() {评论作品</Button>,<Button- type="primary"- onClick={() => {- createCommentList(item);- }}- >- 一键AI评论- </Button>,- <Button- type="primary"- onClick={() => {- openAddAutoRun(item);- }}- >- 创建自动任务- </Button>,+ type="primary"+ onClick={() => {+ dianzanFunc(item);+ }}+ >+ 点赞+ </Button>,+ <Button+ type="primary"+ onClick={() => {+ shoucangFunc(item);+ }}+ >+ 收藏+ </Button>++ // <Button+ // type="primary"+ // onClick={() => {+ // createCommentList(item);+ // }}+ // >+ // 一键AI评论+ // </Button>,+ // <Button+ // type="primary"+ // onClick={() => {+ // openAddAutoRun(item);+ // }}+ // >+ // 创建自动任务+ // </Button>,]}><Meta title={item.title} />