Skip to content

Let's use AI to Earn!

feat: 一键互动界面

牛文政ff9cbdaea806
diff --git a/electron/main/interaction/controller.ts b/electron/main/interaction/controller.ts
index 939a5669..26a3d8a2 100644
--- a/electron/main/interaction/controller.ts
+++ b/electron/main/interaction/controller.ts
@@ -30,15 +30,10 @@ export class InteractionController {
* 一键AI互动
*/
@Icp('ICP_INTERACTION_ONE_KEY')
- async createCommentList(
+ async interactionOneKey(
event: Electron.IpcMainInvokeEvent,
accountId: number,
- worksList: {
- worksId: string;
- desc: string; // 用来AI生成
- title?: string;
- cover?: string;
- }[],
+ worksList: WorkData[],
option: {
commentContent: string; // 评论内容
},
@@ -64,9 +59,9 @@ export class InteractionController {
}
/**
- * 创建自动一键评论任务
+ * 创建自动一键互动任务
*/
- @Icp('ICP_AUTO_RUN_CREATE_REPLY')
+ @Icp('ICP_AUTO_RUN_INTERACTION')
async createReplyCommentAutoRun(
event: Electron.IpcMainInvokeEvent,
accountId: number,
@@ -100,12 +95,7 @@ export class InteractionController {
const res = await this.interactionService.addReplyQueue(
account,
- dataInfo as {
- worksId: string;
- desc: string; // 用来AI生成
- title?: string;
- cover?: string;
- }[],
+ dataInfo as WorkData[],
{
commentContent: dataInfo.commentContent,
},
diff --git a/electron/main/interaction/service.ts b/electron/main/interaction/service.ts
index 436b4fa5..4e43c99a 100644
--- a/electron/main/interaction/service.ts
+++ b/electron/main/interaction/service.ts
@@ -20,6 +20,7 @@ import { GlobleCache } from '../../global/cache';
import { sleep } from '../../util/time';
import { InteractionRecordModel } from '../../db/models/interactionRecord';
import { AutorWorksInteractionScheduleEvent } from '../../../commont/types/interaction';
+import { WorkData } from '../plat/plat.type';
/**
* 获取缓存key
@@ -93,12 +94,7 @@ export class InteractionService {
*/
async autorInteraction(
account: AccountModel,
- worksList: {
- worksId: string;
- desc: string; // 用来AI生成
- title?: string;
- cover?: string;
- }[],
+ worksList: WorkData[],
option: {
commentContent: string; // 评论内容
},
@@ -133,13 +129,13 @@ export class InteractionService {
const oldRecord = await this.getInteractionRecord(
userInfo.id,
account,
- works.worksId,
+ works.dataId,
);
if (oldRecord) continue;
if (!option.commentContent) {
const aiRes = await toolsApi.aiRecoverReview({
- content: works.desc,
+ content: (works.desc || '') + (works.title || ''),
});
// AI接口错误
@@ -163,7 +159,7 @@ export class InteractionService {
// ----- 1-评论作品 -----
const commentWorksRes = await platController.createCommentByOther(
account,
- works.worksId,
+ works.dataId,
aiRes,
);
@@ -187,7 +183,7 @@ export class InteractionService {
try {
const isLikeRes = await platController.dianzanDyOther(
account,
- works.worksId,
+ works.dataId,
);
isLike = isLikeRes ? 1 : 0;
} catch (error) {
@@ -206,7 +202,7 @@ export class InteractionService {
try {
const isCollectRes = await platController.shoucangDyOther(
account,
- works.worksId,
+ works.dataId,
);
isCollect = isCollectRes ? 1 : 0;
} catch (error) {
@@ -225,9 +221,9 @@ export class InteractionService {
userInfo.id,
account,
{
- worksId: works.worksId,
+ worksId: works.dataId,
worksTitle: works.title,
- worksCover: works.cover,
+ worksCover: works.coverUrl,
},
option.commentContent,
isLike,
@@ -260,12 +256,7 @@ export class InteractionService {
*/
async addReplyQueue(
account: AccountModel,
- worksList: {
- worksId: string;
- desc: string; // 用来AI生成
- title?: string;
- cover?: string;
- }[],
+ worksList: WorkData[],
option: {
commentContent: string; // 评论内容
},
diff --git a/electron/main/reply/controller.ts b/electron/main/reply/controller.ts
index 8c6742fc..361938c8 100644
--- a/electron/main/reply/controller.ts
+++ b/electron/main/reply/controller.ts
@@ -101,9 +101,11 @@ export class ReplyController {
async getSearchNodeList(
event: Electron.IpcMainInvokeEvent,
accountId: number,
- qe?: string,
+ qe?: string, // 搜索内容
pageInfo?: any,
) {
+ console.log('==== pageInfo -----', pageInfo);
+
const account = await this.accountService.getAccountById(accountId);
if (!account)
@@ -204,8 +206,7 @@ export class ReplyController {
accountId: number,
dataId: string,
content: string,
- authorId?: string
-
+ authorId?: string,
): Promise<any> {
const account = await this.accountService.getAccountById(accountId);
if (!account) return null;
@@ -214,7 +215,7 @@ export class ReplyController {
account,
dataId,
content,
- authorId
+ authorId,
);
return res;
}
diff --git a/src/icp/replyother.ts b/src/icp/replyother.ts
index d60d1086..ec62933d 100644
--- a/src/icp/replyother.ts
+++ b/src/icp/replyother.ts
@@ -43,7 +43,11 @@ export enum PageType {
/**
* 点赞作品
*/
-export async function icpDianzanDyOther(accountId: number, dataId: string, option?: any) {
+export async function icpDianzanDyOther(
+ accountId: number,
+ dataId: string,
+ option?: any,
+) {
const res: any = await window.ipcRenderer.invoke(
'ICP_DIANZAN_DY_OTHER',
accountId,
@@ -65,22 +69,6 @@ export async function icpShoucangDyOther(accountId: number, dataId: string) {
return res;
}
-/**
- * 获取作品列表
- */
-export async function icpCreatorList(accountId: number, pcursor?: string) {
- const res: {
- list: WorkData[];
- pageInfo: {
- pageType: PageType;
- count?: number;
- hasMore?: boolean;
- pcursor?: string;
- };
- } = await window.ipcRenderer.invoke('ICP_CREATOR_LIST', accountId, pcursor);
- return res;
-}
-
/**
* 搜索各平台内容
*/
@@ -192,50 +180,37 @@ export async function icpReplyCommentByOther(
}
/**
- * 回复评论
+ * 一键AI互动
*/
-export async function icpReplyComment(
+export async function icpCreateInteractionOneKey(
accountId: number,
- commentId: string,
- content: string,
+ worksList: WorkData[],
option: {
- dataId?: string; // 作品ID
- comment: any; // 辅助数据,原数据
+ commentContent: string; // 评论内容
},
) {
const res: boolean = await window.ipcRenderer.invoke(
- 'ICP_REPLY_COMMENT',
+ 'ICP_INTERACTION_ONE_KEY',
accountId,
- commentId,
- content,
+ worksList,
option,
);
return res;
}
-/**
- * 一键作品回复评论
- */
-export async function icpCreateCommentList(accountId: number, dataId: string) {
- const res: boolean = await window.ipcRenderer.invoke(
- 'ICP_REPLY_COMMENT_LIST_BY_AI',
- accountId,
- dataId,
- );
- return res;
-}
-
/**
* 创建一键回复自动进程
- * @param data
+ * @param accountId
+ * @param dataId
+ * @param cycleType
*/
-export async function ipcCreateAutoRunOfReply(
+export async function ipcCreateAutoRunOfInteraction(
accountId: number,
dataId: string, // 作品ID
cycleType: string,
) {
const res: string = await window.ipcRenderer.invoke(
- 'ICP_AUTO_RUN_CREATE_REPLY',
+ 'ICP_AUTO_RUN_INTERACTION',
accountId,
dataId,
cycleType,
diff --git a/src/views/interaction/components/commentList.tsx b/src/views/interaction/components/commentList.tsx
deleted file mode 100644
index e8f8091d..00000000
--- a/src/views/interaction/components/commentList.tsx
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * @Author: nevin
- * @Date: 2025-03-18 21:02:38
- * @LastEditTime: 2025-03-31 09:43:51
- * @LastEditors: nevin
- * @Description: 评论列表
- */
-import { CommentData, icpGetCommentList, WorkData } from '@/icp/reply';
-import { Avatar, Button, Card, Col, Modal, Row, Tooltip } from 'antd';
-import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
-import Meta from 'antd/es/card/Meta';
-import ReplyComment, { ReplyCommentRef } from './replyComment';
-import { MessageOutlined } from '@ant-design/icons';
-
-export interface CommentListRef {
- init: (accountId: number, workData: WorkData) => Promise<void>;
-}
-
-const Com = forwardRef<CommentListRef>((props: any, ref) => {
- const [commentList, setCommentList] = useState<CommentData[]>([]);
- const [isModalOpen, setIsModalOpen] = useState(false);
- const [accountId, setAccountId] = useState<number>(0);
- const [workData, setWorkData] = useState<WorkData | null>(null);
- const Ref_ReplyComment = useRef<ReplyCommentRef>(null);
- const [pageInfo, setPageInfo] = useState<{
- count: number;
- hasMore: boolean;
- pcursor?: string;
- }>({
- count: 0,
- hasMore: false,
- });
-
- async function init(accountId: number, workData: WorkData) {
- setCommentList([]);
- setPageInfo({
- count: 0,
- hasMore: false,
- });
-
- setAccountId(accountId);
- setWorkData(workData);
- await getCommentList(accountId, workData);
- setIsModalOpen(true);
- }
-
- useImperativeHandle(ref, () => ({
- init: init,
- }));
-
- function handleCancel() {
- setCommentList([]);
- setPageInfo({
- count: 0,
- hasMore: false,
- });
- setIsModalOpen(false);
- }
-
- /**
- * 获取评论列表
- */
- async function getCommentList(inAccountId: number, data: WorkData) {
- const res = await icpGetCommentList(inAccountId, data, pageInfo.pcursor);
- if (!res) return;
-
- setPageInfo(res.pageInfo);
- setCommentList([...commentList, ...res.list]);
- }
-
- /**
- * 打开评论回复
- * @param data
- */
- function openReplyComment(data: CommentData) {
- Ref_ReplyComment.current?.init(accountId, data);
- }
-
- /**
- *
- * @param param0
- * @returns
- */
- function WorkDataDom() {
- if (!workData) return <div>数据有误</div>;
-
- return (
- <Card
- style={{ width: 200 }}
- cover={<img alt="example" src={workData.coverUrl} />}
- >
- <Meta title={workData.title} />
- </Card>
- );
- }
-
- return (
- <>
- <Modal
- title="评论列表"
- open={isModalOpen}
- onCancel={handleCancel}
- footer={null}
- width={1200}
- >
- <Row>
- <Col span={6}>{WorkDataDom()}</Col>
- <Col span={18}>
- {commentList.map((item) => (
- <Card key={item.commentId} className="mb-3">
- <p>
- <Avatar src={item.headUrl} />
- {/* <p>{item.nikeName}</p> */}
- {item.content}
- &nbsp;&nbsp;
- <Tooltip title="回复">
- <MessageOutlined onClick={() => openReplyComment(item)} />
- </Tooltip>
- </p>
- <div className="ml-6">
- {item.subCommentList.map((subItem) => (
- <p key={subItem.commentId}>
- <Avatar src={subItem.headUrl} />
- &nbsp;&nbsp;
- {subItem.content}
- </p>
- ))}
- </div>
- </Card>
- ))}
-
- {commentList.length > 0 && (
- <p className="text-center">
- <Button
- type="link"
- onClick={() => getCommentList(accountId, workData!)}
- >
- 加载更多
- </Button>
- </p>
- )}
- </Col>
- </Row>
- </Modal>
-
- <ReplyComment ref={Ref_ReplyComment} />
- </>
- );
-});
-export default Com;
diff --git a/src/views/interaction/components/oneKeyReply.tsx b/src/views/interaction/components/oneKeyInteraction.tsx
similarity index 76%
rename from src/views/interaction/components/oneKeyReply.tsx
rename to src/views/interaction/components/oneKeyInteraction.tsx
index a25d3640..b8d761bf 100644
--- a/src/views/interaction/components/oneKeyReply.tsx
+++ b/src/views/interaction/components/oneKeyInteraction.tsx
@@ -3,9 +3,9 @@
* @Date: 2025-03-18 21:02:38
* @LastEditTime: 2025-03-31 11:02:12
* @LastEditors: nevin
- * @Description: 一键评论
+ * @Description: 一键互动
*/
-import { icpReplyCommentList, WorkData } from '@/icp/reply';
+import { WorkData } from '@/icp/reply';
import { message, Modal } from 'antd';
import { forwardRef, useImperativeHandle, useState } from 'react';
import { SendChannelEnum } from '@@/UtilsEnum';
@@ -13,30 +13,36 @@ import {
AutorReplyCommentScheduleEvent,
AutorReplyCommentScheduleEventTagStrMap,
} from '@@/types/reply';
+import { icpCreateInteractionOneKey } from '@/icp/replyother';
-export interface OneKeyReplyRef {
- init: (accountId: number, data: WorkData) => Promise<void>;
+export interface InteractionOneKeyRef {
+ init: (accountId: number, data: WorkData[]) => Promise<void>;
}
-const Com = forwardRef<OneKeyReplyRef>((props: any, ref) => {
+const Com = forwardRef<InteractionOneKeyRef>((props: any, ref) => {
const [isModalOpen, setIsModalOpen] = useState(false);
const [infoText, setInfoText] = useState('');
const [errorText, setErrorText] = useState('');
- const [workData, setWorkData] = useState<WorkData | null>(null);
- async function init(accountId: number, data: WorkData) {
+ const [workDataList, setWorkDataList] = useState<WorkData[]>([]);
+ async function init(accountId: number, dataList: WorkData[]) {
window.ipcRenderer.on(SendChannelEnum.CommentRelyProgress, onGetNotice);
- setWorkData(data);
+ setWorkDataList(dataList);
setIsModalOpen(true);
- replyCommentList(accountId, data);
+ createInteractionOneKey(accountId, dataList);
}
/**
- * 一键AI评论
+ * 一键互动
*/
- async function replyCommentList(inAccountId: number, inWorkData: WorkData) {
- if (!inWorkData?.dataId) return;
- const res = await icpReplyCommentList(inAccountId, inWorkData);
+ async function createInteractionOneKey(
+ inAccountId: number,
+ inWorkDataList: WorkData[] = [],
+ ) {
+ if (!inWorkDataList.length) return;
+ const res = await icpCreateInteractionOneKey(inAccountId, workDataList, {
+ commentContent: '不错啊!收藏了!',
+ });
console.log('------ res', res);
}
diff --git a/src/views/interaction/components/replyComment.tsx b/src/views/interaction/components/replyComment.tsx
deleted file mode 100644
index b10fadc9..00000000
--- a/src/views/interaction/components/replyComment.tsx
+++ /dev/null
@@ -1,123 +0,0 @@
-import { toolsApi } from '@/api/tools';
-import { CommentData, icpReplyComment } from '@/icp/reply';
-import { SendOutlined } from '@ant-design/icons';
-import { Button, Form, Input, Modal, Tooltip } from 'antd';
-import { forwardRef, useImperativeHandle, useState } from 'react';
-import logoAi from '@/assets/logoAi.png';
-
-export interface ReplyCommentRef {
- init: (accountId: number, inInfo: CommentData) => Promise<void>;
-}
-
-interface FormData {
- content: string;
-}
-
-const Com = forwardRef<ReplyCommentRef>((props: any, ref) => {
- const [isModalOpen, setIsModalOpen] = useState(false);
- const [accountId, setAccountId] = useState<number>(0);
- const [commentData, setCommentData] = useState<CommentData | null>(null);
- const [form] = Form.useForm<FormData>();
- async function init(accountId: number, inInfo: CommentData) {
- setAccountId(accountId);
- setCommentData(inInfo);
- setIsModalOpen(true);
- }
-
- useImperativeHandle(ref, () => ({
- init: init,
- }));
-
- function handleCancel() {
- setIsModalOpen(false);
- }
-
- /**
- * 回复评论
- */
- async function replyComment(content: string) {
- const res = await icpReplyComment(
- accountId,
- commentData!.commentId,
- content,
- {
- dataId: commentData!.dataId,
- comment: commentData!.data,
- },
- );
- console.log('----- res', res);
- }
-
- async function onFinish(values: FormData) {
- await replyComment(values.content);
- console.log('Success:', values);
- }
-
- async function onFinishFailed(errorInfo: any) {
- console.log('Failed:', errorInfo);
- }
-
- async function getAiContent() {
- if (!commentData?.content) return;
- const res = await toolsApi.apiReviewAiRecover({
- content: commentData?.content,
- });
-
- form.setFieldsValue({
- content: res,
- });
- }
-
- return (
- <>
- <Modal
- title={null}
- open={isModalOpen}
- onCancel={handleCancel}
- footer={null}
- width={400}
- >
- <div className="p-5">
- <Form
- form={form}
- name="basic"
- labelCol={{ span: 8 }}
- wrapperCol={{ span: 16 }}
- initialValues={{ remember: true }}
- onFinish={onFinish}
- onFinishFailed={onFinishFailed}
- autoComplete="off"
- >
- <Form.Item
- label="内容"
- name="content"
- rules={[{ required: true, message: '请输入评论!' }]}
- >
- <Input />
- </Form.Item>
-
- <p className="text-right">
- <Tooltip title="获取AI建议">
- <img
- src={logoAi}
- alt="logo"
- width={40}
- onClick={getAiContent}
- />
- </Tooltip>
-
- <Tooltip title="发送">
- <Button
- shape="circle"
- htmlType="submit"
- icon={<SendOutlined />}
- />
- </Tooltip>
- </p>
- </Form>
- </div>
- </Modal>
- </>
- );
-});
-export default Com;
diff --git a/src/views/interaction/components/replyWorks.tsx b/src/views/interaction/components/replyWorks.tsx
deleted file mode 100644
index 9c1a4625..00000000
--- a/src/views/interaction/components/replyWorks.tsx
+++ /dev/null
@@ -1,116 +0,0 @@
-import { toolsApi } from '@/api/tools';
-import { icpCreateComment, WorkData } from '@/icp/reply';
-import { Button, Form, Input, Modal, Tooltip } from 'antd';
-import { forwardRef, useImperativeHandle, useState } from 'react';
-import logoAi from '@/assets/logoAi.png';
-import { SendOutlined } from '@ant-design/icons';
-
-export interface ReplyWorksRef {
- init: (accountId: number, inWorkData: WorkData) => Promise<void>;
-}
-
-interface FormData {
- content: string;
-}
-
-const Com = forwardRef<ReplyWorksRef>((props: any, ref) => {
- const [isModalOpen, setIsModalOpen] = useState(false);
- const [accountId, setAccountId] = useState<number>(0);
- const [workData, setWorkData] = useState<WorkData | null>(null);
- const [form] = Form.useForm<FormData>();
-
- async function init(accountId: number, inWorkData: WorkData) {
- setAccountId(accountId);
- setWorkData(inWorkData);
- setIsModalOpen(true);
- }
-
- useImperativeHandle(ref, () => ({
- init: init,
- }));
-
- function handleCancel() {
- setIsModalOpen(false);
- }
-
- /**
- * 创建评论
- */
- async function createComment(content: string) {
- const res = await icpCreateComment(accountId, workData!.dataId, content);
- console.log('----- res', res);
- }
-
- async function onFinish(values: FormData) {
- createComment(values.content);
- }
-
- async function onFinishFailed(errorInfo: any) {
- console.log('Failed:', errorInfo);
- }
-
- async function getAiContent() {
- if (!workData?.coverUrl) return;
- const res = await toolsApi.apiReviewImgAi({
- imgUrl: workData?.coverUrl,
- });
-
- console.log('----- res', res);
-
- form.setFieldsValue({
- content: res,
- });
- }
-
- return (
- <>
- <Modal
- title="作品评论"
- open={isModalOpen}
- onCancel={handleCancel}
- footer={null}
- width={400}
- >
- <div className="p-5">
- <Form
- form={form}
- name="basic"
- labelCol={{ span: 8 }}
- wrapperCol={{ span: 16 }}
- initialValues={{ remember: true }}
- onFinish={onFinish}
- onFinishFailed={onFinishFailed}
- autoComplete="off"
- >
- <Form.Item
- label="评论"
- name="content"
- rules={[{ required: true, message: '请输入评论!' }]}
- >
- <Input />
- </Form.Item>
- <p className="text-right">
- <Tooltip title="获取AI建议">
- <img
- src={logoAi}
- alt="logo"
- width={40}
- onClick={getAiContent}
- />
- </Tooltip>
-
- <Tooltip title="发送">
- <Button
- shape="circle"
- htmlType="submit"
- icon={<SendOutlined />}
- />
- </Tooltip>
- </p>
- </Form>
- </div>
- </Modal>
- </>
- );
-});
-export default Com;
diff --git a/src/views/interaction/index.tsx b/src/views/interaction/index.tsx
index 01d9e493..a27ed8e0 100644
--- a/src/views/interaction/index.tsx
+++ b/src/views/interaction/index.tsx
@@ -9,16 +9,15 @@ import { WorkData } from '@/icp/reply';
import { Button, Col, Popconfirm, Row, Tabs, Tooltip } from 'antd';
import { useCallback, useRef, useState } from 'react';
import AccountSidebar from '../account/components/AccountSidebar/AccountSidebar';
-import ReplyWorks, { ReplyWorksRef } from './components/replyWorks';
-import CommentList, { CommentListRef } from './components/commentList';
import {
AliwangwangOutlined,
- CommentOutlined,
FieldTimeOutlined,
- MenuUnfoldOutlined,
QuestionCircleOutlined,
} from '@ant-design/icons';
-import OneKeyReply, { OneKeyReplyRef } from './components/oneKeyReply';
+import InteractionOneKey, {
+ InteractionOneKeyRef,
+} from './components/oneKeyInteraction';
+import { getCommentSearchNotes } from '@/icp/replyother';
export default function Page() {
const [wordList, setWordList] = useState<WorkData[]>([]);
@@ -31,31 +30,17 @@ export default function Page() {
count: 0,
hasMore: false,
});
- const Ref_ReplyWorks = useRef<ReplyWorksRef>(null);
- const Ref_CommentList = useRef<CommentListRef>(null);
- const Ref_OneKeyReply = useRef<OneKeyReplyRef>(null);
+ const Ref_InteractionOneKey = useRef<InteractionOneKeyRef>(null);
async function getCreatorList(accountId: number) {
- // const res = await getCommentSearchNotes(thisid, qe, {
- // ...pageInfo,
- // postFirstId: postFirstId,
- // });
- }
+ const res = await getCommentSearchNotes(accountId, '英雄杀道一', {
+ ...pageInfo,
+ postFirstId: '',
+ });
- /**
- * 打开作品评论
- * @param data
- */
- function openReplyWorks(data: WorkData) {
- Ref_ReplyWorks.current?.init(activeAccountId, data);
- }
+ console.log('---- res ----', res);
- /**
- * 打开评论列表
- * @param data
- */
- function openCommentList(data: WorkData) {
- Ref_CommentList.current?.init(activeAccountId, data);
+ setWordList(res.list);
}
/**
@@ -65,7 +50,7 @@ export default function Page() {
function openAddAutoRun(data: WorkData) {}
return (
- <div className={styles.account}>
+ <div>
<AccountSidebar
activeAccountId={activeAccountId}
onAccountChange={useCallback((info) => {
@@ -78,6 +63,17 @@ export default function Page() {
<div className="w-full p-4 text-gray-500">
<Tabs defaultActiveKey="1" className="w-full">
<Tabs.TabPane tab="作品列表" key="1">
+ <Popconfirm
+ title="确认进行一键互动"
+ onConfirm={(e?: React.MouseEvent<HTMLElement>) => {
+ Ref_InteractionOneKey.current?.init(activeAccountId, wordList);
+ }}
+ okText="是"
+ cancelText="否"
+ >
+ <AliwangwangOutlined />
+ </Popconfirm>
+
{activeAccountId === -1 ? (
<div className="flex items-center justify-center h-[300px]">
<Tooltip title="请先在左侧侧边栏选择账户">
@@ -107,41 +103,13 @@ export default function Page() {
<p className="mb-2">{item.title || '无标题'}</p>
<div className="w-full mt-auto">
<Row justify="space-evenly">
- <Col span={8}>
- <Tooltip title="评论列表">
- <MenuUnfoldOutlined
- onClick={() => openCommentList(item)}
- />
- </Tooltip>
- </Col>
- <Col span={8}>
- <Tooltip title="评论作品">
- <CommentOutlined
- onClick={() => openReplyWorks(item)}
- />
- </Tooltip>
- </Col>
+ <Col span={8}></Col>
+ <Col span={8}></Col>
</Row>
<Row justify="space-evenly">
<Col span={8}>
- <Tooltip title="一键评论">
- <Popconfirm
- title="确认进行一键评论"
- onConfirm={(
- e?: React.MouseEvent<HTMLElement>,
- ) => {
- Ref_OneKeyReply.current?.init(
- activeAccountId,
- item,
- );
- }}
- okText="是"
- cancelText="否"
- >
- <AliwangwangOutlined />
- </Popconfirm>
- </Tooltip>
+ <Tooltip title="一键评论"></Tooltip>
</Col>
<Col span={8}>
<Tooltip title="自动评论">
@@ -177,9 +145,7 @@ export default function Page() {
</Tabs>
</div>
- <ReplyWorks ref={Ref_ReplyWorks} />
- <CommentList ref={Ref_CommentList} />
- <OneKeyReply ref={Ref_OneKeyReply} />
+ <InteractionOneKey ref={Ref_InteractionOneKey} />
</div>
);
}
diff --git a/src/views/replyother/index.tsx b/src/views/replyother/index.tsx
index 819863cd..49d98896 100644
--- a/src/views/replyother/index.tsx
+++ b/src/views/replyother/index.tsx
@@ -1,4 +1,3 @@
-
import {
icpCreatorList,
icpGetCommentListByOther,
@@ -153,10 +152,16 @@ export default function Page() {
// 加载更多帖子
const loadMorePosts = async () => {
// console.log('------ loadMorePosts == 1');
- if (!pageInfo.hasMore || isLoadingMore || !searchKeyword || searchKeyword == '') return;
+ if (
+ !pageInfo.hasMore ||
+ isLoadingMore ||
+ !searchKeyword ||
+ searchKeyword == ''
+ )
+ return;
// console.log('------ loadMorePosts == 2');
- if(activeAccountType !== 'xhs'){
- if(!postFirstId || postFirstId == '') return;
+ if (activeAccountType !== 'xhs') {
+ if (!postFirstId || postFirstId == '') return;
}
// console.log('------ loadMorePosts == 3');
setIsLoadingMore(true);
@@ -229,23 +234,35 @@ export default function Page() {
}
// 搜索列表 - 平台自己搜索
- async function getSearchListFunc(thisid: any, qe?: any, isfirst?: boolean) {
+ async function getSearchListFunc(
+ thisid: number,
+ qe?: any,
+ isfirst?: boolean,
+ ) {
if (!pageInfo.hasMore && pageInfo.pcursor !== 1 && !isfirst) {
console.log('没有更多数据了,不再发送请求');
return;
}
-
- const res = await getCommentSearchNotes(thisid, qe, {...pageInfo, postFirstId: postFirstId});
+
+ const res = await getCommentSearchNotes(thisid, qe, {
+ ...pageInfo,
+ postFirstId: postFirstId,
+ });
console.log('------ getSearchListFunc -- @@:', res);
if (isfirst && activeAccountType == 'douyin') {
setPostFirstId(res.orgList?.log_pb?.impr_id);
- } else if (isfirst &&activeAccountType == 'KWAI') {
- console.log('------ getSearchListFunc -- @@:', res.orgList?.searchSessionId);
+ } else if (isfirst && activeAccountType == 'KWAI') {
+ console.log(
+ '------ getSearchListFunc -- @@:',
+ res.orgList?.searchSessionId,
+ );
setPostFirstId(res.orgList?.searchSessionId);
}
if (res.list?.length) {
// 如果是加载更多,则追加到现有列表
- setPostList((prev) => (pageInfo.pcursor !== 1 ? [...prev, ...res.list] : res.list));
+ setPostList((prev) =>
+ pageInfo.pcursor !== 1 ? [...prev, ...res.list] : res.list,
+ );
// 更新分页信息
setPageInfo({
@@ -255,9 +272,9 @@ export default function Page() {
});
} else {
// 如果没有返回数据,设置hasMore为false
- setPageInfo(prev => ({
+ setPageInfo((prev) => ({
...prev,
- hasMore: false
+ hasMore: false,
}));
}
}
@@ -318,7 +335,7 @@ export default function Page() {
title: data.title || '',
coverUrl: data.cover || data.coverUrl || '',
// 添加其他必要的字段
- authorId: data.author.id
+ authorId: data.author.id,
};
Ref_ReplyWorks.current?.init(activeAccountId, workData);
}
@@ -411,9 +428,15 @@ export default function Page() {
return;
}
- const res = await icpDianzanDyOther(activeAccountId, post.dataId, {authid: post.author.id});
+ 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) {
+ if (
+ res.status_code == 0 ||
+ res.data?.code == 0 ||
+ res.data?.visionVideoLike.result == 1
+ ) {
message.success('点赞成功');
// 更新点赞状态
setLikedPosts((prev) => ({
@@ -504,7 +527,7 @@ export default function Page() {
console.log('------ post.dataId', post.dataId);
url = `https://www.douyin.com/video/${post.dataId}`;
console.log('------ url 2:', url);
- } else if(activeAccountType == 'KWAI'){
+ } else if (activeAccountType == 'KWAI') {
// 快手链接格式
url = `https://www.kuaishou.com/short-video/${post.dataId}`;
} else {
@@ -537,7 +560,7 @@ export default function Page() {
hasMore: true,
pcursor: 1,
});
-
+
// 执行搜索
setTimeout(() => {
getSearchListFunc(activeAccountId, searchKeyword, true);
@@ -562,13 +585,11 @@ export default function Page() {
setActiveAccountType(info.type);
setPostList([]);
-
-
- setActiveAccountId(info.id);
- setTimeout(() => {
- getSearchListFunc(info.id, searchKeyword, true);
- }, 600);
-
+
+ setActiveAccountId(info.id);
+ setTimeout(() => {
+ getSearchListFunc(info.id, searchKeyword, true);
+ }, 600);
},
[getCreatorList],
)}
@@ -678,11 +699,7 @@ export default function Page() {
]}
>
<Card.Meta
- avatar={
- <Avatar
- src={`${item.author?.avatar}`}
- />
- }
+ avatar={<Avatar src={`${item.author?.avatar}`} />}
title={item.author?.name}
description={
<div>
@@ -701,17 +718,14 @@ export default function Page() {
</Masonry>
{/* 加载更多区域 */}
- <div
- ref={loadMoreRef}
- className={styles.loadMoreArea}
- >
+ <div ref={loadMoreRef} className={styles.loadMoreArea}>
{isLoadingMore && (
<div className={styles.loadingMore}>
<Spin size="small" />
<span style={{ marginLeft: 8 }}>加载中...</span>
</div>
)}
-
+
{!pageInfo.hasMore && postList.length > 0 && (
<div className={styles.noMoreData}>
<Divider plain>没有更多数据了</Divider>