Dockerfile

This commit is contained in:
2026-03-23 14:08:11 +08:00
parent c7a2f5bd0c
commit 827d55dbee
100 changed files with 3139 additions and 5992 deletions

View File

@@ -1,68 +0,0 @@
package entity
import (
"cid/model/config"
"gitea.com/red-future/common/beans"
)
const AdCreativeCollection = "ad_creative"
// AdCreative 广告创意素材实体
type AdCreative struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
AdvertiserId string `bson:"advertiserId" json:"advertiserId"` // 广告主ID
// 基本信息
Name string `bson:"name" json:"name"` // 创意名称
Title string `bson:"title" json:"title"` // 广告标题
Description string `bson:"description" json:"description"` // 广告描述
AdType string `bson:"adType" json:"adType"` // 广告类型image、video、native、interstitial等
Format string `bson:"format" json:"format"` // 创意格式jpg、png、mp4、html等
// 素材信息
MaterialURL string `bson:"materialUrl" json:"materialUrl"` // 素材URL
ThumbnailURL string `bson:"thumbnailUrl" json:"thumbnailUrl"` // 缩略图URL
LandingPageURL string `bson:"landingPageUrl" json:"landingPageUrl"` // 落地页URL
DisplayURL string `bson:"displayUrl" json:"displayUrl"` // 显示URL
// 尺寸和文件信息
Width int64 `bson:"width" json:"width"` // 宽度(px)
Height int64 `bson:"height" json:"height"` // 高度(px)
Size int64 `bson:"size" json:"size"` // 文件大小(bytes)
Duration int64 `bson:"duration" json:"duration"` // 时长(秒)
HasAudio bool `bson:"hasAudio" json:"hasAudio"` // 是否有音频
AspectRatio string `bson:"aspectRatio" json:"aspectRatio"` // 宽高比
// 技术信息
MimeType string `bson:"mimeType" json:"mimeType"` // MIME类型
Source string `bson:"source" json:"source"` // 来源upload、sync、generate
BackupURL string `bson:"backupUrl" json:"backupUrl"` // 备份URL
CDNURL string `bson:"cdnUrl" json:"cdnUrl"` // CDN加速URL
CompressInfo string `bson:"compressInfo" json:"compressInfo"` // 压缩信息JSON格式
// 平台兼容性
SupportedPlatforms []string `bson:"supportedPlatforms" json:"supportedPlatforms"` // 支持的平台
PlatformSpecific string `bson:"platformSpecific" json:"platformSpecific"` // 平台特定配置JSON格式
// 外部平台信息
ExternalCreativeId string `bson:"externalCreativeId" json:"externalCreativeId"` // 外部创意ID
PlatformId string `bson:"platformId" json:"platformId"` // 平台ID
SyncStatus string `bson:"syncStatus" json:"syncStatus"` // 同步状态
LastSyncTime int64 `bson:"lastSyncTime" json:"lastSyncTime"` // 最后同步时间
// 基础配置
config.BaseConfig `bson:",inline" json:",inline"` // 内联基础配置
// 限制配置
config.RestrictionConfig `bson:",inline" json:",inline"` // 内联限制配置
// 其他信息
Status string `bson:"status" json:"status"` // 状态active、inactive、archived
ExpireTime int64 `bson:"expireTime" json:"expireTime"` // 过期时间
}
// GetCollectionName 获取集合名称
func (a *AdCreative) GetCollectionName() string {
return AdCreativeCollection
}

View File

@@ -1,57 +0,0 @@
package entity
import (
"cid/model/config"
"gitea.com/red-future/common/beans"
)
const AdPlatformCollection = "ad_platform"
// AdPlatform 广告平台实体
type AdPlatform struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
Status string `bson:"status" json:"status"` // 状态active、inactive、maintenance等
// 平台基本信息
Name string `bson:"name" json:"name"` // 平台名称:小红书、抖音、快手、京东、淘宝、百度等
Code string `bson:"code" json:"code"` // 平台编码,唯一标识
DisplayName string `bson:"displayName" json:"displayName"` // 显示名称
Logo string `bson:"logo" json:"logo"` // 平台Logo
Description string `bson:"description" json:"description"` // 平台描述
Category string `bson:"category" json:"category"` // 平台分类social、ecommerce、search、short_video等
// 支持的广告类型
SupportedAdTypes []string `bson:"supportedAdTypes" json:"supportedAdTypes"` // 支持的广告类型
SupportedFormats []string `bson:"supportedFormats" json:"supportedFormats"` // 支持的广告格式
// 技术能力
RealTimeBidding bool `bson:"realTimeBidding" json:"realTimeBidding"` // 是否支持实时竞价
ProgrammaticGuaranteed bool `bson:"programmaticGuaranteed" json:"programmaticGuaranteed"` // 是否支持程序化保障
HeaderBidding bool `bson:"headerBidding" json:"headerBidding"` // 是否支持Header Bidding
// API配置
config.APIConfig `bson:",inline" json:",inline"` // 内联API配置
// 竞价配置
config.BiddingConfig `bson:",inline" json:",inline"` // 内联竞价配置
// 支付配置
config.PaymentConfig `bson:",inline" json:",inline"` // 内联支付配置
// 限流配置
RateLimit int64 `bson:"rateLimit" json:"rateLimit"` // 速率限制
MaxBudgetPerDay int64 `bson:"maxBudgetPerDay" json:"maxBudgetPerDay"` // 每日最大预算
LastSyncTime int64 `bson:"lastSyncTime" json:"lastSyncTime"` // 最后同步时间
// 联系信息
SupportContact string `bson:"supportContact" json:"supportContact"` // 技术支持联系方式
AccountManager string `bson:"accountManager" json:"accountManager"` // 客户经理
TechDocumentation string `bson:"techDocumentation" json:"techDocumentation"` // 技术文档链接
}
// GetCollectionName 获取集合名称
func (a *AdPlatform) GetCollectionName() string {
return AdPlatformCollection
}

