Skip to content

Let's use AI to Earn!

feat: refactor 【AccountType】 更名 【PlatType】

gaoSir5e25b40074a0
diff --git a/commont/AccountEnum.ts b/commont/AccountEnum.ts
index c34504bc..74520dc6 100644
--- a/commont/AccountEnum.ts
+++ b/commont/AccountEnum.ts
@@ -1,5 +1,5 @@
// 平台类型
-export enum AccountType {
+export enum PlatType {
Douyin = 'douyin', // 抖音
Xhs = 'xhs', // 小红书
WxSph = 'wxSph', // 微信视频号
diff --git a/commont/types/task.ts b/commont/types/task.ts
index 2909987e..0c0dea2e 100644
--- a/commont/types/task.ts
+++ b/commont/types/task.ts
@@ -5,7 +5,7 @@
* @LastEditors: nevin
* @Description: 任务
*/
-import { AccountType } from '../AccountEnum';
+import { PlatType } from '../AccountEnum';
import { TimeTemp } from './apiServer';
export enum TaskType {
@@ -56,7 +56,7 @@ export interface TaskProduct extends TaskData {
}
export interface TaskInteraction extends TaskData {
- accountType: AccountType; // 平台类型
+ accountType: PlatType; // 平台类型
worksId: string; // 作品ID
authorId?: string; // 作者ID
commentContent?: string; // 评论内容,不填则使用AI
@@ -85,7 +85,7 @@ export interface Task<T extends TaskDataInfo> extends TimeTemp {
firstTimeBonus: number; // 首次任务奖励
reward: number; // 任务奖励金额
status: TaskStatus; // 'active' | 'completed' | 'cancelled'
- accountTypes: AccountType[];
+ accountTypes: PlatType[];
isAccepted?: boolean; // 是否已经接受任务
requirement?: string;
}
diff --git a/electron/db/models/account.ts b/electron/db/models/account.ts
index 84add540..ef6cf318 100644
--- a/electron/db/models/account.ts
+++ b/electron/db/models/account.ts
@@ -7,7 +7,7 @@
*/
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
import { TempModel } from './temp';
-import {AccountStatus, AccountType, XhsAccountAbnormal} from '../../../commont/AccountEnum';
+import {AccountStatus, PlatType, XhsAccountAbnormal} from '../../../commont/AccountEnum';
@Entity({ name: 'account' })
export class AccountModel extends TempModel {
@@ -19,11 +19,11 @@ export class AccountModel extends TempModel {
@Column({
type: 'varchar',
- enum: AccountType,
+ enum: PlatType,
nullable: true,
comment: '平台类型',
})
- type!: AccountType;
+ type!: PlatType;
@Column({ type: 'varchar', nullable: false, comment: '登录cookie' })
loginCookie!: string;
@@ -96,7 +96,7 @@ export class AccountModel extends TempModel {
// 账号异常状态,异常状态无法发视频
@Column({ type: 'json', nullable: true })
abnormalStatus?: {
- [AccountType.Xhs]: XhsAccountAbnormal;
+ [PlatType.Xhs]: XhsAccountAbnormal;
};
// 登录状态,判断是否失效
diff --git a/electron/db/models/interactionRecord.ts b/electron/db/models/interactionRecord.ts
index c4cd6d05..bcbb24cd 100644
--- a/electron/db/models/interactionRecord.ts
+++ b/electron/db/models/interactionRecord.ts
@@ -7,7 +7,7 @@
*/
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
import { TempModel } from './temp';
-import { AccountType } from '../../../commont/AccountEnum';
+import { PlatType } from '../../../commont/AccountEnum';
@Entity({ name: 'interactionRecord' })
export class InteractionRecordModel extends TempModel {
@@ -22,11 +22,11 @@ export class InteractionRecordModel extends TempModel {
@Column({
type: 'varchar',
- enum: AccountType,
+ enum: PlatType,
nullable: true,
comment: '平台类型',
})
- type!: AccountType;
+ type!: PlatType;
@Column({ type: 'varchar', nullable: false, comment: '作品Id' })
worksId!: string;
diff --git a/electron/db/models/replyCommentRecord.ts b/electron/db/models/replyCommentRecord.ts
index 85ae2711..42e32583 100644
--- a/electron/db/models/replyCommentRecord.ts
+++ b/electron/db/models/replyCommentRecord.ts
@@ -7,7 +7,7 @@
*/
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
import { TempModel } from './temp';
-import { AccountType } from '../../../commont/AccountEnum';
+import { PlatType } from '../../../commont/AccountEnum';
@Entity({ name: 'replyCommentRecord' })
export class ReplyCommentRecordModel extends TempModel {
@@ -22,11 +22,11 @@ export class ReplyCommentRecordModel extends TempModel {
@Column({
type: 'varchar',
- enum: AccountType,
+ enum: PlatType,
nullable: true,
comment: '平台类型',
})
- type!: AccountType;
+ type!: PlatType;
@Column({ type: 'varchar', nullable: false, comment: '评论Id' })
commentId!: string;
diff --git a/electron/db/models/workData.ts b/electron/db/models/workData.ts
index 5864e2a0..b5574e67 100644
--- a/electron/db/models/workData.ts
+++ b/electron/db/models/workData.ts
@@ -7,7 +7,7 @@
*/
import { Column, PrimaryGeneratedColumn } from 'typeorm';
import { TempModel } from './temp';
-import { AccountType } from '../../../commont/AccountEnum';
+import { PlatType } from '../../../commont/AccountEnum';
import type {
CookiesType,
ILocationDataItem,
@@ -30,8 +30,8 @@ export interface ILableValue {
* 每个平台有相同点,有不同点,这不同点都在这个参数下集合
*/
export type DiffParmasType = {
- [AccountType.Xhs]?: {};
- [AccountType.Douyin]?: {
+ [PlatType.Xhs]?: {};
+ [PlatType.Douyin]?: {
// 申请关联的热点
hotPoint?: ILableValue;
// 申请关联的活动
@@ -39,7 +39,7 @@ export type DiffParmasType = {
// 自主声明
selfDeclare?: DeclarationDouyin;
};
- [AccountType.WxSph]?: {
+ [PlatType.WxSph]?: {
// 是否为原创
isOriginal?: boolean;
// 扩展链接
@@ -47,7 +47,7 @@ export type DiffParmasType = {
// 活动
activity?: WxSphEvent;
};
- [AccountType.KWAI]?: {};
+ [PlatType.KWAI]?: {};
};
export type WorkDataModel = WorkData;
@@ -83,11 +83,11 @@ export class WorkData extends TempModel {
@Column({
type: 'varchar',
- enum: AccountType,
+ enum: PlatType,
nullable: false,
comment: '平台类型',
})
- type!: AccountType;
+ type!: PlatType;
// 发布时间
@Column({ type: 'datetime', nullable: true, comment: '发布时间' })
diff --git a/electron/main/account/controller.ts b/electron/main/account/controller.ts
index 3bbb22fb..6d6705c9 100644
--- a/electron/main/account/controller.ts
+++ b/electron/main/account/controller.ts
@@ -11,7 +11,7 @@ import { getUserInfo } from '../user/comment';
import platController from '../plat';
import type { ICreateBrowserWindowParams } from './BrowserWindow/browserWindow';
import { browserWindowController } from './BrowserWindow';
-import { AccountStatus, AccountType } from '../../../commont/AccountEnum';
+import { AccountStatus, PlatType } from '../../../commont/AccountEnum';
import { AccountModel } from '../../db/models/account';
import windowOperate from '../../util/windowOperate';
import { SendChannelEnum } from '../../../commont/UtilsEnum';
@@ -47,7 +47,7 @@ export class AccountController {
@Icp('ICP_ACCOUNT_LOGIN')
async accountLogin(
event: Electron.IpcMainInvokeEvent,
- pType: AccountType,
+ pType: PlatType,
): Promise<any> {
const userInfo = getUserInfo();
@@ -76,7 +76,7 @@ export class AccountController {
@Icp('ICP_ACCOUNT_LOGIN_CHECK')
async checkAccountLogin(
event: Electron.IpcMainInvokeEvent,
- pType: AccountType,
+ pType: PlatType,
uid: string,
isSendEvent: boolean = true,
): Promise<AccountModel | null> {
@@ -94,7 +94,7 @@ export class AccountController {
async checkAccountLoginMulti(
event: Electron.IpcMainInvokeEvent,
checkAccounts: {
- pType: AccountType;
+ pType: PlatType;
uid: string;
}[],
): Promise<(AccountModel | null)[]> {
@@ -127,7 +127,7 @@ export class AccountController {
@Icp('ICP_ACCOUNT_GET_INFO')
async getAccountInfo(
event: Electron.IpcMainInvokeEvent,
- data: { type: AccountType; uid: string },
+ data: { type: PlatType; uid: string },
): Promise<any> {
const userInfo = getUserInfo();
@@ -185,7 +185,7 @@ export class AccountController {
@Icp('ICP_ACCOUNT_STATISTICS')
async getAccountStatistics(
event: Electron.IpcMainInvokeEvent,
- type?: AccountType,
+ type?: PlatType,
): Promise<any> {
const userInfo = getUserInfo();
return this.accountService.getAccountStatistics(userInfo.id, type);
diff --git a/electron/main/account/service.ts b/electron/main/account/service.ts
index 5fc4579b..bf746143 100644
--- a/electron/main/account/service.ts
+++ b/electron/main/account/service.ts
@@ -10,7 +10,7 @@ import { Injectable } from '../core/decorators';
import { FindOptionsWhere, In, Repository } from 'typeorm';
import {
AccountStatus,
- AccountType,
+ PlatType,
defaultAccountGroupId,
} from '../../../commont/AccountEnum';
import platController from '../plat/index';
@@ -63,7 +63,7 @@ export class AccountService {
}
// 单个账号登录状态检测core
- async checkAccountLoginCore(pType: AccountType, uid: string) {
+ async checkAccountLoginCore(pType: PlatType, uid: string) {
const userInfo = getUserInfo();
const accountInfo = await this.getAccountInfo({
@@ -95,7 +95,7 @@ export class AccountService {
async addOrUpdateAccount(
query: {
userId: string;
- type: AccountType;
+ type: PlatType;
uid: string;
},
account: Partial<AccountModel>,
@@ -135,7 +135,7 @@ export class AccountService {
// 获取账户信息
async getAccountInfo(query: {
- type: AccountType;
+ type: PlatType;
userId: string;
uid: string;
}) {
@@ -169,7 +169,7 @@ export class AccountService {
*/
async getAccountStatistics(
userId: string,
- type?: AccountType,
+ type?: PlatType,
): Promise<{
accountTotal: number;
list: AccountModel[];
diff --git a/electron/main/interaction/controller.ts b/electron/main/interaction/controller.ts
index ecab9cc2..ca849d00 100644
--- a/electron/main/interaction/controller.ts
+++ b/electron/main/interaction/controller.ts
@@ -17,7 +17,7 @@ import { AutorWorksInteractionScheduleEvent } from '../../../commont/types/inter
import { AutoInteractionCache } from './cacheData';
import { getUserInfo } from '../user/comment';
import type { CorrectQuery } from '../../global/table';
-import { AccountType } from '../../../commont/AccountEnum';
+import { PlatType } from '../../../commont/AccountEnum';
import { taskApi } from '../api/taskApi';
import platController from '../plat';
@@ -158,7 +158,7 @@ export class InteractionController {
page: CorrectQuery,
query: {
accountId?: number;
- type?: AccountType;
+ type?: PlatType;
},
): Promise<any> {
const userInfo = getUserInfo();
diff --git a/electron/main/interaction/service.ts b/electron/main/interaction/service.ts
index 06c9a5b6..569e766b 100644
--- a/electron/main/interaction/service.ts
+++ b/electron/main/interaction/service.ts
@@ -22,7 +22,7 @@ import { AutorWorksInteractionScheduleEvent } from '../../../commont/types/inter
import { WorkData } from '../plat/plat.type';
import { AutoInteractionCache } from './cacheData';
import { backPageData, CorrectQuery } from '../../global/table';
-import { AccountType } from '../../../commont/AccountEnum';
+import { PlatType } from '../../../commont/AccountEnum';
import { AccountService } from '../account/service';
import { UserService } from '../user/service';
// import { ReplyController } from '../reply/controller';
@@ -93,7 +93,7 @@ export class InteractionService {
page: CorrectQuery,
query: {
accountId?: number;
- type?: AccountType;
+ type?: PlatType;
},
) {
const filter: FindOptionsWhere<InteractionRecordModel> = {
diff --git a/electron/main/plat/PlatformBase.ts b/electron/main/plat/PlatformBase.ts
index 295f8515..567b6aa0 100644
--- a/electron/main/plat/PlatformBase.ts
+++ b/electron/main/plat/PlatformBase.ts
@@ -24,7 +24,7 @@ import {
WorkData,
} from './plat.type';
import { PublishVideoResult } from './module';
-import { AccountType } from '../../../commont/AccountEnum';
+import { PlatType } from '../../../commont/AccountEnum';
import { AccountModel } from '../../db/models/account';
import { VideoModel } from '../../db/models/video';
import { ImgTextModel } from '../../db/models/imgText';
@@ -34,9 +34,9 @@ import { ImgTextModel } from '../../db/models/imgText';
*/
export abstract class PlatformBase {
// 平台类型
- protected readonly type: AccountType;
+ protected readonly type: PlatType;
- constructor(type: AccountType) {
+ constructor(type: PlatType) {
this.type = type;
}
diff --git a/electron/main/plat/index.ts b/electron/main/plat/index.ts
index 6ed0b5fb..67087243 100644
--- a/electron/main/plat/index.ts
+++ b/electron/main/plat/index.ts
@@ -20,24 +20,24 @@ import {
import { PublishVideoResult } from './module';
import { VideoModel } from '../../db/models/video';
import { PubItemVideo } from './pub/PubItemVideo';
-import { AccountType } from '../../../commont/AccountEnum';
+import { PlatType } from '../../../commont/AccountEnum';
import { PubItemImgText } from './pub/PubItemImgText';
import { ImgTextModel } from '../../db/models/imgText';
import { EtEvent } from '../../global/event';
class PlatController {
// 所有平台
- private readonly platforms = new Map<AccountType, PlatformBase>();
+ private readonly platforms = new Map<PlatType, PlatformBase>();
constructor() {
- this.platforms.set(AccountType.KWAI, kwai);
- this.platforms.set(AccountType.Xhs, xhs);
- this.platforms.set(AccountType.Douyin, douyin);
- this.platforms.set(AccountType.WxSph, wxSph);
+ this.platforms.set(PlatType.KWAI, kwai);
+ this.platforms.set(PlatType.Xhs, xhs);
+ this.platforms.set(PlatType.Douyin, douyin);
+ this.platforms.set(PlatType.WxSph, wxSph);
}
// 获取平台类实例
- private getPlatform(type: AccountType) {
+ private getPlatform(type: PlatType) {
const platform = this.platforms.get(type);
if (!platform) console.warn(`没有这个平台:${type}`);
@@ -49,7 +49,7 @@ class PlatController {
* @param type 平台
* @param params 参数
*/
- public async platlogin(type: AccountType, params?: any) {
+ public async platlogin(type: PlatType, params?: any) {
const platform = this.platforms.get(type)!;
const res = await platform.login(params);
if (!res || !res.loginCookie) return null;
@@ -66,7 +66,7 @@ class PlatController {
* @param type 平台
* @param account
*/
- public async platLoginCheck(type: AccountType, account: AccountModel) {
+ public async platLoginCheck(type: PlatType, account: AccountModel) {
const platform = this.platforms.get(type)!;
return await platform.loginCheck(account);
}
@@ -146,7 +146,7 @@ class PlatController {
* @param type 平台
* @param params 参数
*/
- public async getAccountInfo(type: AccountType, params: IAccountInfoParams) {
+ public async getAccountInfo(type: PlatType, params: IAccountInfoParams) {
const platform = this.platforms.get(type)!;
return await platform.getAccountInfo(params);
}
diff --git a/electron/main/plat/module.ts b/electron/main/plat/module.ts
index 87a7d64d..d70c24db 100644
--- a/electron/main/plat/module.ts
+++ b/electron/main/plat/module.ts
@@ -5,7 +5,7 @@
* @LastEditors: nevin
* @Description:
*/
-import { AccountType } from '../../../commont/AccountEnum';
+import { PlatType } from '../../../commont/AccountEnum';
import { PubStatus } from '../../../commont/publish/PublishEnum';
@@ -17,7 +17,7 @@ interface IProperty {
}
export interface IVideoPubOtherData {
- [AccountType.Xhs]?: {
+ [PlatType.Xhs]?: {
// 预览需要
xsec_token: string;
xsec_source: string;
diff --git a/electron/main/plat/platforms/Kwai/index.ts b/electron/main/plat/platforms/Kwai/index.ts
index 9b3ecb57..71a3b84f 100644
--- a/electron/main/plat/platforms/Kwai/index.ts
+++ b/electron/main/plat/platforms/Kwai/index.ts
@@ -23,7 +23,7 @@ import { PublishVideoResult } from '../../module';
import { kwaiPub } from '../../../../plat/Kwai';
import { IRequestNetResult } from '../../../../plat/requestNet';
import { IKwaiUserInfoResponse } from '../../../../plat/Kwai/kwai.type';
-import { AccountType } from '../../../../../commont/AccountEnum';
+import { PlatType } from '../../../../../commont/AccountEnum';
import { AccountModel } from '../../../../db/models/account';
import dayjs from 'dayjs';
import { VideoModel } from '../../../../db/models/video';
@@ -35,7 +35,7 @@ import KwaiPubListener from './KwaiPubListener';
export class Kwai extends PlatformBase {
constructor() {
- super(AccountType.KWAI);
+ super(PlatType.KWAI);
}
/**
diff --git a/electron/main/plat/platforms/douyin/index.ts b/electron/main/plat/platforms/douyin/index.ts
index d912dba4..fe7dedfa 100644
--- a/electron/main/plat/platforms/douyin/index.ts
+++ b/electron/main/plat/platforms/douyin/index.ts
@@ -24,7 +24,7 @@ import {
DouyinPlatformSettingType,
douyinService,
} from '../../../../plat/douyin';
-import { AccountType } from '../../../../../commont/AccountEnum';
+import { PlatType } from '../../../../../commont/AccountEnum';
import { AccountModel } from '../../../../db/models/account';
import { VisibleTypeEnum } from '../../../../../commont/publish/PublishEnum';
import { IRequestNetResult } from '../../../../plat/requestNet';
@@ -44,7 +44,7 @@ export type PubVideoOptin = {
export class Douyin extends PlatformBase {
constructor() {
- super(AccountType.Douyin);
+ super(PlatType.Douyin);
}
/**
@@ -492,7 +492,7 @@ export class Douyin extends PlatformBase {
}
pubParamsParse(params: WorkDataModel): DouyinPlatformSettingType {
- const douyinParams = params.diffParams![AccountType.Douyin];
+ const douyinParams = params.diffParams![PlatType.Douyin];
return {
proxyIp: params.proxyIp || '',
userDeclare: douyinParams?.selfDeclare,
diff --git a/electron/main/plat/platforms/wxSph/index.ts b/electron/main/plat/platforms/wxSph/index.ts
index f4959c83..33293921 100644
--- a/electron/main/plat/platforms/wxSph/index.ts
+++ b/electron/main/plat/platforms/wxSph/index.ts
@@ -22,7 +22,7 @@ import {
} from '../../plat.type';
import { PublishVideoResult } from '../../module';
import { shipinhaoService } from '../../../../plat/shipinhao';
-import { AccountType } from '../../../../../commont/AccountEnum';
+import { PlatType } from '../../../../../commont/AccountEnum';
import { AccountModel } from '../../../../db/models/account';
import { CommentInfo } from '../../../../plat/shipinhao/wxShp.type';
import { IRequestNetResult } from '../../../../plat/requestNet';
@@ -30,7 +30,7 @@ import { VideoModel } from '../../../../db/models/video';
export class WxSph extends PlatformBase {
constructor() {
- super(AccountType.WxSph);
+ super(PlatType.WxSph);
}
/**
@@ -343,7 +343,7 @@ export class WxSph extends PlatformBase {
callback: VideoCallbackType,
): Promise<PublishVideoResult> {
return new Promise(async (resolve) => {
- const wxSphParams = params.diffParams![AccountType.WxSph]!;
+ const wxSphParams = params.diffParams![PlatType.WxSph]!;
const result = await shipinhaoService
.publishVideoWorkApi(
params.cookies!,
diff --git a/electron/main/plat/platforms/xhs/index.ts b/electron/main/plat/platforms/xhs/index.ts
index 6c4a1147..aede8560 100644
--- a/electron/main/plat/platforms/xhs/index.ts
+++ b/electron/main/plat/platforms/xhs/index.ts
@@ -24,7 +24,7 @@ import {
xiaohongshuService,
XSLPlatformSettingType,
} from '../../../../plat/xiaohongshu';
-import { AccountType } from '../../../../../commont/AccountEnum';
+import { PlatType } from '../../../../../commont/AccountEnum';
import { AccountModel } from '../../../../db/models/account';
import { VisibleTypeEnum } from '../../../../../commont/publish/PublishEnum';
import { CookieToString } from '../../../../plat/utils';
@@ -34,7 +34,7 @@ import { ImgTextModel } from '../../../../db/models/imgText';
export class Xhs extends PlatformBase {
constructor() {
- super(AccountType.Xhs);
+ super(PlatType.Xhs);
}
/**
@@ -85,7 +85,7 @@ export class Xhs extends PlatformBase {
nickname: userInfo.nickname,
fansCount: userInfo.fansCount,
abnormalStatus: {
- [AccountType.Xhs]: userInfo.diagnosis_status,
+ [PlatType.Xhs]: userInfo.diagnosis_status,
},
},
};
diff --git a/electron/main/publish/video/controller.ts b/electron/main/publish/video/controller.ts
index 5e37bce1..9aac32e5 100644
--- a/electron/main/publish/video/controller.ts
+++ b/electron/main/publish/video/controller.ts
@@ -16,7 +16,7 @@ import type { CorrectQuery } from '../../../global/table';
import { PublishService } from '../service';
import platController from '../../plat';
import { AccountService } from '../../account/service';
-import { AccountType } from '../../../../commont/AccountEnum';
+import { PlatType } from '../../../../commont/AccountEnum';
import { PubStatus } from '../../../../commont/publish/PublishEnum';
@Controller()
@@ -116,7 +116,7 @@ export class VideoPubController {
page: CorrectQuery,
query: {
pubRecardId?: number;
- type?: AccountType;
+ type?: PlatType;
time?: [string, string];
title?: string;
},
@@ -162,7 +162,7 @@ export class VideoPubController {
@Icp('ICP_PUBLISH_GET_VIDEO_PUL_TYPE_COUNT')
async getVideoPulTypeCount(
event: Electron.IpcMainInvokeEvent,
- type?: AccountType,
+ type?: PlatType,
): Promise<any> {
const userInfo = getUserInfo();
return await this.videoPubService.getVideoPulTypeCount(userInfo.id, type);
diff --git a/electron/main/publish/video/service.ts b/electron/main/publish/video/service.ts
index 3a5ea12b..1135c6ce 100644
--- a/electron/main/publish/video/service.ts
+++ b/electron/main/publish/video/service.ts
@@ -10,7 +10,7 @@ import { Injectable } from '../../core/decorators';
import { FindManyOptions, FindOptionsWhere, Repository } from 'typeorm';
import { CorrectQuery, backPageData } from '../../../global/table';
import { getUserInfo } from '../../user/comment';
-import { AccountType } from '../../../../commont/AccountEnum';
+import { PlatType } from '../../../../commont/AccountEnum';
@Injectable()
export class VideoPubService {
@@ -89,7 +89,7 @@ export class VideoPubService {
}
// 获取不同类型的视频发布的总数
- async getVideoPulTypeCount(userId: string, type?: AccountType) {
+ async getVideoPulTypeCount(userId: string, type?: PlatType) {
return await this.videoRepository.count({
where: { userId: userId, type: type },
});
diff --git a/electron/main/reply/controller.ts b/electron/main/reply/controller.ts
index 53b4f02d..f056e17d 100644
--- a/electron/main/reply/controller.ts
+++ b/electron/main/reply/controller.ts
@@ -18,7 +18,7 @@ import type { WorkData } from '../plat/plat.type';
import { GlobleCache } from '../../global/cache';
import { AutoReplyCache } from './cacheData';
import type { CorrectQuery } from '../../global/table';
-import { AccountType } from '../../../commont/AccountEnum';
+import { PlatType } from '../../../commont/AccountEnum';
import { getUserInfo } from '../user/comment';
@Controller()
export class ReplyController {
@@ -376,7 +376,7 @@ export class ReplyController {
page: CorrectQuery,
query: {
accountId?: number;
- type?: AccountType;
+ type?: PlatType;
},
): Promise<any> {
const userInfo = getUserInfo();
diff --git a/electron/main/reply/service.ts b/electron/main/reply/service.ts
index c8684da8..88f8939d 100644
--- a/electron/main/reply/service.ts
+++ b/electron/main/reply/service.ts
@@ -23,7 +23,7 @@ import { sleep } from '../../util/time';
import { AutoReplyCache, AutorReplyCacheStatus } from './cacheData';
import { logger } from '../../global/log';
import { backPageData, CorrectQuery } from '../../global/table';
-import { AccountType } from '../../../commont/AccountEnum';
+import { PlatType } from '../../../commont/AccountEnum';
@Injectable()
export class ReplyService {
@@ -88,7 +88,7 @@ export class ReplyService {
page: CorrectQuery,
query: {
accountId?: number;
- type?: AccountType;
+ type?: PlatType;
},
) {
const filter: FindOptionsWhere<ReplyCommentRecordModel> = {
diff --git a/src/api/types/task.ts b/src/api/types/task.ts
index bbfb4308..7b718e15 100644
--- a/src/api/types/task.ts
+++ b/src/api/types/task.ts
@@ -7,7 +7,7 @@
*/
import { Task, TaskDataInfo, TaskType } from 'commont/types/task';
import { ApiCorrectQuery } from '.';
-import { AccountType } from '@@/AccountEnum';
+import { PlatType } from '@@/AccountEnum';
export enum UserTaskStatus {
DODING = 'doing', // 进行中
@@ -60,7 +60,7 @@ export interface UserTask<T extends Task<TaskDataInfo> | string> {
export interface ApplyTask {
account: string;
uid: string;
- accountType: AccountType;
+ accountType: PlatType;
taskMaterialId?: string; // 任务素材ID
}
diff --git a/src/components/WebView/index.tsx b/src/components/WebView/index.tsx
index 12dbe7b3..af8dbb88 100644
--- a/src/components/WebView/index.tsx
+++ b/src/components/WebView/index.tsx
@@ -11,7 +11,7 @@ import styles from './webView.module.scss';
import { Spin } from 'antd';
import { ICookieParams } from '../../../electron/main/account/BrowserWindow/browserWindow';
import { AccountInfo } from '../../views/account/comment';
-import { AccountType } from '../../../commont/AccountEnum';
+import { PlatType } from '../../../commont/AccountEnum';
export interface IWebViewRef {}
@@ -46,7 +46,7 @@ const WebView = memo(
// 每个平台localStorage添加
if (account) {
let jsCode;
- if (account?.type === AccountType.Douyin) {
+ if (account?.type === PlatType.Douyin) {
jsCode = `
localStorage.setItem('douyin_web_hide_guide', '1');
localStorage.setItem('user_info', '{"uid":"${account.account}","nickname":"${account.nickname}","avatarUrl":"${account.avatar}"}');
diff --git a/src/icp/account.ts b/src/icp/account.ts
index a43edc5a..9f815d40 100644
--- a/src/icp/account.ts
+++ b/src/icp/account.ts
@@ -7,7 +7,7 @@
*/
import { AccountInfo } from '@/views/account/comment';
-import { AccountStatus, AccountType } from '@@/AccountEnum';
+import { AccountStatus, PlatType } from '@@/AccountEnum';
import { DashboardData } from '@/views/statistics/comment';
import { AccountGroupModel } from '../../electron/db/models/accountGroup';
@@ -32,7 +32,7 @@ export async function ipcUpdateAccountStatus(
* @param isSendEvent 是否发送账户更新的事件
*/
export async function acpAccountLoginCheck(
- pType: AccountType,
+ pType: PlatType,
uid: string,
isSendEvent: boolean = true,
) {
@@ -47,7 +47,7 @@ export async function acpAccountLoginCheck(
// 账户登录状态检测,多个账号
export async function acpAccountLoginCheckMulti(
checkAccounts: {
- pType: AccountType;
+ pType: PlatType;
uid: string;
}[],
) {
@@ -63,7 +63,7 @@ export async function acpAccountLoginCheckMulti(
* @param pType
* @returns
*/
-export async function accountLogin(pType: AccountType) {
+export async function accountLogin(pType: PlatType) {
const res: AccountInfo = await window.ipcRenderer.invoke(
'ICP_ACCOUNT_LOGIN',
pType,
@@ -72,7 +72,7 @@ export async function accountLogin(pType: AccountType) {
}
// 获取账户信息
-export async function icpGetAccountInfo(type: AccountType, uid: string) {
+export async function icpGetAccountInfo(type: PlatType, uid: string) {
const res: AccountInfo = await window.ipcRenderer.invoke(
'ICP_ACCOUNT_GET_INFO',
type,
diff --git a/src/icp/publish.ts b/src/icp/publish.ts
index 263735de..b1a0b809 100644
--- a/src/icp/publish.ts
+++ b/src/icp/publish.ts
@@ -9,7 +9,7 @@
import { CorrectQuery, CorrectResponse } from '@/global/table';
import { PubRecordModel } from '@/views/publish/comment';
import { VideoPul } from '@/views/publish/children/videoPage/comment';
-import { AccountType } from '../../commont/AccountEnum';
+import { PlatType } from '../../commont/AccountEnum';
import { PubStatus, PubType } from '../../commont/publish/PublishEnum';
import {
type IGetLocationDataParams,
@@ -191,7 +191,7 @@ export async function icpGetPubRecordItemList(page: CorrectQuery, id: number) {
*/
export async function icpGetVideoPulList(
page: CorrectQuery,
- query: { type?: AccountType; time?: [string, string]; title?: string },
+ query: { type?: PlatType; time?: [string, string]; title?: string },
) {
const res: CorrectResponse<VideoPul> = await window.ipcRenderer.invoke(
'ICP_PUBLISH_GET_VIDEO_PUL_LIST',
@@ -211,7 +211,7 @@ export async function icpGetVideoPulInfo(id: number) {
}
// 获取不同类型的视频发布的总数
-export async function icpGetVideoPulTypeCount(type?: AccountType) {
+export async function icpGetVideoPulTypeCount(type?: PlatType) {
const res: number = await window.ipcRenderer.invoke(
'ICP_PUBLISH_GET_VIDEO_PUL_TYPE_COUNT',
type,
diff --git a/src/icp/receiveMsg.ts b/src/icp/receiveMsg.ts
index 73d71c61..911907db 100644
--- a/src/icp/receiveMsg.ts
+++ b/src/icp/receiveMsg.ts
@@ -3,7 +3,7 @@ import { SendChannelEnum } from '../../commont/UtilsEnum';
import { PublishProgressRes } from '../../electron/main/plat/pub/PubItemVideo';
import IpcRendererEvent = Electron.IpcRendererEvent;
import { AccountModel } from '../../electron/db/models/account';
-import { AccountType } from '@@/AccountEnum';
+import { PlatType } from '@@/AccountEnum';
// 绑定事件中间层方法
const bindEventCore = (
@@ -40,11 +40,11 @@ export const onInteractionProgress = (callback: (...args: any[]) => void) => {
* @param callback account=如果为多个账户更新的结果那么这个值是第一个,主要是为了兼容之前的单个账户的检测,accounts=如果是单个检测这个值为空,多个值检测这个值为更新后的账号结果
*/
export const onAccountLoginFinish = (
- callback: (account: AccountModel, accounts?: AccountType[]) => void,
+ callback: (account: AccountModel, accounts?: PlatType[]) => void,
) => {
return bindEventCore(
SendChannelEnum.AccountLoginFinish,
- (e, account: AccountModel, accounts?: AccountType[]) => {
+ (e, account: AccountModel, accounts?: PlatType[]) => {
callback(account, accounts);
},
);
diff --git a/src/icp/reply.ts b/src/icp/reply.ts
index 399c5f87..3b131956 100644
--- a/src/icp/reply.ts
+++ b/src/icp/reply.ts
@@ -1,4 +1,4 @@
-import { AccountType } from '@@/AccountEnum';
+import { PlatType } from '@@/AccountEnum';
/*
* @Author: nevin
@@ -177,7 +177,7 @@ export async function ipcGetReplyCommentRecordList(
},
query: {
accountId?: number;
- type?: AccountType;
+ type?: PlatType;
},
) {
const res: string = await window.ipcRenderer.invoke(
diff --git a/src/icp/replyother.ts b/src/icp/replyother.ts
index 5389cfaa..4c24a70c 100644
--- a/src/icp/replyother.ts
+++ b/src/icp/replyother.ts
@@ -5,7 +5,7 @@
* @LastEditors: nevin
* @Description: 评论他人
*/
-import { AccountType } from '@@/AccountEnum';
+import { PlatType } from '@@/AccountEnum';
export type WorkData = {
dataId: string;
readCount?: number;
@@ -261,7 +261,7 @@ export async function ipcGetInteractionRecordList(
},
query: {
accountId?: number;
- type?: AccountType;
+ type?: PlatType;
},
) {
const res: string = await window.ipcRenderer.invoke(
diff --git a/src/views/account/comment.ts b/src/views/account/comment.ts
index a3d2ba7e..f03b3298 100644
--- a/src/views/account/comment.ts
+++ b/src/views/account/comment.ts
@@ -6,7 +6,7 @@
* @Description: 账户
*/
-import { AccountType } from '../../../commont/AccountEnum';
+import { PlatType } from '../../../commont/AccountEnum';
import { PubType } from '../../../commont/publish/PublishEnum';
import ksSvg from '../../assets/svgs/account/ks.svg';
import xhsSvg from '../../assets/svgs/account/xhs.svg';
@@ -57,9 +57,9 @@ export interface IAccountPlatInfo {
// 支持所有发布
const PubTypeAll = new Set([PubType.ARTICLE, PubType.VIDEO, PubType.ImageText]);
// 各个平台的信息
-export const AccountPlatInfoMap = new Map<AccountType, IAccountPlatInfo>([
+export const AccountPlatInfoMap = new Map<PlatType, IAccountPlatInfo>([
[
- AccountType.KWAI,
+ PlatType.KWAI,
{
name: '快手',
icon: ksSvg,
@@ -75,7 +75,7 @@ export const AccountPlatInfoMap = new Map<AccountType, IAccountPlatInfo>([
},
],
[
- AccountType.Xhs,
+ PlatType.Xhs,
{
name: '小红书',
icon: xhsSvg,
@@ -96,7 +96,7 @@ export const AccountPlatInfoMap = new Map<AccountType, IAccountPlatInfo>([
},
],
[
- AccountType.Douyin,
+ PlatType.Douyin,
{
name: '抖音',
icon: douyinSvg,
@@ -121,7 +121,7 @@ export const AccountPlatInfoMap = new Map<AccountType, IAccountPlatInfo>([
},
],
[
- AccountType.WxSph,
+ PlatType.WxSph,
{
name: '微信视频号',
icon: wxSphSvg,
diff --git a/src/views/account/components/AccountSidebar/AccountSidebar.tsx b/src/views/account/components/AccountSidebar/AccountSidebar.tsx
index 460a6d1f..5c200a07 100644
--- a/src/views/account/components/AccountSidebar/AccountSidebar.tsx
+++ b/src/views/account/components/AccountSidebar/AccountSidebar.tsx
@@ -13,7 +13,7 @@ import { accountLogin, acpAccountLoginCheck } from '@/icp/account';
import AddAccountModal from '../AddAccountModal';
import {
AccountStatus,
- AccountType,
+ PlatType,
defaultAccountGroupId,
XhsAccountAbnormal,
} from '@@/AccountEnum';
@@ -41,14 +41,14 @@ export interface IAccountSidebarProps {
// 切换选择的账户
onAccountChange: (info: AccountInfo) => void;
// 排除的平台类型
- excludePlatforms?: AccountType[];
+ excludePlatforms?: PlatType[];
}
const AccountStatusView = ({ account }: { account: AccountModel }) => {
if (
- account.type === AccountType.Xhs &&
+ account.type === PlatType.Xhs &&
account.abnormalStatus &&
- account.abnormalStatus[AccountType.Xhs] === XhsAccountAbnormal.Abnormal
+ account.abnormalStatus[PlatType.Xhs] === XhsAccountAbnormal.Abnormal
) {
return (
<Tooltip title="账号状态异常,无法发布作品,请检查后重试!">
@@ -264,7 +264,7 @@ const AccountSidebar = memo(
'accountList-item--disable',
// 异常状态
account.abnormalStatus &&
- account.abnormalStatus[AccountType.Xhs] ===
+ account.abnormalStatus[PlatType.Xhs] ===
XhsAccountAbnormal.Abnormal &&
'accountList-item--abnormal',
].join(' ')}
@@ -288,7 +288,7 @@ const AccountSidebar = memo(
<Tooltip
title={
account.abnormalStatus &&
- account.abnormalStatus[AccountType.Xhs] ===
+ account.abnormalStatus[PlatType.Xhs] ===
XhsAccountAbnormal.Abnormal
? '账号状态异常,无法发布作品,请检查后重试'
: undefined
diff --git a/src/views/publish/children/imagePage/components/ImageRightSetting/components/ImageParamsSet.tsx b/src/views/publish/children/imagePage/components/ImageRightSetting/components/ImageParamsSet.tsx
index 9305bc93..298f094d 100644
--- a/src/views/publish/children/imagePage/components/ImageRightSetting/components/ImageParamsSet.tsx
+++ b/src/views/publish/children/imagePage/components/ImageRightSetting/components/ImageParamsSet.tsx
@@ -2,7 +2,7 @@ import { ForwardedRef, forwardRef, memo, useEffect, useMemo } from 'react';
import { useImagePageStore } from '../../../useImagePageStore';
import { useShallow } from 'zustand/react/shallow';
import styles from './imageParamsSet.module.scss';
-import { AccountType } from '../../../../../../../../commont/AccountEnum';
+import { PlatType } from '../../../../../../../../commont/AccountEnum';
import { IImageAccountItem } from '../../../imagePage.type';
import { AccountPlatInfoMap } from '../../../../../../account/comment';
import { CloseOutlined, InfoOutlined } from '@ant-design/icons';
@@ -45,7 +45,7 @@ const ImageParamsSet = memo(
const platAccountImagesMap = useMemo(() => {
// 平台账户map
- const platAccountMap = new Map<AccountType, IImageAccountItem[]>([]);
+ const platAccountMap = new Map<PlatType, IImageAccountItem[]>([]);
for (const imageAccount of imageAccounts) {
if (!platAccountMap.has(imageAccount.account.type)) {
@@ -64,7 +64,7 @@ const ImageParamsSet = memo(
// 默认选中的平台map
const newPlatActiveAccountMap = new Map<
- AccountType,
+ PlatType,
IImageAccountItem
>();
@@ -105,7 +105,7 @@ const ImageParamsSet = memo(
// key=平台,val==错误消息
const errParamsPlatMap = useMemo(() => {
if (!errParamsMap) return undefined;
- const errParamsMapTemp = new Map<AccountType, ErrPubParamsItem>();
+ const errParamsMapTemp = new Map<PlatType, ErrPubParamsItem>();
for (const [_, errParamsItem] of errParamsMap) {
if (!errParamsMapTemp.has(errParamsItem.plat!)) {
errParamsMapTemp.set(errParamsItem.plat!, errParamsItem);
diff --git a/src/views/publish/children/imagePage/components/ImageRightSetting/components/ParamsSettingDetails.tsx b/src/views/publish/children/imagePage/components/ImageRightSetting/components/ParamsSettingDetails.tsx
index b0fb0a24..10805c20 100644
--- a/src/views/publish/children/imagePage/components/ImageRightSetting/components/ParamsSettingDetails.tsx
+++ b/src/views/publish/children/imagePage/components/ImageRightSetting/components/ParamsSettingDetails.tsx
@@ -4,7 +4,7 @@ import { CloseOutlined, PlusOutlined } from '@ant-design/icons';
import { Alert, Avatar, Tooltip } from 'antd';
import {
AccountStatus,
- AccountType,
+ PlatType,
} from '../../../../../../../../commont/AccountEnum';
import ImageParamsSet_Douyin from './children/ImageParamsSet_Douyin';
import ImageParamsSet_XHS from './children/ImageParamsSet_XHS';
@@ -140,9 +140,9 @@ const ParamsSettingDetails = memo(
{(() => {
switch (activePlat) {
- case AccountType.Douyin:
+ case PlatType.Douyin:
return <ImageParamsSet_Douyin />;
- case AccountType.Xhs:
+ case PlatType.Xhs:
return <ImageParamsSet_XHS />;
}
})()}
diff --git a/src/views/publish/children/imagePage/components/ImageRightSetting/components/children/ImageParamsSet_Douyin.tsx b/src/views/publish/children/imagePage/components/ImageRightSetting/components/children/ImageParamsSet_Douyin.tsx
index 5ef1e07d..ebf3788e 100644
--- a/src/views/publish/children/imagePage/components/ImageRightSetting/components/children/ImageParamsSet_Douyin.tsx
+++ b/src/views/publish/children/imagePage/components/ImageRightSetting/components/children/ImageParamsSet_Douyin.tsx
@@ -16,7 +16,7 @@ import {
CommonActivitySelect,
CommonHotspotSelect,
} from '../../../../../../components/CommonComponents/DouyinCommonComponents';
-import { AccountType } from '../../../../../../../../../commont/AccountEnum';
+import { PlatType } from '../../../../../../../../../commont/AccountEnum';
import { ILableValue } from '../../../../../../../../../electron/db/models/workData';
import { useImagePlatParams } from './hooks/useImagePlatParams';
import { useImagePageStore } from '../../../../useImagePageStore';
@@ -34,11 +34,11 @@ const HotspotSelect = () => {
<CommonHotspotSelect
account={imageAccountItem.account}
value={
- imageAccountItem.pubParams!.diffParams![AccountType.Douyin]!.hotPoint
+ imageAccountItem.pubParams!.diffParams![PlatType.Douyin]!.hotPoint
}
onChange={(newValue) => {
const newDiffParams = imageAccountItem.pubParams.diffParams!;
- newDiffParams[AccountType.Douyin]!.hotPoint = newValue as ILableValue;
+ newDiffParams[PlatType.Douyin]!.hotPoint = newValue as ILableValue;
setOnePubParams(
{
diffParams: newDiffParams,
@@ -66,11 +66,11 @@ const ActivitySelect = () => {
account={imageAccountItem.account}
maxCount={topicMax - imageAccountItem.pubParams!.topics!.length}
value={
- imageAccountItem.pubParams!.diffParams![AccountType.Douyin]!.activitys
+ imageAccountItem.pubParams!.diffParams![PlatType.Douyin]!.activitys
}
onChange={(newValue) => {
const newDiffParams = imageAccountItem.pubParams.diffParams!;
- newDiffParams[AccountType.Douyin]!.activitys =
+ newDiffParams[PlatType.Douyin]!.activitys =
newValue as ILableValue[];
setOnePubParams(
{
@@ -100,7 +100,7 @@ const ImageParamsSet_Douyin = memo(
<ImgTextTopicSelect
maxCount={
topicMax -
- imageAccountItem.pubParams!.diffParams![AccountType.Douyin]!
+ imageAccountItem.pubParams!.diffParams![PlatType.Douyin]!
.activitys!.length
}
tips="最多可添加5个话题(包含活动奖励)"
diff --git a/src/views/publish/children/imagePage/useImagePageStore.ts b/src/views/publish/children/imagePage/useImagePageStore.ts
index c22faadf..de707944 100644
--- a/src/views/publish/children/imagePage/useImagePageStore.ts
+++ b/src/views/publish/children/imagePage/useImagePageStore.ts
@@ -5,7 +5,7 @@ import { IImageAccountItem } from './imagePage.type';
import lodash from 'lodash';
import { AccountInfo } from '../../../account/comment';
import { useVideoPageStore } from '../videoPage/useVideoPageStore';
-import { AccountType } from '../../../../../commont/AccountEnum';
+import { PlatType } from '../../../../../commont/AccountEnum';
import { IPubParams } from '../videoPage/videoPage';
import { message } from 'antd';
import { accountLogin } from '../../../../icp/account';
@@ -19,9 +19,9 @@ export interface IImagePageStore {
// 选择的图片数据
images: IImgFile[];
// 每个平台当前选择的账户
- platActiveAccountMap: Map<AccountType, IImageAccountItem>;
+ platActiveAccountMap: Map<PlatType, IImageAccountItem>;
// 当前选择的平台
- activePlat?: AccountType;
+ activePlat?: PlatType;
// 通用参数
commonPubParams: IPubParams;
// 图片上传上限
@@ -38,7 +38,7 @@ const store: IImagePageStore = {
imgUploadLimit: 35,
images: [],
imageAccounts: [],
- platActiveAccountMap: new Map<AccountType, IImageAccountItem>(),
+ platActiveAccountMap: new Map<PlatType, IImageAccountItem>(),
activePlat: undefined,
commonPubParams: useVideoPageStore.getState().pubParamsInit(),
errParamsMap: undefined,
@@ -73,7 +73,7 @@ export const useImagePageStore = create(
const methods = {
setPlatActiveAccountMap(
- platActiveAccountMap: Map<AccountType, IImageAccountItem>,
+ platActiveAccountMap: Map<PlatType, IImageAccountItem>,
) {
set({
platActiveAccountMap,
@@ -88,7 +88,7 @@ export const useImagePageStore = create(
warnParamsMap,
});
},
- setActivePlat(activePlat: AccountType) {
+ setActivePlat(activePlat: PlatType) {
set({
activePlat,
});
@@ -144,7 +144,7 @@ export const useImagePageStore = create(
/**
* 账户重新登录。登录成功后会自动更新该条账户数据
*/
- async accountRestart(pType: AccountType) {
+ async accountRestart(pType: PlatType) {
const res = await accountLogin(pType);
if (!res) return;
message.success('登录成功!');
@@ -211,7 +211,7 @@ export const useImagePageStore = create(
},
// 按平台删除
- delAccountByPalt(accountType: AccountType) {
+ delAccountByPalt(accountType: PlatType) {
const imageAccounts = get().imageAccounts.filter(
(v) => v.account.type !== accountType,
);
diff --git a/src/views/publish/children/pubRecord/components/PubRecordDetails.tsx b/src/views/publish/children/pubRecord/components/PubRecordDetails.tsx
index d48abec9..85ad7b23 100644
--- a/src/views/publish/children/pubRecord/components/PubRecordDetails.tsx
+++ b/src/views/publish/children/pubRecord/components/PubRecordDetails.tsx
@@ -10,7 +10,7 @@ import styles from '../pubRecord.module.scss';
import { AccountPlatInfoMap } from '../../../../account/comment';
import { formatTime } from '../../../../../utils';
import { getVideoFile } from '../../../../../components/Choose/VideoChoose';
-import { AccountType } from '../../../../../../commont/AccountEnum';
+import { PlatType } from '../../../../../../commont/AccountEnum';
import { IExamineVideo, ImageView } from '../page';
import { PubRecordModel } from '../../../comment';
import { useAccountStore } from '../../../../../store/account';
@@ -194,7 +194,7 @@ const PubRecordDetails = memo(
url: '',
account,
};
- if (account?.type === AccountType.WxSph) {
+ if (account?.type === PlatType.WxSph) {
const videoFile = await getVideoFile(
(v as VideoModel).videoPath!,
);
diff --git a/src/views/publish/children/videoPage/components/CommonPubSetting.tsx b/src/views/publish/children/videoPage/components/CommonPubSetting.tsx
index 7b05add8..bfad783c 100644
--- a/src/views/publish/children/videoPage/components/CommonPubSetting.tsx
+++ b/src/views/publish/children/videoPage/components/CommonPubSetting.tsx
@@ -9,7 +9,7 @@ import {
AccountPlatInfoMap,
IAccountPlatInfo,
} from '../../../../account/comment';
-import { AccountType } from '../../../../../../commont/AccountEnum';
+import { PlatType } from '../../../../../../commont/AccountEnum';
import AICreateTitle from '../../../components/AICreateTitle/AICreateTitle';
import { AiCreateType } from '../../../../../api/types/tools';
@@ -39,7 +39,7 @@ const CommonPubSetting = memo(
// 获取选择的账户的所有相关平台
const getChoosedAccountPlatList = useMemo(() => {
- const platMap = new Map<AccountType, IAccountPlatInfo>();
+ const platMap = new Map<PlatType, IAccountPlatInfo>();
videoListChoose.map((v) => {
if (v.account) {
platMap.set(
diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx
index a8c24a02..6dc6d295 100644
--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx
+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal.tsx
@@ -23,7 +23,7 @@ import { useShallow } from 'zustand/react/shallow';
import styles from './videoPubSetModal.module.scss';
import { AccountPlatInfoMap } from '@/views/account/comment';
import VideoCoverSeting from '@/views/publish/children/videoPage/components/VideoCoverSeting';
-import { AccountType } from '@@/AccountEnum';
+import { PlatType } from '@@/AccountEnum';
import {
icpCreatePubRecord,
icpCreateVideoPubRecord,
@@ -72,13 +72,13 @@ const PubSetModalChild = ({}: {}) => {
const renderedComponent = useMemo(() => {
switch (currChooseAccount?.account?.type) {
- case AccountType.KWAI:
+ case PlatType.KWAI:
return <VideoPubSetModal_KWAI />;
- case AccountType.Douyin:
+ case PlatType.Douyin:
return <VideoPubSetModal_DouYin />;
- case AccountType.Xhs:
+ case PlatType.Xhs:
return <VideoPubSetModal_XSH />;
- case AccountType.WxSph:
+ case PlatType.WxSph:
return <VideoPubSetModal_WxSph />;
}
return <></>;
@@ -150,7 +150,7 @@ const VideoPubSetModal = memo(
{
moreErrorVerifyCallback(item, errParamsMapTemp) {
if (
- item?.account?.type === AccountType.Douyin &&
+ item?.account?.type === PlatType.Douyin &&
item.other?.duration > 3600
) {
errParamsMapTemp.set(item.id, {
diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_DouYin.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_DouYin.tsx
index 111aec2d..96ae5a8d 100644
--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_DouYin.tsx
+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_DouYin.tsx
@@ -8,7 +8,7 @@ import { useVideoPageStore } from '@/views/publish/children/videoPage/useVideoPa
import { useShallow } from 'zustand/react/shallow';
import TopicSelect from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/TopicSelect';
import LocationSelect from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/LocationSelect';
-import { AccountType } from '@@/AccountEnum';
+import { PlatType } from '@@/AccountEnum';
import {
DescTextArea,
ScheduledTimeSelect,
@@ -38,11 +38,11 @@ const HotspotSelect = ({}: IVideoPubSetModalChildProps) => {
<CommonHotspotSelect
account={currChooseAccount.account}
value={
- currChooseAccount.pubParams!.diffParams![AccountType.Douyin]!.hotPoint
+ currChooseAccount.pubParams!.diffParams![PlatType.Douyin]!.hotPoint
}
onChange={(newValue) => {
const newDiffParams = currChooseAccount.pubParams.diffParams!;
- newDiffParams[AccountType.Douyin]!.hotPoint = newValue as ILableValue;
+ newDiffParams[PlatType.Douyin]!.hotPoint = newValue as ILableValue;
setOnePubParams({
diffParams: newDiffParams,
});
@@ -61,11 +61,11 @@ const ActivitySelect = ({}: IVideoPubSetModalChildProps) => {
account={currChooseAccount.account}
maxCount={topicMax - currChooseAccount.pubParams!.topics!.length}
value={
- currChooseAccount.pubParams!.diffParams![AccountType.Douyin]!.activitys
+ currChooseAccount.pubParams!.diffParams![PlatType.Douyin]!.activitys
}
onChange={(newValue) => {
const newDiffParams = currChooseAccount.pubParams.diffParams!;
- newDiffParams[AccountType.Douyin]!.activitys =
+ newDiffParams[PlatType.Douyin]!.activitys =
newValue as ILableValue[];
setOnePubParams({
diffParams: newDiffParams,
@@ -96,7 +96,7 @@ const VideoPubSetModal_DouYin = memo(
<TopicSelect
maxCount={
topicMax -
- currChooseAccount.pubParams!.diffParams![AccountType.Douyin]!
+ currChooseAccount.pubParams!.diffParams![PlatType.Douyin]!
.activitys!.length
}
tips={`最多可添加${topicMax}个话题(包含活动奖励)`}
@@ -117,7 +117,7 @@ const VideoPubSetModal_DouYin = memo(
<Select
allowClear
value={
- currChooseAccount?.pubParams.diffParams![AccountType.Douyin]!
+ currChooseAccount?.pubParams.diffParams![PlatType.Douyin]!
.selfDeclare
}
style={{ width: '100%' }}
@@ -152,7 +152,7 @@ const VideoPubSetModal_DouYin = memo(
]}
onChange={(newValue: any) => {
const newDiffParams = currChooseAccount.pubParams.diffParams!;
- newDiffParams[AccountType.Douyin]!.selfDeclare = newValue?.value;
+ newDiffParams[PlatType.Douyin]!.selfDeclare = newValue?.value;
setOnePubParams({
diffParams: newDiffParams,
});
diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_WxSph.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_WxSph.tsx
index cddee9c1..e2e6969b 100644
--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_WxSph.tsx
+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_WxSph.tsx
@@ -7,7 +7,7 @@ import { Checkbox, Input, Select, Spin } from 'antd';
import { useVideoPageStore } from '@/views/publish/children/videoPage/useVideoPageStore';
import { useShallow } from 'zustand/react/shallow';
import LocationSelect from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/LocationSelect';
-import { AccountStatus, AccountType } from '@@/AccountEnum';
+import { AccountStatus, PlatType } from '@@/AccountEnum';
import useDebounceFetcher from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/useDebounceFetcher';
import {
DescTextArea,
@@ -67,11 +67,11 @@ const WXSphActivity = ({}: IVideoPubSetModalChildProps) => {
};
})}
value={
- currChooseAccount.pubParams!.diffParams![AccountType.WxSph]!.activity
+ currChooseAccount.pubParams!.diffParams![PlatType.WxSph]!.activity
}
onChange={(_, value) => {
const newDiffParams = currChooseAccount.pubParams.diffParams!;
- newDiffParams[AccountType.WxSph]!.activity = value as WxSphEventList;
+ newDiffParams[PlatType.WxSph]!.activity = value as WxSphEventList;
setOnePubParams({
diffParams: newDiffParams,
});
@@ -153,12 +153,12 @@ const VideoPubSetModal_WxSph = memo(
<Input
placeholder="粘贴链接"
value={
- currChooseAccount?.pubParams.diffParams![AccountType.WxSph]!
+ currChooseAccount?.pubParams.diffParams![PlatType.WxSph]!
.extLink
}
onChange={(e) => {
const newDiffParams = currChooseAccount.pubParams.diffParams!;
- newDiffParams[AccountType.WxSph]!.extLink = e.target.value;
+ newDiffParams[PlatType.WxSph]!.extLink = e.target.value;
setOnePubParams({
diffParams: newDiffParams,
});
@@ -168,12 +168,12 @@ const VideoPubSetModal_WxSph = memo(
<h1>声明原创</h1>
<Checkbox
checked={
- currChooseAccount?.pubParams.diffParams![AccountType.WxSph]!
+ currChooseAccount?.pubParams.diffParams![PlatType.WxSph]!
.isOriginal
}
onChange={(e) => {
const newDiffParams = currChooseAccount.pubParams.diffParams!;
- newDiffParams[AccountType.WxSph]!.isOriginal = e.target.checked;
+ newDiffParams[PlatType.WxSph]!.isOriginal = e.target.checked;
setOnePubParams({
diffParams: newDiffParams,
});
diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/children/hooks/useVideoPubSetModal.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/children/hooks/useVideoPubSetModal.tsx
index b9fc74d6..373ba36e 100644
--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/children/hooks/useVideoPubSetModal.tsx
+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/children/hooks/useVideoPubSetModal.tsx
@@ -1,7 +1,7 @@
import { useVideoPageStore } from '../../../../useVideoPageStore';
import { useShallow } from 'zustand/react/shallow';
import { AccountPlatInfoMap } from '../../../../../../../account/comment';
-import { AccountType } from '../../../../../../../../../commont/AccountEnum';
+import { PlatType } from '../../../../../../../../../commont/AccountEnum';
export default function useVideoPubSetModal() {
const { setOnePubParams, currChooseAccount } = useVideoPageStore(
@@ -15,7 +15,7 @@ export default function useVideoPubSetModal() {
setOnePubParams,
platInfo: currChooseAccount?.account
? AccountPlatInfoMap.get(currChooseAccount!.account!.type)!
- : AccountPlatInfoMap.get(AccountType.Douyin)!,
+ : AccountPlatInfoMap.get(PlatType.Douyin)!,
currChooseAccount: currChooseAccount!,
};
}
diff --git a/src/views/publish/children/videoPage/useVideoPageStore.ts b/src/views/publish/children/videoPage/useVideoPageStore.ts
index 067a8c24..8b61e1d8 100644
--- a/src/views/publish/children/videoPage/useVideoPageStore.ts
+++ b/src/views/publish/children/videoPage/useVideoPageStore.ts
@@ -8,7 +8,7 @@ import { generateUUID } from '@/utils';
import { AccountInfo } from '@/views/account/comment';
import { getVideoFile, IVideoFile } from '@/components/Choose/VideoChoose';
import { accountLogin } from '@/icp/account';
-import { AccountType } from '../../../../../commont/AccountEnum';
+import { PlatType } from '../../../../../commont/AccountEnum';
import { message } from 'antd';
import {
PubStatus,
@@ -55,13 +55,13 @@ const store: IVideoPageStore = {
timingTime: undefined,
mixInfo: undefined,
diffParams: {
- [AccountType.Xhs]: {},
- [AccountType.Douyin]: {
+ [PlatType.Xhs]: {},
+ [PlatType.Douyin]: {
hotPoint: undefined,
selfDeclare: undefined,
activitys: [],
},
- [AccountType.WxSph]: {
+ [PlatType.WxSph]: {
isOriginal: false,
extLink: undefined,
activity: undefined,
@@ -559,7 +559,7 @@ export const useVideoPageStore = create(
/**
* 账户重新登录。登录成功后会自动更新该条账户数据
*/
- async accountRestart(pType: AccountType) {
+ async accountRestart(pType: PlatType) {
const res = await accountLogin(pType);
if (!res) return;
console.log(res);
diff --git a/src/views/publish/components/ChooseAccountModule/components/PlatChoose.tsx b/src/views/publish/components/ChooseAccountModule/components/PlatChoose.tsx
index 342bece5..d964c42d 100644
--- a/src/views/publish/components/ChooseAccountModule/components/PlatChoose.tsx
+++ b/src/views/publish/components/ChooseAccountModule/components/PlatChoose.tsx
@@ -9,7 +9,7 @@ import {
useState,
} from 'react';
import useCssVariables from '@/hooks/useCssVariables';
-import { AccountType } from '../../../../../../commont/AccountEnum';
+import { PlatType } from '../../../../../../commont/AccountEnum';
import { AccountInfo, AccountPlatInfoMap } from '@/views/account/comment';
import styles from '@/views/publish/components/ChooseAccountModule/chooseAccountModule.module.scss';
import {
@@ -36,13 +36,13 @@ export interface IPlatChooseRef {
// 每次关闭弹框的时候需要初始化一些状态
init: () => void;
// 设置选中平台
- setActivePlat: (activePlat: AccountType) => void;
+ setActivePlat: (activePlat: PlatType) => void;
}
export interface IPlatChooseProps {
pubType: PubType;
// 默认选择的平台
- defaultPlat?: AccountType;
+ defaultPlat?: PlatType;
onChange?: (
choosedAcounts: AccountInfo[],
choosedAcount: AccountInfo,
@@ -52,7 +52,7 @@ export interface IPlatChooseProps {
// 按平台 是否禁用多选,true=禁用,false=不禁用
disableAllSelect?: boolean;
// 可选择的平台,默认为全部
- allowPlatSet?: Set<AccountType>;
+ allowPlatSet?: Set<PlatType>;
// 是否可以取消已经选择的账户,默认为 false
isCancelChooseAccount?: boolean;
}
@@ -74,13 +74,13 @@ const PlatChoose = memo(
const cssVars = useCssVariables();
// 所有账户数据
const [accountMap, setAccountMap] = useState<
- Map<AccountType, AccountInfo[]>
+ Map<PlatType, AccountInfo[]>
>(new Map());
// 当前选择的平台
- const [activePlat, setActivePlat] = useState<AccountType | undefined>();
+ const [activePlat, setActivePlat] = useState<PlatType | undefined>();
// 当前选择的账户数据
const [choosedAcountMap, setChoosedAcountMap] = useState<
- Map<AccountType, AccountInfo[]>
+ Map<PlatType, AccountInfo[]>
>(new Map());
// 每次change操作的数据
const recentData = useRef<AccountInfo>();
@@ -92,7 +92,7 @@ const PlatChoose = memo(
// 经过 allowPlatSet 过滤后的账户数据
const accountMapLast = useMemo(() => {
- const newVal = new Map<AccountType, AccountInfo[]>();
+ const newVal = new Map<PlatType, AccountInfo[]>();
for (const [accountType, accountList] of accountMap) {
if (!allowPlatSet ? true : allowPlatSet.has(accountType)) {
newVal.set(accountType, accountList);
diff --git a/src/views/publish/components/CommonComponents/CommonScheduledTimeSelect.tsx b/src/views/publish/components/CommonComponents/CommonScheduledTimeSelect.tsx
index 7fae40cf..47edbf71 100644
--- a/src/views/publish/components/CommonComponents/CommonScheduledTimeSelect.tsx
+++ b/src/views/publish/components/CommonComponents/CommonScheduledTimeSelect.tsx
@@ -3,7 +3,7 @@ import dayjs from 'dayjs';
import { AccountPlatInfoMap } from '../../../account/comment';
import { DatePicker } from 'antd';
import styles from './commonComponents.module.scss';
-import { AccountType } from '../../../../../commont/AccountEnum';
+import { PlatType } from '../../../../../commont/AccountEnum';
export interface ICommonScheduledTimeSelectRef {}
@@ -16,7 +16,7 @@ export interface ICommonScheduledTimeSelectProps {
onChange?:
| ((date: dayjs.Dayjs, dateString: string | string[]) => void)
| undefined;
- platType?: AccountType;
+ platType?: PlatType;
isTitle?: boolean;
}
@@ -36,7 +36,7 @@ const CommonScheduledTimeSelect = memo(
) => {
const getMaxTimes = useMemo(() => {
const accountPlatInfo = AccountPlatInfoMap.get(
- platType || AccountType.Douyin,
+ platType || PlatType.Douyin,
)!;
const timingMax = accountPlatInfo.commonPubParamsConfig.timingMax;
diff --git a/src/views/publish/components/CommonComponents/DouyinCommonComponents.tsx b/src/views/publish/components/CommonComponents/DouyinCommonComponents.tsx
index f3ddefc3..24fb0d08 100644
--- a/src/views/publish/components/CommonComponents/DouyinCommonComponents.tsx
+++ b/src/views/publish/components/CommonComponents/DouyinCommonComponents.tsx
@@ -31,7 +31,7 @@ import { describeNumber } from '../../../../utils';
import { onAccountLoginFinish } from '../../../../icp/receiveMsg';
import { AccountInfo, AccountPlatInfoMap } from '../../../account/comment';
import { ILableValue } from '../../../../../electron/db/models/video';
-import { AccountType } from '../../../../../commont/AccountEnum';
+import { PlatType } from '../../../../../commont/AccountEnum';
interface DouyinCommonComponentsProps
extends Omit<SelectProps<ILableValue[]>, 'options' | 'children'> {
@@ -252,7 +252,7 @@ export const CommonActivitySelect = ({
onOk={() => {
if (value.length > props.maxCount!) {
message.warning(
- `话题和活动最多可添加 ${AccountPlatInfoMap.get(AccountType.Douyin)?.commonPubParamsConfig.topicMax} 个`,
+ `话题和活动最多可添加 ${AccountPlatInfoMap.get(PlatType.Douyin)?.commonPubParamsConfig.topicMax} 个`,
);
} else {
setActivityOpen(false);
diff --git a/src/views/publish/hooks/usePubParamsVerify.tsx b/src/views/publish/hooks/usePubParamsVerify.tsx
index 9ba709ba..c7933abb 100644
--- a/src/views/publish/hooks/usePubParamsVerify.tsx
+++ b/src/views/publish/hooks/usePubParamsVerify.tsx
@@ -6,7 +6,7 @@ import {
import { IPubParams } from '../children/videoPage/videoPage';
import { memo, useMemo } from 'react';
import { parseTopicString } from '@/utils';
-import { AccountStatus, AccountType, XhsAccountAbnormal } from '@@/AccountEnum';
+import { AccountStatus, PlatType, XhsAccountAbnormal } from '@@/AccountEnum';
import { Alert, Tooltip } from 'antd';
import { InfoCircleOutlined } from '@ant-design/icons';
@@ -25,7 +25,7 @@ export interface ErrPubParamsItem {
// 参数错误提示消息
parErrMsg?: string;
// 发生错误的平台
- plat?: AccountType;
+ plat?: PlatType;
}
export type ErrPubParamsMapType = Map<string | number, ErrPubParamsItem>;
@@ -84,7 +84,7 @@ export default function <T>(
}
// 快手要求封面必须大于 400x400
if (
- v.account?.type === AccountType.KWAI &&
+ v.account?.type === PlatType.KWAI &&
v.pubParams.cover &&
(v.pubParams.cover.width < 400 || v.pubParams.cover.height < 400)
) {
@@ -107,9 +107,9 @@ export default function <T>(
* 抖音规定活动奖励 + 话题不能超过5个
*/
if (
- v.account?.type === AccountType.Douyin &&
+ v.account?.type === PlatType.Douyin &&
topicsAll.length +
- v.pubParams.diffParams![AccountType.Douyin]!.activitys!.length >
+ v.pubParams.diffParams![PlatType.Douyin]!.activitys!.length >
topicMax
) {
return errParamsMapTemp.set(v.id, {
@@ -120,9 +120,9 @@ export default function <T>(
}
// 小红书账号异常情况处理
if (
- v.account?.type === AccountType.Xhs &&
+ v.account?.type === PlatType.Xhs &&
v.account.abnormalStatus &&
- v.account.abnormalStatus[AccountType.Xhs] ===
+ v.account.abnormalStatus[PlatType.Xhs] ===
XhsAccountAbnormal.Abnormal
) {
return errParamsMapTemp.set(v.id, {
@@ -186,7 +186,7 @@ export const PubParamsVerifyInfo = memo(
id?: string | number;
errParamsMap?: ErrPubParamsMapType;
warnParamsMap?: ErrPubParamsMapType;
- onAccountRestart: (plat?: AccountType) => void;
+ onAccountRestart: (plat?: PlatType) => void;
style?: React.CSSProperties;
}) => {
const errPubParams = useMemo(() => {
diff --git a/src/views/replyother/replyother.tsx b/src/views/replyother/replyother.tsx
index 76e60e0d..2a46fd16 100644
--- a/src/views/replyother/replyother.tsx
+++ b/src/views/replyother/replyother.tsx
@@ -63,7 +63,7 @@ import { icpCreatorList } from '@/icp/reply';
import { icpCreateInteractionOneKey } from '@/icp/replyother';
import { useUserStore } from '@/store/user';
import { taskApi } from '@/api/task';
-import {AccountType} from "@@/AccountEnum";
+import {PlatType} from "@@/AccountEnum";
export default function Page() {
const userStore = useUserStore();
@@ -906,7 +906,7 @@ export default function Page() {
<div style={{ display: 'flex', flexDirection: 'row', height: '100%' }}>
<AccountSidebar
activeAccountId={activeAccountId}
- excludePlatforms={[AccountType.WxSph]}
+ excludePlatforms={[PlatType.WxSph]}
onAccountChange={useCallback(
(info) => {
console.log('------ onAccountChange', info);
diff --git a/src/views/task/components/articleInfo.tsx b/src/views/task/components/articleInfo.tsx
index 1a69d411..3520970b 100644
--- a/src/views/task/components/articleInfo.tsx
+++ b/src/views/task/components/articleInfo.tsx
@@ -12,7 +12,7 @@ import {
CopyOutlined,
} from '@ant-design/icons';
import ChooseAccountModule from '@/views/publish/components/ChooseAccountModule/ChooseAccountModule';
-import { AccountType } from '@@/AccountEnum';
+import { PlatType } from '@@/AccountEnum';
const FILE_BASE_URL = import.meta.env.VITE_APP_FILE_HOST;
@@ -102,7 +102,7 @@ const Com = forwardRef<TaskInfoRef, TaskInfoProps>((props: any, ref) => {
platChooseProps={{
choosedAccounts: accountListChoose,
pubType: PubType.ARTICLE,
- allowPlatSet: new Set([AccountType.Douyin]),
+ allowPlatSet: new Set([PlatType.Douyin]),
}}
onPlatConfirm={async (aList) => {
console.log('账号:', aList);
diff --git a/src/views/task/components/videoInfo.tsx b/src/views/task/components/videoInfo.tsx
index 634c71bc..936407b8 100644
--- a/src/views/task/components/videoInfo.tsx
+++ b/src/views/task/components/videoInfo.tsx
@@ -26,7 +26,7 @@ import {
} from '@ant-design/icons';
import ChooseAccountModule from '@/views/publish/components/ChooseAccountModule/ChooseAccountModule';
import { ipcDownFile } from '@/icp/tools';
-import { AccountType } from '@@/AccountEnum';
+import { PlatType } from '@@/AccountEnum';
import VideoPlayer from '@/components/VideoPlayer';
const FILE_BASE_URL = import.meta.env.VITE_APP_FILE_HOST;
@@ -242,7 +242,7 @@ const Com = forwardRef<TaskInfoRef, TaskInfoProps>((props: any, ref) => {
platChooseProps={{
choosedAccounts: accountListChoose,
pubType: PubType.VIDEO,
- allowPlatSet: new Set([AccountType.Douyin]),
+ allowPlatSet: new Set([PlatType.Douyin]),
}}
onPlatConfirm={async (aList) => {
console.log('账号:', aList);