Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat: 热门内容添加微信公众号跳转到作品
gaoSir717a1af90402
diff --git a/src/api/hot.ts b/src/api/hot.tsindex ebf111bb..ad59578c 100644--- a/src/api/hot.ts+++ b/src/api/hot.ts@@ -96,6 +96,7 @@ export interface RankingContent {title: string;cover: string;url: string;+ photoId: string;rankingPosition: number;category: string;publishTime: string;@@ -398,4 +399,16 @@ export const platformApi = {},});},++ // 获取热点数据 公众号 链接+ getDetailUrl(photoId: string) {+ return request<string>({+ url: `hotdata/contents/query/getDetailUrl`,+ method: "POST",+ data: {+ platform: 0,+ photoId,+ },+ });+ },};diff --git a/src/app/[lng]/hotContent/components/HotContent/index.tsx b/src/app/[lng]/hotContent/components/HotContent/index.tsxindex c9863967..91360c92 100644--- a/src/app/[lng]/hotContent/components/HotContent/index.tsx+++ b/src/app/[lng]/hotContent/components/HotContent/index.tsx@@ -30,6 +30,7 @@ import {SingleNumberCall,} from "@/app/[lng]/hotContent/components/HotContent/hotContentCommonWidget";import { useTransClient } from "@/app/i18n/client";+import CryptoJS from "crypto-js";export interface IHotContentRef {}@@ -481,22 +482,32 @@ const HotContent = memo(pagination={false}onRow={(record) => {return {- onClick: () => {- // if (- // selectedLabelInfo.ranking.platform.type === "wechat"- // ) {- // const key = CryptoJS.enc.Utf8.parse("cdxbxhs147258369");- // const encrypted =- // "nOCQhzI/tHoSX6D36s0FkrfZUpyb6py4r4Axw4VZ76RwVzM3CIGn1WXurT8Lp2hIgQ5XCu+1FOb1YqgZE+UAaarktdb4TU/VkBJToEGA38e25dtieTQOZioVDgfPxkpBhKVEhPrljOvFCHWBR0fEsw==";- //- // const decrypted = CryptoJS.AES.decrypt(encrypted, key, {- // mode: CryptoJS.mode.ECB,- // padding: CryptoJS.pad.Pkcs7,- // });- // const result = CryptoJS.enc.Utf8.stringify(decrypted);- // window.open(record.url, "_blank");- // return;- // }+ onClick: async () => {+ if (+ selectedLabelInfo.ranking.platform.type === "wechat"+ ) {+ setLoading(true);+ const res = await platformApi.getDetailUrl(+ record.photoId,+ );+ setLoading(false);++ const key =+ CryptoJS.enc.Utf8.parse("cdxbxhs147258369");+ const encrypted = res?.data ?? "";++ const decrypted = CryptoJS.AES.decrypt(+ encrypted,+ key,+ {+ mode: CryptoJS.mode.ECB,+ padding: CryptoJS.pad.Pkcs7,+ },+ );+ const result = CryptoJS.enc.Utf8.stringify(decrypted);+ window.open(result, "_blank");+ return;+ }if (!record.url) return;window.open(record.url, "_blank");