View File

@@ -1,85 +0,0 @@
package entity
import (
"cid/model/config"
"gitea.com/red-future/common/beans"
)
const AdPositionCollection = "ad_position"
// AdPosition 广告位实体
type AdPosition struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
Status string `bson:"status" json:"status"` // 状态active、inactive、maintenance等
// 基本信息
Name string `bson:"name" json:"name"` // 广告位名称
Description string `bson:"description" json:"description"` // 广告位描述
PositionCode string `bson:"positionCode" json:"positionCode"` // 广告位编码,用于标识
AdFormat string `bson:"adFormat" json:"adFormat"` // 支持的广告格式
// 尺寸信息
Width int64 `bson:"width" json:"width"` // 宽度(px)
Height int64 `bson:"height" json:"height"` // 高度(px)
// 位置信息
Page string `bson:"page" json:"page"` // 所属页面
Section string `bson:"section" json:"section"` // 页面区域
Location string `bson:"location" json:"location"` // 具体位置
// 展示设置
MaxAds int `bson:"maxAds" json:"maxAds"` // 最大广告数量
RefreshInterval int `bson:"refreshInterval" json:"refreshInterval"` // 刷新间隔(秒)
IsLazyLoad bool `bson:"isLazyLoad" json:"isLazyLoad"` // 是否懒加载
// 定价设置
PricingModel string `bson:"pricingModel" json:"pricingModel"` // 计费模型CPC、CPM、CPA等
BasePrice int64 `bson:"basePrice" json:"basePrice"` // 基础价格(分)
FloorPrice int64 `bson:"floorPrice" json:"floorPrice"` // 底价(分)
PriceUnit string `bson:"priceUnit" json:"priceUnit"` // 价格单位:千次展示、单次点击、单次转化等
// 展示规则
DisplayRules *DisplayRules `bson:"displayRules" json:"displayRules"` // 展示规则
// 限制配置
config.RestrictionConfig `bson:",inline" json:",inline"` // 内联限制配置
// 其他状态
IsExclusive bool `bson:"isExclusive" json:"isExclusive"` // 是否独占广告位
}
// DisplayRules 广告位展示规则
type DisplayRules struct {
// 频次控制
FrequencyCap *FrequencyCap `bson:"frequencyCap" json:"frequencyCap"` // 频次控制
// 展示条件
DisplayConditions []DisplayCondition `bson:"displayConditions" json:"displayConditions"` // 展示条件
// 排除条件
ExcludeConditions []ExcludeCondition `bson:"excludeConditions" json:"excludeConditions"` // 排除条件
}
// FrequencyCap 频次控制
type FrequencyCap struct {
Impressions int `bson:"impressions" json:"impressions"` // 展示次数
TimeWindow int `bson:"timeWindow" json:"timeWindow"` // 时间窗口(小时)
}
// DisplayCondition 展示条件
type DisplayCondition struct {
Type string `bson:"type" json:"type"` // 条件类型
Value interface{} `bson:"value" json:"value"` // 条件值
}
// ExcludeCondition 排除条件
type ExcludeCondition struct {
Type string `bson:"type" json:"type"` // 条件类型
Value interface{} `bson:"value" json:"value"` // 条件值
}
// GetCollectionName 获取集合名称
func (a *AdPosition) GetCollectionName() string {
return AdPositionCollection
}

View File

