初始化项目

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,82 @@
package entity
import (
"gitee.com/red-future---jilin-g/common/do"
)
const AdPositionCollection = "ad_position"
// AdPosition 广告位实体
type AdPosition struct {
do.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// 基本信息
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 int `bson:"width" json:"width"` // 宽度(px)
Height int `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"` // 展示规则
// 状态信息
Status string `bson:"status" json:"status"` // 广告位状态:启用、禁用、测试
IsExclusive bool `bson:"isExclusive" json:"isExclusive"` // 是否独占广告位
// 统计信息
DailyImpressions int64 `bson:"dailyImpressions" json:"dailyImpressions"` // 日均展示量
DailyClicks int64 `bson:"dailyClicks" json:"dailyClicks"` // 日均点击量
DailyRevenue int64 `bson:"dailyRevenue" json:"dailyRevenue"` // 日均收入(分)
CTR float64 `bson:"ctr" json:"ctr"` // 点击率
eCPM int64 `bson:"ecpm" json:"ecpm"` // 有效千次展示收入
}
// 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"` // 条件值
}

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"` // 数据
}

View File

@@ -0,0 +1,91 @@
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
LinkUrl string `bson:"linkUrl" json:"linkUrl"` // 点击跳转链接
LandingPageUrl string `bson:"landingPageUrl" json:"landingPageUrl"` // 落地页URL
// 投放设置
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"` // 广告状态:待审核、已审核、已拒绝、投放中、已暂停、已结束
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"` // 消耗(分)
CTR float64 `bson:"ctr" json:"ctr"` // 点击率
CVR float64 `bson:"cvr" json:"cvr"` // 转化率
CPM int64 `bson:"cpm" json:"cpm"` // 千次展示成本
CPC int64 `bson:"cpc" json:"cpc"` // 单次点击成本
}
// 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
}

View File

@@ -0,0 +1,50 @@
package entity
import (
"gitee.com/red-future---jilin-g/common/do"
)
const AdvertiserCollection = "advertiser"
// Advertiser 广告主实体
type Advertiser struct {
do.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// 基本信息
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"` // 公司名称
Industry string `bson:"industry" json:"industry"` // 所属行业
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"` // 到期日期
// 状态信息
Status string `bson:"status" json:"status"` // 广告主状态:待审核、已审核、已拒绝、已冻结
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"` // 授信额度(分)
Remark string `bson:"remark" json:"remark"` // 备注
}

View File

@@ -1,25 +0,0 @@
package entity
import (
"gitee.com/red-future---jilin-g/common/do"
)
const DataCollection = "data"
type Data struct {
do.MongoBaseDO `bson:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
// 业务字段
CustomerId string `bson:"customerId" json:"customerId"` // 客户ID
CustomerServiceId string `bson:"customerServiceId" json:"customerServiceId"` // 客服ID
CustomerServicePlatform string `bson:"customerServicePlatform" json:"customerServicePlatform"` // 客服平台
CustomerServiceName string `bson:"customerServiceName" json:"customerServiceName"` // 客服名称
IsInbound bool `bson:"isInbound" json:"isInbound"` // 用户是否点开了客服页面
IsActive bool `bson:"isActive" json:"isActive"` // 用户是否开口询问
IsServed bool `bson:"isServed" json:"isServed"` // 客服是否回答了用户
HasSentContactCard bool `bson:"hasSentContactCard" json:"hasSentContactCard"` // 客服是否发送了联系卡
HasSentNameCard bool `bson:"hasSentNameCard" json:"hasSentNameCard"` // 客服是否发送了名称卡
HasLeftContactInfo bool `bson:"hasLeftContactInfo" json:"hasLeftContactInfo"` // 用户是否留下了联系信息
SessionStartTime int64 `bson:"sessionStartTime" json:"sessionStartTime"` // 业务数据的时间
MessageTime int64 `bson:"messageTime" json:"messageTime"` // 消息时间
}