Skip to content

Let's use AI to Earn!

feat: 更改评论列表的传参

牛文政be74321b3dac
diff --git a/electron/main/plat/index.ts b/electron/main/plat/index.ts
index 01e47423..822c21a8 100644
--- a/electron/main/plat/index.ts
+++ b/electron/main/plat/index.ts
@@ -15,6 +15,7 @@ import {
IAccountInfoParams,
IGetLocationDataParams,
IGetUsersParams,
+ WorkData,
} from './plat.type';
import { PublishVideoResult } from './module';
import { VideoModel } from '../../db/models/video';
@@ -209,35 +210,31 @@ class PlatController {
/**
* 获取评论列表
* @param account
- * @param dataId
+ * @param data
* @param pcursor
*/
public async getCommentList(
account: AccountModel,
- dataId: string,
+ data: WorkData,
pcursor?: string,
) {
const platform = this.platforms.get(account.type)!;
- return await platform.getCommentList(account, dataId, pcursor);
+ return await platform.getCommentList(account, data, pcursor);
}
/**
* 获取评论列表
* @param account
- * @param dataId
+ * @param data
* @param pcursor
*/
public async getCreatorCommentListByOther(
account: AccountModel,
- dataId: string,
+ data: WorkData,
pcursor?: string,
) {
const platform = this.platforms.get(account.type)!;
- return await platform.getCreatorCommentListByOther(
- account,
- dataId,
- pcursor,
- );
+ return await platform.getCreatorCommentListByOther(account, data, pcursor);
}
/**
@@ -248,14 +245,14 @@ class PlatController {
*/
public async getCreatorSecondCommentListByOther(
account: AccountModel,
- dataId: string,
+ data: WorkData,
root_comment_id: string,
pcursor?: string,
) {
const platform = this.platforms.get(account.type)!;
return await platform.getCreatorSecondCommentListByOther(
account,
- dataId,
+ data,
root_comment_id,
pcursor,
);
diff --git a/electron/main/reply/controller.ts b/electron/main/reply/controller.ts
index 6fd530f4..879e907c 100644
--- a/electron/main/reply/controller.ts
+++ b/electron/main/reply/controller.ts
@@ -14,6 +14,7 @@ import platController from '../plat';
import { ReplyService } from './service';
import { SendChannelEnum } from '../../../commont/UtilsEnum';
import { AutorReplyCommentScheduleEvent } from '../../../commont/types/reply';
+import type { WorkData } from '../plat/plat.type';
@Controller()
export class ReplyController {
@@ -99,13 +100,13 @@ export class ReplyController {
async getCommentList(
event: Electron.IpcMainInvokeEvent,
accountId: number,
- dataId: string,
+ data: WorkData,
pcursor?: string,
): Promise<any> {
const account = await this.accountService.getAccountById(accountId);
if (!account) return null;
- const res = await platController.getCommentList(account, dataId, pcursor);
+ const res = await platController.getCommentList(account, data, pcursor);
return res;
}
@@ -116,7 +117,7 @@ export class ReplyController {
async getCommentListByOther(
event: Electron.IpcMainInvokeEvent,
accountId: number,
- dataId: string,
+ data: WorkData,
pcursor?: string,
): Promise<any> {
const account = await this.accountService.getAccountById(accountId);
@@ -124,7 +125,7 @@ export class ReplyController {
const res = await platController.getCreatorCommentListByOther(
account,
- dataId,
+ data,
pcursor,
);
return res;
@@ -137,7 +138,7 @@ export class ReplyController {
async getSecondCommentListByOther(
event: Electron.IpcMainInvokeEvent,
accountId: number,
- dataId: string,
+ data: WorkData,
root_comment_id: string,
pcursor?: string,
): Promise<any> {
@@ -146,7 +147,7 @@ export class ReplyController {
const res = await platController.getCreatorSecondCommentListByOther(
account,
- dataId,
+ data,
root_comment_id,
pcursor,
);
diff --git a/src/icp/reply.ts b/src/icp/reply.ts
index a2c2f5d1..0d0cdbd9 100644
--- a/src/icp/reply.ts
+++ b/src/icp/reply.ts
@@ -17,6 +17,9 @@ export type WorkData = {
desc?: string;
coverUrl?: string;
videoUrl?: string;
+ option?: {
+ xsec_token: string;
+ };
};
export type CommentData = {
@@ -51,7 +54,7 @@ export async function icpCreatorList(accountId: number, pcursor?: string) {
*/
export async function icpGetCommentList(
accountId: number,
- dataId: string,
+ data: WorkData,
pcursor?: string,
) {
const res: {
@@ -64,7 +67,7 @@ export async function icpGetCommentList(
} = await window.ipcRenderer.invoke(
'ICP_COMMENT_LIST',
accountId,
- dataId,
+ data,
pcursor,
);
return res;
diff --git a/src/icp/replyother.ts b/src/icp/replyother.ts
index f677f7e4..966b1fca 100644
--- a/src/icp/replyother.ts
+++ b/src/icp/replyother.ts
@@ -17,6 +17,9 @@ export type WorkData = {
desc?: string;
coverUrl?: string;
videoUrl?: string;
+ option?: {
+ xsec_token: string;
+ };
};
export type CommentData = {
@@ -81,7 +84,7 @@ export async function icpCreatorList(accountId: number, pcursor?: string) {
*/
export async function icpGetCommentListByOther(
accountId: number,
- dataId: string,
+ data: WorkData,
pcursor?: string,
) {
const res: {
@@ -94,7 +97,7 @@ export async function icpGetCommentListByOther(
} = await window.ipcRenderer.invoke(
'ICP_COMMENT_LIST_BY_OTHER',
accountId,
- dataId,
+ data,
pcursor,
);
return res;
@@ -105,14 +108,14 @@ export async function icpGetCommentListByOther(
*/
export async function icpGetSecondCommentListByOther(
accountId: number,
- dataId: string,
+ data: WorkData,
root_comment_id: string,
pcursor?: string,
) {
const res: any = await window.ipcRenderer.invoke(
'ICP_SECOND_COMMENT_LIST_BY_OTHER',
accountId,
- dataId,
+ data,
root_comment_id,
pcursor,
);
diff --git a/src/views/reply/components/commentList.tsx b/src/views/reply/components/commentList.tsx
index 9f0f0503..20e5e125 100644
--- a/src/views/reply/components/commentList.tsx
+++ b/src/views/reply/components/commentList.tsx
@@ -36,7 +36,7 @@ const Com = forwardRef<CommentListRef>((props: any, ref) => {
setAccountId(accountId);
setWorkData(workData);
setIsModalOpen(true);
- await getCommentList(workData.dataId);
+ await getCommentList(workData);
}
useImperativeHandle(ref, () => ({
@@ -50,8 +50,8 @@ const Com = forwardRef<CommentListRef>((props: any, ref) => {
/**
* 获取评论列表
*/
- async function getCommentList(dataId: string) {
- const res = await icpGetCommentList(accountId, dataId, pageInfo.pcursor);
+ async function getCommentList(data: WorkData) {
+ const res = await icpGetCommentList(accountId, data, pageInfo.pcursor);
if (!res) return;
setPageInfo(res.pageInfo);
@@ -121,10 +121,7 @@ const Com = forwardRef<CommentListRef>((props: any, ref) => {
{commentList.length > 0 && (
<p>
- <Button
- type="link"
- onClick={() => getCommentList(workData!.dataId)}
- >
+ <Button type="link" onClick={() => getCommentList(workData!)}>
加载更多
</Button>
</p>
diff --git a/src/views/replyother/index.tsx b/src/views/replyother/index.tsx
index 5d5cc39f..4d33cff8 100644
--- a/src/views/replyother/index.tsx
+++ b/src/views/replyother/index.tsx
@@ -68,7 +68,12 @@ export default function Page() {
const res = await icpGetCommentListByOther(
activeAccountId,
// '7480598266392972596',
- '67dfda09000000000903912c',
+ {
+ dataId: '67dfda09000000000903912c',
+ option: {
+ xsec_token: '111',
+ },
+ },
);
console.log('------ icpGetCommentList', res);
@@ -82,7 +87,7 @@ export default function Page() {
const res = await icpGetSecondCommentListByOther(
activeAccountId,
// '7480598266392972596',
- item.dataId,
+ item,
item.data.id,
item.data.sub_comment_cursor,
);
@@ -293,7 +298,7 @@ export default function Page() {
]}
>
{item.content}
- {item.subCommentList.map((subItem) => (
+ {item.subCommentList.map((subItem: any) => (
<div key={subItem.commentId}>
{subItem.content}
<Meta