fix: 更新 Cloudflare Web Analytics GraphQL 查询字段名称
continuous-integration/drone/push Build is passing

This commit is contained in:
seahi committed 2026-09-26 20:17:52 +08:00
1 parent cfa8128aa4
commit 16cf001bb3
1 file changed
+3 -3
+3 -3
View File
@@ -267,7 +267,7 @@ async function fetchAudience(
const data = await graphql<{ const data = await graphql<{
viewer: { viewer: {
accounts: { accounts: {
rumPagesAdaptiveGroups: { rumPageloadEventsAdaptiveGroups: {
count: number; count: number;
sum: { visits: number }; sum: { visits: number };
dimensions: { date: string }; dimensions: { date: string };
@@ -280,7 +280,7 @@ async function fetchAudience(
query WebAnalytics($account: string, $site: string, $date: string) { query WebAnalytics($account: string, $site: string, $date: string) {
viewer { viewer {
accounts(filter: { accountTag: $account }) { accounts(filter: { accountTag: $account }) {
rumPagesAdaptiveGroups( rumPageloadEventsAdaptiveGroups(
limit: 30 limit: 30
filter: { siteTag: $site, datetime_geq: $date } filter: { siteTag: $site, datetime_geq: $date }
orderBy: [date_ASC] orderBy: [date_ASC]
@@ -303,7 +303,7 @@ async function fetchAudience(
date: `${thirtyDaysAgo}T00:00:00Z` date: `${thirtyDaysAgo}T00:00:00Z`
} }
); );
const rows = data.viewer.accounts[0]?.rumPagesAdaptiveGroups; const rows = data.viewer.accounts[0]?.rumPageloadEventsAdaptiveGroups;
if (!rows) if (!rows)
throw new Error('未返回数据,请检查 Token、Account ID 和 Site Tag 是否正确并具有权限'); throw new Error('未返回数据,请检查 Token、Account ID 和 Site Tag 是否正确并具有权限');