补充个人中心下的页面
This commit is contained in:
52
src/api/dashboard.ts
Normal file
52
src/api/dashboard.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import type { ApiResponse } from "@/lib/api"
|
||||
import type { OrderItem, OrderQueryParams } from "@/lib/models/order"
|
||||
import { callByUser } from "./base"
|
||||
import { fetchHttpBalance } from "./http"
|
||||
|
||||
// ==================== 仪表盘 ====================
|
||||
// 余额走 php-api,订单/消费统计走 .NET;账号信息与 IP 统计接口待后端确认。
|
||||
|
||||
export async function fetchDashboardBalance(): Promise<ApiResponse<number>> {
|
||||
return fetchHttpBalance()
|
||||
}
|
||||
|
||||
export async function fetchDashboardConsumption(
|
||||
params: Record<string, unknown>,
|
||||
): Promise<ApiResponse<Record<string, unknown>>> {
|
||||
return await callByUser<Record<string, unknown>>(
|
||||
"/api/course/v1/order/UserConsumeStatistics",
|
||||
params,
|
||||
"GET",
|
||||
)
|
||||
}
|
||||
|
||||
export async function fetchDashboardRecentOrders(
|
||||
params: OrderQueryParams,
|
||||
): Promise<ApiResponse<OrderItem[]>> {
|
||||
return await callByUser<OrderItem[]>(
|
||||
"/api/course/v1/order/Page",
|
||||
{ ...params, PageIndex: 1, PageSize: 10 },
|
||||
"GET",
|
||||
)
|
||||
}
|
||||
|
||||
// TODO: 账号信息/IP 统计接口路径待后端确认
|
||||
export async function fetchDashboardAccountInfo(): Promise<
|
||||
ApiResponse<Record<string, unknown>>
|
||||
> {
|
||||
return await callByUser<Record<string, unknown>>(
|
||||
"/api/baseinfo/v1/user/Info",
|
||||
undefined,
|
||||
"GET",
|
||||
)
|
||||
}
|
||||
|
||||
export async function fetchDashboardIpStats(): Promise<
|
||||
ApiResponse<Record<string, unknown>>
|
||||
> {
|
||||
return await callByUser<Record<string, unknown>>(
|
||||
"/api/course/v1/order/IpAccountStatistics",
|
||||
undefined,
|
||||
"GET",
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user