Use country dashboard ARPU summary
This commit is contained in:
parent
b2fb090fb1
commit
d92285ae4a
@ -42,6 +42,7 @@ export interface CountryDashboardMetric {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface CountryDashboardResult {
|
export interface CountryDashboardResult {
|
||||||
|
arpuSummary?: CountryDashboardArpuSummary;
|
||||||
computedAt: string;
|
computedAt: string;
|
||||||
endDate?: string;
|
endDate?: string;
|
||||||
periodType: string;
|
periodType: string;
|
||||||
@ -51,6 +52,12 @@ export interface CountryDashboardResult {
|
|||||||
total: CountryDashboardMetric;
|
total: CountryDashboardMetric;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface CountryDashboardArpuSummary {
|
||||||
|
day?: CountryDashboardResult | null;
|
||||||
|
threeDay?: CountryDashboardResult | null;
|
||||||
|
week?: CountryDashboardResult | null;
|
||||||
|
}
|
||||||
|
|
||||||
export interface CountryDashboardRechargeDetail {
|
export interface CountryDashboardRechargeDetail {
|
||||||
amount: number | string;
|
amount: number | string;
|
||||||
coinQuantity: number | string;
|
coinQuantity: number | string;
|
||||||
|
|||||||
@ -502,36 +502,18 @@ function buildParams() {
|
|||||||
return params;
|
return params;
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildRecentDayParams(dayCount: number) {
|
|
||||||
const end = dayjs().tz(DEFAULT_STAT_TIMEZONE);
|
|
||||||
const start = end.subtract(dayCount - 1, 'day');
|
|
||||||
return {
|
|
||||||
periodType: 'DAY',
|
|
||||||
startDate: start.format('YYYY-MM-DD'),
|
|
||||||
endDate: end.format('YYYY-MM-DD'),
|
|
||||||
statTimezone: DEFAULT_STAT_TIMEZONE,
|
|
||||||
sysOrigin: query.sysOrigin || undefined,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadDashboard() {
|
async function loadDashboard() {
|
||||||
if (!canQuery.value) {
|
if (!canQuery.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
try {
|
try {
|
||||||
const [mainDashboard, dayArpuDashboard, threeDayArpuDashboard, weekArpuDashboard] =
|
const mainDashboard = await countryDashboard(buildParams());
|
||||||
await Promise.all([
|
|
||||||
countryDashboard(buildParams()),
|
|
||||||
countryDashboard(buildRecentDayParams(1)),
|
|
||||||
countryDashboard(buildRecentDayParams(3)),
|
|
||||||
countryDashboard(buildRecentDayParams(7)),
|
|
||||||
]);
|
|
||||||
dashboard.value = mainDashboard;
|
dashboard.value = mainDashboard;
|
||||||
arpuDashboards.value = {
|
arpuDashboards.value = {
|
||||||
day: dayArpuDashboard,
|
day: mainDashboard.arpuSummary?.day || null,
|
||||||
threeDay: threeDayArpuDashboard,
|
threeDay: mainDashboard.arpuSummary?.threeDay || null,
|
||||||
week: weekArpuDashboard,
|
week: mainDashboard.arpuSummary?.week || null,
|
||||||
};
|
};
|
||||||
if (activeTableTab.value === 'game') {
|
if (activeTableTab.value === 'game') {
|
||||||
await loadGameMetrics();
|
await loadGameMetrics();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user