Files
cid/model/entity/ad_source.go
2025-12-18 17:51:33 +08:00

164 lines
7.5 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 entity
import (
"gitee.com/red-future---jilin-g/common/do"
)
const AdSourceCollection = "ad_source"
// AdSource 广告源实体
type AdSource struct {
do.MongoBaseDO `bson:",inline" json:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// 基本信息
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"` // 描述
// 连接配置
Config string `json:"config"` // 广告源配置JSON字符串
// API配置
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"` // 重试次数
// 广告源能力
Capabilities string `json:"capabilities"` // 广告源能力JSON字符串
// 质量指标
QualityMetrics string `json:"qualityMetrics"` // 质量指标JSON字符串
// 财务设置
PaymentTerms string `json:"paymentTerms"` // 支付条款JSON字符串
// 状态信息
Status string `json:"status"` // 广告源状态active、inactive、maintenance
Health string `json:"health"` // 健康状态healthy、degraded、unhealthy
LastCheckAt int64 `json:"lastCheckAt"` // 最后检查时间
// 统计信息
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"` // 转化率
// 系统信息
Priority int `json:"priority"` // 优先级,数值越高优先级越高
}
// AdSourceConfig 广告源配置
type AdSourceConfig struct {
// 基础配置
SupportedFormats []string `json:"supportedFormats"` // 支持的广告格式
SupportedSizes []string `json:"supportedSizes"` // 支持的尺寸
SupportedDevices []string `json:"supportedDevices"` // 支持的设备类型
SupportedOS []string `json:"supportedOS"` // 支持的操作系统
SupportedCountries []string `json:"supportedCountries"` // 支持的国家/地区
// 竞价配置
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"` // 是否自动优化
// 定向配置
TargetingSupport *TargetingSupport `json:"targetingSupport"` // 定向支持
// 其他配置
MaxAdsPerRequest int `json:"maxAdsPerRequest"` // 单次请求最大广告数量
BrandSafety bool `json:"brandSafety"` // 品牌安全
Viewability bool `json:"viewability"` // 可见性支持
}
// TargetingSupport 定向支持
type TargetingSupport struct {
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定向
}
// AdSourceCapabilities 广告源能力
type AdSourceCapabilities struct {
// 广告格式
SupportedFormats []AdFormat `json:"supportedFormats"` // 支持的广告格式
// 功能特性
RealTimeBidding bool `json:"realTimeBidding"` // 实时竞价
HeaderBidding bool `json:"headerBidding"` // 标题竞价
ProgrammaticDirect bool `json:"programmaticDirect"` // 程序化直购
PrivateMarketplace bool `json:"privateMarketplace"` // 私有交易市场
// 质量控制
FraudDetection bool `json:"fraudDetection"` // 反欺诈检测
BrandSafety bool `json:"brandSafety"` // 品牌安全
Viewability bool `json:"viewability"` // 可见度验证
CreativeApproval bool `json:"creativeApproval"` // 创意审核
// 数据能力
AudienceTargeting bool `json:"audienceTargeting"` // 受众定向
ContextualTargeting bool `json:"contextualTargeting"` // 上下文定向
CrossDeviceTargeting bool `json:"crossDeviceTargeting"` // 跨设备定向
}
// AdFormat 广告格式
type AdFormat struct {
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类型
}
// AdSourceQualityMetrics 广告源质量指标
type AdSourceQualityMetrics struct {
// 性能指标
AverageResponseTime float64 `json:"averageResponseTime"` // 平均响应时间(毫秒)
SuccessRate float64 `json:"successRate"` // 成功率
ErrorRate float64 `json:"errorRate"` // 错误率
Uptime float64 `json:"uptime"` // 可用性(百分比)
// 广告质量
CTR float64 `json:"ctr"` // 点击率
CVR float64 `json:"cvr"` // 转化率
FillRate float64 `json:"fillRate"` // 填充率
ViewabilityRate float64 `json:"viewabilityRate"` // 可见率
BrandSafetyScore float64 `json:"brandSafetyScore"` // 品牌安全评分
// 财务指标
Ecpm int64 `json:"ecpm"` // 有效千次展示成本(分)
Ecpc int64 `json:"ecpc"` // 有效点击成本(分)
RevenuePerRequest int64 `json:"revenuePerRequest"` // 每请求收入(分)
// 时间指标
LastUpdated int64 `json:"lastUpdated"` // 最后更新时间
MetricsUpdateWindow int `json:"metricsUpdateWindow"` // 指标更新窗口(分钟)
}
// PaymentTerms 支付条款
type PaymentTerms struct {
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"` // 提前付款折扣
}