@@ -1,74 +0,0 @@
package entity
import (
"cid/model/config"
"gitea.com/red-future/common/beans"
)
const AdSourceCollection = "ad_source"
// AdSource 广告源实体
type AdSource struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
Status string `bson:"status" json:"status"` // 状态active、inactive、maintenance等
// 基本信息
Name string `bson:"name" json:"name"` // 广告源名称
Code string `bson:"code" json:"code"` // 广告源编码,唯一标识
Provider string `bson:"provider" json:"provider"` // 提供商self(自营)、chuanshanjia(穿山甲)、gdt(腾讯广点通)、baidu(百度)、byteance(字节跳动)等
Type string `bson:"type" json:"type"` // 类型self(自营)、third_party(第三方)、exchange(广告交易平台)、platform_ad_source(平台广告源)
Category string `bson:"category" json:"category"` // 分类network、ssp、dsp、rtb等
// 连接配置
Config string `bson:"config" json:"config"` // 广告源配置JSON字符串
// API配置
config.APIConfig `bson:",inline" json:",inline"` // 内联API配置
// 创意配置
config.CreativeConfig `bson:",inline" json:",inline"` // 内联创意配置
// 广告源能力
Capabilities *AdSourceCapabilities `bson:"capabilities" json:"capabilities"` // 广告源能力
// 支付配置
config.PaymentConfig `bson:",inline" json:",inline"` // 内联支付配置
}
// 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类型
}
// GetCollectionName 获取集合名称
func (a *AdSource) GetCollectionName() string {
return AdSourceCollection
}

View File

@@ -1,44 +0,0 @@
package entity
import (
"gitea.com/red-future/common/beans"
)
const AdTypeCollection = "ad_type"
// AdType 广告类型实体
type AdType struct {
beans.MongoBaseDO `bson:",inline"`
// 广告类型信息
Name string `bson:"name" json:"name"` // 广告类型名称
Code string `bson:"code" json:"code"` // 广告类型编码
Description string `bson:"description" json:"description"` // 广告类型描述
Icon string `bson:"icon" json:"icon"` // 广告类型图标
// 类型配置
Category string `bson:"category" json:"category"` // 分类display, video, native, interstitial
Platforms []string `bson:"platforms" json:"platforms"` // 支持的平台
Formats []string `bson:"formats" json:"formats"` // 支持格式
Dimensions []string `bson:"dimensions" json:"dimensions"` // 尺寸规格
// 技术要求
MaxFileSize int64 `bson:"maxFileSize" json:"maxFileSize"` // 最大文件大小(bytes)
MaxDuration int64 `bson:"maxDuration" json:"maxDuration"` // 最大时长(秒)
SupportedMimeTypes []string `bson:"supportedMimeTypes" json:"supportedMimeTypes"` // 支持的MIME类型
// 业务配置
BidType string `bson:"bidType" json:"bidType"` // 竞价类型CPM, CPC, CPA
MinBidPrice int64 `bson:"minBidPrice" json:"minBidPrice"` // 最低出价(分)
MaxBidPrice int64 `bson:"maxBidPrice" json:"maxBidPrice"` // 最高出价(分)
// 状态信息
Status string `bson:"status" json:"status"` // 状态active, inactive
SortOrder int `bson:"sortOrder" json:"sortOrder"` // 排序顺序
// 统计信息
DailyImpression int64 `bson:"dailyImpression" json:"dailyImpression"` // 日展示量
DailyClick int64 `bson:"dailyClick" json:"dailyClick"` // 日点击量
Remark string `bson:"remark" json:"remark"` // 备注
}

View File

@@ -1,55 +0,0 @@
package entity
import (
"cid/model/config"
"gitea.com/red-future/common/beans"
)
const AdvertisementCollection = "advertisement"
// Advertisement 广告实体
type Advertisement struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
AdvertiserId string `bson:"advertiserId" json:"advertiserId"` // 广告主ID
// 广告基本信息
Title string `bson:"title" json:"title"` // 广告标题
Description string `bson:"description" json:"description"` // 广告描述
AdPositionId string `bson:"adPositionId" json:"adPositionId"` // 广告位ID
AdType string `bson:"adType" json:"adType"` // 广告类型:图片、视频、文字等
AdFormat string `bson:"adFormat" json:"adFormat"` // 广告格式
MaterialUrl string `bson:"materialUrl" json:"materialUrl"` // 广告素材URL
TargetUrl string `bson:"targetUrl" json:"targetUrl"` // 目标链接(点击跳转或落地页)
// 平台和广告源信息
AdSourceId string `bson:"adSourceId" json:"adSourceId"` // 广告源ID
AdPlatformId string `bson:"adPlatformId" json:"adPlatformId"` // 广告平台ID当广告来自第三方平台时
ExternalAdId string `bson:"externalAdId" json:"externalAdId"` // 外部广告ID第三方平台的广告ID
AdProvider string `bson:"adProvider" json:"adProvider"` // 广告提供者self、chuanshanjia、xiaohongshu、douyin等
// 投放配置
config.BudgetConfig `bson:",inline" json:",inline"` // 内联预算配置
BidAmount int64 `bson:"bidAmount" json:"bidAmount"` // 出价(分)
BillingType string `bson:"billingType" json:"billingType"` // 计费类型CPC、CPM、CPA等
// 定向条件
Targeting *UnifiedTargeting `bson:"targeting" json:"targeting"` // 统一定向条件
// 审核状态
AuditStatus string `bson:"auditStatus" json:"auditStatus"` // 广告状态:待审核、审核中、已通过、已拒绝、投放中、已暂停、已结束
AuditReason string `bson:"auditReason" json:"auditReason"` // 审核不通过原因
AuditTime int64 `bson:"auditTime" json:"auditTime"` // 审核时间
AuditBy string `bson:"auditBy" json:"auditBy"` // 审核人
// 限制配置
config.RestrictionConfig `bson:",inline" json:",inline"` // 内联限制配置
// 其他状态信息
Status string `bson:"status" json:"status"` // 业务状态active、inactive、archived
}
// GetCollectionName 获取集合名称
func (a *Advertisement) GetCollectionName() string {
return AdvertisementCollection
}

