Files
cid/model/entity/ad_source.go

167 lines
7.6 KiB
Go
Raw Normal View History

2025-12-06 10:38:48 +08:00
package entity
import (
2025-12-06 15:24:30 +08:00
"time"
2025-12-06 10:38:48 +08:00
)
// AdSource 广告源实体
type AdSource struct {
2025-12-10 15:41:52 +08:00
Id string `json:"id"` // 主键ID
2025-12-06 15:24:30 +08:00
CreatedAt time.Time `json:"createdAt"` // 创建时间
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
Creator string `json:"creator"` // 创建者
Updater string `json:"updater"` // 更新者
IsDeleted bool `json:"isDeleted"` // 是否删除
2025-12-06 10:38:48 +08:00
// 基本信息
2025-12-06 15:24:30 +08:00
Name string `json:"name"` // 广告源名称
Code string `json:"code"` // 广告源编码,唯一标识
Provider string `json:"provider"` // 提供商google、facebook、baidu、tencent、self等
Type string `json:"type"` // 类型self(自营)、third_party(第三方)、exchange(广告交易平台)
Description string `json:"description"` // 描述
2025-12-06 10:38:48 +08:00
// 连接配置
2025-12-06 15:24:30 +08:00
Config string `json:"config"` // 广告源配置JSON字符串
2025-12-06 10:38:48 +08:00
// API配置
2025-12-06 15:24:30 +08:00
APIEndpoint string `json:"apiEndpoint"` // API端点
APIVersion string `json:"apiVersion"` // API版本
AuthType string `json:"authType"` // 认证类型api_key、oauth、basic
AuthConfig string `json:"authConfig"` // 认证配置JSON字符串
Headers string `json:"headers"` // 请求头配置JSON字符串
Timeout int `json:"timeout"` // 超时时间(毫秒)
RetryCount int `json:"retryCount"` // 重试次数
2025-12-06 10:38:48 +08:00
// 广告源能力
2025-12-06 15:24:30 +08:00
Capabilities string `json:"capabilities"` // 广告源能力JSON字符串
2025-12-06 10:38:48 +08:00
// 质量指标
2025-12-06 15:24:30 +08:00
QualityMetrics string `json:"qualityMetrics"` // 质量指标JSON字符串
2025-12-06 10:38:48 +08:00
// 财务设置
2025-12-06 15:24:30 +08:00
PaymentTerms string `json:"paymentTerms"` // 支付条款JSON字符串
2025-12-06 10:38:48 +08:00
// 状态信息
2025-12-06 15:24:30 +08:00
Status string `json:"status"` // 广告源状态active、inactive、maintenance
Health string `json:"health"` // 健康状态healthy、degraded、unhealthy
LastCheckAt int64 `json:"lastCheckAt"` // 最后检查时间
2025-12-06 10:38:48 +08:00
// 统计信息
2025-12-06 15:24:30 +08:00
TotalRequests int64 `json:"totalRequests"` // 总请求数
SuccessfulRequests int64 `json:"successfulRequests"` // 成功请求数
FailedRequests int64 `json:"failedRequests"` // 失败请求数
AverageResponseTime float64 `json:"averageResponseTime"` // 平均响应时间(毫秒)
FillRate float64 `json:"fillRate"` // 填充率
CTR float64 `json:"ctr"` // 点击率
CVR float64 `json:"cvr"` // 转化率
2025-12-06 10:38:48 +08:00
// 系统信息
2025-12-06 15:24:30 +08:00
Priority int `json:"priority"` // 优先级,数值越高优先级越高
2025-12-06 10:38:48 +08:00
}
// AdSourceConfig 广告源配置
type AdSourceConfig struct {
// 基础配置
2025-12-06 15:24:30 +08:00
SupportedFormats []string `json:"supportedFormats"` // 支持的广告格式
SupportedSizes []string `json:"supportedSizes"` // 支持的尺寸
SupportedDevices []string `json:"supportedDevices"` // 支持的设备类型
SupportedOS []string `json:"supportedOS"` // 支持的操作系统
SupportedCountries []string `json:"supportedCountries"` // 支持的国家/地区
2025-12-06 10:38:48 +08:00
// 竞价配置
2025-12-06 15:24:30 +08:00
BiddingType string `json:"biddingType"` // 竞价类型cpm、cpc、cpa、rtb
MinBidAmount int64 `json:"minBidAmount"` // 最小出价(分)
MaxBidAmount int64 `json:"maxBidAmount"` // 最大出价(分)
BidIncrement int64 `json:"bidIncrement"` // 出价增量(分)
DefaultBidAmount int64 `json:"defaultBidAmount"` // 默认出价(分)
AutoOptimization bool `json:"autoOptimization"` // 是否自动优化
2025-12-06 10:38:48 +08:00
// 定向配置
2025-12-06 15:24:30 +08:00
TargetingSupport *TargetingSupport `json:"targetingSupport"` // 定向支持
2025-12-06 10:38:48 +08:00
// 其他配置
2025-12-06 15:24:30 +08:00
MaxAdsPerRequest int `json:"maxAdsPerRequest"` // 单次请求最大广告数量
BrandSafety bool `json:"brandSafety"` // 品牌安全
Viewability bool `json:"viewability"` // 可见性支持
2025-12-06 10:38:48 +08:00
}
// TargetingSupport 定向支持
type TargetingSupport struct {
2025-12-06 15:24:30 +08:00
GeoTargeting bool `json:"geoTargeting"` // 地理定向
DemographicTargeting bool `json:"demographicTargeting"` // 人口统计定向
BehavioralTargeting bool `json:"behavioralTargeting"` // 行为定向
ContextualTargeting bool `json:"contextualTargeting"` // 上下文定向
DeviceTargeting bool `json:"deviceTargeting"` // 设备定向
TimeTargeting bool `json:"timeTargeting"` // 时间定向
Retargeting bool `json:"retargeting"` // 重定向
CookieTargeting bool `json:"cookieTargeting"` // Cookie定向
2025-12-06 10:38:48 +08:00
}
// AdSourceCapabilities 广告源能力
type AdSourceCapabilities struct {
// 广告格式
2025-12-06 15:24:30 +08:00
SupportedFormats []AdFormat `json:"supportedFormats"` // 支持的广告格式
2025-12-06 10:38:48 +08:00
// 功能特性
2025-12-06 15:24:30 +08:00
RealTimeBidding bool `json:"realTimeBidding"` // 实时竞价
HeaderBidding bool `json:"headerBidding"` // 标题竞价
ProgrammaticDirect bool `json:"programmaticDirect"` // 程序化直购
PrivateMarketplace bool `json:"privateMarketplace"` // 私有交易市场
2025-12-06 10:38:48 +08:00
// 质量控制
2025-12-06 15:24:30 +08:00
FraudDetection bool `json:"fraudDetection"` // 反欺诈检测
BrandSafety bool `json:"brandSafety"` // 品牌安全
Viewability bool `json:"viewability"` // 可见度验证
CreativeApproval bool `json:"creativeApproval"` // 创意审核
2025-12-06 10:38:48 +08:00
// 数据能力
2025-12-06 15:24:30 +08:00
AudienceTargeting bool `json:"audienceTargeting"` // 受众定向
ContextualTargeting bool `json:"contextualTargeting"` // 上下文定向
CrossDeviceTargeting bool `json:"crossDeviceTargeting"` // 跨设备定向
2025-12-06 10:38:48 +08:00
}
// AdFormat 广告格式
type AdFormat struct {
2025-12-06 15:24:30 +08:00
Type string `json:"type"` // 格式类型banner、video、native、interstitial等
Name string `json:"name"` // 格式名称
Width int `json:"width"` // 宽度
Height int `json:"height"` // 高度
MimeType string `json:"mimeType"` // MIME类型
2025-12-06 10:38:48 +08:00
}
// AdSourceQualityMetrics 广告源质量指标
type AdSourceQualityMetrics struct {
// 性能指标
2025-12-06 15:24:30 +08:00
AverageResponseTime float64 `json:"averageResponseTime"` // 平均响应时间(毫秒)
SuccessRate float64 `json:"successRate"` // 成功率
ErrorRate float64 `json:"errorRate"` // 错误率
Uptime float64 `json:"uptime"` // 可用性(百分比)
2025-12-06 10:38:48 +08:00
// 广告质量
2025-12-06 15:24:30 +08:00
CTR float64 `json:"ctr"` // 点击率
CVR float64 `json:"cvr"` // 转化率
FillRate float64 `json:"fillRate"` // 填充率
ViewabilityRate float64 `json:"viewabilityRate"` // 可见率
BrandSafetyScore float64 `json:"brandSafetyScore"` // 品牌安全评分
2025-12-06 10:38:48 +08:00
// 财务指标
2025-12-06 15:24:30 +08:00
Ecpm int64 `json:"ecpm"` // 有效千次展示成本(分)
Ecpc int64 `json:"ecpc"` // 有效点击成本(分)
RevenuePerRequest int64 `json:"revenuePerRequest"` // 每请求收入(分)
2025-12-06 10:38:48 +08:00
// 时间指标
2025-12-06 15:24:30 +08:00
LastUpdated int64 `json:"lastUpdated"` // 最后更新时间
MetricsUpdateWindow int `json:"metricsUpdateWindow"` // 指标更新窗口(分钟)
2025-12-06 10:38:48 +08:00
}
// PaymentTerms 支付条款
type PaymentTerms struct {
2025-12-06 15:24:30 +08:00
BillingModel string `json:"billingModel"` // 计费模式cpm、cpc、cpa、rev_share
PaymentTerms string `json:"paymentTerms"` // 支付条款net_30、net_60、net_90
RevShareRate float64 `json:"revShareRate"` // 收入分成比例(0-1)
MinPayment int64 `json:"minPayment"` // 最小支付金额(分)
Currency string `json:"currency"` // 货币单位
TaxInclusive bool `json:"taxInclusive"` // 是否含税
EarlyPaymentDiscount float64 `json:"earlyPaymentDiscount"` // 提前付款折扣
2025-12-06 10:38:48 +08:00
}