Skip to content

Let's use AI to Earn!

feat: 发布记录

Nevin7591ac9c471e
diff --git a/src/api/publish.ts b/src/api/publish.ts
index baab682c..dca72124 100644
--- a/src/api/publish.ts
+++ b/src/api/publish.ts
@@ -44,18 +44,21 @@ export interface PublishListResponse {
}
// 获取发布列表
-export const apiGetPublishList = (pageNo: number, pageSize: number) => {
+export const apiGetPublishList = (
+ pageNo: number,
+ pageSize: number,
+ filter: {
+ readonly accountId?: string;
+ readonly accountType?: AccountType;
+ readonly type?: PubType;
+ readonly status?: PubStatus;
+ readonly time?: [Date, Date];
+ },
+) => {
return request<PublishListResponse>({
url: `/publish/list/${pageNo}/${pageSize}`,
method: "GET",
- });
-};
-
-// 获取草稿箱列表
-export const apiGetDraftsList = (pageNo: number, pageSize: number) => {
- return request<PublishListResponse>({
- url: `/publish/drafts/list/${pageNo}/${pageSize}`,
- method: "GET",
+ params: filter,
});
};
diff --git a/src/app/[lng]/demo/demoPublish.tsx b/src/app/[lng]/demo/demoPublish.tsx
index bb7da207..6271e2cd 100644
--- a/src/app/[lng]/demo/demoPublish.tsx
+++ b/src/app/[lng]/demo/demoPublish.tsx
@@ -2,7 +2,12 @@
import { useTransClient } from "@/app/i18n/client";
import { useEffect, useState } from "react";
-import { AccountType, apiCreatePublish, PubStatus } from "@/api/publish";
+import {
+ AccountType,
+ apiCreatePublish,
+ apiGetPublishList,
+ PubStatus,
+} from "@/api/publish";
import { PubType } from "@/app/config/publishConfig";
export const DemoPublish = () => {
@@ -25,7 +30,7 @@ export const DemoPublish = () => {
videoUrl: "videoUrl",
coverUrl: "coverUrl",
imgList: ["imgList1", "imgList2"],
- publishTime: (new Date()).toDateString(),
+ publishTime: new Date().toDateString(),
status: PubStatus.RELEASED,
option: {
isAutoPublish: true,
@@ -42,11 +47,23 @@ export const DemoPublish = () => {
}
};
+ const getPublishList = async () => {
+ try {
+ const res: any = await apiGetPublishList(1, 10);
+ if (res?.data?.data) {
+ console.log("获取记录列表成功:", res.data.data);
+ }
+ } catch (error) {
+ console.error("获取记录列表失败:", error);
+ }
+ };
+
return (
<div>
<div>========= 发布记录 ==============</div>
<div>
<button onClick={createPublish}>创建记录</button>
+ <button onClick={getPublishList}>获取记录列表</button>
</div>
</div>
);