初始化项目
This commit is contained in:
168
model/dto/stat_report_dto.go
Normal file
168
model/dto/stat_report_dto.go
Normal file
@@ -0,0 +1,168 @@
|
||||
package dto
|
||||
|
||||
import "github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
// 报表生成请求
|
||||
type ReportGenerateReq struct {
|
||||
g.Meta `path:"/report/generate" method:"post"`
|
||||
TenantID int64 `json:"tenant_id" v:"required"`
|
||||
AppID int64 `json:"app_id"`
|
||||
ReportType string `json:"report_type" v:"required|in:daily,monthly,quarterly,yearly"`
|
||||
Date string `json:"date"` // 格式: 2024-01-01 (daily), 2024-01 (monthly), 2024-Q1 (quarterly), 2024 (yearly)
|
||||
}
|
||||
|
||||
// 报表生成响应
|
||||
type ReportGenerateResp struct {
|
||||
ReportID int64 `json:"report_id"`
|
||||
ReportType string `json:"report_type"`
|
||||
ReportDate string `json:"report_date"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
// 报表列表请求
|
||||
type ReportListReq struct {
|
||||
g.Meta `path:"/report/list" method:"get"`
|
||||
TenantID int64 `json:"tenant_id"`
|
||||
AppID int64 `json:"app_id"`
|
||||
ReportType string `json:"report_type"`
|
||||
StartDate string `json:"start_date"`
|
||||
EndDate string `json:"end_date"`
|
||||
Page int `json:"page" d:"1"`
|
||||
PageSize int `json:"page_size" d:"20"`
|
||||
}
|
||||
|
||||
// 报表列表响应
|
||||
type ReportListResp struct {
|
||||
Reports []*ReportDTO `json:"reports"`
|
||||
Total int `json:"total"`
|
||||
Page int `json:"page"`
|
||||
PageSize int `json:"page_size"`
|
||||
}
|
||||
|
||||
// 报表详情请求
|
||||
type ReportDetailReq struct {
|
||||
g.Meta `path:"/report/detail" method:"get"`
|
||||
ReportID int64 `json:"report_id" v:"required"`
|
||||
}
|
||||
|
||||
// 报表详情响应
|
||||
type ReportDetailResp struct {
|
||||
ID int64 `json:"id"`
|
||||
TenantID int64 `json:"tenant_id"`
|
||||
AppID int64 `json:"app_id"`
|
||||
ReportType string `json:"report_type"`
|
||||
ReportDate string `json:"report_date"`
|
||||
GeneratedAt string `json:"generated_at"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
// 报表DTO
|
||||
type ReportDTO struct {
|
||||
ID int64 `json:"id"`
|
||||
TenantID int64 `json:"tenant_id"`
|
||||
AppID int64 `json:"app_id"`
|
||||
ReportType string `json:"report_type"`
|
||||
ReportDate string `json:"report_date"`
|
||||
GeneratedAt string `json:"generated_at"`
|
||||
}
|
||||
|
||||
// 统计查询请求
|
||||
type StatQueryReq struct {
|
||||
g.Meta `path:"/stat/query" method:"get"`
|
||||
TenantID int64 `json:"tenant_id" v:"required"`
|
||||
AppID int64 `json:"app_id"`
|
||||
AdType string `json:"ad_type"`
|
||||
Platform string `json:"platform"`
|
||||
Region string `json:"region"`
|
||||
StartDate string `json:"start_date" v:"required"`
|
||||
EndDate string `json:"end_date" v:"required"`
|
||||
Granularity string `json:"granularity" v:"in:daily,weekly,monthly" d:"daily"` // 统计粒度
|
||||
}
|
||||
|
||||
// 统计查询响应
|
||||
type StatQueryResp struct {
|
||||
Data []*StatDataPoint `json:"data"`
|
||||
Summary *StatSummary `json:"summary"`
|
||||
}
|
||||
|
||||
// 统计数据点
|
||||
type StatDataPoint struct {
|
||||
Date string `json:"date"`
|
||||
Impressions int64 `json:"impressions"`
|
||||
Clicks int64 `json:"clicks"`
|
||||
Revenue float64 `json:"revenue"`
|
||||
CTR float64 `json:"ctr"`
|
||||
AvgDuration float64 `json:"avg_duration"`
|
||||
}
|
||||
|
||||
// 统计摘要
|
||||
type StatSummary struct {
|
||||
TotalImpressions int64 `json:"total_impressions"`
|
||||
TotalClicks int64 `json:"total_clicks"`
|
||||
TotalRevenue float64 `json:"total_revenue"`
|
||||
AvgCTR float64 `json:"avg_ctr"`
|
||||
AvgDuration float64 `json:"avg_duration"`
|
||||
GrowthRate *GrowthRate `json:"growth_rate"`
|
||||
}
|
||||
|
||||
// 增长率统计
|
||||
type GrowthRate struct {
|
||||
Impressions float64 `json:"impressions"`
|
||||
Clicks float64 `json:"clicks"`
|
||||
Revenue float64 `json:"revenue"`
|
||||
CTR float64 `json:"ctr"`
|
||||
}
|
||||
|
||||
// 实时统计请求
|
||||
type RealTimeStatReq struct {
|
||||
g.Meta `path:"/stat/realtime" method:"get"`
|
||||
TenantID int64 `json:"tenant_id" v:"required"`
|
||||
AppID int64 `json:"app_id"`
|
||||
Hours int `json:"hours" d:"24"` // 过去多少小时的统计
|
||||
}
|
||||
|
||||
// 实时统计响应
|
||||
type RealTimeStatResp struct {
|
||||
CurrentHour *HourlyStat `json:"current_hour"`
|
||||
Last24Hours []*HourlyStat `json:"last_24_hours"`
|
||||
}
|
||||
|
||||
// 小时统计
|
||||
type HourlyStat struct {
|
||||
Hour string `json:"hour"`
|
||||
Impressions int64 `json:"impressions"`
|
||||
Clicks int64 `json:"clicks"`
|
||||
Revenue float64 `json:"revenue"`
|
||||
}
|
||||
|
||||
// Controller响应结构
|
||||
|
||||
// 生成报表响应
|
||||
type ReportGenerateRes struct {
|
||||
Data *ReportGenerateResp `json:"data"`
|
||||
}
|
||||
|
||||
// 报表列表响应
|
||||
type ReportListRes struct {
|
||||
Data *ReportListResp `json:"data"`
|
||||
}
|
||||
|
||||
// 报表详情响应
|
||||
type ReportDetailRes struct {
|
||||
Data *ReportDetailResp `json:"data"`
|
||||
}
|
||||
|
||||
// 统计查询响应
|
||||
type StatQueryRes struct {
|
||||
Data *StatQueryResp `json:"data"`
|
||||
}
|
||||
|
||||
// 实时统计响应
|
||||
type RealTimeStatRes struct {
|
||||
Data *RealTimeStatResp `json:"data"`
|
||||
}
|
||||
|
||||
// 导出报表响应
|
||||
type ExportReportRes struct {
|
||||
ReportData *ReportDetailResp `json:"report_data"`
|
||||
}
|
||||
Reference in New Issue
Block a user