94 lines
3.2 KiB
Plaintext
94 lines
3.2 KiB
Plaintext
syntax = "v1"
|
||
|
||
info (
|
||
title: "后台统计面板服务"
|
||
desc: "后台统计面板相关接口"
|
||
author: "team"
|
||
version: "v1"
|
||
)
|
||
|
||
// ============================================
|
||
// 统计面板接口
|
||
// ============================================
|
||
@server (
|
||
prefix: /api/v1/admin/dashboard
|
||
group: admin_dashboard
|
||
middleware: AdminAuthInterceptor
|
||
)
|
||
service main {
|
||
// 获取统计面板数据
|
||
@handler AdminGetDashboardStatistics
|
||
get /statistics returns (AdminGetDashboardStatisticsResp)
|
||
}
|
||
|
||
type (
|
||
// 统计面板响应
|
||
AdminGetDashboardStatisticsResp {
|
||
// 订单统计
|
||
OrderStats AdminOrderStatistics `json:"order_stats"`
|
||
// 营收统计
|
||
RevenueStats AdminRevenueStatistics `json:"revenue_stats"`
|
||
// 代理统计
|
||
AgentStats AdminAgentStatistics `json:"agent_stats"`
|
||
// 利润统计
|
||
ProfitStats AdminProfitStatistics `json:"profit_stats"`
|
||
// 订单趋势(最近7天)
|
||
OrderTrend []AdminTrendData `json:"order_trend"`
|
||
// 营收趋势(最近7天)
|
||
RevenueTrend []AdminTrendData `json:"revenue_trend"`
|
||
}
|
||
// 订单统计
|
||
AdminOrderStatistics {
|
||
TodayCount int64 `json:"today_count"` // 今日订单数
|
||
MonthCount int64 `json:"month_count"` // 当月订单数
|
||
TotalCount int64 `json:"total_count"` // 总订单数
|
||
YesterdayCount int64 `json:"yesterday_count"` // 昨日订单数
|
||
ChangeRate float64 `json:"change_rate"` // 变化率(百分比)
|
||
}
|
||
// 营收统计
|
||
AdminRevenueStatistics {
|
||
TodayAmount float64 `json:"today_amount"` // 今日营收
|
||
MonthAmount float64 `json:"month_amount"` // 当月营收
|
||
TotalAmount float64 `json:"total_amount"` // 总营收
|
||
YesterdayAmount float64 `json:"yesterday_amount"` // 昨日营收
|
||
ChangeRate float64 `json:"change_rate"` // 变化率(百分比)
|
||
}
|
||
// 代理统计
|
||
AdminAgentStatistics {
|
||
TotalCount int64 `json:"total_count"` // 代理总数
|
||
TodayNew int64 `json:"today_new"` // 今日新增
|
||
MonthNew int64 `json:"month_new"` // 当月新增
|
||
}
|
||
// 利润统计
|
||
AdminProfitStatistics {
|
||
TodayProfit float64 `json:"today_profit"` // 今日利润
|
||
MonthProfit float64 `json:"month_profit"` // 当月利润
|
||
TotalProfit float64 `json:"total_profit"` // 总利润
|
||
TodayProfitRate float64 `json:"today_profit_rate"` // 今日利润率
|
||
MonthProfitRate float64 `json:"month_profit_rate"` // 当月利润率
|
||
TotalProfitRate float64 `json:"total_profit_rate"` // 总利润率
|
||
// 今日明细
|
||
TodayDetail AdminProfitDetail `json:"today_detail"`
|
||
// 当月明细
|
||
MonthDetail AdminProfitDetail `json:"month_detail"`
|
||
// 总计明细
|
||
TotalDetail AdminProfitDetail `json:"total_detail"`
|
||
}
|
||
// 利润明细
|
||
AdminProfitDetail {
|
||
Revenue float64 `json:"revenue"` // 营收
|
||
Commission float64 `json:"commission"` // 佣金
|
||
Rebate float64 `json:"rebate"` // 返利
|
||
CompanyTax float64 `json:"company_tax"` // 税务成本
|
||
ApiCost float64 `json:"api_cost"` // API调用成本
|
||
TaxIncome float64 `json:"tax_income"` // 提现收税
|
||
Profit float64 `json:"profit"` // 利润
|
||
ProfitRate float64 `json:"profit_rate"` // 利润率
|
||
}
|
||
// 趋势数据
|
||
AdminTrendData {
|
||
Date string `json:"date"` // 日期(格式:MM-DD)
|
||
Value float64 `json:"value"` // 数值
|
||
}
|
||
)
|