Files
cid/model/entity/advertisement.go
2025-12-09 13:32:43 +08:00

86 lines
3.6 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 AdvertisementCollection = "advertisement"
// Advertisement 广告实体
type Advertisement struct {
do.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// 广告基本信息
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等
// 投放条件
Targeting *Targeting `bson:"targeting" json:"targeting"` // 定向条件
// 状态信息
Status string `bson:"status" json:"status"` // 广告状态:待审核、审核中、已通过、已拒绝、投放中、已暂停、已结束
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"` // 消耗(分)
}
// 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
}