Files
cid/model/dto/ad_source_dto.go

301 lines
14 KiB
Go
Raw Normal View History

2025-12-06 10:38:48 +08:00
package dto
import (
2025-12-09 16:10:45 +08:00
"cid/model/entity"
2025-12-06 10:38:48 +08:00
"gitee.com/red-future---jilin-g/common/http"
"github.com/gogf/gf/v2/frame/g"
)
// CreateAdSourceReq 创建广告源请求
type CreateAdSourceReq struct {
2025-12-06 15:41:38 +08:00
g.Meta `path:"/create" method:"post" tags:"广告源管理" summary:"创建广告源" dc:"创建新的广告源配置"`
2025-12-06 10:38:48 +08:00
// 基本信息
Name string `json:"name" v:"required"` // 广告源名称
Code string `json:"code" v:"required"` // 广告源编码,唯一标识
Provider string `json:"provider" v:"required"` // 提供商google、facebook、baidu、tencent、self等
Type string `json:"type" v:"required|in:self,third_party,exchange"` // 类型
Description string `json:"description"` // 描述
// 连接配置
APIEndpoint string `json:"apiEndpoint" v:"required"` // API端点
APIVersion string `json:"apiVersion"` // API版本
AuthType string `json:"authType" v:"required|in:api_key,oauth,basic"` // 认证类型
AuthConfig map[string]interface{} `json:"authConfig" v:"required"` // 认证配置
Headers map[string]string `json:"headers"` // 请求头配置
Timeout int `json:"timeout"` // 超时时间(毫秒)
RetryCount int `json:"retryCount"` // 重试次数
// 基础配置
SupportedFormats []string `json:"supportedFormats" v:"required"` // 支持的广告格式
SupportedSizes []string `json:"supportedSizes"` // 支持的尺寸
SupportedDevices []string `json:"supportedDevices"` // 支持的设备类型
SupportedOS []string `json:"supportedOS"` // 支持的操作系统
SupportedCountries []string `json:"supportedCountries"` // 支持的国家/地区
// 竞价配置
BiddingType string `json:"biddingType" v:"required|in:cpm,cpc,cpa,rtb"` // 竞价类型
MinBidAmount int64 `json:"minBidAmount"` // 最小出价(分)
MaxBidAmount int64 `json:"maxBidAmount"` // 最大出价(分)
BidIncrement int64 `json:"bidIncrement"` // 出价增量(分)
DefaultBidAmount int64 `json:"defaultBidAmount"` // 默认出价(分)
AutoOptimization bool `json:"autoOptimization"` // 是否自动优化
// 最大广告数
MaxAdsPerRequest int `json:"maxAdsPerRequest"` // 单次请求最大广告数量
// 其他配置
BrandSafety bool `json:"brandSafety"` // 品牌安全
Viewability bool `json:"viewability"` // 可见性支持
RealTimeBidding bool `json:"realTimeBidding"` // 实时竞价
HeaderBidding bool `json:"headerBidding"` // 标题竞价
// 财务设置
BillingModel string `json:"billingModel" v:"required|in:cpm,cpc,cpa,rev_share"` // 计费模式
PaymentTerms string `json:"paymentTerms" v:"in:net_30,net_60,net_90"` // 支付条款
RevShareRate float64 `json:"revShareRate" v:"between:0,1"` // 收入分成比例
MinPayment int64 `json:"minPayment"` // 最小支付金额(分)
Currency string `json:"currency"` // 货币单位
TaxInclusive bool `json:"taxInclusive"` // 是否含税
// 系统信息
Priority int `json:"priority"` // 优先级
}
type CreateAdSourceRes struct {
Id string `json:"id"` // 广告源ID
}
// GetAdSourceReq 获取广告源详情请求
type GetAdSourceReq struct {
2025-12-06 15:41:38 +08:00
g.Meta `path:"/getByID" method:"get" tags:"广告源管理" summary:"获取广告源详情" dc:"根据ID获取单个广告源详情"`
2025-12-06 10:38:48 +08:00
Id string `json:"id" v:"required"` // 广告源ID
}
type GetAdSourceRes struct {
*entity.AdSource
}
// ListAdSourceReq 获取广告源列表请求
type ListAdSourceReq struct {
2025-12-06 15:41:38 +08:00
g.Meta `path:"/getList" method:"get" tags:"广告源管理" summary:"获取广告源列表" dc:"分页查询广告源列表,支持多条件筛选"`
2025-12-06 10:38:48 +08:00
http.Page
Name string `json:"name"` // 广告源名称模糊查询
Code string `json:"code"` // 广告源编码
Provider string `json:"provider"` // 提供商
Type string `json:"type"` // 类型
Status string `json:"status"` // 状态
Health string `json:"health"` // 健康状态
}
type ListAdSourceRes struct {
List []*entity.AdSource `json:"list"`
Total int `json:"total"`
}
// UpdateAdSourceReq 更新广告源请求
type UpdateAdSourceReq struct {
2025-12-06 15:41:38 +08:00
g.Meta `path:"/update" method:"put" tags:"广告源管理" summary:"更新广告源" dc:"更新广告源信息"`
2025-12-06 10:38:48 +08:00
Id string `json:"id" v:"required"` // 广告源ID
// 基本信息
Name string `json:"name"` // 广告源名称
Description string `json:"description"` // 描述
// 连接配置
APIEndpoint string `json:"apiEndpoint"` // API端点
APIVersion string `json:"apiVersion"` // API版本
AuthType string `json:"authType"` // 认证类型
AuthConfig map[string]interface{} `json:"authConfig"` // 认证配置
Headers map[string]string `json:"headers"` // 请求头配置
Timeout int `json:"timeout"` // 超时时间(毫秒)
RetryCount int `json:"retryCount"` // 重试次数
// 基础配置
SupportedFormats []string `json:"supportedFormats"` // 支持的广告格式
SupportedSizes []string `json:"supportedSizes"` // 支持的尺寸
SupportedDevices []string `json:"supportedDevices"` // 支持的设备类型
SupportedOS []string `json:"supportedOS"` // 支持的操作系统
SupportedCountries []string `json:"supportedCountries"` // 支持的国家/地区
// 竞价配置
BiddingType string `json:"biddingType"` // 竞价类型
MinBidAmount int64 `json:"minBidAmount"` // 最小出价(分)
MaxBidAmount int64 `json:"maxBidAmount"` // 最大出价(分)
BidIncrement int64 `json:"bidIncrement"` // 出价增量(分)
DefaultBidAmount int64 `json:"defaultBidAmount"` // 默认出价(分)
AutoOptimization bool `json:"autoOptimization"` // 是否自动优化
// 最大广告数
MaxAdsPerRequest int `json:"maxAdsPerRequest"` // 单次请求最大广告数量
// 其他配置
BrandSafety bool `json:"brandSafety"` // 品牌安全
Viewability bool `json:"viewability"` // 可见性支持
RealTimeBidding bool `json:"realTimeBidding"` // 实时竞价
HeaderBidding bool `json:"headerBidding"` // 标题竞价
// 财务设置
BillingModel string `json:"billingModel"` // 计费模式
PaymentTerms string `json:"paymentTerms"` // 支付条款
RevShareRate float64 `json:"revShareRate"` // 收入分成比例
MinPayment int64 `json:"minPayment"` // 最小支付金额(分)
Currency string `json:"currency"` // 货币单位
TaxInclusive bool `json:"taxInclusive"` // 是否含税
// 系统信息
Priority int `json:"priority"` // 优先级
}
// UpdateAdSourceStatusReq 更新广告源状态请求
type UpdateAdSourceStatusReq struct {
2025-12-06 15:41:38 +08:00
// g.Meta `path:"/adsource" method:"patch" tags:"广告源管理" summary:"更新广告源状态" dc:"更新广告源状态"` // 暂时注释缺少对应的controller方法
2025-12-06 10:38:48 +08:00
Id string `json:"id" v:"required"` // 广告源ID
Status string `json:"status" v:"required"` // 广告源状态active、inactive、maintenance
}
// DeleteAdSourceReq 删除广告源请求
type DeleteAdSourceReq struct {
2025-12-06 15:41:38 +08:00
g.Meta `path:"/delete" method:"delete" tags:"广告源管理" summary:"删除广告源" dc:"删除指定的广告源"`
2025-12-06 10:38:48 +08:00
Id string `json:"id" v:"required"` // 广告源ID
}
// TestAdSourceReq 测试广告源连接请求
type TestAdSourceReq struct {
2025-12-06 15:41:38 +08:00
// g.Meta `path:"/adsource-test" method:"post" tags:"广告源管理" summary:"测试广告源连接" dc:"测试广告源的连接性和可用性"` // 暂时注释缺少对应的controller方法
2025-12-06 10:38:48 +08:00
Id string `json:"id" v:"required"` // 广告源ID
}
type TestAdSourceRes struct {
Success bool `json:"success"` // 测试是否成功
ResponseTime int64 `json:"responseTime"` // 响应时间(毫秒)
ErrorMessage string `json:"errorMessage"` // 错误信息
SupportedFormats []string `json:"supportedFormats"` // 支持的广告格式
QualityMetrics *AdSourceTestMetrics `json:"qualityMetrics"` // 质量指标
}
// DeleteAdSourceRes 删除广告源响应
type DeleteAdSourceRes struct {
Success bool `json:"success"` // 删除是否成功
}
// AdSourceTestMetrics 广告源测试质量指标
type AdSourceTestMetrics struct {
SuccessRate float64 `json:"successRate"` // 成功率
AverageResponseTime float64 `json:"averageResponseTime"` // 平均响应时间(毫秒)
FillRate float64 `json:"fillRate"` // 填充率
CTR float64 `json:"ctr"` // 点击率
}
// GetAdSourceStatisticsReq 获取广告源统计数据请求
type GetAdSourceStatisticsReq struct {
2025-12-06 15:41:38 +08:00
// g.Meta `path:"/adsource-statistics" method:"get" tags:"广告源管理" summary:"获取广告源统计数据" dc:"获取广告源的详细统计数据"` // 暂时注释缺少对应的controller方法
2025-12-06 10:38:48 +08:00
Id string `json:"id" v:"required"` // 广告源ID
StartDate int64 `json:"startDate" v:"required"` // 开始日期
EndDate int64 `json:"endDate" v:"required"` // 结束日期
Dimension string `json:"dimension"` // 统计维度day、week、month
}
type GetAdSourceStatisticsRes struct {
// 概览数据
Overview AdSourceOverviewStats `json:"overview"`
// 趋势数据
Trends []AdSourceTrendData `json:"trends"`
// 性能数据
Performance AdSourcePerformanceStats `json:"performance"`
// 错误统计
Errors []AdSourceErrorStats `json:"errors"`
}
// AdSourceOverviewStats 广告源概览统计
type AdSourceOverviewStats struct {
TotalRequests int64 `json:"totalRequests"` // 总请求数
SuccessfulRequests int64 `json:"successfulRequests"` // 成功请求数
FailedRequests int64 `json:"failedRequests"` // 失败请求数
TotalImpressions int64 `json:"totalImpressions"` // 总展示次数
TotalClicks int64 `json:"totalClicks"` // 总点击次数
TotalConversions int64 `json:"totalConversions"` // 总转化次数
TotalRevenue int64 `json:"totalRevenue"` // 总收入(分)
SuccessRate float64 `json:"successRate"` // 成功率
ErrorRate float64 `json:"errorRate"` // 错误率
CTR float64 `json:"ctr"` // 点击率
CVR float64 `json:"cvr"` // 转化率
FillRate float64 `json:"fillRate"` // 填充率
eCPM int64 `json:"ecpm"` // 有效千次展示成本(分)
eCPC int64 `json:"ecpc"` // 有效点击成本(分)
AverageResponseTime float64 `json:"averageResponseTime"` // 平均响应时间(毫秒)
Uptime float64 `json:"uptime"` // 可用性(百分比)
}
// AdSourceTrendData 广告源趋势数据
type AdSourceTrendData struct {
Date int64 `json:"date"` // 日期
Requests int64 `json:"requests"` // 请求数
Impressions int64 `json:"impressions"` // 展示次数
Clicks int64 `json:"clicks"` // 点击次数
Conversions int64 `json:"conversions"` // 转化次数
Revenue int64 `json:"revenue"` // 收入(分)
SuccessRate float64 `json:"successRate"` // 成功率
ErrorRate float64 `json:"errorRate"` // 错误率
CTR float64 `json:"ctr"` // 点击率
CVR float64 `json:"cvr"` // 转化率
FillRate float64 `json:"fillRate"` // 填充率
eCPM int64 `json:"ecpm"` // 有效千次展示成本(分)
ResponseTime float64 `json:"responseTime"` // 平均响应时间(毫秒)
}
// AdSourcePerformanceStats 广告源性能统计
type AdSourcePerformanceStats struct {
// 响应时间分布
ResponseTimeDistribution map[string]int64 `json:"responseTimeDistribution"` // 响应时间分布
// 错误类型统计
ErrorTypes map[string]int64 `json:"errorTypes"` // 错误类型统计
// 地区性能
RegionalPerformance map[string]AdSourceRegionalStats `json:"regionalPerformance"` // 地区性能
// 设备性能
DevicePerformance map[string]AdSourceDeviceStats `json:"devicePerformance"` // 设备性能
}
// AdSourceErrorStats 广告源错误统计
type AdSourceErrorStats struct {
ErrorType string `json:"errorType"` // 错误类型
Count int64 `json:"count"` // 错误次数
Percentage float64 `json:"percentage"` // 占比
LastOccurred int64 `json:"lastOccurred"` // 最后发生时间
}
// AdSourceRegionalStats 广告源地区统计
type AdSourceRegionalStats struct {
Region string `json:"region"` // 地区
Requests int64 `json:"requests"` // 请求数
Impressions int64 `json:"impressions"` // 展示次数
Clicks int64 `json:"clicks"` // 点击次数
Revenue int64 `json:"revenue"` // 收入(分)
CTR float64 `json:"ctr"` // 点击率
ResponseTime float64 `json:"responseTime"` // 平均响应时间(毫秒)
}
// AdSourceDeviceStats 广告源设备统计
type AdSourceDeviceStats struct {
Device string `json:"device"` // 设备类型
Requests int64 `json:"requests"` // 请求数
Impressions int64 `json:"impressions"` // 展示次数
Clicks int64 `json:"clicks"` // 点击次数
Revenue int64 `json:"revenue"` // 收入(分)
CTR float64 `json:"ctr"` // 点击率
ResponseTime float64 `json:"responseTime"` // 平均响应时间(毫秒)
}