View File

@@ -1,53 +0,0 @@
package entity
import (
"gitea.com/red-future/common/beans"
)
const AdvertiserCollection = "advertiser"
// Advertiser 广告主实体
type Advertiser struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
Status string `bson:"status" json:"status"` // 状态active、inactive、maintenance等
// 基本信息
Name string `bson:"name" json:"name"` // 广告主名称
ContactName string `bson:"contactName" json:"contactName"` // 联系人姓名
ContactPhone string `bson:"contactPhone" json:"contactPhone"` // 联系电话
ContactEmail string `bson:"contactEmail" json:"contactEmail"` // 联系邮箱
Company string `bson:"company" json:"company"` // 公司名称
Scale string `bson:"scale" json:"scale"` // 公司规模
// 证件信息
BusinessLicenseUrl string `bson:"businessLicenseUrl" json:"businessLicenseUrl"` // 营业执照URL
ICPLicenseUrl string `bson:"icpLicenseUrl" json:"icpLicenseUrl"` // ICP备案截图URL
OtherLicenseUrls []string `bson:"otherLicenseUrls" json:"otherLicenseUrls"` // 其他证件URL
// 财务信息
BankName string `bson:"bankName" json:"bankName"` // 开户银行
BankAccount string `bson:"bankAccount" json:"bankAccount"` // 银行账号
AccountName string `bson:"accountName" json:"accountName"` // 账户名称
// 合同信息
ContractId string `bson:"contractId" json:"contractId"` // 合同编号
ContractType string `bson:"contractType" json:"contractType"` // 合同类型
ContractUrl string `bson:"contractUrl" json:"contractUrl"` // 合同文件URL
SignDate int64 `bson:"signDate" json:"signDate"` // 签约日期
ExpireDate int64 `bson:"expireDate" json:"expireDate"` // 到期日期
// 审核状态
AuditStatus string `bson:"auditStatus" json:"auditStatus"` // 广告主状态:待审核、审核中、已通过、已拒绝、已冻结
AuditReason string `bson:"auditReason" json:"auditReason"` // 审核不通过原因
AuditTime int64 `bson:"auditTime" json:"auditTime"` // 审核时间
AuditBy string `bson:"auditBy" json:"auditBy"` // 审核人
// 系统信息
AccountBalance int64 `bson:"accountBalance" json:"accountBalance"` // 账户余额(分)
CreditLimit int64 `bson:"creditLimit" json:"creditLimit"` // 授信额度(分)
}
// GetCollectionName 获取集合名称
func (a *Advertiser) GetCollectionName() string {
return AdvertiserCollection
}

View File

@@ -0,0 +1,49 @@
package app
import (
consts "cid/consts/app"
"gitea.com/red-future/common/beans"
)
// Application 应用管理实体
type Application struct {
beans.SQLBaseDO `orm:",inherit"`
// 基础信息
Name string `orm:"name" json:"name" description:"应用名称"`
AppCode string `orm:"app_code" json:"appCode" description:"应用编码(唯一标识)"`
Type consts.AppType `orm:"type" json:"type" description:"应用类型"`
Status consts.AppStatus `orm:"status" json:"status" description:"应用状态active启用/inactive停用"`
Description string `orm:"description" json:"description" description:"应用描述"`
// 接入配置 (JSONB)
AccessConfig map[string]interface{} `orm:"access_config" json:"accessConfig" description:"接入配置"`
// 限流配置 (JSONB)
LimitConfig map[string]interface{} `orm:"limit_config" json:"limitConfig" description:"限流配置"`
// 回调配置 (JSONB)
CallbackConfig map[string]interface{} `orm:"callback_config" json:"callbackConfig" description:"回调配置"`
}
// ApplicationCol 应用表字段定义
type ApplicationCol struct {
beans.SQLBaseCol
Name string
AppCode string
Type string
Status string
Description string
AccessConfig string
LimitConfig string
CallbackConfig string
}
// ApplicationCols 应用表字段常量
var ApplicationCols = ApplicationCol{
SQLBaseCol: beans.DefSQLBaseCol,
Name: "name",
AppCode: "app_code",
Type: "type",
Status: "status",
Description: "description",
AccessConfig: "access_config",
LimitConfig: "limit_config",
CallbackConfig: "callback_config",
}

