Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat(demo): 添加定时测试demo,修复添加账号switch case语法错误问题
gaoSir626164448d9a
diff --git a/.env.development b/.env.developmentindex bad81f21..f6f06c94 100644--- a/.env.development+++ b/.env.development@@ -1,5 +1,5 @@NEXT_PUBLIC_EVN=dev-# NEXT_PUBLIC_API_URL=http://localhost:7000/api/+#NEXT_PUBLIC_API_URL=http://localhost:7000/api/NEXT_PUBLIC_API_URL=https://apitest.aiearn.ai/api/\ No newline at end of filediff --git a/.idea/workspace.xml b/.idea/workspace.xmlindex a97f7c58..e24a3f92 100644--- a/.idea/workspace.xml+++ b/.idea/workspace.xml@@ -4,35 +4,35 @@<option name="autoReloadType" value="SELECTIVE" /></component><component name="ChangeListManager">- <list default="true" id="90ed3383-49aa-4e32-95a2-9f070c0da49b" name="更改" comment="fix: 修复类型错误,更改next配置">- <change afterPath="$PROJECT_DIR$/Dockerfile" afterDir="false" />- <change afterPath="$PROJECT_DIR$/deploy/docker-compose.yaml" afterDir="false" />- <change beforePath="$PROJECT_DIR$/.env.production" beforeDir="false" afterPath="$PROJECT_DIR$/.env.production" afterDir="false" />+ <list default="true" id="90ed3383-49aa-4e32-95a2-9f070c0da49b" name="更改" comment="feat(demo): 添加定时任务测试">+ <change afterPath="$PROJECT_DIR$/src/app/[lng]/demo/pubDemo/page.tsx" afterDir="false" />+ <change beforePath="$PROJECT_DIR$/.env.development" beforeDir="false" afterPath="$PROJECT_DIR$/.env.development" afterDir="false" /><change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />- <change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />- <change beforePath="$PROJECT_DIR$/src/middleware.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/middleware.ts" afterDir="false" />+ <change beforePath="$PROJECT_DIR$/src/api/publish.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/api/publish.ts" afterDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/AddAccountModal/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/AddAccountModal/index.tsx" afterDir="false" />+ <change beforePath="$PROJECT_DIR$/src/app/[lng]/demo/demoPublish.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/demo/demoPublish.tsx" afterDir="false" /></list><option name="SHOW_DIALOG" value="false" /><option name="HIGHLIGHT_CONFLICTS" value="true" /><option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /><option name="LAST_RESOLUTION" value="IGNORE" /></component>- <component name="ChangesViewManager">- <option name="groupingKeys">- <option value="directory" />- </option>- </component><component name="FileTemplateManagerImpl"><option name="RECENT_TEMPLATES"><list>- <option value="tsx组件模板" /><option value="TypeScript File" />+ <option value="tsx组件模板" /><option value="TypeScript JSX File" /></list></option></component><component name="Git.Settings"><option name="PUSH_AUTO_UPDATE" value="true" />+ <option name="RECENT_BRANCH_BY_REPOSITORY">+ <map>+ <entry key="$PROJECT_DIR$" value="test" />+ </map>+ </option><option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /></component><component name="ProblemsViewState">@@ -50,27 +50,27 @@<option name="hideEmptyMiddlePackages" value="true" /><option name="showLibraryContents" value="true" /></component>- <component name="PropertiesComponent"><![CDATA[{- "keyToString": {- "ASKED_ADD_EXTERNAL_FILES": "true",- "ASKED_MARK_IGNORED_FILES_AS_EXCLUDED": "true",- "ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",- "RunOnceActivity.ShowReadmeOnStart": "true",- "SHARE_PROJECT_CONFIGURATION_FILES": "true",- "git-widget-placeholder": "master",- "ignore.virus.scanning.warn.message": "true",- "last_opened_file_path": "E:/project-dev/web/艺咖/aitoearn-web",- "node.js.detected.package.eslint": "true",- "node.js.detected.package.tslint": "true",- "node.js.selected.package.eslint": "(autodetect)",- "node.js.selected.package.tslint": "(autodetect)",- "nodejs_package_manager_path": "npm",- "run.code.analysis.last.selected.profile": "pProject Default",- "settings.editor.selected.configurable": "editor.reader.mode",- "ts.external.directory.path": "E:\\project-dev\\web\\艺咖\\aitoearn-web\\node_modules\\typescript\\lib",- "vue.rearranger.settings.migration": "true"+ <component name="PropertiesComponent">{+ "keyToString": {+ "ASKED_ADD_EXTERNAL_FILES": "true",+ "ASKED_MARK_IGNORED_FILES_AS_EXCLUDED": "true",+ "ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",+ "RunOnceActivity.ShowReadmeOnStart": "true",+ "SHARE_PROJECT_CONFIGURATION_FILES": "true",+ "git-widget-placeholder": "master",+ "ignore.virus.scanning.warn.message": "true",+ "last_opened_file_path": "E:/project-dev/web/艺咖/aitoearn-web",+ "node.js.detected.package.eslint": "true",+ "node.js.detected.package.tslint": "true",+ "node.js.selected.package.eslint": "(autodetect)",+ "node.js.selected.package.tslint": "(autodetect)",+ "nodejs_package_manager_path": "npm",+ "run.code.analysis.last.selected.profile": "pProject Default",+ "settings.editor.selected.configurable": "editor.reader.mode",+ "ts.external.directory.path": "E:\\project-dev\\web\\艺咖\\aitoearn-web\\node_modules\\typescript\\lib",+ "vue.rearranger.settings.migration": "true"}-}]]></component>+}</component><component name="ReactBuddySettings"><option name="extensionsIgnore" value="true" /></component>@@ -126,6 +126,7 @@<workItem from="1751278214456" duration="955000" /><workItem from="1751334170049" duration="2844000" /><workItem from="1751351785412" duration="26981000" />+ <workItem from="1751624107936" duration="2913000" /></task><task id="LOCAL-00001" summary="feat: 日历完善"><option name="closed" value="true" />@@ -322,7 +323,19 @@<map><entry key="MAIN"><value>- <State />+ <State>+ <option name="FILTERS">+ <map>+ <entry key="branch">+ <value>+ <list>+ <option value="master" />+ </list>+ </value>+ </entry>+ </map>+ </option>+ </State></value></entry></map>diff --git a/src/api/publish.ts b/src/api/publish.tsindex dca72124..c00cc9d1 100644--- a/src/api/publish.ts+++ b/src/api/publish.ts@@ -25,12 +25,10 @@ export interface PublishParams {desc?: string;accountId: string;accountType: AccountType;- uid: string;videoUrl?: string;coverUrl?: string;imgList?: string[];publishTime?: string;- status?: PubStatus;option?: any;}@@ -65,7 +63,7 @@ export const apiGetPublishList = (// 创建发布export const apiCreatePublish = (data: PublishParams) => {return request({- url: "/publish",+ url: "/plat/publish/create",method: "POST",data,});diff --git a/src/app/[lng]/accounts/components/AddAccountModal/index.tsx b/src/app/[lng]/accounts/components/AddAccountModal/index.tsxindex 156bdfd9..4286b712 100644--- a/src/app/[lng]/accounts/components/AddAccountModal/index.tsx+++ b/src/app/[lng]/accounts/components/AddAccountModal/index.tsx@@ -52,17 +52,17 @@ const AddAccountModal = memo(onClick={async () => {switch (key) {case PlatType.KWAI:- kwaiSkip(key);-+ await kwaiSkip(key);+ break;case PlatType.BILIBILI:- bilibiliSkip(key);-- case PlatType.YouTube:- console.log('key',key)- youtubeSkip(key);-+ await bilibiliSkip(key);+ break;+ case PlatType.YouTube:+ await youtubeSkip(key);+ break;case PlatType.Twitter:- twitterSkip(key);+ await twitterSkip(key);+ break;}}}>diff --git a/src/app/[lng]/demo/demoPublish.tsx b/src/app/[lng]/demo/demoPublish.tsxindex d92d98e4..36184590 100644--- a/src/app/[lng]/demo/demoPublish.tsx+++ b/src/app/[lng]/demo/demoPublish.tsx@@ -1,43 +1,43 @@"use client";-import { useTransClient } from "@/app/i18n/client";-import { useEffect, useState } from "react";import {AccountType,apiCreatePublish,apiGetPublishList,- PubStatus,} from "@/api/publish";import { PubType } from "@/app/config/publishConfig";-// import Page from "../pubRecord/page";+import dayjs from "dayjs";+import utc from "dayjs/plugin/utc";+// import timezone from "dayjs/plugin/timezone";-export const DemoPublish = () => {- const { t } = useTransClient("demo");-- useEffect(() => {- //- }, []);+dayjs.extend(utc);+// dayjs.extend(timezone);+export const DemoPublish = () => {const createPublish = async () => {+ const publishTime = dayjs().add(31, "minute").utc().format();try {const res: any = await apiCreatePublish({- flowId: "flowIdxxx",+ flowId: "cd296d3bda0f465f977b1cbf200e21d6",type: PubType.VIDEO,title: "测试视频标题",desc: "测试视频描述",- accountId: "111",- uid: "uid",- accountType: AccountType.KWAI,- videoUrl: "videoUrl",- coverUrl: "coverUrl",- imgList: ["imgList1", "imgList2"],- publishTime: new Date().toDateString(),- status: PubStatus.RELEASED,+ accountId: "685a8d466d33f16378b7bdfe",+ accountType: AccountType.BILIBILI,+ videoUrl:+ "https://v2.kwaicdn.com/ksc2/d2q1A45M3Dq7tzU1oxY-1trkIMKvM7_7SzRHFhPWMyv8MatfnrAhssXlVmWRVcok-zzQmyooCLGO_K-UXLRx547rxh4VnQ1uMCK4ljl6h8IANtgbCDdDnMvk7amRiyvfADYxi0GedqjHF8kF4iUDMjSl3kJTWbtbbjn8F-AK8UWG66m0W4rFjuSig1px-gxC.mp4?pkey=AAU8pxO15eRlb-oUBHkLPbqgb41b-i13g7MJXM_rILMMpOH-W8mR0-_V5teAff_N6MmFZN6abZXieAoDuAVUaWMDd1YGZCfB3B7qIv2MBHqsEPQC3-SRIQ5T8PTEKWP2a8c&tag=1-1751611371-unknown-0-csnzcnrvrd-0ae9c87425d902fe&clientCacheKey=3xnhic5vb7mq3n9_b.mp4&di=dfa08251&bp=14944&kwai-not-alloc=28&tt=b&ss=vpm",+ coverUrl: "https://education.yikart.cn/images/swiper/swiper1.png",+ // imgList: ["imgList1", "imgList2"],+ publishTime,option: {isAutoPublish: true,isAutoDelete: true,isAutoCover: true,isAutoImg: true,+ bilibili: {+ tid: 21,+ copyright: 1,+ },},});if (res?.data?.data) {@@ -66,8 +66,8 @@ export const DemoPublish = () => {<button onClick={createPublish}>创建记录</button><button onClick={getPublishList}>获取记录列表</button></div>-- <div style={{ marginTop: '20px' }}>++ <div style={{ marginTop: "20px" }}><h3>发布记录列表组件测试:</h3>{/* <Pageheight="400px"diff --git a/src/app/[lng]/demo/pubDemo/page.tsx b/src/app/[lng]/demo/pubDemo/page.tsxnew file mode 100644index 00000000..b3e4988c--- /dev/null+++ b/src/app/[lng]/demo/pubDemo/page.tsx@@ -0,0 +1,5 @@+import { DemoPublish } from "@/app/[lng]/demo/demoPublish";++export default function Page() {+ return <DemoPublish />;+}