Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat: 发布记录状态添加、发布记录发布时间格式错误修改完成。
gaoSir5119d08c864a
diff --git a/electron/db/models/pubRecord.ts b/electron/db/models/pubRecord.tsindex ea3a0584..9121559c 100644--- a/electron/db/models/pubRecord.ts+++ b/electron/db/models/pubRecord.ts@@ -13,6 +13,7 @@ export enum PubStatus {UNPUBLISH = 0, // 未发布/草稿RELEASED = 1, // 已发布FAIL = 2, // 发布失败+ PartSuccess = 3, // 部分成功}@Entity({ name: 'pubRecord' })export class PubRecordModel extends TempModel {diff --git a/electron/db/models/workData.ts b/electron/db/models/workData.tsindex 38f2ae02..6d4cd36c 100644--- a/electron/db/models/workData.ts+++ b/electron/db/models/workData.ts@@ -43,7 +43,7 @@ export class WorkData extends TempModel {@Column({type: 'tinyint',nullable: false,- comment: '状态 0 未发布/草稿 1 已发布 2=发布失败',+ comment: '状态 0 未发布/草稿 1 已发布 2=发布失败 3=部分成功',enum: PubStatus,default: PubStatus.UNPUBLISH,})diff --git a/electron/main/publish/video/controller.ts b/electron/main/publish/video/controller.tsindex c930bab5..bf056b1f 100644--- a/electron/main/publish/video/controller.ts+++ b/electron/main/publish/video/controller.ts@@ -85,10 +85,19 @@ export class VideoPubController {);// 发布const pubRes = await platController.videoPublish(videoList, accountList);++ let successCount = 0;+ pubRes.map((v) => {+ if (v.code === 1) successCount++;+ });// 更改记录状态await this.publishService.updatePubRecordStatus(pubRecordId,- PubStatus.RELEASED,+ successCount === 0+ ? PubStatus.FAIL+ : successCount === pubRes.length+ ? PubStatus.RELEASED+ : PubStatus.PartSuccess,);return pubRes;}diff --git a/src/index.css b/src/index.cssindex 6dd9d732..bfd9ec78 100644--- a/src/index.css+++ b/src/index.css@@ -18,6 +18,10 @@ html, body, #root {}}+.ant-drawer-header {+ -webkit-app-region: no-drag;+}+:root {font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;line-height: 1.5;diff --git a/src/utils/index.ts b/src/utils/index.tsindex 1f394b3f..daffebad 100644--- a/src/utils/index.ts+++ b/src/utils/index.ts@@ -20,8 +20,9 @@ export function getFilePathName(path: string) {// 格式化时间export function formatTime(time: string | number | Date,- format: string = 'YYYY-MM-DD HH:MM:SS',+ format: string = 'YYYY-MM-DD HH:mm:ss',) {+ console.log(time);return dayjs(time).format(format);}diff --git a/src/views/publish/children/pubRecord/page.tsx b/src/views/publish/children/pubRecord/page.tsxindex 76c2edbc..d7fa1a45 100644--- a/src/views/publish/children/pubRecord/page.tsx+++ b/src/views/publish/children/pubRecord/page.tsx@@ -10,6 +10,7 @@ import {Spin,Table,TableProps,+ Tag,Tooltip,} from 'antd';import { getImgFile, IImgFile } from '@/components/Choose/ImgChoose';@@ -94,6 +95,22 @@ export default function Page() {render: (text, prm) => formatTime(prm.publishTime),width: 200,},+ {+ title: '状态',+ dataIndex: 'status',+ key: 'status',+ render: (text, prm) => {+ switch (prm.status) {+ case 2:+ return <Tag color="error">全部发布失败</Tag>;+ case 1:+ return <Tag color="success">全部发布成功</Tag>;+ case 3:+ return <Tag color="warning">部分发布成功</Tag>;+ }+ },+ width: 100,+ },{title: '操作',width: 100,diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsxindex 75c053e4..c5aaa147 100644--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx@@ -214,7 +214,7 @@ const VideoPubSetModal = memo(setLoading(false);close();setPubProgressModuleOpen(false);- usePubStroe().clearVideoPubSaveData();+ usePubStroe.getState().clearVideoPubSaveData();// 成功数据const successList = okRes.filter((v) => v.code === 1);diff --git a/src/views/publish/children/videoPage/page.tsx b/src/views/publish/children/videoPage/page.tsxindex 8580687d..c368038e 100644--- a/src/views/publish/children/videoPage/page.tsx+++ b/src/views/publish/children/videoPage/page.tsx@@ -208,8 +208,8 @@ export default function Page() {title="温馨提示"description="是否确认清空内容和账号?"onConfirm={() => {- usePubStroe.getState().clearVideoPubSaveData();clear();+ usePubStroe.getState().clearVideoPubSaveData();}}okText="确认"cancelText="取消"