View File

@@ -1,32 +0,0 @@
package entity
import (
"gitea.com/red-future/common/beans"
)
const AppPlatformConfigCollection = "app_platform_config"
// AppPlatformConfig 应用平台配置实体
type AppPlatformConfig struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
Status string `bson:"status" json:"status"` // 状态active、inactive、maintenance等
// 关联信息
AppID string `bson:"appId" json:"appId"` // 应用ID
PlatformID string `bson:"platformId" json:"platformId"` // 平台ID
// 配置信息
Config string `bson:"config" json:"config"` // 配置信息JSON字符串
MaxAdsPerReq int `bson:"maxAdsPerReq" json:"maxAdsPerReq"` // 每次请求最大广告数
// 定向配置
TargetingRules string `bson:"targetingRules" json:"targetingRules"` // 定向规则JSON字符串
// 过滤配置
FilterRules string `bson:"filterRules" json:"filterRules"` // 过滤规则JSON字符串
}
// GetCollectionName 获取集合名称
func (a *AppPlatformConfig) GetCollectionName() string {
return AppPlatformConfigCollection
}

View File

@@ -1,54 +0,0 @@
package entity
import (
"gitea.com/red-future/common/beans"
)
const ApplicationCollection = "application"
// Application 应用实体
type Application struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
Status string `bson:"status" json:"status"` // 状态active、inactive、maintenance等
// 应用基本信息
Name string `bson:"name" json:"name"` // 应用名称
Code string `bson:"code" json:"code"` // 应用编码
Description string `bson:"description" json:"description"` // 应用描述
AppKey string `bson:"appKey" json:"appKey"` // 应用密钥
AppSecret string `bson:"appSecret" json:"appSecret"` // 应用秘钥
Platform string `bson:"platform" json:"platform"` // 平台web、ios、android、h5
Version string `bson:"version" json:"version"` // 版本号
PackageName string `bson:"packageName" json:"packageName"` // 包名(移动应用)
BundleID string `bson:"bundleId" json:"bundleId"` // Bundle IDiOS应用
AppStoreURL string `bson:"appStoreUrl" json:"appStoreUrl"` // 应用商店URL
// 应用配置
Config string `bson:"config" json:"config"` // 应用配置JSON字符串
Permissions string `bson:"permissions" json:"permissions"` // 权限配置JSON字符串
// 应用分类和标签
Categories []string `bson:"categories" json:"categories"` // 应用分类
Tags []string `bson:"tags" json:"tags"` // 标签
AdTypes []string `bson:"adTypes" json:"adTypes"` // 支持的广告类型
// 回调配置
CallbackURL string `bson:"callbackUrl" json:"callbackUrl"` // 回调URL
// 应用特定统计
DailyActiveUsers int64 `bson:"dailyActiveUsers" json:"dailyActiveUsers"` // 日活用户数
MonthlyActiveUsers int64 `bson:"monthlyActiveUsers" json:"monthlyActiveUsers"` // 月活用户数
TotalRequests int64 `bson:"totalRequests" json:"totalRequests"` // 总请求数
DailyRequests int64 `bson:"dailyRequests" json:"dailyRequests"` // 日请求数
MonthlyRequests int64 `bson:"monthlyRequests" json:"monthlyRequests"` // 月请求数
// 联系信息
ContactName string `bson:"contactName" json:"contactName"` // 联系人姓名
ContactEmail string `bson:"contactEmail" json:"contactEmail"` // 联系邮箱
ContactPhone string `bson:"contactPhone" json:"contactPhone"` // 联系电话
}
// GetCollectionName 获取集合名称
func (a *Application) GetCollectionName() string {
return ApplicationCollection
}

View File

@@ -1,251 +0,0 @@
package entity
import (
"gitea.com/red-future/common/beans"
)
const CidRequestCollection = "cid_request"
// CidRequest CID请求实体合并后的统一版本
type CidRequest struct {
beans.MongoBaseDO `bson:",inline" json:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, IsDeleted
// 请求基础信息
RequestID string `bson:"requestId" json:"requestId"` // 请求唯一ID
SessionID string `bson:"sessionId" json:"sessionId"` // 会话ID
UserID string `bson:"userId" json:"userId"` // 用户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 *UnifiedUserContext `bson:"userContext" json:"userContext"` // 用户上下文
DeviceInfo *DeviceInfo `bson:"deviceInfo" json:"deviceInfo"` // 设备信息
LocationInfo *UnifiedLocationInfo `bson:"locationInfo" json:"locationInfo"` // 位置信息
TemporalInfo *UnifiedTemporalInfo `bson:"temporalInfo" json:"temporalInfo"` // 时间信息
// 请求参数(使用合并版本)
RequestParams *RequestParams `bson:"requestParams" json:"requestParams"` // 请求参数
// 定向规则(使用统一的定向结构)
TargetingRules *UnifiedTargeting `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"` // 系统版本
}
// GetCollectionName 获取集合名称
func (c *CidRequest) GetCollectionName() string {
return CidRequestCollection
}
// UnifiedUserContext 统一的用户上下文
type UnifiedUserContext 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"` // 自定义数据
}
// UnifiedLocationInfo 统一的位置信息
type UnifiedLocationInfo 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"` // 互联网服务提供商
}
// UnifiedTemporalInfo 统一的时间信息
type UnifiedTemporalInfo 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"` // 节假日
}
// 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连接
}
// 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"` // 自定义参数
}
// 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"` // 自定义设置
}
// 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"` // 平均出价(分)
}

