Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat: 小红书、抖音、视频号前端及发布 @用户 添加,视频号添加活动参数
gaoSir320c2db764e1
diff --git a/electron/db/models/video.ts b/electron/db/models/video.tsindex 0fb208e7..d9e5c8a8 100644--- a/electron/db/models/video.ts+++ b/electron/db/models/video.ts@@ -12,7 +12,7 @@ import {VisibleTypeEnum,} from '../../../commont/publish/PublishEnum';import { AccountType } from '../../../commont/AccountEnum';-import type { ILocationDataItem } from '../../main/plat/plat.type';+import type { ILocationDataItem, WxSphEvent } from '../../main/plat/plat.type';// 包含一个name和一个value的对象export interface ILableValue {@@ -47,7 +47,7 @@ export type DiffParmasType = {// 扩展链接extLink?: string;// 活动- activity?: ILableValue;+ activity?: WxSphEvent;};[AccountType.KWAI]?: {};};@@ -106,6 +106,10 @@ export class VideoModel extends WorkData {@Column({ type: 'datetime', nullable: true, comment: '定时发布日期' })timingTime?: Date;+ // @用户+ @Column({ type: 'json', nullable: true, comment: '@用户数组' })+ mentionedUserInfo?: ILableValue[];+// 视频可见性@Column({type: 'tinyint',diff --git a/electron/main/plat/PlatformBase.ts b/electron/main/plat/PlatformBase.tsindex a5e6460d..88bb9530 100644--- a/electron/main/plat/PlatformBase.ts+++ b/electron/main/plat/PlatformBase.ts@@ -13,11 +13,12 @@ import {IGetLocationResponse,IGetTopicsParams,IGetTopicsResponse,+ IGetUsersParams, IGetUsersResponse,IVideoPublishParams,StatisticsData,VideoCallbackType,- WorkData,-} from './plat.type';+ WorkData+} from "./plat.type";import { PublishVideoResult } from './module';import { AccountType } from '../../../commont/AccountEnum';import { AccountModel } from '../../db/models/account';@@ -89,4 +90,7 @@ export abstract class PlatformBase {abstract getLocationData(params: IGetLocationDataParams,): Promise<IGetLocationResponse>;++ // 获取@用户数据+ abstract getUsers(params: IGetUsersParams): Promise<IGetUsersResponse>;}diff --git a/electron/main/plat/index.ts b/electron/main/plat/index.tsindex 3e5fdf5d..1af1c107 100644--- a/electron/main/plat/index.ts+++ b/electron/main/plat/index.ts@@ -11,7 +11,7 @@ import kwai from './platforms/Kwai';import xhs from './platforms/xhs';import douyin from './platforms/douyin';import wxSph from './platforms/wxSph';-import { IAccountInfoParams, IGetLocationDataParams } from './plat.type';+import { IAccountInfoParams, IGetLocationDataParams, IGetUsersParams } from "./plat.type";import { PublishVideoResult } from './module';import { VideoModel } from '../../db/models/video';import { PubItemVideo } from './pub/PubItemVideo';@@ -131,6 +131,12 @@ class PlatController {cookie: JSON.parse(params.account!.loginCookie),});}++ // 获取用户数据+ public async getUsers(params: IGetUsersParams) {+ const platform = this.platforms.get(params.account!.type)!;+ return await platform.getUsers(params);+ }}const platController = new PlatController();diff --git a/electron/main/plat/plat.type.ts b/electron/main/plat/plat.type.tsindex ca0e5671..e806efa2 100644--- a/electron/main/plat/plat.type.ts+++ b/electron/main/plat/plat.type.ts@@ -7,7 +7,7 @@*/import { AccountModel } from '../../db/models/account';import { VisibleTypeEnum } from '../../../commont/publish/PublishEnum';-import { DiffParmasType } from '../../db/models/video';+import { DiffParmasType, ILableValue } from '../../db/models/video';export type CookiesType = Electron.Cookie[];@@ -50,6 +50,13 @@ export type WorkData = {// 视频发布进度回调函数类型export type VideoCallbackType = (progress: number, msg?: string) => void;+// 微信视频号活动+export interface WxSphEvent {+ eventCreatorNickname: string;+ eventTopicId: string;+ eventName: string;+}+// 发布视频入参export interface IVideoPublishParams {// 调用该平台的cookies@@ -72,9 +79,34 @@ export interface IVideoPublishParams {timingTime?: Date;// 地点location?: ILocationDataItem;+ // @用户+ mentionedUserInfo?: ILableValue[];other?: any;}+// 获取用户参数+export interface IGetUsersParams {+ keyword: string;+ account: AccountModel;+ page: number;+}++// 获取用户返回值+export interface IGetUsersResponse {+ status: number;+ data?: IUsersItem[];+}++// 用户数据+export interface IUsersItem {+ image: string;+ id: string;+ name: string;+ des?: string;+ unique_id?: string;+ follower_count?: number;+}+// 获取话题返回值export interface IGetTopicsResponse {status: number;diff --git a/electron/main/plat/platforms/Kwai/index.ts b/electron/main/plat/platforms/Kwai/index.tsindex 9750b209..bd8bb79a 100644--- a/electron/main/plat/platforms/Kwai/index.ts+++ b/electron/main/plat/platforms/Kwai/index.ts@@ -12,6 +12,7 @@ import {IGetLocationDataParams,IGetTopicsParams,IGetTopicsResponse,+ IGetUsersParams,IVideoPublishParams,VideoCallbackType,} from '../../plat.type';@@ -137,6 +138,13 @@ export class Kwai extends PlatformBase {};}+ async getUsers(params: IGetUsersParams) {+ return {+ status: 400,+ data: [],+ };+ }+async getLocationData(params: IGetLocationDataParams) {return {status: 400,diff --git a/electron/main/plat/platforms/douyin/index.ts b/electron/main/plat/platforms/douyin/index.tsindex 14711ffe..2c87312e 100644--- a/electron/main/plat/platforms/douyin/index.ts+++ b/electron/main/plat/platforms/douyin/index.ts@@ -14,6 +14,7 @@ import {IGetLocationDataParams,IGetTopicsParams,IGetTopicsResponse,+ IGetUsersParams,IVideoPublishParams,VideoCallbackType,} from '../../plat.type';@@ -204,6 +205,27 @@ export class Douyin extends PlatformBase {};}+ async getUsers(params: IGetUsersParams) {+ const usersRes = await douyinService.getUsers(+ JSON.parse(params.account.loginCookie),+ params.keyword,+ params.page,+ );+ return {+ status: usersRes.data.status_code === 8 ? 401 : usersRes.status,+ data: usersRes.data.user_list.map((v) => {+ return {+ image: 'https://p26.douyinpic.com/aweme/' + v.avatar_thumb.uri,+ id: v.uid,+ name: v.nickname,+ unique_id: v.unique_id,+ des: '',+ follower_count: v.follower_count,+ };+ }),+ };+ }+async getLocationData(params: IGetLocationDataParams) {const locationRes = await douyinService.getLocation({...params,diff --git a/electron/main/plat/platforms/wxSph/index.ts b/electron/main/plat/platforms/wxSph/index.tsindex 79f3814d..6e2c5e01 100644--- a/electron/main/plat/platforms/wxSph/index.ts+++ b/electron/main/plat/platforms/wxSph/index.ts@@ -14,6 +14,7 @@ import {IGetLocationDataParams,IGetTopicsParams,IGetTopicsResponse,+ IGetUsersParams,IVideoPublishParams,VideoCallbackType,} from '../../plat.type';@@ -125,6 +126,27 @@ export class WxSph extends PlatformBase {return {};}+ async getUsers(params: IGetUsersParams) {+ const usersRes = await shipinhaoService.getUsers(+ JSON.parse(params.account.loginCookie),+ params.keyword,+ params.page,+ );+ return {+ status:+ usersRes.data.errCode === 300334 || usersRes.data.errCode === 300333+ ? 401+ : usersRes.status,+ data: usersRes.data.data.list.map((v) => {+ return {+ image: v.headImgUrl,+ id: v.username,+ name: v.nickName,+ };+ }),+ };+ }+async videoPublish(params: IVideoPublishParams,callback: VideoCallbackType,@@ -151,6 +173,16 @@ export class WxSph extends PlatformBase {},}: {}),+ // @用户+ mentionedUserInfo: params.mentionedUserInfo+ ? params.mentionedUserInfo.map((v) => {+ return {+ nickName: v.label,+ };+ })+ : undefined,+ // 活动+ event: params.diffParams![AccountType.WxSph]!.activity,},callback,);@@ -191,7 +223,7 @@ export class WxSph extends PlatformBase {return {name: v.name,simpleAddress: v.fullAddress,- id: v.poiCheckSum,+ id: v.uid,latitude: v.latitude,longitude: v.longitude,city: v.city,diff --git a/electron/main/plat/platforms/xhs/index.ts b/electron/main/plat/platforms/xhs/index.tsindex cfe1f6c5..575e6caf 100644--- a/electron/main/plat/platforms/xhs/index.ts+++ b/electron/main/plat/platforms/xhs/index.ts@@ -14,6 +14,7 @@ import {IGetLocationDataParams,IGetTopicsParams,IGetTopicsResponse,+ IGetUsersParams,IVideoPublishParams,VideoCallbackType,} from '../../plat.type';@@ -156,16 +157,23 @@ export class Xhs extends PlatformBase {timingTime: params.timingTime?.getTime(),privacy: params.visibleType !== VisibleTypeEnum.Public,// 位置- ...(params.location+ poiInfo: params.location? {- poiInfo: {- poiType: params.location.poi_type!,- poiId: params.location.id,- poiName: params.location.name,- poiAddress: params.location.simpleAddress,- },+ poiType: params.location.poi_type!,+ poiId: params.location.id,+ poiName: params.location.name,+ poiAddress: params.location.simpleAddress,}- : {}),+ : undefined,+ // @用户+ mentionedUserInfo: params.mentionedUserInfo+ ? params.mentionedUserInfo.map((v) => {+ return {+ nickName: v.label,+ uid: `${v.value}`,+ };+ })+ : undefined,},callback,)@@ -192,6 +200,24 @@ export class Xhs extends PlatformBase {});}+ async getUsers(params: IGetUsersParams) {+ const usersRes = await xiaohongshuService.getUsers(+ JSON.parse(params.account.loginCookie),+ params.keyword,+ params.page,+ );+ return {+ status: usersRes.status,+ data: usersRes?.data?.data?.user_info_dtos?.map((v) => {+ return {+ image: v.user_base_dto.image,+ id: v.user_base_dto.red_id,+ name: v.user_base_dto.user_nickname,+ };+ }),+ };+ }+async getTopics({keyword,account,@@ -200,7 +226,6 @@ export class Xhs extends PlatformBase {keyword,cookies: JSON.parse(account.loginCookie),});- console.log(res);return {status: res.status,data: res?.data?.data?.topic_info_dtos?.map((v) => {diff --git a/electron/main/plat/pub/PubItemVideo.ts b/electron/main/plat/pub/PubItemVideo.tsindex c7112021..af82b409 100644--- a/electron/main/plat/pub/PubItemVideo.ts+++ b/electron/main/plat/pub/PubItemVideo.ts@@ -44,6 +44,7 @@ export class PubItemVideo extends PubItemBase {async publishVideo() {const publishVideoResult = await this.platform.videoPublish({+ ...this.videoModel,cookies: JSON.parse(this.accountModel.loginCookie),desc: this.videoModel.desc!,videoPath: this.videoModel.videoPath!,diff --git a/electron/main/publish/controller.ts b/electron/main/publish/controller.tsindex 93368ece..be064077 100644--- a/electron/main/publish/controller.ts+++ b/electron/main/publish/controller.ts@@ -16,7 +16,10 @@ import { VideoPubService } from './video/service';import { VideoModel } from '../../db/models/video';import platController from '../plat';import { AccountModel } from '../../db/models/account';-import type { IGetLocationDataParams } from '../plat/plat.type';+import type {+ IGetLocationDataParams,+ IGetUsersParams,+} from '../plat/plat.type';import { douyinService } from '../../plat/douyin';import { shipinhaoService } from '../../plat/shipinhao';@@ -158,6 +161,12 @@ export class PublishController {return await platController.getLocationData(params);}+ // 获取所有平台的用户数据+ @Icp('ICP_PUBLISH_GET_USERS')+ async getUsers(event: Electron.IpcMainInvokeEvent, params: IGetUsersParams) {+ return await platController.getUsers(params);+ }+// 获取抖音热点数据@Icp('ICP_PUBLISH_GET_DOYTIN_HOT')async getDoytinHot(diff --git a/electron/plat/douyin/douyin.type.ts b/electron/plat/douyin/douyin.type.tsindex f63c0edf..13ddd90c 100644--- a/electron/plat/douyin/douyin.type.ts+++ b/electron/plat/douyin/douyin.type.ts@@ -218,6 +218,64 @@ interface ActivityInfo {show_start_time: string;}+interface DouyinUser {+ avatar_larger: Avatar;+ avatar_medium: Avatar;+ avatar_thumb: Avatar;+ aweme_count: number;+ card_entries: any;+ custom_verify: string;+ enterprise_verify_reason: string;+ favoriting_count: number;+ follow_status: number;+ follower_count: number;+ follower_status: number;+ followers_detail: any;+ following_count: number;+ geofencing: any;+ has_orders: boolean;+ is_ad_fake: boolean;+ is_gov_media_vip: boolean;+ mix_info: any;+ nickname: string;+ original_musician: OriginalMusician;+ platform_sync_info: any;+ policy_version: any;+ rate: number;+ region: string;+ sec_uid: string;+ secret: number;+ short_id: string;+ signature: string;+ status: number;+ story_open: boolean;+ total_favorited: string;+ type_label: any[];+ uid: string;+ unique_id: string;+ user_canceled: boolean;+ verification_type: number;+ video_icon: VideoIcon;+ with_commerce_entry: boolean;+ with_fusion_shop_entry: boolean;+ with_shop_entry: boolean;+}++interface Avatar {+ uri: string;+ url_list: string[];+}++interface OriginalMusician {+ music_count: number;+ music_used_count: number;+}++interface VideoIcon {+ uri: string;+ url_list: string[];+}+export interface DemoVideo {aweme_id: string;cha_list?: any;@@ -324,3 +382,14 @@ export interface DouyinLocationDataResponse {status_msg: string;user_interest_city_code_list: any;}++// 抖音用户数据+export interface DouyinUserListResponse {+ challenge_list: any[];+ cursor: number;+ extra: Extra;+ has_more: boolean;+ scene: number;+ status_code: number;+ user_list: DouyinUser[];+}diff --git a/electron/plat/douyin/index.ts b/electron/plat/douyin/index.tsindex a8b4dced..b39db109 100644--- a/electron/plat/douyin/index.ts+++ b/electron/plat/douyin/index.ts@@ -15,6 +15,7 @@ import {DouyinHotDataResponse,DouyinLocationDataResponse,DouyinTopicsSugResponse,+ DouyinUserListResponse,} from './douyin.type';import requestNet from '../requestNet';import { jsonToQueryString } from '../../util';@@ -1686,7 +1687,7 @@ export class DouyinService {// 处理话题if (platformSetting.hasOwnProperty('topics') &&- platformSetting.topics.length > 0+ platformSetting.topics?.length > 0) {console.log('处理话题标签...');for (const topic of platformSetting.topics) {@@ -1713,7 +1714,7 @@ export class DouyinService {// 处理@好友if (platformSetting.hasOwnProperty('mentionedUserInfo') &&- platformSetting.mentionedUserInfo.length > 0+ platformSetting.mentionedUserInfo?.length > 0) {console.log('处理@好友...');for (const userInfo of platformSetting.mentionedUserInfo) {@@ -2129,6 +2130,17 @@ export class DouyinService {method: 'GET',});}++ // 获取@的用户+ async getUsers(cookie: Electron.Cookie[], keyword: string, page: number) {+ return await requestNet<DouyinUserListResponse>({+ url: `https://creator.douyin.com/web/api/v2/discover/search/?search_source=publish_web&count=10&keyword=${keyword}&cursor=${(page - 1) * 10}&scene=1`,+ headers: {+ cookie: CookieToString(cookie),+ },+ method: 'GET',+ });+ }}// 导出服务实例diff --git a/electron/plat/shipinhao/index.ts b/electron/plat/shipinhao/index.tsindex a2884afc..8c72be7d 100644--- a/electron/plat/shipinhao/index.ts+++ b/electron/plat/shipinhao/index.ts@@ -4,7 +4,11 @@ import path from 'path';import { FileUtils } from '../../util/file';import { CookieToString, getFileContent } from '../utils';import requestNet from '../requestNet';-import { WeChatLocationData, WeChatVideoApiResponse } from './wxShp.type';+import {+ WeChatLocationData,+ WeChatVideoApiResponse,+ WeChatVideoUserData,+} from './wxShp.type';interface UserInfo {authorId: string;@@ -24,58 +28,6 @@ interface UploadArguments {[key: string]: any;}-interface RequestData {- objectType: number;- longitude: number;- latitude: number;- feedLongitude: number;- feedLatitude: number;- originalFlag: number;- topics: string[];- isFullPost: number;- handleFlag: number;- videoClipTaskId: any;- traceInfo: {- traceKey: string;- uploadCdnStart: number;- uploadCdnEnd: number;- };- objectDesc: {- mpTitle: string;- description: string;- extReading: Record<string, any>;- mediaType: number;- location: Record<string, any>;- topic: Record<string, any>;- event: Record<string, any>;- mentionedUser: Array<{ nickname: string }>;- media: Array<{- url: string;- fileSize: number;- thumbUrl: string;- fullThumbUrl: string;- mediaType: number;- videoPlayLen: number;- width: number;- height: number;- md5sum: string;- coverUrl: string;- fullCoverUrl: string;- urlCdnTaskId: string;- }>;- member: Record<string, any>;- };- postFlag: number;- mode: number;- clientid: string;- timestamp: number;- rawKeyBuff: null;- pluginSessionId: null;- scene: number;- reqScene: number;- effectiveTime?: number;-}-export class ShipinhaoService {private defaultUserAgent ='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36';@@ -1016,17 +968,7 @@ export class ShipinhaoService {startUploadTime: number,endUploadTime: number,clipResult: any,- platformSetting: {- cover: string;- mentionedUserInfo: {- nickName?: string;- }[];- title?: string;- topics: string[];- mixInfo?: any;- poiInfo?: any;- timingTime?: any;- },+ platformSetting: any,): Promise<string> {return new Promise(async (resolve, reject) => {try {@@ -1036,7 +978,7 @@ export class ShipinhaoService {const mentionedUser = [];if (platformSetting.hasOwnProperty('topics') &&- platformSetting.topics.length > 0+ platformSetting.topics?.length > 0) {for (const topic of platformSetting.topics) {description += ` #${topic}`;@@ -1045,7 +987,7 @@ export class ShipinhaoService {}if (platformSetting.hasOwnProperty('mentionedUserInfo') &&- platformSetting.mentionedUserInfo.length > 0+ platformSetting.mentionedUserInfo?.length > 0) {for (const userInfo of platformSetting.mentionedUserInfo) {if (@@ -1113,7 +1055,7 @@ export class ShipinhaoService {mediaType: 4,location: poiInfo,topic: topicMix,- event: {},+ event: platformSetting['event'] || {},mentionedUser: mentionedUser,media: [{@@ -1241,6 +1183,16 @@ export class ShipinhaoService {poiAddress: string;poiId: string;};+ // @的用户+ mentionedUserInfo?: {+ nickName?: string;+ }[];+ // 活动+ event?: {+ eventCreatorNickname: string;+ eventTopicId: string;+ eventName: string;+ };},callback: (progress: number, msg?: string) => void,): Promise<{@@ -1298,7 +1250,6 @@ export class ShipinhaoService {...platformSetting,cover: platformSetting.cover,title: platformSetting.title,- mentionedUserInfo: [],topics: platformSetting.topics ? platformSetting.topics : [],},);@@ -1353,6 +1304,23 @@ export class ShipinhaoService {},});}++ // 获取@用户列表+ async getUsers(cookie: Electron.Cookie[], keyword: string, page: number) {+ return await requestNet<WeChatVideoUserData>({+ url: `https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/helper/helper_search_finder_account`,+ headers: {+ cookie: CookieToString(cookie),+ },+ method: 'POST',+ body: {+ pageSize: 10,+ currentPage: page,+ offset: (page - 1) * 10,+ query: keyword,+ },+ });+ }}// 导出服务实例diff --git a/electron/plat/shipinhao/wxShp.type.ts b/electron/plat/shipinhao/wxShp.type.tsindex 8242ef8c..f1f77ec5 100644--- a/electron/plat/shipinhao/wxShp.type.ts+++ b/electron/plat/shipinhao/wxShp.type.ts@@ -50,4 +50,21 @@ export interface WeChatLocationData {address: Location;continueFlag: number;};-}\ No newline at end of file+}++interface WeChatVideoUser {+ username: string;+ headImgUrl: string;+ nickName: string;+ authImgUrl: string;+ authCompanyName: string;+}++export interface WeChatVideoUserData {+ errCode: number;+ errMsg: string;+ data: {+ list: WeChatVideoUser[];+ totalCount: number;+ };+}diff --git a/electron/plat/xiaohongshu/index.ts b/electron/plat/xiaohongshu/index.tsindex c85ccbb4..d70f94cc 100644--- a/electron/plat/xiaohongshu/index.ts+++ b/electron/plat/xiaohongshu/index.ts@@ -5,7 +5,11 @@ import { CommonUtils } from '../../util/common';import { FileUtils } from '../../util/file';import { CookieToString, getFileContent } from '../utils';import requestNet from '../requestNet';-import { IXHSLocationResponse, IXHSTopicsResponse } from './xiaohongshu.type';+import {+ IXHSLocationResponse,+ IXHSTopicsResponse,+ XiaohongshuApiResponse,+} from './xiaohongshu.type';export class XiaohongshuService {private defaultUserAgent =@@ -601,7 +605,7 @@ export class XiaohongshuService {let remoteVideoId = '';// 开始上传文件- if (filePartInfo.blockInfo.length === 1) {+ if (filePartInfo.blockInfo?.length === 1) {// 获取文件内容const fileContent = await FileUtils.getFilePartContent(filePath,@@ -965,7 +969,7 @@ export class XiaohongshuService {const hashTag = [];if (platformSetting.hasOwnProperty('topicsDetail') &&- platformSetting.topicsDetail.length > 0+ platformSetting.topicsDetail?.length > 0) {for (const topicInfo of platformSetting.topicsDetail) {description += ` #${topicInfo.topicName}[话题]# `;@@ -980,7 +984,7 @@ export class XiaohongshuService {const ats = [];if (platformSetting.hasOwnProperty('mentionedUserInfo') &&- platformSetting.mentionedUserInfo.length > 0+ platformSetting.mentionedUserInfo?.length > 0) {for (const userInfo of platformSetting.mentionedUserInfo) {if (@@ -1140,6 +1144,11 @@ export class XiaohongshuService {desc?: string;// 定时发布timingTime?: number;+ // @用户+ mentionedUserInfo?: {+ nickName: string;+ uid: string;+ }[];// 话题topicsDetail?: {topicId: string;@@ -1319,6 +1328,27 @@ export class XiaohongshuService {},});}++ // 获取@用户列表+ async getUsers(cookie: Electron.Cookie[], keyword: string, page: number) {+ return await requestNet<XiaohongshuApiResponse>({+ url: `https://edith.xiaohongshu.com/web_api/sns/v1/search/user_info`,+ headers: {+ cookie: CookieToString(cookie),+ Referer: this.loginUrl,+ origin: this.loginUrl,+ },+ method: 'POST',+ body: {+ keyword,+ search_id: '',+ page: {+ page_size: 10,+ page,+ },+ },+ });+ }}// 导出服务实例diff --git a/electron/plat/xiaohongshu/xiaohongshu.type.ts b/electron/plat/xiaohongshu/xiaohongshu.type.tsindex a436b263..e0350421 100644--- a/electron/plat/xiaohongshu/xiaohongshu.type.ts+++ b/electron/plat/xiaohongshu/xiaohongshu.type.ts@@ -40,6 +40,39 @@ interface LocationData {search_context: string;}+interface XiaohongshuUserBaseDTO {+ desc: string;+ image_size_large: string;+ followed: boolean;+ show_red_official_verify_icon: boolean;+ red_id: string;+ user_id: string;+ user_nickname: string;+ image: string;+ red_official_verified: boolean;+ red_official_verify_type: number;+}++interface XiaohongshuUserInfoDTO {+ user_base_dto: XiaohongshuUserBaseDTO;+ fans_total: number;+ discovery_total: number;+}++interface XiaohongshuResult {+ success: boolean;+ code: number;+ message: string;+}++interface XiaohongshuData {+ result: XiaohongshuResult;+ user_info_dtos: XiaohongshuUserInfoDTO[];+}++// 搜索用户+export type XiaohongshuApiResponse = CommonResponse<XiaohongshuData>;+// 话题列表返回值export type IXHSTopicsResponse = CommonResponse<TopicsData>;diff --git a/src/icp/publish.ts b/src/icp/publish.tsindex fce90c63..8b19e189 100644--- a/src/icp/publish.ts+++ b/src/icp/publish.ts@@ -15,6 +15,8 @@ import {type IGetLocationDataParams,IGetLocationResponse,IGetTopicsResponse,+ type IGetUsersParams,+ IGetUsersResponse,} from '../../electron/main/plat/plat.type';import { AccountInfo } from '@/views/account/comment';import { AccountModel } from '../../electron/db/models/account';@@ -249,3 +251,12 @@ export async function getSphActivity(account: AccountModel, query: string) {);return res;}++// 获取所有平台的用户数据+export async function icpGetUsers(params: IGetUsersParams) {+ const res: IGetUsersResponse = await window.ipcRenderer.invoke(+ 'ICP_PUBLISH_GET_USERS',+ params,+ );+ return res;+}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.tsxindex 55ed38c6..4ef0bac4 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@@ -38,6 +38,7 @@ import {import styles from '../components/videoPubSetModalCommon.module.scss';import { describeNumber } from '@/utils';import { onAccountLoginFinish } from '@/icp/receiveMsg';+import UserSelect from '../components/UserSelect';const { TextArea } = Input;@@ -347,6 +348,12 @@ const VideoPubSetModal_KWAI = memo(tips="最多可添加5个话题(包含活动奖励)"/>+ <UserSelect+ currChooseAccount={currChooseAccount}+ maxCount={10}+ tips="您可以@10个视频号"+ />+<ActivitySelect currChooseAccount={currChooseAccount} /><LocationSelect currChooseAccount={currChooseAccount} />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.tsxindex c9f222a0..c471ff75 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@@ -17,6 +17,7 @@ import {import { getSphActivity } from '@/icp/publish';import { ipcUpdateAccountStatus } from '@/icp/account';import { WxSphEventList } from '../../../../../../../../electron/plat/shipinhao/wxShp.type';+import UserSelect from '../components/UserSelect';const { TextArea } = Input;@@ -57,6 +58,7 @@ const WXSphActivity = ({ currChooseAccount }: IVideoPubSetModalChildProps) => {notFoundContent={fetching ? <Spin size="small" /> : null}options={options?.map((v) => {return {+ ...v,label: v.eventName,value: v.eventTopicId,};@@ -64,9 +66,9 @@ const WXSphActivity = ({ currChooseAccount }: IVideoPubSetModalChildProps) => {value={currChooseAccount.pubParams!.diffParams![AccountType.WxSph]!.activity}- onChange={(newValue) => {+ onChange={(_, value) => {const newDiffParams = currChooseAccount.pubParams.diffParams!;- newDiffParams[AccountType.WxSph]!.activity = newValue;+ newDiffParams[AccountType.WxSph]!.activity = value as WxSphEventList;setOnePubParams({diffParams: newDiffParams,@@ -174,6 +176,12 @@ const VideoPubSetModal_KWAI = memo(您可添加10个标签,按回车键确认</p>+ <UserSelect+ currChooseAccount={currChooseAccount}+ maxCount={100}+ tips="您可以添加100个好友"+ />+<LocationSelect currChooseAccount={currChooseAccount} /><WXSphActivity currChooseAccount={currChooseAccount} />@@ -199,7 +207,7 @@ const VideoPubSetModal_KWAI = memo(<h1>声明原创</h1><Checkbox- value={+ checked={currChooseAccount?.pubParams.diffParams![AccountType.WxSph]!.isOriginal}diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_XSH.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_XSH.tsxindex 31f3a61a..5fdcc6e4 100644--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_XSH.tsx+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/children/VideoPubSetModal_XSH.tsx@@ -10,6 +10,7 @@ import { VisibleTypeEnum } from '@@/publish/PublishEnum';import TopicSelect from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/TopicSelect';import LocationSelect from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/LocationSelect';import { ScheduledTimeSelect } from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/VideoPubSetModalCommon';+import UserSelect from '../components/UserSelect';const { TextArea } = Input;@@ -68,6 +69,8 @@ const VideoPubSetModal_KWAI = memo(tips="您可以添加20个话题"/>+ <UserSelect currChooseAccount={currChooseAccount} />+<LocationSelect currChooseAccount={currChooseAccount} /><h1>权限设置</h1>diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/components/TopicSelect.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/components/TopicSelect.tsxindex 321107c9..4a992bd3 100644--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/components/TopicSelect.tsx+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/components/TopicSelect.tsx@@ -27,7 +27,7 @@ export default function TopicSelect<const { fetching, options, debounceFetcher } = useDebounceFetcher<ValueType>(async (keyword: string): Promise<ValueType[]> => {const topics = await icpGetTopic(currChooseAccount.account!, keyword);- if (topics.status !== 200) {+ if (topics.status !== 200 && topics.status !== 201) {if (topics.status === 401) {currChooseAccount.account!.status = AccountStatus.DISABLE;updateAccounts({ accounts: [currChooseAccount.account!] });diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/components/UserSelect.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/components/UserSelect.tsxnew file mode 100644index 00000000..e61efe94--- /dev/null+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/components/UserSelect.tsx@@ -0,0 +1,128 @@+import React, { useEffect } from 'react';+import { Avatar, Select, SelectProps, Spin } from 'antd';+import { useVideoPageStore } from '@/views/publish/children/videoPage/useVideoPageStore';+import { useShallow } from 'zustand/react/shallow';+import { IUsersItem } from '../../../../../../../../electron/main/plat/plat.type';+import useDebounceFetcher from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/useDebounceFetcher';+import { IVideoChooseItem } from '@/views/publish/children/videoPage/videoPage';+import styles from './videoPubSetModalCommon.module.scss';+// @ts-ignore+import { VideoPubRestartLogin } from '@/views/publish/children/videoPage/components/VideoPubSetModal/components/VideoPubSetModalCommon';+import { icpGetUsers } from '../../../../../../../icp/publish';+import { AccountStatus } from '../../../../../../../../commont/AccountEnum';+import { ipcUpdateAccountStatus } from '../../../../../../../icp/account';+import { describeNumber } from '../../../../../../../utils';++interface DebounceSelectProps<ValueType = any>+ extends Omit<SelectProps<ValueType | ValueType[]>, 'options' | 'children'> {+ currChooseAccount: IVideoChooseItem;+ tips?: string;+}++// 话题选择器+export default function UserSelect({+ currChooseAccount,+ ...props+}: DebounceSelectProps<IUsersItem>) {+ const { setOnePubParams, updateAccounts } = useVideoPageStore(+ useShallow((state) => ({+ setOnePubParams: state.setOnePubParams,+ updateAccounts: state.updateAccounts,+ })),+ );+ const { fetching, options, debounceFetcher } = useDebounceFetcher<IUsersItem>(+ async (keywords) => {+ const res = await icpGetUsers({+ page: 1,+ keyword: keywords,+ account: currChooseAccount.account!,+ });+ if (res.status !== 200 && res.status !== 201) {+ if (res.status === 401) {+ currChooseAccount.account!.status = AccountStatus.DISABLE;+ updateAccounts({ accounts: [currChooseAccount.account!] });+ await ipcUpdateAccountStatus(+ currChooseAccount.account!.id,+ AccountStatus.DISABLE,+ );+ }+ return [];+ }+ console.log(res);+ return res.data || [];+ },+ );++ useEffect(() => {}, []);++ return (+ <>+ <h1>@好友</h1>+ <Select+ showSearch+ allowClear+ style={{ width: '100%' }}+ mode="multiple"+ placeholder="输入关键词搜索"+ labelInValue+ filterOption={false}+ onSearch={debounceFetcher}+ notFoundContent={fetching ? <Spin size="small" /> : null}+ fieldNames={{+ label: 'name',+ value: 'id',+ }}+ {...props}+ options={options}+ optionRender={({ data }) => {+ return (+ <div className={styles.usersSelect}>+ <Avatar src={data.image} />+ <div className="usersSelect-con">+ <div className="usersSelect-con-name">{data.name}</div>+ {(data.unique_id || data.follower_count) && (+ <div className="usersSelect-con-footer">+ <div className="usersSelect-con-footer-follower">+ 粉丝数:{describeNumber(data.follower_count || 0)}+ </div>+ {data.unique_id && (+ <div className="usersSelect-con-footer-unique">+ 抖音号:{data.unique_id}+ </div>+ )}+ </div>+ )}+ </div>+ </div>+ );+ }}+ value={+ currChooseAccount.pubParams!.mentionedUserInfo?.map((v) => {+ return {+ ...v,+ id: v.value,+ name: v.label,+ };+ }) as any+ }+ onChange={(_, value) => {+ setOnePubParams(+ {+ mentionedUserInfo: value+ ? (value as IUsersItem[]).map((v) => {+ return {+ value: v.id,+ label: v.name,+ };+ })+ : undefined,+ },+ currChooseAccount.id,+ );+ }}+ />+ {props.tips && <p className="videoPubSetModal_con-tips">{props.tips}</p>}+ <VideoPubRestartLogin currChooseAccount={currChooseAccount} />+ </>+ );+}diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/components/videoPubSetModalCommon.module.scss b/src/views/publish/children/videoPage/components/VideoPubSetModal/components/videoPubSetModalCommon.module.scssindex c1bd651c..1a01bc02 100644--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/components/videoPubSetModalCommon.module.scss+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/components/videoPubSetModalCommon.module.scss@@ -135,4 +135,29 @@}}}+}++.usersSelect {+ display: flex;+ padding: 3px 0;+ align-items: center;+ :global {+ .usersSelect-con {+ margin-left: 10px;+ &-name {+ font-size: var(--fs-md);+ }+ &-footer {+ margin-top: 5px;+ font-size: var(--fs-xs);+ display: flex;+ &-follower {+ color: var(--lightGreyColor);+ }+ &-unique {+ margin-left: 20px;+ }+ }+ }+ }}\ No newline at end of filediff --git a/src/views/publish/children/videoPage/useVideoPageStore.ts b/src/views/publish/children/videoPage/useVideoPageStore.tsindex e4041408..3711cc14 100644--- a/src/views/publish/children/videoPage/useVideoPageStore.ts+++ b/src/views/publish/children/videoPage/useVideoPageStore.ts@@ -341,10 +341,7 @@ export const useVideoPageStore = create(const findedData = newValue.find((v) => v.id === id);if (findedData) {for (const key in pubParmas) {- if (- pubParmas[key as 'title'] !== undefined ||- pubParmas[key as 'title'] === ''- ) {+ if (pubParmas.hasOwnProperty(key)) {findedData.pubParams[key as 'title'] =pubParmas[key as 'title'];}diff --git a/src/views/publish/children/videoPage/videoPage.d.ts b/src/views/publish/children/videoPage/videoPage.d.tsindex af0731aa..cdcee18a 100644--- a/src/views/publish/children/videoPage/videoPage.d.ts+++ b/src/views/publish/children/videoPage/videoPage.d.ts@@ -4,6 +4,7 @@ import { IImgFile } from '@/components/Choose/ImgChoose';import { VisibleTypeEnum } from '@@/publish/PublishEnum';import {DiffParmasType,+ ILableValue,TopicsArrType,} from '../../../../../electron/db/models/video';import { ILocationDataItem } from '../../../../../electron/main/plat/plat.type';@@ -25,6 +26,8 @@ export interface IPubParams {location?: ILocationDataItem;// 定时发布日期timingTime?: Date | null;+ // @用户+ mentionedUserInfo?: ILableValue[];}// 选择视频的每项数据