✨ feat: add traffic limit rules and user traffic statistics
This commit is contained in:
+13
@@ -2693,8 +2693,13 @@ declare namespace API {
|
||||
description: string;
|
||||
sort: number;
|
||||
for_calculation: boolean;
|
||||
is_expired_group: boolean;
|
||||
expired_days_limit: number;
|
||||
max_traffic_gb_expired?: number;
|
||||
speed_limit: number;
|
||||
min_traffic_gb?: number;
|
||||
max_traffic_gb?: number;
|
||||
node_count?: number;
|
||||
created_at: number;
|
||||
updated_at: number;
|
||||
};
|
||||
@@ -2832,6 +2837,10 @@ declare namespace API {
|
||||
description?: string;
|
||||
sort?: number;
|
||||
for_calculation?: boolean;
|
||||
is_expired_group?: boolean;
|
||||
expired_days_limit?: number;
|
||||
max_traffic_gb_expired?: number;
|
||||
speed_limit?: number;
|
||||
min_traffic_gb?: number;
|
||||
max_traffic_gb?: number;
|
||||
};
|
||||
@@ -2842,6 +2851,10 @@ declare namespace API {
|
||||
description?: string;
|
||||
sort?: number;
|
||||
for_calculation?: boolean;
|
||||
is_expired_group?: boolean;
|
||||
expired_days_limit?: number;
|
||||
max_traffic_gb_expired?: number;
|
||||
speed_limit?: number;
|
||||
min_traffic_gb?: number;
|
||||
max_traffic_gb?: number;
|
||||
};
|
||||
|
||||
@@ -9,6 +9,7 @@ import * as payment from "./payment";
|
||||
import * as portal from "./portal";
|
||||
import * as subscribe from "./subscribe";
|
||||
import * as ticket from "./ticket";
|
||||
import * as traffic from "./traffic";
|
||||
import * as user from "./user";
|
||||
export default {
|
||||
announcement,
|
||||
@@ -18,5 +19,6 @@ export default {
|
||||
portal,
|
||||
subscribe,
|
||||
ticket,
|
||||
traffic,
|
||||
user,
|
||||
};
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
import request from "@workspace/ui/lib/request";
|
||||
|
||||
export interface GetUserTrafficStatsRequest {
|
||||
user_subscribe_id: string; // 保持字符串,避免精度问题
|
||||
days: 7 | 30;
|
||||
}
|
||||
|
||||
export interface DailyTrafficStats {
|
||||
date: string;
|
||||
upload: number;
|
||||
download: number;
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface GetUserTrafficStatsResponse {
|
||||
list: DailyTrafficStats[];
|
||||
total_upload: number;
|
||||
total_download: number;
|
||||
total_traffic: number;
|
||||
}
|
||||
|
||||
/** Get User Traffic Statistics GET /v1/public/user/traffic_stats */
|
||||
export async function getUserTrafficStats(
|
||||
params: GetUserTrafficStatsRequest,
|
||||
options?: { [key: string]: any }
|
||||
) {
|
||||
return request<API.Response & { data?: GetUserTrafficStatsResponse }>(
|
||||
`${import.meta.env.VITE_API_PREFIX || ""}/v1/public/user/traffic_stats`,
|
||||
{
|
||||
method: "GET",
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
}
|
||||
);
|
||||
}
|
||||
+1
@@ -1184,6 +1184,7 @@ declare namespace API {
|
||||
|
||||
type UserSubscribe = {
|
||||
id: number;
|
||||
id_str: string;
|
||||
user_id: number;
|
||||
order_id: number;
|
||||
subscribe_id: number;
|
||||
|
||||
Reference in New Issue
Block a user