gomod引用

This commit is contained in:
2025-12-19 09:42:39 +08:00
parent 0814c6c819
commit ed0e384907
33 changed files with 723 additions and 3123 deletions

View File

@@ -8,78 +8,46 @@ const AdvertisementCollection = "advertisement"
// Advertisement 广告实体
type Advertisement struct {
do.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
do.MongoBaseDO `bson:",inline" json:",inline"`
AdvertiserId string `bson:"advertiserId" json:"advertiserId"` // 广告主ID
// 广告基本信息
Title string `bson:"title" json:"title"` // 广告标题
Description string `bson:"description" json:"description"` // 广告描述
AdvertiserId string `bson:"advertiserId" json:"advertiserId"` // 广告主ID
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"` // 目标链接(点击跳转或落地页)
// 投放设置
StartDate int64 `bson:"startDate" json:"startDate"` // 开始投放时间
EndDate int64 `bson:"endDate" json:"endDate"` // 结束投放时间
Budget int64 `bson:"budget" json:"budget"` // 预算(分)
DailyBudget int64 `bson:"dailyBudget" json:"dailyBudget"` // 日预算(分)
BidAmount int64 `bson:"bidAmount" json:"bidAmount"` // 出价(分)
BillingType string `bson:"billingType" json:"billingType"` // 计费类型CPC、CPM、CPA等
// 平台和广告源信息
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等
// 投放条件
Targeting *Targeting `bson:"targeting" json:"targeting"` // 定向条件
// 投放配置
BudgetConfig `bson:",inline" json:",inline"` // 内联预算配置
BidAmount int64 `bson:"bidAmount" json:"bidAmount"` // 出价(分)
BillingType string `bson:"billingType" json:"billingType"` // 计费类型CPC、CPM、CPA等
// 状态信息
Status string `bson:"status" json:"status"` // 广告状态:待审核、审核中、已通过、已拒绝、投放中、已暂停、已结束
// 定向条件
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"` // 审核人
// 基础统计信息(比率字段通过计算得到,不持久化存储)
Impressions int64 `bson:"impressions" json:"impressions"` // 展示次数
Clicks int64 `bson:"clicks" json:"clicks"` // 点击次数
Conversions int64 `bson:"conversions" json:"conversions"` // 转化次数
Cost int64 `bson:"cost" json:"cost"` // 消耗(分)
// 限制配置
RestrictionConfig `bson:",inline" json:",inline"` // 内联限制配置
// 其他状态信息
Status string `bson:"status" json:"status"` // 业务状态active、inactive、archived
}
// Targeting 广告定向条件
type Targeting struct {
// 地域定向
Regions []string `bson:"regions" json:"regions"` // 地域列表
// 兴趣定向
Interests []string `bson:"interests" json:"interests"` // 兴趣标签
// 年龄定向
AgeRange *AgeRange `bson:"ageRange" json:"ageRange"` // 年龄范围
// 性别定向
Gender []string `bson:"gender" json:"gender"` // 性别:男、女、全部
// 设备定向
Devices []string `bson:"devices" json:"devices"` // 设备类型
// 操作系统定向
OperatingSystems []string `bson:"operatingSystems" json:"operatingSystems"` // 操作系统
// 时间定向
TimeSlots []TimeSlot `bson:"timeSlots" json:"timeSlots"` // 时间段
// 行为定向
Behaviors []string `bson:"behaviors" json:"behaviors"` // 行为标签
}
// AgeRange 年龄范围
type AgeRange struct {
Min int `bson:"min" json:"min"` // 最小年龄
Max int `bson:"max" json:"max"` // 最大年龄
}
// TimeSlot 时间段
type TimeSlot 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
// GetCollectionName 获取集合名称
func (a *Advertisement) GetCollectionName() string {
return AdvertisementCollection
}