Files
cid/model/dto/ad_statistics_dto.go
2025-12-06 09:10:24 +08:00

114 lines
4.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package dto
import (
"cidService/model/entity"
"gitee.com/red-future---jilin-g/common/http"
"github.com/gogf/gf/v2/frame/g"
)
// GetAdStatisticsReq 获取广告统计数据请求
type GetAdStatisticsReq struct {
g.Meta `path:"/statistics/list" method:"get" tags:"广告统计" summary:"获取广告统计数据" dc:"获取广告的统计数据"`
// 分页参数
http.Page
// 维度信息
StatType string `json:"statType" v:"required"` // 统计类型:广告主、广告、广告位等
StatDimension string `json:"statDimension" v:"required"` // 统计维度:小时、天、周、月
TargetId string `json:"targetId"` // 目标ID广告主ID、广告ID、广告位ID等
// 时间范围
StartDate int64 `json:"startDate" v:"required"` // 开始日期
EndDate int64 `json:"endDate" v:"required"` // 结束日期
// 筛选条件
DeviceType string `json:"deviceType"` // 设备类型
Platform string `json:"platform"` // 平台
Region string `json:"region"` // 地区
Gender string `json:"gender"` // 性别
AgeGroup string `json:"ageGroup"` // 年龄段
// 排序
SortBy string `json:"sortBy"` // 排序字段
SortDirection string `json:"sortDirection"` // 排序方向asc、desc
}
type GetAdStatisticsRes struct {
Statistics []*entity.AdStatistics `json:"statistics"`
Total int `json:"total"`
}
// GetDashboardReq 获取仪表盘数据请求
type GetDashboardReq struct {
g.Meta `path:"/dashboard" method:"get" tags:"广告仪表盘" summary:"获取仪表盘数据" dc:"获取广告系统的仪表盘统计数据"`
// 时间范围
StartDate int64 `json:"startDate" v:"required"` // 开始日期
EndDate int64 `json:"endDate" v:"required"` // 结束日期
// 维度
Dimension string `json:"dimension"` // 统计维度:天、周、月
}
type GetDashboardRes struct {
// 总览数据
Overview OverviewData `json:"overview"`
// 趋势数据
Trends []TrendData `json:"trends"`
// 排行数据
TopAdvertisers []RankData `json:"topAdvertisers"` // 广告主排行
TopAds []RankData `json:"topAds"` // 广告排行
TopPositions []RankData `json:"topPositions"` // 广告位排行
}
// OverviewData 总览数据
type OverviewData struct {
TotalAdvertisers int64 `json:"totalAdvertisers"` // 广告主总数
TotalAds int64 `json:"totalAds"` // 广告总数
TotalPositions int64 `json:"totalPositions"` // 广告位总数
TotalImpressions int64 `json:"totalImpressions"` // 总展示次数
TotalClicks int64 `json:"totalClicks"` // 总点击次数
TotalCost int64 `json:"totalCost"` // 总消耗(分)
TotalRevenue int64 `json:"totalRevenue"` // 总收入(分)
AverageCTR float64 `json:"averageCTR"` // 平均点击率
AverageCVR float64 `json:"averageCVR"` // 平均转化率
}
// TrendData 趋势数据
type TrendData struct {
Date int64 `json:"date"` // 日期
Impressions int64 `json:"impressions"` // 展示次数
Clicks int64 `json:"clicks"` // 点击次数
Conversions int64 `json:"conversions"` // 转化次数
Cost int64 `json:"cost"` // 消耗(分)
Revenue int64 `json:"revenue"` // 收入(分)
CTR float64 `json:"ctr"` // 点击率
CVR float64 `json:"cvr"` // 转化率
}
// RankData 排行数据
type RankData struct {
Id string `json:"id"` // ID
Name string `json:"name"` // 名称
Impressions int64 `json:"impressions"` // 展示次数
Clicks int64 `json:"clicks"` // 点击次数
Cost int64 `json:"cost"` // 消耗(分)
Revenue int64 `json:"revenue"` // 收入(分)
CTR float64 `json:"ctr"` // 点击率
}
// GenerateDailyStatisticsReq 生成每日统计数据请求
type GenerateDailyStatisticsReq struct {
g.Meta `path:"/statistics/generate-daily" method:"post" tags:"广告统计" summary:"生成每日统计数据" dc:"手动生成指定日期的广告统计数据"`
Date int64 `json:"date" v:"required"` // 日期时间戳
}
type GenerateDailyStatisticsRes struct {
Success bool `json:"success"` // 是否成功
}