View File

@@ -0,0 +1,56 @@
package data
import (
consts "cid/consts/data"
"gitea.com/red-future/common/beans"
)
// ApiInterface 接口管理实体
type ApiInterface struct {
beans.SQLBaseDO `orm:",inherit"`
// 基础信息
PlatformId int64 `orm:"platform_id" json:"platformId" description:"所属平台ID"`
Name string `orm:"name" json:"name" description:"接口名称"`
Code string `orm:"code" json:"code" description:"接口编码"`
Url string `orm:"url" json:"url" description:"接口地址"`
Method consts.ApiMethod `orm:"method" json:"method" description:"请求方法GET/POST/PUT/DELETE等"`
Status consts.PlatformStatus `orm:"status" json:"status" description:"接口状态active启用/inactive停用"`
// 认证类型
AuthType string `orm:"auth_type" json:"authType" description:"认证类型oauth2/apikey/basic等"`
// 请求配置 (JSONB)
RequestConfig map[string]interface{} `orm:"request_config" json:"requestConfig" description:"请求配置"`
// 响应配置 (JSONB)
ResponseConfig map[string]interface{} `orm:"response_config" json:"responseConfig" description:"响应配置"`
// 独立限流配置 (JSONB)
LimitConfig map[string]interface{} `orm:"limit_config" json:"limitConfig" description:"接口独立限流配置(可选,覆盖平台配置)"`
}
// ApiInterfaceCol 接口表字段定义
type ApiInterfaceCol struct {
beans.SQLBaseCol
PlatformId string
Name string
Code string
Url string
Method string
Status string
AuthType string
RequestConfig string
ResponseConfig string
LimitConfig string
}
// ApiInterfaceCols 接口表字段常量
var ApiInterfaceCols = ApiInterfaceCol{
SQLBaseCol: beans.DefSQLBaseCol,
PlatformId: "platform_id",
Name: "name",
Code: "code",
Url: "url",
Method: "method",
Status: "status",
AuthType: "auth_type",
RequestConfig: "request_config",
ResponseConfig: "response_config",
LimitConfig: "limit_config",
}

View File

@@ -0,0 +1,58 @@
package data
import (
consts "cid/consts/data"
"gitea.com/red-future/common/beans"
)
// DataFetchLog 数据获取日志实体
type DataFetchLog struct {
beans.SQLBaseDO `orm:",inherit"`
// 关联信息
PlatformId int64 `orm:"platform_id" json:"platformId" description:"平台ID"`
InterfaceId int64 `orm:"interface_id" json:"interfaceId" description:"接口ID"`
RequestId string `orm:"request_id" json:"requestId" description:"请求ID"`
// 执行状态
Status consts.FetchStatus `orm:"status" json:"status" description:"执行状态pending/running/success/failed/rate_limit"`
StartTime int64 `orm:"start_time" json:"startTime" description:"开始时间(时间戳)"`
EndTime int64 `orm:"end_time" json:"endTime" description:"结束时间(时间戳)"`
Duration int `orm:"duration" json:"duration" description:"执行时长(毫秒)"`
// 请求响应数据
RequestConfig map[string]interface{} `orm:"request_config" json:"requestConfig" description:"请求配置参数"`
ResponseData string `orm:"response_data" json:"responseData" description:"响应数据JSON"`
ErrorMessage string `orm:"error_message" json:"errorMessage" description:"错误信息"`
// 重试信息
RetryCount int `orm:"retry_count" json:"retryCount" description:"重试次数"`
}
// DataFetchLogCol 数据获取日志表字段定义
type DataFetchLogCol struct {
beans.SQLBaseCol
PlatformId string
InterfaceId string
RequestId string
Status string
StartTime string
EndTime string
Duration string
RequestConfig string
ResponseData string
ErrorMessage string
RetryCount string
}
// DataFetchLogCols 数据获取日志表字段常量
var DataFetchLogCols = DataFetchLogCol{
SQLBaseCol: beans.DefSQLBaseCol,
PlatformId: "platform_id",
InterfaceId: "interface_id",
RequestId: "request_id",
Status: "status",
StartTime: "start_time",
EndTime: "end_time",
Duration: "duration",
RequestConfig: "request_config",
ResponseData: "response_data",
ErrorMessage: "error_message",
RetryCount: "retry_count",
}

