Use country dashboard ARPU summary
This commit is contained in:
parent
b2fb090fb1
commit
d92285ae4a
@ -42,6 +42,7 @@ export interface CountryDashboardMetric {
|
||||
}
|
||||
|
||||
export interface CountryDashboardResult {
|
||||
arpuSummary?: CountryDashboardArpuSummary;
|
||||
computedAt: string;
|
||||
endDate?: string;
|
||||
periodType: string;
|
||||
@ -51,6 +52,12 @@ export interface CountryDashboardResult {
|
||||
total: CountryDashboardMetric;
|
||||
}
|
||||
|
||||
export interface CountryDashboardArpuSummary {
|
||||
day?: CountryDashboardResult | null;
|
||||
threeDay?: CountryDashboardResult | null;
|
||||
week?: CountryDashboardResult | null;
|
||||
}
|
||||
|
||||
export interface CountryDashboardRechargeDetail {
|
||||
amount: number | string;
|
||||
coinQuantity: number | string;
|
||||
|
||||
@ -502,36 +502,18 @@ function buildParams() {
|
||||
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() {
|
||||
if (!canQuery.value) {
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
try {
|
||||
const [mainDashboard, dayArpuDashboard, threeDayArpuDashboard, weekArpuDashboard] =
|
||||
await Promise.all([
|
||||
countryDashboard(buildParams()),
|
||||
countryDashboard(buildRecentDayParams(1)),
|
||||
countryDashboard(buildRecentDayParams(3)),
|
||||
countryDashboard(buildRecentDayParams(7)),
|
||||
]);
|
||||
const mainDashboard = await countryDashboard(buildParams());
|
||||
dashboard.value = mainDashboard;
|
||||
arpuDashboards.value = {
|
||||
day: dayArpuDashboard,
|
||||
threeDay: threeDayArpuDashboard,
|
||||
week: weekArpuDashboard,
|
||||
day: mainDashboard.arpuSummary?.day || null,
|
||||
threeDay: mainDashboard.arpuSummary?.threeDay || null,
|
||||
week: mainDashboard.arpuSummary?.week || null,
|
||||
};
|
||||
if (activeTableTab.value === 'game') {
|
||||
await loadGameMetrics();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user