Ver Fonte

Merge remote-tracking branch 'origin/fix/bug-6075-6072-6071-6070-6066'

ethanfly há 4 dias atrás
pai
commit
9e1f48d3f1

+ 8 - 0
client/src/views/Analytics/Account/index.vue

@@ -355,6 +355,7 @@ import { ElMessage } from 'element-plus';
 import * as XLSX from 'xlsx';
 import dayjs from 'dayjs';
 import request from '@/api/request';
+import { useTaskQueueStore } from '@/stores/taskQueue';
 import iconDefaultUrl from '@/assets/platforms/default.svg?url';
 import douyinIconUrl from '@/assets/platforms/douyin.svg?url';
 import xhsIconUrl from '@/assets/platforms/xiaohongshu.svg?url';
@@ -363,6 +364,7 @@ import kuaishouIconUrl from '@/assets/platforms/kuaishou.svg?url';
 import weixinVideoIconUrl from '@/assets/platforms/weixin_video.svg?url';
 import baijiahaoIconUrl from '@/assets/platforms/baijiahao.svg?url';
 const route = useRoute();
+const taskStore = useTaskQueueStore();
 const loading = ref(false);
 const chartLoading = ref(false);
 
@@ -894,6 +896,12 @@ watch(drawerVisible, (visible) => {
   }
 });
 
+// Bug #6070: 监听账号数据变更事件,新增账号后自动刷新数据
+watch(() => taskStore.accountRefreshTrigger, () => {
+  console.log('[Analytics/Account] Account data changed, reloading...');
+  loadData();
+});
+
 onMounted(() => {
   // 如果从平台详情页跳转过来,优先使用路由上的时间范围
   if (route.query.startDate) {

+ 9 - 1
client/src/views/Analytics/Overview/index.vue

@@ -137,18 +137,20 @@
 </template>
 
 <script setup lang="ts">
-import { ref, computed, onMounted } from 'vue';
+import { ref, computed, onMounted, watch } from 'vue';
 import { Search } from '@element-plus/icons-vue';
 import { PLATFORMS, AVAILABLE_PLATFORM_TYPES } from '@media-manager/shared';
 import type { PlatformType } from '@media-manager/shared';
 import { useAuthStore } from '@/stores/auth';
 import { useServerStore } from '@/stores/server';
+import { useTaskQueueStore } from '@/stores/taskQueue';
 import { ElMessage } from 'element-plus';
 import dayjs from 'dayjs';
 import request from '@/api/request';
 
 const authStore = useAuthStore();
 const serverStore = useServerStore();
+const taskStore = useTaskQueueStore();
 const loading = ref(false);
 const refreshing = ref(false);
 
@@ -440,6 +442,12 @@ async function handleExport() {
   }
 }
 
+// Bug #6070: 监听账号数据变更事件,新增账号后自动刷新数据
+watch(() => taskStore.accountRefreshTrigger, () => {
+  console.log('[Analytics/Overview] Account data changed, reloading...');
+  loadData();
+});
+
 onMounted(() => {
   loadGroups();
   loadData();

+ 8 - 0
client/src/views/Analytics/Platform/index.vue

@@ -159,6 +159,7 @@ import { PLATFORMS } from '@media-manager/shared';
 import type { PlatformType } from '@media-manager/shared';
 import { useAuthStore } from '@/stores/auth';
 import { useServerStore } from '@/stores/server';
+import { useTaskQueueStore } from '@/stores/taskQueue';
 import { ElMessage } from 'element-plus';
 import dayjs from 'dayjs';
 import request from '@/api/request';
@@ -173,6 +174,7 @@ import baijiahaoIconUrl from '@/assets/platforms/baijiahao.svg?url';
 const router = useRouter();
 const authStore = useAuthStore();
 const serverStore = useServerStore();
+const taskStore = useTaskQueueStore();
 const loading = ref(false);
 const chartLoading = ref(false);
 
@@ -478,6 +480,12 @@ watch(drawerVisible, (visible) => {
   }
 });
 
+// Bug #6070: 监听账号数据变更事件,新增账号后自动刷新数据
+watch(() => taskStore.accountRefreshTrigger, () => {
+  console.log('[Analytics/Platform] Account data changed, reloading...');
+  loadData();
+});
+
 onMounted(() => {
   // 默认选择昨天
   handleQuickDate('yesterday');

+ 2 - 1
server/src/services/HeadlessBrowserService.ts

@@ -856,7 +856,8 @@ class HeadlessBrowserService {
           cookie: cookieString,
           page: pageParam,
           page_size: pageSize,
-          auto_paging: (platform === 'xiaohongshu' || platform === 'baijiahao') && pageIndex === 0,
+          // Bug #6071: 移除 auto_paging 参数,避免干扰 cursor 分页遍历。
+          // Python API 的 /works 接口本身支持 cursor 分页,不需要 auto_paging 参数。
         }),
       });
 

+ 2 - 1
server/src/services/WorkService.ts

@@ -279,7 +279,8 @@ export class WorkService {
       if (Object.keys(accountUpdate).length > 0) {
         await this.accountRepository.update(account.id, accountUpdate as any);
         logger.info(`[SyncAccountWorks] Updated account info: ${Object.keys(accountUpdate).join(', ')}`);
-        wsManager.sendToUser(userId, 'account:info_updated', {
+        // Bug #6075: 改用前端监听的 ACCOUNT_DATA_CHANGED 事件,确保前端能刷新账号数据(头像、昵称等)
+        wsManager.sendToUser(userId, WS_EVENTS.ACCOUNT_DATA_CHANGED, {
           accountId: account.id,
           ...accountUpdate,
         });