feat(databi): query china stat timezone
This commit is contained in:
parent
88ef541b95
commit
9405e2b7d6
@ -110,7 +110,8 @@ export function DatabiApp() {
|
|||||||
regionId,
|
regionId,
|
||||||
seriesEndMs: rangeEndMs(seriesRange, timeZone),
|
seriesEndMs: rangeEndMs(seriesRange, timeZone),
|
||||||
seriesStartMs: rangeStartMs(seriesRange, timeZone),
|
seriesStartMs: rangeStartMs(seriesRange, timeZone),
|
||||||
startMs
|
startMs,
|
||||||
|
statTz: timeZone
|
||||||
});
|
});
|
||||||
const nextOverview = enrichCountryBreakdown(data || {}, scopedCountries);
|
const nextOverview = enrichCountryBreakdown(data || {}, scopedCountries);
|
||||||
if (requestId === overviewRequestIdRef.current) {
|
if (requestId === overviewRequestIdRef.current) {
|
||||||
@ -146,7 +147,8 @@ export function DatabiApp() {
|
|||||||
endMs: rangeEndMs(range, timeZone),
|
endMs: rangeEndMs(range, timeZone),
|
||||||
gameId,
|
gameId,
|
||||||
regionId,
|
regionId,
|
||||||
startMs: rangeStartMs(range, timeZone)
|
startMs: rangeStartMs(range, timeZone),
|
||||||
|
statTz: timeZone
|
||||||
});
|
});
|
||||||
if (requestId === selfGameRequestIdRef.current) {
|
if (requestId === selfGameRequestIdRef.current) {
|
||||||
setSelfGameOverview(data || {});
|
setSelfGameOverview(data || {});
|
||||||
|
|||||||
@ -53,6 +53,22 @@ test("keeps current data visible during scheduled refresh", async () => {
|
|||||||
expect(document.querySelector(".metric-card.is-loading")).toBeNull();
|
expect(document.querySelector(".metric-card.is-loading")).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("queries China natural day statistics when display timezone is Beijing", async () => {
|
||||||
|
fetchStatisticsOverview.mockResolvedValue({ active_users: 10, paid_users: 2, recharge_usd_minor: 100, updated_at_ms: 1 });
|
||||||
|
|
||||||
|
render(<DatabiApp />);
|
||||||
|
|
||||||
|
await flushEffects();
|
||||||
|
|
||||||
|
expect(fetchStatisticsOverview).toHaveBeenCalledWith(expect.objectContaining({
|
||||||
|
endMs: Date.UTC(2026, 5, 6, 15, 59, 59),
|
||||||
|
seriesEndMs: Date.UTC(2026, 5, 6, 15, 59, 59),
|
||||||
|
seriesStartMs: Date.UTC(2026, 4, 30, 16, 0, 0),
|
||||||
|
startMs: Date.UTC(2026, 5, 5, 16, 0, 0),
|
||||||
|
statTz: "Asia/Shanghai"
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
test("loads self game statistics from the big screen switch", async () => {
|
test("loads self game statistics from the big screen switch", async () => {
|
||||||
fetchStatisticsOverview.mockResolvedValue({ active_users: 10, paid_users: 2, recharge_usd_minor: 100, updated_at_ms: 1 });
|
fetchStatisticsOverview.mockResolvedValue({ active_users: 10, paid_users: 2, recharge_usd_minor: 100, updated_at_ms: 1 });
|
||||||
fetchSelfGameStatisticsOverview.mockResolvedValue({
|
fetchSelfGameStatisticsOverview.mockResolvedValue({
|
||||||
@ -69,7 +85,7 @@ test("loads self game statistics from the big screen switch", async () => {
|
|||||||
});
|
});
|
||||||
await flushEffects();
|
await flushEffects();
|
||||||
|
|
||||||
expect(fetchSelfGameStatisticsOverview).toHaveBeenCalledWith(expect.objectContaining({ appCode: "lalu", gameId: "all" }));
|
expect(fetchSelfGameStatisticsOverview).toHaveBeenCalledWith(expect.objectContaining({ appCode: "lalu", gameId: "all", statTz: "Asia/Shanghai" }));
|
||||||
expect(screen.getByText("Dice / Rock H5 聚合统计")).toBeTruthy();
|
expect(screen.getByText("Dice / Rock H5 聚合统计")).toBeTruthy();
|
||||||
expect(screen.getByText("创建局")).toBeTruthy();
|
expect(screen.getByText("创建局")).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|||||||
@ -16,8 +16,11 @@ export function setCurrentAppCode(value) {
|
|||||||
return appCode;
|
return appCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchStatisticsOverview({ appCode, countryId, endMs, regionId, seriesEndMs, seriesStartMs, startMs }) {
|
export async function fetchStatisticsOverview({ appCode, countryId, endMs, regionId, seriesEndMs, seriesStartMs, startMs, statTz }) {
|
||||||
const query = { app_code: normalizeAppCode(appCode) || "lalu" };
|
const query = { app_code: normalizeAppCode(appCode) || "lalu" };
|
||||||
|
if (statTz) {
|
||||||
|
query.stat_tz = statTz;
|
||||||
|
}
|
||||||
if (startMs) {
|
if (startMs) {
|
||||||
query.start_ms = String(startMs);
|
query.start_ms = String(startMs);
|
||||||
}
|
}
|
||||||
@ -40,8 +43,11 @@ export async function fetchStatisticsOverview({ appCode, countryId, endMs, regio
|
|||||||
return fetchDatabiData("/v1/statistics/overview", { appCode, query });
|
return fetchDatabiData("/v1/statistics/overview", { appCode, query });
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchSelfGameStatisticsOverview({ appCode, countryId, endMs, gameId, regionId, startMs }) {
|
export async function fetchSelfGameStatisticsOverview({ appCode, countryId, endMs, gameId, regionId, startMs, statTz }) {
|
||||||
const query = { app_code: normalizeAppCode(appCode) || "lalu" };
|
const query = { app_code: normalizeAppCode(appCode) || "lalu" };
|
||||||
|
if (statTz) {
|
||||||
|
query.stat_tz = statTz;
|
||||||
|
}
|
||||||
if (startMs) {
|
if (startMs) {
|
||||||
query.start_ms = String(startMs);
|
query.start_ms = String(startMs);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user