初始化项目
This commit is contained in:
163
model/entity/ad_source.go
Normal file
163
model/entity/ad_source.go
Normal file
@@ -0,0 +1,163 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"gitee.com/red-future---jilin-g/common/do"
|
||||
)
|
||||
|
||||
const AdSourceCollection = "ad_source"
|
||||
|
||||
// AdSource 广告源实体
|
||||
type AdSource struct {
|
||||
do.MongoBaseDO `bson:",inline"` // 嵌入基础字段:Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
|
||||
|
||||
// 基本信息
|
||||
Name string `bson:"name" json:"name"` // 广告源名称
|
||||
Code string `bson:"code" json:"code"` // 广告源编码,唯一标识
|
||||
Provider string `bson:"provider" json:"provider"` // 提供商:google、facebook、baidu、tencent、self等
|
||||
Type string `bson:"type" json:"type"` // 类型:self(自营)、third_party(第三方)、exchange(广告交易平台)
|
||||
Description string `bson:"description" json:"description"` // 描述
|
||||
|
||||
// 连接配置
|
||||
Config *AdSourceConfig `bson:"config" json:"config"` // 广告源配置
|
||||
|
||||
// API配置
|
||||
APIEndpoint string `bson:"apiEndpoint" json:"apiEndpoint"` // API端点
|
||||
APIVersion string `bson:"apiVersion" json:"apiVersion"` // API版本
|
||||
AuthType string `bson:"authType" json:"authType"` // 认证类型:api_key、oauth、basic
|
||||
AuthConfig map[string]interface{} `bson:"authConfig" json:"authConfig"` // 认证配置
|
||||
Headers map[string]string `bson:"headers" json:"headers"` // 请求头配置
|
||||
Timeout int `bson:"timeout" json:"timeout"` // 超时时间(毫秒)
|
||||
RetryCount int `bson:"retryCount" json:"retryCount"` // 重试次数
|
||||
|
||||
// 广告源能力
|
||||
Capabilities *AdSourceCapabilities `bson:"capabilities" json:"capabilities"` // 广告源能力
|
||||
|
||||
// 质量指标
|
||||
QualityMetrics *AdSourceQualityMetrics `bson:"qualityMetrics" json:"qualityMetrics"` // 质量指标
|
||||
|
||||
// 财务设置
|
||||
PaymentTerms *PaymentTerms `bson:"paymentTerms" json:"paymentTerms"` // 支付条款
|
||||
|
||||
// 状态信息
|
||||
Status string `bson:"status" json:"status"` // 广告源状态:active、inactive、maintenance
|
||||
Health string `bson:"health" json:"health"` // 健康状态:healthy、degraded、unhealthy
|
||||
LastCheckAt int64 `bson:"lastCheckAt" json:"lastCheckAt"` // 最后检查时间
|
||||
|
||||
// 统计信息
|
||||
TotalRequests int64 `bson:"totalRequests" json:"totalRequests"` // 总请求数
|
||||
SuccessfulRequests int64 `bson:"successfulRequests" json:"successfulRequests"` // 成功请求数
|
||||
FailedRequests int64 `bson:"failedRequests" json:"failedRequests"` // 失败请求数
|
||||
AverageResponseTime float64 `bson:"averageResponseTime" json:"averageResponseTime"` // 平均响应时间(毫秒)
|
||||
FillRate float64 `bson:"fillRate" json:"fillRate"` // 填充率
|
||||
CTR float64 `bson:"ctr" json:"ctr"` // 点击率
|
||||
CVR float64 `bson:"cvr" json:"cvr"` // 转化率
|
||||
|
||||
// 系统信息
|
||||
Priority int `bson:"priority" json:"priority"` // 优先级,数值越高优先级越高
|
||||
}
|
||||
|
||||
// AdSourceConfig 广告源配置
|
||||
type AdSourceConfig struct {
|
||||
// 基础配置
|
||||
SupportedFormats []string `bson:"supportedFormats" json:"supportedFormats"` // 支持的广告格式
|
||||
SupportedSizes []string `bson:"supportedSizes" json:"supportedSizes"` // 支持的尺寸
|
||||
SupportedDevices []string `bson:"supportedDevices" json:"supportedDevices"` // 支持的设备类型
|
||||
SupportedOS []string `bson:"supportedOS" json:"supportedOS"` // 支持的操作系统
|
||||
SupportedCountries []string `bson:"supportedCountries" json:"supportedCountries"` // 支持的国家/地区
|
||||
|
||||
// 竞价配置
|
||||
BiddingType string `bson:"biddingType" json:"biddingType"` // 竞价类型:cpm、cpc、cpa、rtb
|
||||
MinBidAmount int64 `bson:"minBidAmount" json:"minBidAmount"` // 最小出价(分)
|
||||
MaxBidAmount int64 `bson:"maxBidAmount" json:"maxBidAmount"` // 最大出价(分)
|
||||
BidIncrement int64 `bson:"bidIncrement" json:"bidIncrement"` // 出价增量(分)
|
||||
DefaultBidAmount int64 `bson:"defaultBidAmount" json:"defaultBidAmount"` // 默认出价(分)
|
||||
AutoOptimization bool `bson:"autoOptimization" json:"autoOptimization"` // 是否自动优化
|
||||
|
||||
// 定向配置
|
||||
TargetingSupport *TargetingSupport `bson:"targetingSupport" json:"targetingSupport"` // 定向支持
|
||||
|
||||
// 其他配置
|
||||
MaxAdsPerRequest int `bson:"maxAdsPerRequest" json:"maxAdsPerRequest"` // 单次请求最大广告数量
|
||||
BrandSafety bool `bson:"brandSafety" json:"brandSafety"` // 品牌安全
|
||||
Viewability bool `bson:"viewability" json:"viewability"` // 可见性支持
|
||||
}
|
||||
|
||||
// TargetingSupport 定向支持
|
||||
type TargetingSupport struct {
|
||||
GeoTargeting bool `bson:"geoTargeting" json:"geoTargeting"` // 地理定向
|
||||
DemographicTargeting bool `bson:"demographicTargeting" json:"demographicTargeting"` // 人口统计定向
|
||||
BehavioralTargeting bool `bson:"behavioralTargeting" json:"behavioralTargeting"` // 行为定向
|
||||
ContextualTargeting bool `bson:"contextualTargeting" json:"contextualTargeting"` // 上下文定向
|
||||
DeviceTargeting bool `bson:"deviceTargeting" json:"deviceTargeting"` // 设备定向
|
||||
TimeTargeting bool `bson:"timeTargeting" json:"timeTargeting"` // 时间定向
|
||||
Retargeting bool `bson:"retargeting" json:"retargeting"` // 重定向
|
||||
CookieTargeting bool `bson:"cookieTargeting" json:"cookieTargeting"` // Cookie定向
|
||||
}
|
||||
|
||||
// AdSourceCapabilities 广告源能力
|
||||
type AdSourceCapabilities struct {
|
||||
// 广告格式
|
||||
SupportedFormats []AdFormat `bson:"supportedFormats" json:"supportedFormats"` // 支持的广告格式
|
||||
|
||||
// 功能特性
|
||||
RealTimeBidding bool `bson:"realTimeBidding" json:"realTimeBidding"` // 实时竞价
|
||||
HeaderBidding bool `bson:"headerBidding" json:"headerBidding"` // 标题竞价
|
||||
ProgrammaticDirect bool `bson:"programmaticDirect" json:"programmaticDirect"` // 程序化直购
|
||||
PrivateMarketplace bool `bson:"privateMarketplace" json:"privateMarketplace"` // 私有交易市场
|
||||
|
||||
// 质量控制
|
||||
FraudDetection bool `bson:"fraudDetection" json:"fraudDetection"` // 反欺诈检测
|
||||
BrandSafety bool `bson:"brandSafety" json:"brandSafety"` // 品牌安全
|
||||
Viewability bool `bson:"viewability" json:"viewability"` // 可见度验证
|
||||
CreativeApproval bool `bson:"creativeApproval" json:"creativeApproval"` // 创意审核
|
||||
|
||||
// 数据能力
|
||||
AudienceTargeting bool `bson:"audienceTargeting" json:"audienceTargeting"` // 受众定向
|
||||
ContextualTargeting bool `bson:"contextualTargeting" json:"contextualTargeting"` // 上下文定向
|
||||
CrossDeviceTargeting bool `bson:"crossDeviceTargeting" json:"crossDeviceTargeting"` // 跨设备定向
|
||||
}
|
||||
|
||||
// AdFormat 广告格式
|
||||
type AdFormat struct {
|
||||
Type string `bson:"type" json:"type"` // 格式类型:banner、video、native、interstitial等
|
||||
Name string `bson:"name" json:"name"` // 格式名称
|
||||
Width int `bson:"width" json:"width"` // 宽度
|
||||
Height int `bson:"height" json:"height"` // 高度
|
||||
MimeType string `bson:"mimeType" json:"mimeType"` // MIME类型
|
||||
}
|
||||
|
||||
// AdSourceQualityMetrics 广告源质量指标
|
||||
type AdSourceQualityMetrics struct {
|
||||
// 性能指标
|
||||
AverageResponseTime float64 `bson:"averageResponseTime" json:"averageResponseTime"` // 平均响应时间(毫秒)
|
||||
SuccessRate float64 `bson:"successRate" json:"successRate"` // 成功率
|
||||
ErrorRate float64 `bson:"errorRate" json:"errorRate"` // 错误率
|
||||
Uptime float64 `bson:"uptime" json:"uptime"` // 可用性(百分比)
|
||||
|
||||
// 广告质量
|
||||
CTR float64 `bson:"ctr" json:"ctr"` // 点击率
|
||||
CVR float64 `bson:"cvr" json:"cvr"` // 转化率
|
||||
FillRate float64 `bson:"fillRate" json:"fillRate"` // 填充率
|
||||
ViewabilityRate float64 `bson:"viewabilityRate" json:"viewabilityRate"` // 可见率
|
||||
BrandSafetyScore float64 `bson:"brandSafetyScore" json:"brandSafetyScore"` // 品牌安全评分
|
||||
|
||||
// 财务指标
|
||||
eCPM int64 `bson:"ecpm" json:"ecpm"` // 有效千次展示成本(分)
|
||||
eCPC int64 `bson:"ecpc" json:"ecpc"` // 有效点击成本(分)
|
||||
RevenuePerRequest int64 `bson:"revenuePerRequest" json:"revenuePerRequest"` // 每请求收入(分)
|
||||
|
||||
// 时间指标
|
||||
LastUpdated int64 `bson:"lastUpdated" json:"lastUpdated"` // 最后更新时间
|
||||
MetricsUpdateWindow int `bson:"metricsUpdateWindow" json:"metricsUpdateWindow"` // 指标更新窗口(分钟)
|
||||
}
|
||||
|
||||
// PaymentTerms 支付条款
|
||||
type PaymentTerms struct {
|
||||
BillingModel string `bson:"billingModel" json:"billingModel"` // 计费模式:cpm、cpc、cpa、rev_share
|
||||
PaymentTerms string `bson:"paymentTerms" json:"paymentTerms"` // 支付条款:net_30、net_60、net_90
|
||||
RevShareRate float64 `bson:"revShareRate" json:"revShareRate"` // 收入分成比例(0-1)
|
||||
MinPayment int64 `bson:"minPayment" json:"minPayment"` // 最小支付金额(分)
|
||||
Currency string `bson:"currency" json:"currency"` // 货币单位
|
||||
TaxInclusive bool `bson:"taxInclusive" json:"taxInclusive"` // 是否含税
|
||||
EarlyPaymentDiscount float64 `bson:"earlyPaymentDiscount" json:"earlyPaymentDiscount"` // 提前付款折扣
|
||||
}
|
||||
312
model/entity/cid_request.go
Normal file
312
model/entity/cid_request.go
Normal file
@@ -0,0 +1,312 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"gitee.com/red-future---jilin-g/common/do"
|
||||
)
|
||||
|
||||
const CidRequestCollection = "cid_request"
|
||||
|
||||
// CidRequest CID请求实体
|
||||
type CidRequest struct {
|
||||
do.MongoBaseDO `bson:",inline"` // 嵌入基础字段:Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
|
||||
|
||||
// 请求信息
|
||||
RequestID string `bson:"requestId" json:"requestId"` // 请求唯一ID
|
||||
SessionID string `bson:"sessionId" json:"sessionId"` // 会话ID
|
||||
UserID string `bson:"userId" json:"userId"` // 用户ID
|
||||
TenantID string `bson:"tenantId" json:"tenantId"` // 租户ID
|
||||
IPAddress string `bson:"ipAddress" json:"ipAddress"` // IP地址
|
||||
UserAgent string `bson:"userAgent" json:"userAgent"` // 用户代理
|
||||
Referer string `bson:"referer" json:"referer"` // 来源页面
|
||||
|
||||
// 广告位信息
|
||||
PositionCode string `bson:"positionCode" json:"positionCode"` // 广告位编码
|
||||
PositionSize string `bson:"positionSize" json:"positionSize"` // 广告位尺寸
|
||||
PositionFormat string `bson:"positionFormat" json:"positionFormat"` // 广告位格式
|
||||
PositionType string `bson:"positionType" json:"positionType"` // 广告位类型
|
||||
|
||||
// 页面信息
|
||||
PageURL string `bson:"pageUrl" json:"pageUrl"` // 页面URL
|
||||
PageTitle string `bson:"pageTitle" json:"pageTitle"` // 页面标题
|
||||
PageCategory string `bson:"pageCategory" json:"pageCategory"` // 页面分类
|
||||
PageKeywords []string `bson:"pageKeywords" json:"pageKeywords"` // 页面关键词
|
||||
PageTags map[string]string `bson:"pageTags" json:"pageTags"` // 页面标签
|
||||
|
||||
// 用户信息
|
||||
UserContext *UserContext `bson:"userContext" json:"userContext"` // 用户上下文
|
||||
DeviceInfo *DeviceInfo `bson:"deviceInfo" json:"deviceInfo"` // 设备信息
|
||||
LocationInfo *LocationInfo `bson:"locationInfo" json:"locationInfo"` // 位置信息
|
||||
TemporalInfo *TemporalInfo `bson:"temporalInfo" json:"temporalInfo"` // 时间信息
|
||||
|
||||
// 请求参数
|
||||
RequestParams *RequestParams `bson:"requestParams" json:"requestParams"` // 请求参数
|
||||
TargetingRules *TargetingRules `bson:"targetingRules" json:"targetingRules"` // 定向规则
|
||||
|
||||
// 策略配置
|
||||
StrategyConfig *StrategyConfig `bson:"strategyConfig" json:"strategyConfig"` // 策略配置
|
||||
|
||||
// 响应信息
|
||||
Response *CidResponse `bson:"response" json:"response"` // 响应结果
|
||||
ProcessingTime int64 `bson:"processingTime" json:"processingTime"` // 处理时间(毫秒)
|
||||
ResponseTime int64 `bson:"responseTime" json:"responseTime"` // 响应时间(毫秒)
|
||||
|
||||
// 状态信息
|
||||
Status string `bson:"status" json:"status"` // 请求状态:pending、processing、completed、failed、timeout
|
||||
ErrorMessage string `bson:"errorMessage" json:"errorMessage"` // 错误信息
|
||||
ErrorCode string `bson:"errorCode" json:"errorCode"` // 错误代码
|
||||
|
||||
// 广告源信息
|
||||
RequestedAdSources []string `bson:"requestedAdSources" json:"requestedAdSources"` // 请求的广告源列表
|
||||
RespondedAdSources []string `bson:"respondedAdSources" json:"respondedAdSources"` // 响应的广告源列表
|
||||
AdSourceResponses map[string]*AdSourceResponse `bson:"adSourceResponses" json:"adSourceResponses"` // 各广告源响应
|
||||
|
||||
// 统计信息
|
||||
TotalAdsReturned int `bson:"totalAdsReturned" json:"totalAdsReturned"` // 返回的广告总数
|
||||
ValidAdsReturned int `bson:"validAdsReturned" json:"validAdsReturned"` // 有效广告数
|
||||
FilteredAds int `bson:"filteredAds" json:"filteredAds"` // 过滤的广告数
|
||||
DuplicateAds int `bson:"duplicateAds" json:"duplicateAds"` // 重复广告数
|
||||
|
||||
// 系统信息
|
||||
ServerInstance string `bson:"serverInstance" json:"serverInstance"` // 服务实例ID
|
||||
Region string `bson:"region" json:"region"` // 服务区域
|
||||
Version string `bson:"version" json:"version"` // 系统版本
|
||||
}
|
||||
|
||||
// CidResponse CID响应
|
||||
type CidResponse struct {
|
||||
Ads []Ad `bson:"ads" json:"ads"` // 广告列表
|
||||
TrackingInfo *TrackingInfo `bson:"trackingInfo" json:"trackingInfo"` // 跟踪信息
|
||||
Metadata *ResponseMetadata `bson:"metadata" json:"metadata"` // 响应元数据
|
||||
}
|
||||
|
||||
// Ad 广告
|
||||
type Ad struct {
|
||||
ID string `bson:"id" json:"id"` // 广告ID
|
||||
AdSource string `bson:"adSource" json:"adSource"` // 广告源
|
||||
Advertiser string `bson:"advertiser" json:"advertiser"` // 广告主
|
||||
Title string `bson:"title" json:"title"` // 广告标题
|
||||
Description string `bson:"description" json:"description"` // 广告描述
|
||||
CreativeURL string `bson:"creativeUrl" json:"creativeUrl"` // 创意URL
|
||||
LandingURL string `bson:"landingUrl" json:"landingUrl"` // 落地页URL
|
||||
DisplayURL string `bson:"displayUrl" json:"displayUrl"` // 显示URL
|
||||
AdType string `bson:"adType" json:"adType"` // 广告类型
|
||||
Format string `bson:"format" json:"format"` // 广告格式
|
||||
Width int `bson:"width" json:"width"` // 宽度
|
||||
Height int `bson:"height" json:"height"` // 高度
|
||||
MimeType string `bson:"mimeType" json:"mimeType"` // MIME类型
|
||||
BidAmount int64 `bson:"bidAmount" json:"bidAmount"` // 出价(分)
|
||||
Revenue int64 `bson:"revenue" json:"revenue"` // 预估收入(分)
|
||||
CTR float64 `bson:"ctr" json:"ctr"` // 点击率
|
||||
CVR float64 `bson:"cvr" json:"cvr"` // 转化率
|
||||
Targeting map[string]interface{} `bson:"targeting" json:"targeting"` // 定向条件
|
||||
Restrictions map[string]interface{} `bson:"restrictions" json:"restrictions"` // 限制条件
|
||||
TrackingPixels []string `bson:"trackingPixels" json:"trackingPixels"` // 跟踪像素
|
||||
CustomData map[string]interface{} `bson:"customData" json:"customData"` // 自定义数据
|
||||
ExpiresAt int64 `bson:"expiresAt" json:"expiresAt"` // 过期时间
|
||||
Priority int `bson:"priority" json:"priority"` // 优先级
|
||||
Score float64 `bson:"score" json:"score"` // 评分
|
||||
}
|
||||
|
||||
// TrackingInfo 跟踪信息
|
||||
type TrackingInfo struct {
|
||||
ImpressionURLs []string `bson:"impressionUrls" json:"impressionUrls"` // 展示跟踪URL
|
||||
ClickURLs []string `bson:"clickUrls" json:"clickUrls"` // 点击跟踪URL
|
||||
ConversionURLs []string `bson:"conversionUrls" json:"conversionUrls"` // 转化跟踪URL
|
||||
ViewThroughURLs []string `bson:"viewThroughUrls" json:"viewThroughUrls"` // 查看跟踪URL
|
||||
EventURLs map[string][]string `bson:"eventUrls" json:"eventUrls"` // 事件跟踪URL
|
||||
BeaconURLs []string `bson:"beaconUrls" json:"beaconUrls"` // 信标URL
|
||||
}
|
||||
|
||||
// ResponseMetadata 响应元数据
|
||||
type ResponseMetadata struct {
|
||||
TotalAvailableAds int `bson:"totalAvailableAds" json:"totalAvailableAds"` // 总可用广告数
|
||||
SelectedAds int `bson:"selectedAds" json:"selectedAds"` // 选择的广告数
|
||||
FilteredAds int `bson:"filteredAds" json:"filteredAds"` // 过滤的广告数
|
||||
DuplicateAds int `bson:"duplicateAds" json:"duplicateAds"` // 重复的广告数
|
||||
AverageBidAmount int64 `bson:"averageBidAmount" json:"averageBidAmount"` // 平均出价
|
||||
HighestBidAmount int64 `bson:"highestBidAmount" json:"highestBidAmount"` // 最高出价
|
||||
LowestBidAmount int64 `bson:"lowestBidAmount" json:"lowestBidAmount"` // 最低出价
|
||||
AverageCTR float64 `bson:"averageCTR" json:"averageCTR"` // 平均点击率
|
||||
AverageCVR float64 `bson:"averageCVR" json:"averageCVR"` // 平均转化率
|
||||
ResponseTime int64 `bson:"responseTime" json:"responseTime"` // 响应时间(毫秒)
|
||||
CacheHit bool `bson:"cacheHit" json:"cacheHit"` // 是否命中缓存
|
||||
StrategyUsed string `bson:"strategyUsed" json:"strategyUsed"` // 使用的策略
|
||||
AdSourcesUsed []string `bson:"adSourcesUsed" json:"adSourcesUsed"` // 使用的广告源
|
||||
}
|
||||
|
||||
// AdSourceResponse 广告源响应
|
||||
type AdSourceResponse struct {
|
||||
AdSource string `bson:"adSource" json:"adSource"` // 广告源名称
|
||||
Status string `bson:"status" json:"status"` // 响应状态:success、timeout、error
|
||||
ResponseTime int64 `bson:"responseTime" json:"responseTime"` // 响应时间(毫秒)
|
||||
AdsReturned int `bson:"adsReturned" json:"adsReturned"` // 返回的广告数
|
||||
AdsAccepted int `bson:"adsAccepted" json:"adsAccepted"` // 接受的广告数
|
||||
AdsFiltered int `bson:"adsFiltered" json:"adsFiltered"` // 过滤的广告数
|
||||
ErrorMessage string `bson:"errorMessage" json:"errorMessage"` // 错误信息
|
||||
ErrorCode string `bson:"errorCode" json:"errorCode"` // 错误代码
|
||||
RetryCount int `bson:"retryCount" json:"retryCount"` // 重试次数
|
||||
CacheHit bool `bson:"cacheHit" json:"cacheHit"` // 是否命中缓存
|
||||
TotalRevenue int64 `bson:"totalRevenue" json:"totalRevenue"` // 总收入(分)
|
||||
AverageBidAmount int64 `bson:"averageBidAmount" json:"averageBidAmount"` // 平均出价(分)
|
||||
}
|
||||
|
||||
// UserContext 用户上下文
|
||||
type UserContext struct {
|
||||
UserID string `bson:"userId" json:"userId"` // 用户ID
|
||||
SessionID string `bson:"sessionId" json:"sessionId"` // 会话ID
|
||||
CookieID string `bson:"cookieId" json:"cookieId"` // Cookie ID
|
||||
IP string `bson:"ip" json:"ip"` // IP地址
|
||||
UserAgent string `bson:"userAgent" json:"userAgent"` // 用户代理
|
||||
Language string `bson:"language" json:"language"` // 语言
|
||||
Timezone string `bson:"timezone" json:"timezone"` // 时区
|
||||
CustomData map[string]interface{} `bson:"customData" json:"customData"` // 自定义数据
|
||||
}
|
||||
|
||||
// DeviceInfo 设备信息
|
||||
type DeviceInfo struct {
|
||||
Type string `bson:"type" json:"type"` // 设备类型:desktop、mobile、tablet
|
||||
Brand string `bson:"brand" json:"brand"` // 设备品牌
|
||||
Model string `bson:"model" json:"model"` // 设备型号
|
||||
OS string `bson:"os" json:"os"` // 操作系统
|
||||
OSVersion string `bson:"osVersion" json:"osVersion"` // 操作系统版本
|
||||
Browser string `bson:"browser" json:"browser"` // 浏览器
|
||||
BrowserVersion string `bson:"browserVersion" json:"browserVersion"` // 浏览器版本
|
||||
ScreenWidth int `bson:"screenWidth" json:"screenWidth"` // 屏幕宽度
|
||||
ScreenHeight int `bson:"screenHeight" json:"screenHeight"` // 屏幕高度
|
||||
ViewportWidth int `bson:"viewportWidth" json:"viewportWidth"` // 视口宽度
|
||||
ViewportHeight int `bson:"viewportHeight" json:"viewportHeight"` // 视口高度
|
||||
DPI int `bson:"dpi" json:"dpi"` // 设备DPI
|
||||
IsJavaScript bool `bson:"isJavaScript" json:"isJavaScript"` // 是否支持JavaScript
|
||||
IsCookie bool `bson:"isCookie" json:"isCookie"` // 是否支持Cookie
|
||||
IsFlash bool `bson:"isFlash" json:"isFlash"` // 是否支持Flash
|
||||
IsHTTPS bool `bson:"isHTTPS" json:"isHTTPS"` // 是否HTTPS连接
|
||||
}
|
||||
|
||||
// LocationInfo 位置信息
|
||||
type LocationInfo struct {
|
||||
Country string `bson:"country" json:"country"` // 国家
|
||||
Region string `bson:"region" json:"region"` // 地区/省份
|
||||
City string `bson:"city" json:"city"` // 城市
|
||||
PostalCode string `bson:"postalCode" json:"postalCode"` // 邮政编码
|
||||
Latitude float64 `bson:"latitude" json:"latitude"` // 纬度
|
||||
Longitude float64 `bson:"longitude" json:"longitude"` // 经度
|
||||
Timezone string `bson:"timezone" json:"timezone"` // 时区
|
||||
Metro string `bson:"metro" json:"metro"` // 都市区
|
||||
Area string `bson:"area" json:"area"` // 区域
|
||||
Network string `bson:"network" json:"network"` // 网络运营商
|
||||
ConnectionType string `bson:"connectionType" json:"connectionType"` // 连接类型
|
||||
ISP string `bson:"isp" json:"isp"` // 互联网服务提供商
|
||||
}
|
||||
|
||||
// TemporalInfo 时间信息
|
||||
type TemporalInfo struct {
|
||||
Timestamp int64 `bson:"timestamp" json:"timestamp"` // 时间戳(秒)
|
||||
Milliseconds int64 `bson:"milliseconds" json:"milliseconds"` // 毫秒数
|
||||
Timezone string `bson:"timezone" json:"timezone"` // 时区
|
||||
DayOfWeek int `bson:"dayOfWeek" json:"dayOfWeek"` // 星期几(0-6)
|
||||
HourOfDay int `bson:"hourOfDay" json:"hourOfDay"` // 小时(0-23)
|
||||
DayOfMonth int `bson:"dayOfMonth" json:"dayOfMonth"` // 月份中的天数
|
||||
Month int `bson:"month" json:"month"` // 月份(1-12)
|
||||
Year int `bson:"year" json:"year"` // 年份
|
||||
IsWeekend bool `bson:"isWeekend" json:"isWeekend"` // 是否周末
|
||||
IsBusinessHours bool `bson:"isBusinessHours" json:"isBusinessHours"` // 是否营业时间
|
||||
Season string `bson:"season" json:"season"` // 季节
|
||||
Holiday string `bson:"holiday" json:"holiday"` // 节假日
|
||||
}
|
||||
|
||||
// RequestParams 请求参数
|
||||
type RequestParams struct {
|
||||
AdCount int `bson:"adCount" json:"adCount"` // 请求的广告数量
|
||||
AdTypes []string `bson:"adTypes" json:"adTypes"` // 广告类型
|
||||
AdSizes []string `bson:"adSizes" json:"adSizes"` // 广告尺寸
|
||||
ExcludedAdSources []string `bson:"excludedAdSources" json:"excludedAdSources"` // 排除的广告源
|
||||
RequiredAdSources []string `bson:"requiredAdSources" json:"requiredAdSources"` // 必需的广告源
|
||||
MinBidAmount int64 `bson:"minBidAmount" json:"minBidAmount"` // 最小出价(分)
|
||||
MaxBidAmount int64 `bson:"maxBidAmount" json:"maxBidAmount"` // 最大出价(分)
|
||||
AllowDuplicates bool `bson:"allowDuplicates" json:"allowDuplicates"` // 是否允许重复广告
|
||||
FloorPrice int64 `bson:"floorPrice" json:"floorPrice"` // 底价(分)
|
||||
CeilingPrice int64 `bson:"ceilingPrice" json:"ceilingPrice"` // 封顶价(分)
|
||||
CustomParams map[string]interface{} `bson:"customParams" json:"customParams"` // 自定义参数
|
||||
}
|
||||
|
||||
// TargetingRules 定向规则
|
||||
type TargetingRules struct {
|
||||
GeoTargeting *GeoTargeting `bson:"geoTargeting" json:"geoTargeting"` // 地理定向
|
||||
DemographicTargeting *DemographicTargeting `bson:"demographicTargeting" json:"demographicTargeting"` // 人口统计定向
|
||||
BehavioralTargeting *BehavioralTargeting `bson:"behavioralTargeting" json:"behavioralTargeting"` // 行为定向
|
||||
ContextualTargeting *ContextualTargeting `bson:"contextualTargeting" json:"contextualTargeting"` // 上下文定向
|
||||
DeviceTargeting *DeviceTargeting `bson:"deviceTargeting" json:"deviceTargeting"` // 设备定向
|
||||
TimeTargeting *TimeTargeting `bson:"timeTargeting" json:"timeTargeting"` // 时间定向
|
||||
CustomTargeting map[string]interface{} `bson:"customTargeting" json:"customTargeting"` // 自定义定向
|
||||
}
|
||||
|
||||
// GeoTargeting 地理定向
|
||||
type GeoTargeting struct {
|
||||
Countries []string `bson:"countries" json:"countries"` // 国家列表
|
||||
Regions []string `bson:"regions" json:"regions"` // 地区列表
|
||||
Cities []string `bson:"cities" json:"cities"` // 城市列表
|
||||
PostalCodes []string `bson:"postalCodes" json:"postalCodes"` // 邮政编码列表
|
||||
GeoTargets []string `bson:"geoTargets" json:"geoTargets"` // 地理目标
|
||||
}
|
||||
|
||||
// DemographicTargeting 人口统计定向
|
||||
type DemographicTargeting struct {
|
||||
AgeRange *AgeRange `bson:"ageRange" json:"ageRange"` // 年龄范围
|
||||
Gender []string `bson:"gender" json:"gender"` // 性别
|
||||
Income []string `bson:"income" json:"income"` // 收入水平
|
||||
Education []string `bson:"education" json:"education"` // 教育程度
|
||||
Occupation []string `bson:"occupation" json:"occupation"` // 职业类型
|
||||
Interests []string `bson:"interests" json:"interests"` // 兴趣标签
|
||||
Lifestyle []string `bson:"lifestyle" json:"lifestyle"` // 生活方式
|
||||
}
|
||||
|
||||
// BehavioralTargeting 行为定向
|
||||
type BehavioralTargeting struct {
|
||||
SearchHistory []string `bson:"searchHistory" json:"searchHistory"` // 搜索历史
|
||||
BrowseHistory []string `bson:"browseHistory" json:"browseHistory"` // 浏览历史
|
||||
PurchaseHistory []string `bson:"purchaseHistory" json:"purchaseHistory"` // 购买历史
|
||||
AdInteractions []string `bson:"adInteractions" json:"adInteractions"` // 广告互动
|
||||
Behaviors []string `bson:"behaviors" json:"behaviors"` // 行为标签
|
||||
Segments []string `bson:"segments" json:"segments"` // 用户分群
|
||||
}
|
||||
|
||||
// ContextualTargeting 上下文定向
|
||||
type ContextualTargeting struct {
|
||||
Categories []string `bson:"categories" json:"categories"` // 内容分类
|
||||
Keywords []string `bson:"keywords" json:"keywords"` // 关键词
|
||||
Tags []string `bson:"tags" json:"tags"` // 标签
|
||||
Sentiment string `bson:"sentiment" json:"sentiment"` // 情感倾向
|
||||
ContentType string `bson:"contentType" json:"contentType"` // 内容类型
|
||||
ContentRating string `bson:"contentRating" json:"contentRating"` // 内容评级
|
||||
}
|
||||
|
||||
// DeviceTargeting 设备定向
|
||||
type DeviceTargeting struct {
|
||||
DeviceTypes []string `bson:"deviceTypes" json:"deviceTypes"` // 设备类型
|
||||
OS []string `bson:"os" json:"os"` // 操作系统
|
||||
Browsers []string `bson:"browsers" json:"browsers"` // 浏览器
|
||||
Carriers []string `bson:"carriers" json:"carriers"` // 运营商
|
||||
ConnectionTypes []string `bson:"connectionTypes" json:"connectionTypes"` // 连接类型
|
||||
}
|
||||
|
||||
// TimeTargeting 时间定向
|
||||
type TimeTargeting struct {
|
||||
TimeSlots []TimeSlot `bson:"timeSlots" json:"timeSlots"` // 时间段
|
||||
DaysOfWeek []int `bson:"daysOfWeek" json:"daysOfWeek"` // 星期几
|
||||
Dates []string `bson:"dates" json:"dates"` // 日期范围
|
||||
Timezone string `bson:"timezone" json:"timezone"` // 时区
|
||||
ExcludeHolidays bool `bson:"excludeHolidays" json:"excludeHolidays"` // 排除节假日
|
||||
}
|
||||
|
||||
// StrategyConfig 策略配置
|
||||
type StrategyConfig struct {
|
||||
StrategyType string `bson:"strategyType" json:"strategyType"` // 策略类型
|
||||
Priority int `bson:"priority" json:"priority"` // 优先级
|
||||
Weight float64 `bson:"weight" json:"weight"` // 权重
|
||||
MinAds int `bson:"minAds" json:"minAds"` // 最小广告数
|
||||
MaxAds int `bson:"maxAds" json:"maxAds"` // 最大广告数
|
||||
AllowDuplicates bool `bson:"allowDuplicates" json:"allowDuplicates"` // 是否允许重复
|
||||
Timeout int64 `bson:"timeout" json:"timeout"` // 超时时间(毫秒)
|
||||
RetryCount int `bson:"retryCount" json:"retryCount"` // 重试次数
|
||||
CustomSettings map[string]interface{} `bson:"customSettings" json:"customSettings"` // 自定义设置
|
||||
}
|
||||
23
model/entity/strategy.go
Normal file
23
model/entity/strategy.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
// Strategy 匹配策略表
|
||||
type Strategy struct {
|
||||
Id int64 `json:"id" orm:"id,primary"` // ID
|
||||
Name string `json:"name" orm:"name"` // 策略名称
|
||||
Description string `json:"description" orm:"description"` // 描述
|
||||
TenantLevel string `json:"tenant_level" orm:"tenant_level"` // 适用租户级别
|
||||
MinConversion float64 `json:"min_conversion" orm:"min_conversion"` // 最低转化率
|
||||
MaxConversion float64 `json:"max_conversion" orm:"max_conversion"` // 最高转化率
|
||||
SourceWeights string `json:"source_weights" orm:"source_weights"` // 广告源权重 (JSON格式)
|
||||
MaxAdsPerReq int `json:"max_ads_per_req" orm:"max_ads_per_req"` // 每次请求最大广告数
|
||||
Priority int `json:"priority" orm:"priority"` // 优先级
|
||||
Status string `json:"status" orm:"status"` // 状态: active, inactive
|
||||
CreatedAt *gtime.Time `json:"created_at" orm:"created_at"` // 创建时间
|
||||
UpdatedAt *gtime.Time `json:"updated_at" orm:"updated_at"` // 更新时间
|
||||
CreatedBy int64 `json:"created_by" orm:"created_by"` // 创建人
|
||||
UpdatedBy int64 `json:"updated_by" orm:"updated_by"` // 更新人
|
||||
}
|
||||
Reference in New Issue
Block a user