Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat: 新增IP代理开关功能
gaoSir447fe3a31d98
diff --git a/electron/db/models/accountGroup.ts b/electron/db/models/accountGroup.tsindex 6cbf746f..8d811306 100644--- a/electron/db/models/accountGroup.ts+++ b/electron/db/models/accountGroup.ts@@ -31,4 +31,12 @@ export class AccountGroupModel extends TempModel {default: 1,})rank!: number;++ @Column({+ type: 'boolean',+ nullable: false,+ comment: '是否启用代理',+ default: true,+ })+ proxyOpen!: boolean;}diff --git a/electron/main/publish/imgText/controller.ts b/electron/main/publish/imgText/controller.tsindex 29bcf277..d0b2db05 100644--- a/electron/main/publish/imgText/controller.ts+++ b/electron/main/publish/imgText/controller.ts@@ -66,7 +66,7 @@ export class ImgTextPubController {for (let i = 0; i < accountList.length; i++) {const account = accountList[i];const group = groupModels.find((v) => v.id === account.groupId);- if (group && group.proxyIp) {+ if (group && group.proxyIp && group.proxyOpen) {imgTextModels[i].proxyIp = group.proxyIp;}}diff --git a/electron/main/publish/video/controller.ts b/electron/main/publish/video/controller.tsindex 8ac7482f..5e37bce1 100644--- a/electron/main/publish/video/controller.ts+++ b/electron/main/publish/video/controller.ts@@ -76,7 +76,7 @@ export class VideoPubController {for (let i = 0; i < accountList.length; i++) {const account = accountList[i];const group = groupModels.find((v) => v.id === account.groupId);- if (group && group.proxyIp) {+ if (group && group.proxyIp && group.proxyOpen) {videoList[i].proxyIp = group.proxyIp;}}diff --git a/src/views/account/components/AccountSidebar/ProxyManage/index.tsx b/src/views/account/components/AccountSidebar/ProxyManage/index.tsxindex 11b34d74..c636835b 100644--- a/src/views/account/components/AccountSidebar/ProxyManage/index.tsx+++ b/src/views/account/components/AccountSidebar/ProxyManage/index.tsx@@ -7,7 +7,7 @@ import {useState,} from 'react';import styles from './proxyManage.module.scss';-import { Button, Input, message, Modal, Table, TableProps } from 'antd';+import { Button, Input, message, Modal, Switch, Table, TableProps } from 'antd';import { AccountGroupItem, useAccountStore } from '@/store/account';import { useShallow } from 'zustand/react/shallow';import { SearchOutlined } from '@ant-design/icons';@@ -52,6 +52,28 @@ const ProxyManage = memo(key: 'proxy',dataIndex: 'proxyIp',},+ {+ title: '代理启用',+ width: 90,+ key: 'proxyOpen',+ dataIndex: 'proxyOpen',+ render: (_, gri) => {+ return (+ <>+ <Switch+ value={gri.proxyOpen}+ onChange={async (v) => {+ await icpEditDeleteAccountGroup({+ id: gri.id,+ proxyOpen: v,+ });+ await getAccountGroup();+ }}+ />+ </>+ );+ },+ },{title: '账号数量',key: 'accountCount',diff --git a/src/views/publish/components/PubAccountDetModule/PubAccountDetModule.tsx b/src/views/publish/components/PubAccountDetModule/PubAccountDetModule.tsxindex f20084d3..40da50c9 100644--- a/src/views/publish/components/PubAccountDetModule/PubAccountDetModule.tsx+++ b/src/views/publish/components/PubAccountDetModule/PubAccountDetModule.tsx@@ -143,9 +143,12 @@ const PubAccountDetModule = memo(if (isCheckProxy) {if (!proxyGroupSet.has(account.groupId!)) {- tasksProxyCheck.push(- retProxyCheckCore(accountGroupMap.get(account.groupId!)!),- );+ const group = accountGroupMap.get(account.groupId!)!;+ if (group.proxyOpen) {+ tasksProxyCheck.push(+ retProxyCheckCore(accountGroupMap.get(account.groupId!)!),+ );+ }proxyGroupSet.add(account.groupId!);}}