gomod引用

This commit is contained in:
2025-12-12 16:20:47 +08:00
parent 0393931e91
commit a4ba4dd715
27 changed files with 2886 additions and 87 deletions

View File

@@ -98,7 +98,7 @@ type OrderDetail struct {
ID string `json:"id"` // 订单ID
TenantID string `json:"tenant_id"` // 租户ID
OrderNo string `json:"order_no"` // 订单号
UserID string `json:"user_id"` // 用户ID
UserID int64 `json:"user_id"` // 用户ID
TotalAmount int64 `json:"total_amount"` // 订单总金额
PayAmount int64 `json:"pay_amount"` // 实付金额
Status string `json:"status"` // 订单状态

View File

@@ -0,0 +1,141 @@
package dto
import (
"time"
"github.com/gogf/gf/v2/frame/g"
)
// GetOrderStatisticsReq 获取订单统计数据请求
type GetOrderStatisticsReq struct {
g.Meta `path:"/statistics" method:"get" tags:"订单统计" summary:"获取订单统计数据" dc:"根据报表类型和日期获取订单统计数据"`
TenantID int64 `v:"required" json:"tenant_id" dc:"租户ID"`
ReportType string `v:"required|in:daily,monthly,quarterly,yearly" json:"report_type" dc:"报表类型"`
StartDate string `json:"start_date,omitempty" dc:"开始日期"`
EndDate string `json:"end_date,omitempty" dc:"结束日期"`
}
// GetOrderStatisticsRes 获取订单统计数据响应
type GetOrderStatisticsRes struct {
Statistics *OrderStatisticsDetail `json:"statistics"`
}
// OrderStatisticsDetail 订单统计详情
type OrderStatisticsDetail struct {
ReportType string `json:"report_type"`
ReportDate time.Time `json:"report_date"`
Period string `json:"period"`
// 订单基础统计
TotalOrders int64 `json:"total_orders"`
CompletedOrders int64 `json:"completed_orders"`
CancelledOrders int64 `json:"cancelled_orders"`
PaidOrders int64 `json:"paid_orders"`
// 金额统计(单位:分)
TotalAmount int64 `json:"total_amount"`
PaidAmount int64 `json:"paid_amount"`
RefundAmount int64 `json:"refund_amount"`
NetAmount int64 `json:"net_amount"`
// 业务指标
AverageOrderValue int64 `json:"average_order_value"`
PaymentRate float64 `json:"payment_rate"`
CompletionRate float64 `json:"completion_rate"`
// 用户统计
UniqueUsers int64 `json:"unique_users"`
NewUsers int64 `json:"new_users"`
ReturningUsers int64 `json:"returning_users"`
// 商品统计
TotalItems int64 `json:"total_items"`
UniqueAssets int64 `json:"unique_assets"`
TopAssetID string `json:"top_asset_id,omitempty"`
TopAssetName string `json:"top_asset_name,omitempty"`
TopAssetCount int64 `json:"top_asset_count,omitempty"`
// 时间统计
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
// GetOrderStatisticsListReq 获取订单统计列表请求
type GetOrderStatisticsListReq struct {
g.Meta `path:"/statistics/list" method:"get" tags:"订单统计" summary:"获取订单统计列表" dc:"分页获取订单统计列表"`
TenantID int64 `v:"required" json:"tenant_id" dc:"租户ID"`
ReportType string `v:"required|in:daily,monthly,quarterly,yearly" json:"report_type" dc:"报表类型"`
StartDate string `json:"start_date,omitempty" dc:"开始日期"`
EndDate string `json:"end_date,omitempty" dc:"结束日期"`
PageNum int `json:"page_num,omitempty" dc:"页码"`
PageSize int `json:"page_size,omitempty" dc:"每页数量"`
}
// GetOrderStatisticsListRes 获取订单统计列表响应
type GetOrderStatisticsListRes struct {
List []*OrderStatisticsDetail `json:"list"`
TotalCount int64 `json:"total_count"`
PageNum int `json:"page_num"`
PageSize int `json:"page_size"`
}
// GenerateOrderStatisticsReq 生成订单统计数据请求
type GenerateOrderStatisticsReq struct {
g.Meta `path:"/statistics/generate" method:"post" tags:"订单统计" summary:"生成订单统计数据" dc:"手动触发生成指定日期的统计数据"`
TenantID int64 `v:"required" json:"tenant_id" dc:"租户ID"`
ReportType string `v:"required|in:daily,monthly,quarterly,yearly" json:"report_type" dc:"报表类型"`
ReportDate string `json:"report_date,omitempty" dc:"统计日期格式YYYY-MM-DD"`
Force bool `json:"force,omitempty" dc:"是否强制重新生成"`
}
// GenerateOrderStatisticsRes 生成订单统计数据响应
type GenerateOrderStatisticsRes struct {
Success bool `json:"success"`
Message string `json:"message"`
}
// GetOrderTrendReq 获取订单趋势数据请求
type GetOrderTrendReq struct {
g.Meta `path:"/statistics/trend" method:"get" tags:"订单统计" summary:"获取订单趋势数据" dc:"获取指定时间范围内的订单趋势数据"`
TenantID int64 `v:"required" json:"tenant_id" dc:"租户ID"`
StartDate string `v:"required" json:"start_date" dc:"开始日期格式YYYY-MM-DD"`
EndDate string `v:"required" json:"end_date" dc:"结束日期格式YYYY-MM-DD"`
TrendType string `v:"required|in:revenue,orders,users" json:"trend_type" dc:"趋势类型revenue-收入趋势orders-订单趋势users-用户趋势"`
}
// GetOrderTrendRes 获取订单趋势数据响应
type GetOrderTrendRes struct {
TrendData []*TrendDataPoint `json:"trend_data"`
}
// TrendDataPoint 趋势数据点
type TrendDataPoint struct {
Date string `json:"date"`
Value int64 `json:"value"`
Label string `json:"label,omitempty"`
}
// GetTopAssetsReq 获取热门资产请求
type GetTopAssetsReq struct {
g.Meta `path:"/statistics/top-assets" method:"get" tags:"订单统计" summary:"获取热门资产" dc:"获取指定时间范围内的热门资产排行"`
TenantID int64 `v:"required" json:"tenant_id" dc:"租户ID"`
StartDate string `v:"required" json:"start_date" dc:"开始日期格式YYYY-MM-DD"`
EndDate string `v:"required" json:"end_date" dc:"结束日期格式YYYY-MM-DD"`
Limit int `json:"limit,omitempty" dc:"返回数量限制默认10"`
}
// GetTopAssetsRes 获取热门资产响应
type GetTopAssetsRes struct {
TopAssets []*AssetRanking `json:"top_assets"`
}
// AssetRanking 资产排行
type AssetRanking struct {
AssetID string `json:"asset_id"`
AssetName string `json:"asset_name"`
AssetType string `json:"asset_type"`
OrderCount int64 `json:"order_count"`
TotalAmount int64 `json:"total_amount"`
Quantity int64 `json:"quantity"`
Rank int `json:"rank"`
}