Skip to content

Let's use AI to Earn!

select accont

bulaienaofutuojiesenzhangdf2e38e906b0
diff --git a/src/components/PublishDialog/usePublishDialogData.ts b/src/components/PublishDialog/usePublishDialogData.ts
index 4d0c501c..c88a63b1 100644
--- a/src/components/PublishDialog/usePublishDialogData.ts
+++ b/src/components/PublishDialog/usePublishDialogData.ts
@@ -63,11 +63,22 @@ export const usePublishDialogData = create(
return res?.data;
},
// 获取Facebook页面列表
- async getFacebookPages() {
+ async getFacebookPages(accountId?: string) {
if (get().facebookPages.length !== 0) return;
- const facebookAccount = useAccountStore
- .getState()
- .accountList.find((v) => v.type === PlatType.Facebook);
+
+ let facebookAccount;
+
+ if (accountId) {
+ // 如果提供了账户ID,使用指定的账户
+ facebookAccount = useAccountStore
+ .getState()
+ .accountList.find((v) => v.id === accountId && v.type === PlatType.Facebook);
+ } else {
+ // 如果没有提供账户ID,使用第一个找到的Facebook账户(保持向后兼容)
+ facebookAccount = useAccountStore
+ .getState()
+ .accountList.find((v) => v.type === PlatType.Facebook);
+ }
if (!facebookAccount) {
console.warn('没有找到Facebook账户');
@@ -81,28 +92,49 @@ export const usePublishDialogData = create(
return res?.data;
},
// 获取YouTube国区列表
- async getYouTubeRegions() {
+ async getYouTubeRegions(accountId?: string) {
if (get().youTubeRegions.length !== 0) return;
- const youtubeAccount = useAccountStore
- .getState()
- .accountList.find((v) => v.type === PlatType.YouTube);
+
+ let youtubeAccount;
+
+ if (accountId) {
+ // 如果提供了账户ID,使用指定的账户
+ youtubeAccount = useAccountStore
+ .getState()
+ .accountList.find((v) => v.id === accountId && v.type === PlatType.YouTube);
+ } else {
+ // 如果没有提供账户ID,使用第一个找到的YouTube账户(保持向后兼容)
+ youtubeAccount = useAccountStore
+ .getState()
+ .accountList.find((v) => v.type === PlatType.YouTube);
+ }
if (!youtubeAccount) {
console.warn('没有找到YouTube账户');
return;
}
- const res: any = await apiGetYouTubeRegions(youtubeAccount.account);
+ const res: any = await apiGetYouTubeRegions(youtubeAccount.id);
set({
youTubeRegions: res?.data?.regionCode || [],
});
return res?.data?.regionCode;
},
// 获取YouTube视频分类
- async getYouTubeCategories(regionCode?: string) {
- const youtubeAccount = useAccountStore
- .getState()
- .accountList.find((v) => v.type === PlatType.YouTube);
+ async getYouTubeCategories(accountId?: string, regionCode?: string) {
+ let youtubeAccount;
+
+ if (accountId) {
+ // 如果提供了账户ID,使用指定的账户
+ youtubeAccount = useAccountStore
+ .getState()
+ .accountList.find((v) => v.id === accountId && v.type === PlatType.YouTube);
+ } else {
+ // 如果没有提供账户ID,使用第一个找到的YouTube账户(保持向后兼容)
+ youtubeAccount = useAccountStore
+ .getState()
+ .accountList.find((v) => v.type === PlatType.YouTube);
+ }
if (!youtubeAccount) {
console.warn('没有找到YouTube账户');
@@ -119,11 +151,22 @@ export const usePublishDialogData = create(
return res?.data;
},
// 获取Pinterest Board列表
- async getPinterestBoards(forceRefresh = false) {
+ async getPinterestBoards(forceRefresh = false, accountId?: string) {
if (!forceRefresh && get().pinterestBoards.length !== 0) return;
- const pinterestAccount = useAccountStore
- .getState()
- .accountList.find((v) => v.type === PlatType.Pinterest);
+
+ let pinterestAccount;
+
+ if (accountId) {
+ // 如果提供了账户ID,使用指定的账户
+ pinterestAccount = useAccountStore
+ .getState()
+ .accountList.find((v) => v.id === accountId && v.type === PlatType.Pinterest);
+ } else {
+ // 如果没有提供账户ID,使用第一个找到的Pinterest账户(保持向后兼容)
+ pinterestAccount = useAccountStore
+ .getState()
+ .accountList.find((v) => v.type === PlatType.Pinterest);
+ }
if (!pinterestAccount) {
console.warn('没有找到Pinterest账户');