View File

@@ -0,0 +1,46 @@
package data
import (
consts "cid/consts/data"
"gitea.com/red-future/common/beans"
)
// Platform 平台管理实体
type Platform struct {
beans.SQLBaseDO `orm:",inherit"`
// 基础信息
Name string `orm:"name" json:"name" description:"平台名称"`
Type consts.SyncPlatform `orm:"type" json:"type" description:"平台类型"`
Status consts.PlatformStatus `orm:"status" json:"status" description:"平台状态active启用/inactive停用"`
Description string `orm:"description" json:"description" description:"平台描述"`
// 认证配置 (JSONB)
AuthConfig map[string]interface{} `orm:"auth_config" json:"authConfig" description:"认证配置"`
// 限流配置 (JSONB)
LimitConfig map[string]interface{} `orm:"limit_config" json:"limitConfig" description:"限流配置"`
// 平台专用配置 (JSONB)
PlatformConfig map[string]interface{} `orm:"platform_config" json:"platformConfig" description:"平台专用配置"`
}
// PlatformCol 平台表字段定义
type PlatformCol struct {
beans.SQLBaseCol
Name string
Type string
Status string
Description string
AuthConfig string
LimitConfig string
PlatformConfig string
}
// PlatformCols 平台表字段常量
var PlatformCols = PlatformCol{
SQLBaseCol: beans.DefSQLBaseCol,
Name: "name",
Type: "type",
Status: "status",
Description: "description",
AuthConfig: "auth_config",
LimitConfig: "limit_config",
PlatformConfig: "platform_config",
}

View File

@@ -0,0 +1,52 @@
package mapping
import (
"cid/consts/mapping"
"gitea.com/red-future/common/beans"
)
// DataMapping 数据映射实体
type DataMapping struct {
beans.SQLBaseDO `orm:",inherit"`
// 关联信息
PlatformId int64 `orm:"platform_id" json:"platformId" description:"平台ID"`
InterfaceId int64 `orm:"interface_id" json:"interfaceId" description:"接口ID"`
// 映射规则
SourceField string `orm:"source_field" json:"sourceField" description:"源字段(接口返回字段)"`
TargetField string `orm:"target_field" json:"targetField" description:"目标字段(本地表字段)"`
FieldType string `orm:"field_type" json:"fieldType" description:"字段类型string/int/float/bool/array/object"`
DefaultValue string `orm:"default_value" json:"defaultValue" description:"默认值"`
// 转换规则 (JSONB)
TransformRule map[string]interface{} `orm:"transform_rule" json:"transformRule" description:"转换规则"`
// 优先级和状态
Priority int `orm:"priority" json:"priority" description:"优先级(数字越小优先级越高)"`
Status mapping.MappingStatus `orm:"status" json:"status" description:"状态active启用/inactive停用"`
}
// DataMappingCol 数据映射表字段定义
type DataMappingCol struct {
beans.SQLBaseCol
PlatformId string
InterfaceId string
SourceField string
TargetField string
FieldType string
DefaultValue string
TransformRule string
Priority string
Status string
}
// DataMappingCols 数据映射表字段常量
var DataMappingCols = DataMappingCol{
SQLBaseCol: beans.DefSQLBaseCol,
PlatformId: "platform_id",
InterfaceId: "interface_id",
SourceField: "source_field",
TargetField: "target_field",
FieldType: "field_type",
DefaultValue: "default_value",
TransformRule: "transform_rule",
Priority: "priority",
Status: "status",
}

View File

