Skip to content

Let's use AI to Earn!

feat: 快手参数处理

gaoSir6afe06ddb09c
diff --git a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx b/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx
index cfe25113..f996da5f 100644
--- a/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx
+++ b/src/app/[lng]/publish/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx
@@ -43,7 +43,6 @@ import usePubParamsVerify, {
import { IVideoFile } from "@/app/[lng]/publish/components/Choose/VideoChoose";
import { useRouter } from "next/navigation";
import { useSystemStore } from "@/store/system";
-import { signInApi } from "@/api/signIn";
import { generateUUID } from "@/utils";
import { PubStatus } from "@/app/config/publishConfig";
import { platManage } from "@/app/plat/PlatManage";
@@ -149,6 +148,7 @@ const VideoPubSetModal = memo(
},
},
);
+ const recordId = useRef("");
useEffect(() => {
if (!currChooseAccountId)
@@ -157,13 +157,11 @@ const VideoPubSetModal = memo(
// 发布进度获取
const pubProgressData = useMemo(() => {
- // TODO 发布进度处理
- // return (
- // (noticeMap.get(NoticeType.PubNotice) || []).find(
- // (v) => v.id === recordId.current,
- // )?.pub?.progressList || []
- // );
- return [];
+ return (
+ (noticeMap.get(NoticeType.PubNotice) || []).find(
+ (v) => v.id === recordId.current,
+ )?.pub?.progressList || []
+ );
}, [noticeMap]);
// 当前选择的账户数据
@@ -177,7 +175,8 @@ const VideoPubSetModal = memo(
}, [currChooseAccount, videoListChoose]);
const pubCore = async () => {
- setLoading(false);
+ setLoading(true);
+ setPubProgressModuleOpen(true);
// await signInApi.createSignInRecord();
const err = () => {
@@ -186,6 +185,7 @@ const VideoPubSetModal = memo(
};
const operateId = generateUUID();
+ recordId.current = operateId;
// 发布记录通知消息初始化
const initialNotice: NoticeItem = {
title:
diff --git a/src/app/plat/PlatManage.ts b/src/app/plat/PlatManage.ts
index a3422130..715a2046 100644
--- a/src/app/plat/PlatManage.ts
+++ b/src/app/plat/PlatManage.ts
@@ -7,6 +7,7 @@ import {
PublishVideoParams,
} from "@/app/plat/plat.type";
import { useBellMessageStroe } from "@/store/bellMessageStroe";
+import { parseTopicString } from "@/utils";
class PlatManage {
private getPlat(type: PlatType, params: IPlatConstrParams): PlatBase {
@@ -28,6 +29,15 @@ class PlatManage {
): Promise<IPublishResult[]> {
const task: Promise<IPublishResult>[] = [];
for (const pub of pubArr) {
+ const { topics, cleanedString } = parseTopicString(
+ pub.videoPubParams.describe || "",
+ );
+ pub.videoPubParams = {
+ ...pub.videoPubParams,
+ describe: cleanedString,
+ topics,
+ };
+
task.push(
this.getPlat(pub.account.type, {
access_token: pub.access_token,
diff --git a/src/app/plat/platChildren/kwai/KwaiPubCore.ts b/src/app/plat/platChildren/kwai/KwaiPubCore.ts
index 815c3a6d..c3f99b07 100644
--- a/src/app/plat/platChildren/kwai/KwaiPubCore.ts
+++ b/src/app/plat/platChildren/kwai/KwaiPubCore.ts
@@ -24,6 +24,27 @@ export class KwaiPubCore {
this.onProgress = onProgress;
}
+ // 获取caption
+ getCaption() {
+ const { title, describe, topics } = this.videoPubParams;
+ let caption = "";
+ if (title) {
+ caption += `${title} `;
+ }
+
+ if (describe) {
+ caption += `${describe} `;
+ }
+
+ if (topics?.length !== 0) {
+ for (const topic of topics!) {
+ caption += `#${topic} `;
+ }
+ }
+
+ return caption.trim();
+ }
+
// 视频发布
async publishVideo(): Promise<IPublishResult> {
try {
@@ -91,7 +112,7 @@ export class KwaiPubCore {
console.log("分片上传完成:", completeRes);
const formData = new FormData();
- formData.append("caption", " #分享转发 标题1 #推广昨品 ");
+ formData.append("caption", this.getCaption());
formData.append("cover", this.videoPubParams.cover!.file);
const pubRes = await this.kwaiPlat.request({
url: "/openapi/photo/publish",