2025-12-06 09:10:24 +08:00
|
|
|
|
package entity
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
2025-12-19 10:20:30 +08:00
|
|
|
|
"cid/model/config"
|
|
|
|
|
|
|
2026-02-24 16:24:47 +08:00
|
|
|
|
"gitea.com/red-future/common/beans"
|
2025-12-06 09:10:24 +08:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
const AdPositionCollection = "ad_position"
|
|
|
|
|
|
|
|
|
|
|
|
// AdPosition 广告位实体
|
|
|
|
|
|
type AdPosition struct {
|
2025-12-31 11:04:55 +08:00
|
|
|
|
beans.MongoBaseDO `bson:",inline" json:",inline"`
|
|
|
|
|
|
Status string `bson:"status" json:"status"` // 状态:active、inactive、maintenance等
|
2025-12-06 09:10:24 +08:00
|
|
|
|
|
|
|
|
|
|
// 基本信息
|
|
|
|
|
|
Name string `bson:"name" json:"name"` // 广告位名称
|
|
|
|
|
|
Description string `bson:"description" json:"description"` // 广告位描述
|
|
|
|
|
|
PositionCode string `bson:"positionCode" json:"positionCode"` // 广告位编码,用于标识
|
|
|
|
|
|
AdFormat string `bson:"adFormat" json:"adFormat"` // 支持的广告格式
|
|
|
|
|
|
|
|
|
|
|
|
// 尺寸信息
|
2025-12-19 09:42:39 +08:00
|
|
|
|
Width int64 `bson:"width" json:"width"` // 宽度(px)
|
|
|
|
|
|
Height int64 `bson:"height" json:"height"` // 高度(px)
|
2025-12-06 09:10:24 +08:00
|
|
|
|
|
|
|
|
|
|
// 位置信息
|
|
|
|
|
|
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"` // 展示规则
|
|
|
|
|
|
|
2025-12-19 09:42:39 +08:00
|
|
|
|
// 限制配置
|
2025-12-19 10:20:30 +08:00
|
|
|
|
config.RestrictionConfig `bson:",inline" json:",inline"` // 内联限制配置
|
2025-12-06 09:10:24 +08:00
|
|
|
|
|
2025-12-19 09:42:39 +08:00
|
|
|
|
// 其他状态
|
|
|
|
|
|
IsExclusive bool `bson:"isExclusive" json:"isExclusive"` // 是否独占广告位
|
2025-12-06 09:10:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 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"` // 条件值
|
|
|
|
|
|
}
|
2025-12-19 09:42:39 +08:00
|
|
|
|
|
|
|
|
|
|
// GetCollectionName 获取集合名称
|
|
|
|
|
|
func (a *AdPosition) GetCollectionName() string {
|
|
|
|
|
|
return AdPositionCollection
|
|
|
|
|
|
}
|