@@ -1,71 +0,0 @@
package entity
import (
"cid/model/config"
"gitea.com/red-future/common/beans"
)
const PlatformDeliveryRuleCollection = "platform_delivery_rule"
// PlatformDeliveryRule 平台投放规则实体
type PlatformDeliveryRule struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
Status string `bson:"status" json:"status"` // 状态active、inactive、maintenance等
// 关联信息
AppID string `bson:"appId" json:"appId"` // 应用ID
PlatformID string `bson:"platformId" json:"platformId"` // 平台ID
// 规则基本信息
Name string `bson:"name" json:"name"` // 规则名称
Description string `bson:"description" json:"description"` // 规则描述
RuleType string `bson:"ruleType" json:"ruleType"` // 规则类型budget、targeting、bidding、frequency等
// 预算配置
config.BudgetConfig `bson:",inline" json:",inline"` // 内联预算配置
// 出价配置
config.BiddingConfig `bson:",inline" json:",inline"` // 内联竞价配置
// 定向配置
TargetingConfig string `bson:"targetingConfig" json:"targetingConfig"` // 定向配置JSON格式
IncludeAudience []string `bson:"includeAudience" json:"includeAudience"` // 包含受众
ExcludeAudience []string `bson:"excludeAudience" json:"excludeAudience"` // 排除受众
// 频次控制配置
config.FrequencyCapConfig `bson:",inline" json:",inline"` // 内联频次控制配置
// 创意配置
CreativeRotation string `bson:"creativeRotation" json:"creativeRotation"` // 创意轮播方式optimize、even、random
SelectedCreatives []string `bson:"selectedCreatives" json:"selectedCreatives"` // 选中的创意列表
ExcludedCreatives []string `bson:"excludedCreatives" json:"excludedCreatives"` // 排除的创意列表
// 平台特定配置
PlatformSpecific string `bson:"platformSpecific" json:"platformSpecific"` // 平台特定配置JSON格式
// 监控和告警
PerformanceThresholds string `bson:"performanceThresholds" json:"performanceThresholds"` // 性能阈值JSON格式
// 自动优化配置
IsAutoOptimize bool `bson:"isAutoOptimize" json:"isAutoOptimize"` // 是否自动优化
LastOptimizeTime int64 `bson:"lastOptimizeTime" json:"lastOptimizeTime"` // 最后优化时间
AutoOptimizeConfig string `bson:"autoOptimizeConfig" json:"autoOptimizeConfig"` // 自动优化配置JSON格式
// 执行统计
ExecutionCount int64 `bson:"executionCount" json:"executionCount"` // 执行次数
SuccessCount int64 `bson:"successCount" json:"successCount"` // 成功次数
FailureCount int64 `bson:"failureCount" json:"failureCount"` // 失败次数
LastExecutionTime int64 `bson:"lastExecutionTime" json:"lastExecutionTime"` // 最后执行时间
NextExecutionTime int64 `bson:"nextExecutionTime" json:"nextExecutionTime"` // 下次执行时间
// 执行信息
CreatedBy string `bson:"createdBy" json:"createdBy"` // 创建人
LastModifiedBy string `bson:"lastModifiedBy" json:"lastModifiedBy"` // 最后修改人
ModifiedReason string `bson:"modifiedReason" json:"modifiedReason"` // 修改原因
}
// GetCollectionName 获取集合名称
func (p *PlatformDeliveryRule) GetCollectionName() string {
return PlatformDeliveryRuleCollection
}

View File

@@ -1,28 +0,0 @@
package entity
import (
"gitea.com/red-future/common/beans"
)
const StrategyCollection = "strategy"
// Strategy 匹配策略表
type Strategy struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
Status string `bson:"status" json:"status"` // 状态active、inactive、maintenance等
// 策略基本信息
Name string `bson:"name" json:"name"` // 策略名称
Description string `bson:"description" json:"description"` // 描述
MinConversion float64 `bson:"minConversion" json:"minConversion"` // 最低转化率
MaxConversion float64 `bson:"maxConversion" json:"maxConversion"` // 最高转化率
SourceWeights string `bson:"sourceWeights" json:"sourceWeights"` // 广告源权重 (JSON格式)
MaxAdsPerReq int `bson:"maxAdsPerReq" json:"maxAdsPerReq"` // 每次请求最大广告数
MaxReqPerHour int `bson:"maxReqPerHour" json:"maxReqPerHour"` // 每小时最大请求次数
Priority int `bson:"priority" json:"priority"` // 优先级(用于策略排序)
}
// GetCollectionName 获取集合名称
func (s *Strategy) GetCollectionName() string {
return StrategyCollection
}

View File

@@ -1,68 +0,0 @@
package entity
// UnifiedTargeting 统一的定向条件
type UnifiedTargeting 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"` // 邮政编码列表
// 人口统计定向
AgeRange *UnifiedAgeRange `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"` // 生活方式
// 行为定向
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"` // 用户分群
// 上下文定向
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"` // 内容评级
// 设备定向
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"` // 连接类型
// 时间定向
TimeSlots []UnifiedTimeSlot `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"` // 排除节假日
// 扩展定向条件
CustomTargeting map[string]interface{} `bson:"customTargeting" json:"customTargeting"` // 自定义定向
}
// UnifiedAgeRange 统一的年龄范围
type UnifiedAgeRange struct {
Min int `bson:"min" json:"min"` // 最小年龄
Max int `bson:"max" json:"max"` // 最大年龄
}
// UnifiedTimeSlot 统一的时间段
type UnifiedTimeSlot struct {
DayOfWeek int `bson:"dayOfWeek" json:"dayOfWeek"` // 星期几0-60表示星期日
StartTime string `bson:"startTime" json:"startTime"` // 开始时间格式HH:mm
EndTime string `bson:"endTime" json:"endTime"` // 结束时间格式HH:mm
Timezone string `bson:"timezone" json:"timezone"` // 时区
}