feat(dashboard): Statistics

This commit is contained in:
web@ppanel
2024-12-18 21:27:53 +07:00
parent 1836980691
commit 2926abc99e
9 changed files with 971 additions and 629 deletions
+44
View File
@@ -0,0 +1,44 @@
// @ts-ignore
/* eslint-disable */
import request from '@/utils/request';
/** Query revenue statistics GET /v1/admin/console/revenue */
export async function queryRevenueStatistics(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.RevenueStatisticsResponse }>(
'/v1/admin/console/revenue',
{
method: 'GET',
...(options || {}),
},
);
}
/** Query server total data GET /v1/admin/console/server */
export async function queryServerTotalData(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ServerTotalDataResponse }>(
'/v1/admin/console/server',
{
method: 'GET',
...(options || {}),
},
);
}
/** Query ticket wait reply GET /v1/admin/console/ticket */
export async function queryTicketWaitReply(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.TicketWaitRelpyResponse }>(
'/v1/admin/console/ticket',
{
method: 'GET',
...(options || {}),
},
);
}
/** Query user statistics GET /v1/admin/console/user */
export async function queryUserStatistics(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.UserStatisticsResponse }>('/v1/admin/console/user', {
method: 'GET',
...(options || {}),
});
}
+2
View File
@@ -3,6 +3,7 @@
// API 更新时间:
// API 唯一标识:
import * as announcement from './announcement';
import * as console from './console';
import * as coupon from './coupon';
import * as document from './document';
import * as order from './order';
@@ -15,6 +16,7 @@ import * as tool from './tool';
import * as user from './user';
export default {
announcement,
console,
coupon,
document,
order,
+61
View File
@@ -556,6 +556,14 @@ declare namespace API {
updated_at: number;
};
type OrdersStatistics = {
date?: string;
amount_total: number;
new_order_amount: number;
renewal_order_amount: number;
list?: OrdersStatistics[];
};
type PaymentConfig = {
id: number;
name: string;
@@ -589,6 +597,12 @@ declare namespace API {
data?: Record<string, any>;
};
type RevenueStatisticsResponse = {
today: OrdersStatistics;
monthly: OrdersStatistics;
all: OrdersStatistics;
};
type SecurityConfig = {
sni: string;
allow_insecure: boolean;
@@ -633,6 +647,28 @@ declare namespace API {
updated_at: number;
};
type ServerTotalDataResponse = {
online_user_ips: number;
online_servers: number;
offline_servers: number;
today_upload: number;
today_download: number;
monthly_upload: number;
monthly_download: number;
updated_at: number;
server_traffic_ranking_today: ServerTrafficData[];
server_traffic_ranking_yesterday: ServerTrafficData[];
user_traffic_ranking_today: UserTrafficData[];
user_traffic_ranking_yesterday: UserTrafficData[];
};
type ServerTrafficData = {
server_id: number;
name: string;
upload: number;
download: number;
};
type Shadowsocks = {
method: string;
port: number;
@@ -719,6 +755,10 @@ declare namespace API {
updated_at: number;
};
type TicketWaitRelpyResponse = {
count: number;
};
type TosConfig = {
tos_content: string;
};
@@ -942,6 +982,20 @@ declare namespace API {
created_at: number;
};
type UserStatistics = {
date?: string;
register: number;
new_order_users: number;
renewal_order_users: number;
list?: UserStatistics[];
};
type UserStatisticsResponse = {
today: UserStatistics;
monthly: UserStatistics;
all: UserStatistics;
};
type UserSubscribe = {
id: number;
user_id: number;
@@ -959,6 +1013,13 @@ declare namespace API {
updated_at: number;
};
type UserTrafficData = {
user_id: number;
email: string;
upload: number;
download: number;
};
type VerifyConfig = {
turnstile_site_key: string;
turnstile_secret: string;