初始化项目

This commit is contained in:
2025-12-06 09:10:24 +08:00
parent d730752f01
commit c9fcfc761e
35 changed files with 4283 additions and 295 deletions

View File

@@ -0,0 +1,92 @@
package entity
import (
"gitee.com/red-future---jilin-g/common/do"
)
const AdStatisticsCollection = "ad_statistics"
// AdStatistics 广告统计实体
type AdStatistics struct {
do.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// 维度信息
StatType string `bson:"statType" json:"statType"` // 统计类型:广告主、广告、广告位等
StatDimension string `bson:"statDimension" json:"statDimension"` // 统计维度:小时、天、周、月
TargetId string `bson:"targetId" json:"targetId"` // 目标ID广告主ID、广告ID、广告位ID等
TargetName string `bson:"targetName" json:"targetName"` // 目标名称:广告主名称、广告名称、广告位名称等
StatDate int64 `bson:"statDate" json:"statDate"` // 统计日期(Unix时间戳)
// 基础数据
Impressions int64 `bson:"impressions" json:"impressions"` // 展示次数
Clicks int64 `bson:"clicks" json:"clicks"` // 点击次数
Conversions int64 `bson:"conversions" json:"conversions"` // 转化次数
UniqueUsers int64 `bson:"uniqueUsers" json:"uniqueUsers"` // 唯一用户数
NewUsers int64 `bson:"newUsers" json:"newUsers"` // 新用户数
ReturnUsers int64 `bson:"returnUsers" json:"returnUsers"` // 回访用户数
ViewTime int64 `bson:"viewTime" json:"viewTime"` // 查看时间(秒)
// 财务数据
Cost int64 `bson:"cost" json:"cost"` // 消耗(分)
Revenue int64 `bson:"revenue" json:"revenue"` // 收入(分)
Budget int64 `bson:"budget" json:"budget"` // 预算(分)
RemainingBudget int64 `bson:"remainingBudget" json:"remainingBudget"` // 剩余预算(分)
// 比率数据
CTR float64 `bson:"ctr" json:"ctr"` // 点击率
CVR float64 `bson:"cvr" json:"cvr"` // 转化率
BounceRate float64 `bson:"bounceRate" json:"bounceRate"` // 跳出率
EngagementRate float64 `bson:"engagementRate" json:"engagementRate"` // 互动率
// 成本数据
CPM int64 `bson:"cpm" json:"cpm"` // 千次展示成本
CPC int64 `bson:"cpc" json:"cpc"` // 单次点击成本
CPA int64 `bson:"cpa" json:"cpa"` // 单次转化成本
eCPM int64 `bson:"ecpm" json:"ecpm"` // 有效千次展示收入
eCPC int64 `bson:"ecpc" json:"ecpc"` // 有效单次点击收入
eCPA int64 `bson:"ecpa" json:"ecpa"` // 有效单次转化收入
// 其他信息
DeviceType string `bson:"deviceType" json:"deviceType"` // 设备类型
Platform string `bson:"platform" json:"platform"` // 平台
Region string `bson:"region" json:"region"` // 地区
Gender string `bson:"gender" json:"gender"` // 性别
AgeGroup string `bson:"ageGroup" json:"ageGroup"` // 年龄段
Extra map[string]interface{} `bson:"extra" json:"extra"` // 扩展字段
}
const AdReportCollection = "ad_report"
// AdReport 广告报表实体
type AdReport struct {
do.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// 报表信息
ReportName string `bson:"reportName" json:"reportName"` // 报表名称
ReportType string `bson:"reportType" json:"reportType"` // 报表类型:日报、周报、月报、自定义
ReportPeriod string `bson:"reportPeriod" json:"reportPeriod"` // 报表周期
StartDate int64 `bson:"startDate" json:"startDate"` // 开始日期
EndDate int64 `bson:"endDate" json:"endDate"` // 结束日期
ReportData []ReportItem `bson:"reportData" json:"reportData"` // 报表数据
// 状态信息
Status string `bson:"status" json:"status"` // 报表状态:生成中、已完成、失败
GenerateTime int64 `bson:"generateTime" json:"generateTime"` // 生成时间
DownloadUrl string `bson:"downloadUrl" json:"downloadUrl"` // 下载链接
ExpiredTime int64 `bson:"expiredTime" json:"expiredTime"` // 过期时间
FileSize int64 `bson:"fileSize" json:"fileSize"` // 文件大小(字节)
FileFormat string `bson:"fileFormat" json:"fileFormat"` // 文件格式CSV、Excel、PDF
// 其他信息
Operator string `bson:"operator" json:"operator"` // 操作人
EmailRecipients []string `bson:"emailRecipients" json:"emailRecipients"` // 邮件接收人列表
Schedule string `bson:"schedule" json:"schedule"` // 定时设置
LastSentTime int64 `bson:"lastSentTime" json:"lastSentTime"` // 上次发送时间
NextSendTime int64 `bson:"nextSendTime" json:"nextSendTime"` // 下次发送时间
}
// ReportItem 报表项
type ReportItem struct {
Dimension string `bson:"dimension" json:"dimension"` // 维度名称
Data map[string]interface{} `bson:"data" json:"data"` // 数据
}