Dockerfile

This commit is contained in:
2026-03-23 14:08:11 +08:00
parent c7a2f5bd0c
commit 827d55dbee
100 changed files with 3139 additions and 5992 deletions

View File

@@ -1,231 +0,0 @@
package config
import (
"cid/consts"
"errors"
)
// BaseConfig 基础配置结构
type BaseConfig struct {
// 优先级和权重
Priority int `bson:"priority" json:"priority"` // 优先级
Weight float64 `bson:"weight" json:"weight"` // 权重
Order int `bson:"order" json:"order"` // 排序顺序
// 标签和分类
Tags []string `bson:"tags" json:"tags"` // 标签
Category string `bson:"category" json:"category"` // 分类
Industry string `bson:"industry" json:"industry"` // 行业
// 配置信息
Config string `bson:"config" json:"config"` // 配置信息JSON格式
Extra map[string]interface{} `bson:"extra" json:"extra"` // 扩展字段
Remark string `bson:"remark" json:"remark"` // 备注
}
// Validate 基础配置验证
func (c *BaseConfig) Validate() error {
if c.Priority < 0 {
return errors.New(consts.ErrInvalidConfiguration)
}
if c.Weight < 0 || c.Weight > 1 {
return errors.New(consts.ErrInvalidConfiguration)
}
return nil
}
// BiddingConfig 竞价配置
type BiddingConfig struct {
// 竞价类型
BiddingType string `bson:"biddingType" json:"biddingType"` // 竞价类型cpm、cpc、cpa、rtb
BiddingStrategy string `bson:"biddingStrategy" json:"biddingStrategy"` // 出价策略manual、auto、target_cpa、target_roas等
// 出价范围
MinBidAmount int64 `bson:"minBidAmount" json:"minBidAmount"` // 最小出价(分)
MaxBidAmount int64 `bson:"maxBidAmount" json:"maxBidAmount"` // 最大出价(分)
DefaultBidAmount int64 `bson:"defaultBidAmount" json:"defaultBidAmount"` // 默认出价(分)
BidIncrement int64 `bson:"bidIncrement" json:"bidIncrement"` // 出价增量(分)
// 自动优化
AutoOptimization bool `bson:"autoOptimization" json:"autoOptimization"` // 是否自动优化
TargetCPA int64 `bson:"targetCPA" json:"targetCPA"` // 目标CPA(分)
TargetROAS float64 `bson:"targetROAS" json:"targetROAS"` // 目标ROAS
OptimizationGoal string `bson:"optimizationGoal" json:"optimizationGoal"` // 优化目标impressions、clicks、conversions、revenue等
}
// Validate 竞价配置验证
func (c *BiddingConfig) Validate() error {
if c.MinBidAmount < 0 || c.MaxBidAmount < 0 || c.DefaultBidAmount < 0 {
return errors.New(consts.ErrInvalidConfiguration)
}
if c.MinBidAmount > c.MaxBidAmount {
return errors.New(consts.ErrInvalidConfiguration)
}
if c.TargetROAS < 0 {
return errors.New(consts.ErrInvalidConfiguration)
}
return nil
}
// BudgetConfig 预算配置
type BudgetConfig struct {
// 预算设置
TotalBudget int64 `bson:"totalBudget" json:"totalBudget"` // 总预算(分)
DailyBudget int64 `bson:"dailyBudget" json:"dailyBudget"` // 日预算(分)
// 投放节奏
PaceType string `bson:"paceType" json:"paceType"` // 投放节奏even、accelerated、standard
IsBudgetPacing bool `bson:"isBudgetPacing" json:"isBudgetPacing"` // 是否预算匀速投放
// 时间配置
StartDate int64 `bson:"startDate" json:"startDate"` // 开始投放时间
EndDate int64 `bson:"endDate" json:"endDate"` // 结束投放时间
Timezone string `bson:"timezone" json:"timezone"` // 时区
}
// Validate 预算配置验证
func (c *BudgetConfig) Validate() error {
if c.TotalBudget < 0 || c.DailyBudget < 0 {
return errors.New(consts.ErrInvalidConfiguration)
}
if c.StartDate > c.EndDate {
return errors.New(consts.ErrInvalidConfiguration)
}
return nil
}
// APIConfig API配置
type APIConfig struct {
// 基础配置
Endpoint string `bson:"endpoint" json:"endpoint"` // API端点
Version string `bson:"version" json:"version"` // API版本
Timeout int `bson:"timeout" json:"timeout"` // 超时时间(毫秒)
RetryCount int `bson:"retryCount" json:"retryCount"` // 重试次数
// 认证配置
AuthType string `bson:"authType" json:"authType"` // 认证类型api_key、oauth、basic
AuthConfig string `bson:"authConfig" json:"authConfig"` // 认证配置JSON字符串
// 请求配置
Headers string `bson:"headers" json:"headers"` // 请求头配置JSON字符串
// 限流配置
RateLimit int64 `bson:"rateLimit" json:"rateLimit"` // 速率限制
}
// Validate API配置验证
func (c *APIConfig) Validate() error {
if c.Timeout <= 0 {
return errors.New(consts.ErrInvalidConfiguration)
}
if c.RetryCount < 0 {
return errors.New(consts.ErrInvalidConfiguration)
}
if c.RateLimit <= 0 {
return errors.New(consts.ErrInvalidConfiguration)
}
return nil
}
// CreativeConfig 创意配置
type CreativeConfig struct {
// 轮播设置
CreativeRotation string `bson:"creativeRotation" json:"creativeRotation"` // 创意轮播方式optimize、even、random
SelectedCreatives []string `bson:"selectedCreatives" json:"selectedCreatives"` // 选中的创意列表
ExcludedCreatives []string `bson:"excludedCreatives" json:"excludedCreatives"` // 排除的创意列表
// 技术要求
MaxFileSize int64 `bson:"maxFileSize" json:"maxFileSize"` // 最大文件大小(bytes)
MaxDuration int64 `bson:"maxDuration" json:"maxDuration"` // 最大时长(秒)
// 支持的格式
SupportedFormats []string `bson:"supportedFormats" json:"supportedFormats"` // 支持的格式
SupportedSizes []string `bson:"supportedSizes" json:"supportedSizes"` // 支持的尺寸
}
// Validate 创意配置验证
func (c *CreativeConfig) Validate() error {
if c.MaxFileSize <= 0 {
return errors.New(consts.ErrInvalidConfiguration)
}
if c.MaxDuration <= 0 {
return errors.New(consts.ErrInvalidConfiguration)
}
return nil
}
// PaymentConfig 支付配置
type PaymentConfig struct {
// 计费模式
BillingModel string `bson:"billingModel" json:"billingModel"` // 计费模式CPC、CPM、CPA等
CommissionRate float64 `bson:"commissionRate" json:"commissionRate"` // 佣金比例
MinimumBudget int64 `bson:"minimumBudget" json:"minimumBudget"` // 最低预算(分)
// 结算配置
SettlementCycle string `bson:"settlementCycle" json:"settlementCycle"` // 结算周期daily、weekly、monthly
PaymentTerms string `bson:"paymentTerms" json:"paymentTerms"` // 支付条款
Currency string `bson:"currency" json:"currency"` // 货币单位
// 收入分成
RevShareRate float64 `bson:"revShareRate" json:"revShareRate"` // 收入分成比例(0-1)
MinPayment int64 `bson:"minPayment" json:"minPayment"` // 最小支付金额(分)
TaxInclusive bool `bson:"taxInclusive" json:"taxInclusive"` // 是否含税
}
// Validate 支付配置验证
func (c *PaymentConfig) Validate() error {
if c.CommissionRate < 0 || c.CommissionRate > 1 {
return errors.New(consts.ErrInvalidConfiguration)
}
if c.RevShareRate < 0 || c.RevShareRate > 1 {
return errors.New(consts.ErrInvalidConfiguration)
}
if c.MinimumBudget < 0 {
return errors.New(consts.ErrInvalidConfiguration)
}
if c.MinPayment < 0 {
return errors.New(consts.ErrInvalidConfiguration)
}
return nil
}
// FrequencyCapConfig 频次控制配置
type FrequencyCapConfig struct {
// 频次限制
Impressions int `bson:"impressions" json:"impressions"` // 展示次数
TimeWindow int `bson:"timeWindow" json:"timeWindow"` // 时间窗口(小时)
PerUser int `bson:"perUser" json:"perUser"` // 每用户频次
PerHour int `bson:"perHour" json:"perHour"` // 每小时频次
PerDay int `bson:"perDay" json:"perDay"` // 每日频次
// 频次控制规则
CapType string `bson:"capType" json:"capType"` // 频次类型lifetime、daily、hourly
CapScope string `bson:"capScope" json:"capScope"` // 频次范围user、device、ip
ResetRule string `bson:"resetRule" json:"resetRule"` // 重置规则daily、weekly、monthly
}
// RestrictionConfig 限制配置
type RestrictionConfig struct {
// 年龄限制
AgeRestriction bool `bson:"ageRestriction" json:"ageRestriction"` // 年龄限制
MinAge int `bson:"minAge" json:"minAge"` // 最小年龄
MaxAge int `bson:"maxAge" json:"maxAge"` // 最大年龄
// 地域限制
GeoRestrictions []string `bson:"geoRestrictions" json:"geoRestrictions"` // 地域限制
// 设备限制
DeviceRestrictions []string `bson:"deviceRestrictions" json:"deviceRestrictions"` // 设备限制
// 分类限制
CategoryRestrictions []string `bson:"categoryRestrictions" json:"categoryRestrictions"` // 分类限制
// 内容限制
ContentRestrictions []string `bson:"contentRestrictions" json:"contentRestrictions"` // 内容限制
// 品牌安全
BrandSafety bool `bson:"brandSafety" json:"brandSafety"` // 品牌安全
BlockedCategories []string `bson:"blockedCategories" json:"blockedCategories"` // 阻止的分类
AllowedCategories []string `bson:"allowedCategories" json:"allowedCategories"` // 允许的分类
ExcludedKeywords []string `bson:"excludedKeywords" json:"excludedKeywords"` // 排除的关键词
}

View File

@@ -1,149 +0,0 @@
package dto
import (
"cid/model/entity"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
"go.mongodb.org/mongo-driver/v2/bson"
)
// AddAdPositionReq 添加广告位请求
type AddAdPositionReq struct {
g.Meta `path:"/add" method:"post" tags:"广告位管理" summary:"添加广告位" dc:"添加新的广告位"`
// 基本信息
Name string `json:"name" v:"required"` // 广告位名称
Description string `json:"description"` // 广告位描述
PositionCode string `json:"positionCode" v:"required"` // 广告位编码,用于标识
AdFormat string `json:"adFormat" v:"required"` // 支持的广告格式
// 尺寸信息
Width int `json:"width" v:"required"` // 宽度(px)
Height int `json:"height" v:"required"` // 高度(px)
// 位置信息
Page string `json:"page" v:"required"` // 所属页面
Section string `json:"section" v:"required"` // 页面区域
Location string `json:"location" v:"required"` // 具体位置
// 展示设置
MaxAds int `json:"maxAds"` // 最大广告数量
RefreshInterval int `json:"refreshInterval"` // 刷新间隔(秒)
IsLazyLoad bool `json:"isLazyLoad"` // 是否懒加载
// 定价设置
PricingModel string `json:"pricingModel" v:"required"` // 计费模型CPC、CPM、CPA等
BasePrice int64 `json:"basePrice" v:"required"` // 基础价格(分)
FloorPrice int64 `json:"floorPrice" v:"required"` // 底价(分)
PriceUnit string `json:"priceUnit" v:"required"` // 价格单位:千次展示、单次点击、单次转化等
// 展示规则
DisplayRules *entity.DisplayRules `json:"displayRules"` // 展示规则
// 状态信息
Status string `json:"status" v:"required"` // 广告位状态:启用、禁用、测试
IsExclusive bool `json:"isExclusive"` // 是否独占广告位
}
type AddAdPositionRes struct {
Id *bson.ObjectID `json:"id"`
}
// UpdateAdPositionReq 更新广告位请求
type UpdateAdPositionReq struct {
g.Meta `path:"/update" method:"put" tags:"广告位管理" summary:"更新广告位" dc:"更新广告位信息"`
Id string `json:"id" v:"required"` // ID
// 基本信息
Name string `json:"name"` // 广告位名称
Description string `json:"description"` // 广告位描述
PositionCode string `json:"positionCode"` // 广告位编码,用于标识
AdFormat string `json:"adFormat"` // 支持的广告格式
// 尺寸信息
Width *int `json:"width"` // 宽度(px)
Height *int `json:"height"` // 高度(px)
// 位置信息
Page string `json:"page"` // 所属页面
Section string `json:"section"` // 页面区域
Location string `json:"location"` // 具体位置
// 展示设置
MaxAds *int `json:"maxAds"` // 最大广告数量
RefreshInterval *int `json:"refreshInterval"` // 刷新间隔(秒)
IsLazyLoad *bool `json:"isLazyLoad"` // 是否懒加载
// 定价设置
PricingModel string `json:"pricingModel"` // 计费模型CPC、CPM、CPA等
BasePrice *int64 `json:"basePrice"` // 基础价格(分)
FloorPrice *int64 `json:"floorPrice"` // 底价(分)
PriceUnit string `json:"priceUnit"` // 价格单位:千次展示、单次点击、单次转化等
// 展示规则
DisplayRules *entity.DisplayRules `json:"displayRules"` // 展示规则
// 状态信息
Status *string `json:"status"` // 广告位状态:启用、禁用、测试
IsExclusive *bool `json:"isExclusive"` // 是否独占广告位
}
// GetAdPositionReq 获取广告位详情请求
type GetAdPositionReq struct {
g.Meta `path:"/one" method:"get" tags:"广告位管理" summary:"获取广告位详情" dc:"根据ID获取单个广告位详情"`
Id string `json:"id" v:"required"` // ID
}
type GetAdPositionRes struct {
*entity.AdPosition
}
// ListAdPositionReq 获取广告位列表请求
type ListAdPositionReq struct {
g.Meta `path:"/list" method:"get" tags:"广告位管理" summary:"获取广告位列表" dc:"分页查询广告位列表,支持多条件筛选"`
*beans.Page
Name string `json:"name"` // 广告位名称模糊查询
PositionCode string `json:"positionCode"` // 广告位编码
PageName string `json:"pageName"` // 所属页面
Section string `json:"section"` // 页面区域
Status string `json:"status"` // 广告位状态
AdFormat string `json:"adFormat"` // 广告格式
DateRange []string `json:"dateRange"` // 创建时间范围 [start, end]
}
type ListAdPositionRes struct {
List []*entity.AdPosition `json:"list"`
Total int `json:"total"`
}
// UpdateAdPositionStatusReq 更新广告位状态请求
type UpdateAdPositionStatusReq struct {
g.Meta `path:"/updateStatus" method:"patch" tags:"广告位管理" summary:"更新广告位状态" dc:"更新广告位状态"`
Id string `json:"id" v:"required"` // 广告位ID
Status string `json:"status" v:"required"` // 广告位状态:启用、禁用、测试
}
// GetAvailableAdPositionsReq 获取可用广告位请求
type GetAvailableAdPositionsReq struct {
g.Meta `path:"/getAvailableAdPositions" method:"get" tags:"广告位管理" summary:"获取可用广告位列表" dc:"获取所有启用的广告位列表"`
}
type GetAvailableAdPositionsRes struct {
List []*entity.AdPosition `json:"list"`
}
// MatchAdReq 匹配广告请求
type MatchAdReq struct {
g.Meta `path:"/matchAd" method:"post" tags:"广告位管理" summary:"匹配广告" dc:"根据广告位编码和用户信息匹配适合的广告"`
PositionCode string `json:"positionCode" v:"required"` // 广告位编码
UserInfo map[string]interface{} `json:"userInfo"` // 用户信息
}
type MatchAdRes struct {
*entity.Advertisement `json:"advertisement"`
}

View File

@@ -1,185 +0,0 @@
package dto
import (
"cid/model/entity"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
)
// CreateAdSourceReq 创建广告源请求
type CreateAdSourceReq struct {
g.Meta `path:"/create" method:"post" tags:"广告源管理" summary:"创建广告源" dc:"创建新的广告源配置"`
// 基本信息
Name string `json:"name" v:"required"` // 广告源名称
Code string `json:"code" v:"required"` // 广告源编码,唯一标识
Provider string `json:"provider" v:"required"` // 提供商google、facebook、baidu、tencent、self等
Type string `json:"type" v:"required|in:self,third_party,exchange"` // 类型
Description string `json:"description"` // 描述
// 连接配置
APIEndpoint string `json:"apiEndpoint" v:"required"` // API端点
APIVersion string `json:"apiVersion"` // API版本
AuthType string `json:"authType" v:"required|in:api_key,oauth,basic"` // 认证类型
AuthConfig map[string]interface{} `json:"authConfig" v:"required"` // 认证配置
Headers map[string]string `json:"headers"` // 请求头配置
Timeout int `json:"timeout"` // 超时时间(毫秒)
RetryCount int `json:"retryCount"` // 重试次数
// 基础配置
SupportedFormats []string `json:"supportedFormats" v:"required"` // 支持的广告格式
SupportedSizes []string `json:"supportedSizes"` // 支持的尺寸
SupportedDevices []string `json:"supportedDevices"` // 支持的设备类型
SupportedOS []string `json:"supportedOS"` // 支持的操作系统
SupportedCountries []string `json:"supportedCountries"` // 支持的国家/地区
// 竞价配置
BiddingType string `json:"biddingType" v:"required|in:cpm,cpc,cpa,rtb"` // 竞价类型
MinBidAmount int64 `json:"minBidAmount"` // 最小出价(分)
MaxBidAmount int64 `json:"maxBidAmount"` // 最大出价(分)
BidIncrement int64 `json:"bidIncrement"` // 出价增量(分)
DefaultBidAmount int64 `json:"defaultBidAmount"` // 默认出价(分)
AutoOptimization bool `json:"autoOptimization"` // 是否自动优化
// 最大广告数
MaxAdsPerRequest int `json:"maxAdsPerRequest"` // 单次请求最大广告数量
// 其他配置
BrandSafety bool `json:"brandSafety"` // 品牌安全
Viewability bool `json:"viewability"` // 可见性支持
RealTimeBidding bool `json:"realTimeBidding"` // 实时竞价
HeaderBidding bool `json:"headerBidding"` // 标题竞价
// 财务设置
BillingModel string `json:"billingModel" v:"required|in:cpm,cpc,cpa,rev_share"` // 计费模式
PaymentTerms string `json:"paymentTerms" v:"in:net_30,net_60,net_90"` // 支付条款
RevShareRate float64 `json:"revShareRate" v:"between:0,1"` // 收入分成比例
MinPayment int64 `json:"minPayment"` // 最小支付金额(分)
Currency string `json:"currency"` // 货币单位
TaxInclusive bool `json:"taxInclusive"` // 是否含税
// 系统信息
Priority int `json:"priority"` // 优先级
}
type CreateAdSourceRes struct {
Id string `json:"id"` // 广告源ID
}
// GetAdSourceReq 获取广告源详情请求
type GetAdSourceReq struct {
g.Meta `path:"/getByID" method:"get" tags:"广告源管理" summary:"获取广告源详情" dc:"根据ID获取单个广告源详情"`
Id string `json:"id" v:"required"` // 广告源ID
}
type GetAdSourceRes struct {
*entity.AdSource
}
// ListAdSourceReq 获取广告源列表请求
type ListAdSourceReq struct {
g.Meta `path:"/getList" method:"get" tags:"广告源管理" summary:"获取广告源列表" dc:"分页查询广告源列表,支持多条件筛选"`
*beans.Page
Name string `json:"name"` // 广告源名称模糊查询
Code string `json:"code"` // 广告源编码
Provider string `json:"provider"` // 提供商
Type string `json:"type"` // 类型
Status string `json:"status"` // 状态
Health string `json:"health"` // 健康状态
}
type ListAdSourceRes struct {
List []*entity.AdSource `json:"list"`
Total int `json:"total"`
}
// UpdateAdSourceReq 更新广告源请求
type UpdateAdSourceReq struct {
g.Meta `path:"/update" method:"put" tags:"广告源管理" summary:"更新广告源" dc:"更新广告源信息"`
Id string `json:"id" v:"required"` // 广告源ID
// 基本信息
Name string `json:"name"` // 广告源名称
Description string `json:"description"` // 描述
// 连接配置
APIEndpoint string `json:"apiEndpoint"` // API端点
APIVersion string `json:"apiVersion"` // API版本
AuthType string `json:"authType"` // 认证类型
AuthConfig map[string]interface{} `json:"authConfig"` // 认证配置
Headers map[string]string `json:"headers"` // 请求头配置
Timeout int `json:"timeout"` // 超时时间(毫秒)
RetryCount int `json:"retryCount"` // 重试次数
// 基础配置
SupportedFormats []string `json:"supportedFormats"` // 支持的广告格式
SupportedSizes []string `json:"supportedSizes"` // 支持的尺寸
SupportedDevices []string `json:"supportedDevices"` // 支持的设备类型
SupportedOS []string `json:"supportedOS"` // 支持的操作系统
SupportedCountries []string `json:"supportedCountries"` // 支持的国家/地区
// 竞价配置
BiddingType string `json:"biddingType"` // 竞价类型
MinBidAmount int64 `json:"minBidAmount"` // 最小出价(分)
MaxBidAmount int64 `json:"maxBidAmount"` // 最大出价(分)
BidIncrement int64 `json:"bidIncrement"` // 出价增量(分)
DefaultBidAmount int64 `json:"defaultBidAmount"` // 默认出价(分)
AutoOptimization bool `json:"autoOptimization"` // 是否自动优化
// 最大广告数
MaxAdsPerRequest int `json:"maxAdsPerRequest"` // 单次请求最大广告数量
// 其他配置
BrandSafety bool `json:"brandSafety"` // 品牌安全
Viewability bool `json:"viewability"` // 可见性支持
RealTimeBidding bool `json:"realTimeBidding"` // 实时竞价
HeaderBidding bool `json:"headerBidding"` // 标题竞价
// 财务设置
BillingModel string `json:"billingModel"` // 计费模式
PaymentTerms string `json:"paymentTerms"` // 支付条款
RevShareRate float64 `json:"revShareRate"` // 收入分成比例
MinPayment int64 `json:"minPayment"` // 最小支付金额(分)
Currency string `json:"currency"` // 货币单位
TaxInclusive bool `json:"taxInclusive"` // 是否含税
// 系统信息
Priority int `json:"priority"` // 优先级
}
// UpdateAdSourceStatusReq 更新广告源状态请求
type UpdateAdSourceStatusReq struct {
// g.Meta `path:"/adsource" method:"patch" tags:"广告源管理" summary:"更新广告源状态" dc:"更新广告源状态"` // 暂时注释缺少对应的controller方法
Id string `json:"id" v:"required"` // 广告源ID
Status string `json:"status" v:"required"` // 广告源状态active、inactive、maintenance
}
// DeleteAdSourceReq 删除广告源请求
type DeleteAdSourceReq struct {
g.Meta `path:"/delete" method:"delete" tags:"广告源管理" summary:"删除广告源" dc:"删除指定的广告源"`
Id string `json:"id" v:"required"` // 广告源ID
}
// TestAdSourceReq 测试广告源连接请求
type TestAdSourceReq struct {
// g.Meta `path:"/adsource-test" method:"post" tags:"广告源管理" summary:"测试广告源连接" dc:"测试广告源的连接性和可用性"` // 暂时注释缺少对应的controller方法
Id string `json:"id" v:"required"` // 广告源ID
}
type TestAdSourceRes struct {
Success bool `json:"success"` // 测试是否成功
ResponseTime int64 `json:"responseTime"` // 响应时间(毫秒)
ErrorMessage string `json:"errorMessage"` // 错误信息
SupportedFormats []string `json:"supportedFormats"` // 支持的广告格式
}
// DeleteAdSourceRes 删除广告源响应
type DeleteAdSourceRes struct {
Success bool `json:"success"` // 删除是否成功
}

View File

@@ -1,117 +0,0 @@
package dto
import "github.com/gogf/gf/v2/frame/g"
// GetAdSourceStatisticsReq 获取广告源统计数据请求
type GetAdSourceStatisticsReq struct {
g.Meta `path:"/adsource-statistics" method:"get" tags:"广告源管理" summary:"获取广告源统计数据" dc:"获取广告源的详细统计数据"`
Id string `json:"id" v:"required"` // 广告源ID
StartDate int64 `json:"startDate" v:"required"` // 开始日期
EndDate int64 `json:"endDate" v:"required"` // 结束日期
Dimension string `json:"dimension"` // 统计维度day、week、month
}
type GetAdSourceStatisticsRes struct {
// 概览数据
Overview AdSourceOverviewStats `json:"overview"`
// 趋势数据
Trends []AdSourceTrendData `json:"trends"`
// 性能数据
Performance AdSourcePerformanceStats `json:"performance"`
// 错误统计
Errors []AdSourceErrorStats `json:"errors"`
}
// AdSourceOverviewStats 广告源概览统计
type AdSourceOverviewStats struct {
TotalRequests int64 `json:"totalRequests"` // 总请求数
SuccessfulRequests int64 `json:"successfulRequests"` // 成功请求数
FailedRequests int64 `json:"failedRequests"` // 失败请求数
TotalImpressions int64 `json:"totalImpressions"` // 总展示次数
TotalClicks int64 `json:"totalClicks"` // 总点击次数
TotalConversions int64 `json:"totalConversions"` // 总转化次数
TotalRevenue int64 `json:"totalRevenue"` // 总收入(分)
SuccessRate float64 `json:"successRate"` // 成功率
ErrorRate float64 `json:"errorRate"` // 错误率
CTR float64 `json:"ctr"` // 点击率
CVR float64 `json:"cvr"` // 转化率
FillRate float64 `json:"fillRate"` // 填充率
ECPM int64 `json:"ecpm"` // 有效千次展示成本(分)
ECPC int64 `json:"ecpc"` // 有效点击成本(分)
AverageResponseTime float64 `json:"averageResponseTime"` // 平均响应时间(毫秒)
Uptime float64 `json:"uptime"` // 可用性(百分比)
}
// AdSourceTrendData 广告源趋势数据
type AdSourceTrendData struct {
Date int64 `json:"date"` // 日期
Requests int64 `json:"requests"` // 请求数
Impressions int64 `json:"impressions"` // 展示次数
Clicks int64 `json:"clicks"` // 点击次数
Conversions int64 `json:"conversions"` // 转化次数
Revenue int64 `json:"revenue"` // 收入(分)
SuccessRate float64 `json:"successRate"` // 成功率
ErrorRate float64 `json:"errorRate"` // 错误率
CTR float64 `json:"ctr"` // 点击率
CVR float64 `json:"cvr"` // 转化率
FillRate float64 `json:"fillRate"` // 填充率
ECPM int64 `json:"ecpm"` // 有效千次展示成本(分)
ResponseTime float64 `json:"responseTime"` // 平均响应时间(毫秒)
}
// AdSourcePerformanceStats 广告源性能统计
type AdSourcePerformanceStats struct {
// 响应时间分布
ResponseTimeDistribution map[string]int64 `json:"responseTimeDistribution"` // 响应时间分布
// 错误类型统计
ErrorTypes map[string]int64 `json:"errorTypes"` // 错误类型统计
// 地区性能
RegionalPerformance map[string]AdSourceRegionalStats `json:"regionalPerformance"` // 地区性能
// 设备性能
DevicePerformance map[string]AdSourceDeviceStats `json:"devicePerformance"` // 设备性能
}
// AdSourceErrorStats 广告源错误统计
type AdSourceErrorStats struct {
ErrorType string `json:"errorType"` // 错误类型
Count int64 `json:"count"` // 错误次数
Percentage float64 `json:"percentage"` // 占比
LastOccurred int64 `json:"lastOccurred"` // 最后发生时间
}
// AdSourceRegionalStats 广告源地区统计
type AdSourceRegionalStats struct {
Region string `json:"region"` // 地区
Requests int64 `json:"requests"` // 请求数
Impressions int64 `json:"impressions"` // 展示次数
Clicks int64 `json:"clicks"` // 点击次数
Revenue int64 `json:"revenue"` // 收入(分)
CTR float64 `json:"ctr"` // 点击率
ResponseTime float64 `json:"responseTime"` // 平均响应时间(毫秒)
}
// AdSourceDeviceStats 广告源设备统计
type AdSourceDeviceStats struct {
Device string `json:"device"` // 设备类型
Requests int64 `json:"requests"` // 请求数
Impressions int64 `json:"impressions"` // 展示次数
Clicks int64 `json:"clicks"` // 点击次数
Revenue int64 `json:"revenue"` // 收入(分)
CTR float64 `json:"ctr"` // 点击率
ResponseTime float64 `json:"responseTime"` // 平均响应时间(毫秒)
}
// AdSourceTestMetrics 广告源测试质量指标
type AdSourceTestMetrics struct {
SuccessRate float64 `json:"successRate"` // 成功率
AverageResponseTime float64 `json:"averageResponseTime"` // 平均响应时间(毫秒)
FillRate float64 `json:"fillRate"` // 填充率
CTR float64 `json:"ctr"` // 点击率
}

View File

@@ -1,117 +0,0 @@
package dto
import (
"cid/model/entity"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
)
// AddAdvertisementReq 添加广告请求
type AddAdvertisementReq struct {
g.Meta `path:"/add" method:"post" tags:"广告管理" summary:"添加广告" dc:"添加新的广告"`
// 广告基本信息
Title string `json:"title" v:"required"` // 广告标题
Description string `json:"description"` // 广告描述
AdvertiserId string `json:"advertiserId" v:"required"` // 广告主ID
AdPositionId string `json:"adPositionId" v:"required"` // 广告位ID
AdType string `json:"adType" v:"required"` // 广告类型:图片、视频、文字等
AdFormat string `json:"adFormat" v:"required"` // 广告格式
MaterialUrl string `json:"materialUrl" v:"required"` // 广告素材URL
TargetUrl string `json:"targetUrl" v:"required"` // 目标链接
// 投放设置
StartDate int64 `json:"startDate" v:"required"` // 开始投放时间
EndDate int64 `json:"endDate" v:"required"` // 结束投放时间
Budget int64 `json:"budget" v:"required"` // 预算(分)
DailyBudget int64 `json:"dailyBudget"` // 日预算(分)
BidAmount int64 `json:"bidAmount" v:"required"` // 出价(分)
BillingType string `json:"billingType" v:"required"` // 计费类型CPC、CPM、CPA等
// 投放条件
Targeting *entity.UnifiedTargeting `json:"targeting"` // 定向条件
}
type AddAdvertisementRes struct {
Id string `json:"id"`
}
// UpdateAdvertisementReq 更新广告请求
type UpdateAdvertisementReq struct {
g.Meta `path:"/update" method:"put" tags:"广告管理" summary:"更新广告" dc:"更新广告信息"`
Id string `json:"id" v:"required"` // ID
// 广告基本信息
Title string `json:"title"` // 广告标题
Description string `json:"description"` // 广告描述
AdvertiserId string `json:"advertiserId"` // 广告主ID
AdPositionId string `json:"adPositionId"` // 广告位ID
AdType string `json:"adType"` // 广告类型:图片、视频、文字等
AdFormat string `json:"adFormat"` // 广告格式
MaterialUrl string `json:"materialUrl"` // 广告素材URL
TargetUrl string `json:"targetUrl"` // 目标链接
// 投放设置
StartDate *int64 `json:"startDate"` // 开始投放时间
EndDate *int64 `json:"endDate"` // 结束投放时间
Budget *int64 `json:"budget"` // 预算(分)
DailyBudget *int64 `json:"dailyBudget"` // 日预算(分)
BidAmount *int64 `json:"bidAmount"` // 出价(分)
BillingType string `json:"billingType"` // 计费类型CPC、CPM、CPA等
// 投放条件
Targeting *entity.UnifiedTargeting `json:"targeting"` // 定向条件
// 状态信息
Status *string `json:"status"` // 广告状态:待审核、审核中、已通过、已拒绝、投放中、已暂停、已结束
AuditStatus *string `json:"auditStatus"` // 审核状态:通过、拒绝
AuditReason *string `json:"auditReason"` // 审核不通过原因
}
// GetAdvertisementReq 获取广告详情请求
type GetAdvertisementReq struct {
g.Meta `path:"/getOne" method:"get" tags:"广告管理" summary:"获取广告详情" dc:"根据ID获取单个广告详情"`
Id string `json:"id" v:"required"` // ID
}
type GetAdvertisementRes struct {
*entity.Advertisement
}
// ListAdvertisementReq 获取广告列表请求
type ListAdvertisementReq struct {
g.Meta `path:"/list" method:"get" tags:"广告管理" summary:"获取广告列表" dc:"分页查询广告列表,支持多条件筛选"`
*beans.Page
AdvertiserId string `json:"advertiserId"` // 广告主ID
AdPositionId string `json:"adPositionId"` // 广告位ID
AdType string `json:"adType"` // 广告类型
Status string `json:"status"` // 广告状态
AuditStatus string `json:"auditStatus"` // 审核状态
Title string `json:"title"` // 广告标题模糊查询
DateRange []string `json:"dateRange"` // 创建时间范围 [start, end]
}
type ListAdvertisementRes struct {
List []*entity.Advertisement `json:"list"`
Total int `json:"total"`
}
// AuditAdvertisementReq 审核广告请求
type AuditAdvertisementReq struct {
g.Meta `path:"/audit" method:"post" tags:"广告管理" summary:"审核广告" dc:"审核广告,通过或拒绝"`
Id string `json:"id" v:"required"` // 广告ID
AuditStatus string `json:"auditStatus" v:"required"` // 审核状态:通过、拒绝
AuditReason string `json:"auditReason"` // 审核不通过原因
}
// UpdateAdStatusReq 更新广告状态请求
type UpdateAdStatusReq struct {
g.Meta `path:"/updateStatus" method:"patch" tags:"广告管理" summary:"更新广告状态" dc:"更新广告状态"`
Id string `json:"id" v:"required"` // 广告ID
Status string `json:"status" v:"required"` // 广告状态:启用、禁用
}

View File

@@ -1,167 +0,0 @@
package dto
import (
"cid/model/entity"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
)
// AddAdvertiserReq 添加广告主请求
type AddAdvertiserReq struct {
g.Meta `path:"/add" method:"post" tags:"广告主管理" summary:"添加广告主" dc:"添加新的广告主"`
// 基本信息
Name string `json:"name" v:"required"` // 广告主名称
ContactName string `json:"contactName" v:"required"` // 联系人姓名
ContactPhone string `json:"contactPhone" v:"required"` // 联系电话
ContactEmail string `json:"contactEmail" v:"required"` // 联系邮箱
Company string `json:"company" v:"required"` // 公司名称
Industry string `json:"industry" v:"required"` // 所属行业
Scale string `json:"scale"` // 公司规模
// 证件信息
BusinessLicenseUrl string `json:"businessLicenseUrl" v:"required"` // 营业执照URL
ICPLicenseUrl string `json:"icpLicenseUrl"` // ICP备案截图URL
OtherLicenseUrls []string `json:"otherLicenseUrls"` // 其他证件URL
// 财务信息
BankName string `json:"bankName" v:"required"` // 开户银行
BankAccount string `json:"bankAccount" v:"required"` // 银行账号
AccountName string `json:"accountName" v:"required"` // 账户名称
// 合同信息
ContractId string `json:"contractId"` // 合同编号
ContractType string `json:"contractType"` // 合同类型
ContractUrl string `json:"contractUrl"` // 合同文件URL
SignDate int64 `json:"signDate"` // 签约日期
ExpireDate int64 `json:"expireDate"` // 到期日期
// 系统信息
AccountBalance int64 `json:"accountBalance"` // 账户余额(分)
CreditLimit int64 `json:"creditLimit"` // 授信额度(分)
Remark string `json:"remark"` // 备注
}
type AddAdvertiserRes struct {
Id string `json:"id"`
}
// UpdateAdvertiserReq 更新广告主请求
type UpdateAdvertiserReq struct {
g.Meta `path:"/update" method:"put" tags:"广告主管理" summary:"更新广告主" dc:"更新广告主信息"`
Id string `json:"id" v:"required"` // ID
// 基本信息
Name string `json:"name"` // 广告主名称
ContactName string `json:"contactName"` // 联系人姓名
ContactPhone string `json:"contactPhone"` // 联系电话
ContactEmail string `json:"contactEmail"` // 联系邮箱
Company string `json:"company"` // 公司名称
Industry string `json:"industry"` // 所属行业
Scale string `json:"scale"` // 公司规模
// 证件信息
BusinessLicenseUrl string `json:"businessLicenseUrl"` // 营业执照URL
ICPLicenseUrl string `json:"icpLicenseUrl"` // ICP备案截图URL
OtherLicenseUrls []string `json:"otherLicenseUrls"` // 其他证件URL
// 财务信息
BankName string `json:"bankName"` // 开户银行
BankAccount string `json:"bankAccount"` // 银行账号
AccountName string `json:"accountName"` // 账户名称
// 合同信息
ContractId string `json:"contractId"` // 合同编号
ContractType string `json:"contractType"` // 合同类型
ContractUrl string `json:"contractUrl"` // 合同文件URL
SignDate *int64 `json:"signDate"` // 签约日期
ExpireDate *int64 `json:"expireDate"` // 到期日期
// 系统信息
AccountBalance *int64 `json:"accountBalance"` // 账户余额(分)
CreditLimit *int64 `json:"creditLimit"` // 授信额度(分)
Remark string `json:"remark"` // 备注
// 状态信息
Status *string `json:"status"` // 广告主状态:待审核、已审核、已拒绝、已冻结
AuditStatus *string `json:"auditStatus"` // 审核状态
AuditReason *string `json:"auditReason"` // 审核不通过原因
}
// GetAdvertiserReq 获取广告主详情请求
type GetAdvertiserReq struct {
g.Meta `path:"/getOne" method:"get" tags:"广告主管理" summary:"获取广告主详情" dc:"根据ID获取单个广告主详情"`
Id string `json:"id" v:"required"` // ID
}
type GetAdvertiserRes struct {
*entity.Advertiser
}
// ListAdvertiserReq 获取广告主列表请求
type ListAdvertiserReq struct {
g.Meta `path:"/list" method:"get" tags:"广告主管理" summary:"获取广告主列表" dc:"分页查询广告主列表,支持多条件筛选"`
*beans.Page
Name string `json:"name"` // 广告主名称模糊查询
ContactName string `json:"contactName"` // 联系人模糊查询
Company string `json:"company"` // 公司名称模糊查询
Industry string `json:"industry"` // 所属行业
Status string `json:"status"` // 广告主状态
AuditStatus string `json:"auditStatus"` // 审核状态
DateRange []string `json:"dateRange"` // 创建时间范围 [start, end]
}
type ListAdvertiserRes struct {
List []*entity.Advertiser `json:"list"`
Total int `json:"total"`
}
// AuditAdvertiserReq 审核广告主请求
type AuditAdvertiserReq struct {
g.Meta `path:"/audit" method:"post" tags:"广告主管理" summary:"审核广告主" dc:"审核广告主,通过或拒绝"`
Id string `json:"id" v:"required"` // 广告主ID
AuditStatus string `json:"auditStatus" v:"required"` // 审核状态:通过、拒绝
AuditReason string `json:"auditReason"` // 审核不通过原因
}
// UpdateAdvertiserStatusReq 更新广告主状态请求
type UpdateAdvertiserStatusReq struct {
g.Meta `path:"/updateStatus" method:"patch" tags:"广告主管理" summary:"更新广告主状态" dc:"更新广告主状态"`
Id string `json:"id" v:"required"` // 广告主ID
Status string `json:"status" v:"required"` // 广告主状态:启用、禁用、冻结
}
// RechargeAdvertiserReq 广告主充值请求
type RechargeAdvertiserReq struct {
g.Meta `path:"/recharge" method:"post" tags:"广告主管理" summary:"广告主充值" dc:"为广告主账户充值"`
Id string `json:"id" v:"required"` // 广告主ID
Amount int64 `json:"amount" v:"required"` // 充值金额(分)
Remark string `json:"remark"` // 充值备注
}
// UpdateCreditLimitReq 更新授信额度请求
type UpdateCreditLimitReq struct {
g.Meta `path:"/updateCreditLimit" method:"post" tags:"广告主管理" summary:"更新授信额度" dc:"更新广告主的授信额度"`
Id string `json:"id" v:"required"` // 广告主ID
CreditLimit int64 `json:"creditLimit" v:"required"` // 授信额度(分)
Remark string `json:"remark"` // 备注说明
}
// GetAdvertiserBalanceReq 获取广告主余额请求
type GetAdvertiserBalanceReq struct {
g.Meta `path:"/getBalance" method:"get" tags:"广告主管理" summary:"获取广告主余额" dc:"根据ID获取广告主账户余额和授信额度"`
Id string `json:"id" v:"required"` // 广告主ID
}
// GetAdvertiserBalanceRes 获取广告主余额响应
type GetAdvertiserBalanceRes struct {
Balance int64 `json:"balance"` // 账户余额(分)
CreditLimit int64 `json:"creditLimit"` // 授信额度(分)
}

View File

@@ -0,0 +1,95 @@
package app
import (
"cid/consts/app"
entity "cid/model/entity/app"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
)
// CreateApplicationReq 创建应用请求
type CreateApplicationReq struct {
g.Meta `path:"/createApplication" method:"post" tags:"应用管理" summary:"创建应用" dc:"创建新的应用"`
Name string `json:"name" v:"required" dc:"应用名称"`
AppCode string `json:"appCode" v:"required" dc:"应用编码(唯一标识)"`
Type app.AppType `json:"type" v:"required" dc:"应用类型"`
Status app.AppStatus `json:"status" dc:"应用状态" d:"active"`
Description string `json:"description" dc:"应用描述"`
AccessConfig map[string]interface{} `json:"accessConfig" dc:"接入配置"`
LimitConfig map[string]interface{} `json:"limitConfig" dc:"限流配置"`
CallbackConfig map[string]interface{} `json:"callbackConfig" dc:"回调配置"`
}
// CreateApplicationRes 创建应用响应
type CreateApplicationRes struct {
Id int64 `json:"id" dc:"应用ID"`
}
// ListApplicationReq 获取应用列表请求
type ListApplicationReq struct {
g.Meta `path:"/listApplications" method:"get" tags:"应用管理" summary:"获取应用列表" dc:"分页查询应用列表"`
*beans.Page
Name string `json:"name" dc:"应用名称"`
AppCode string `json:"appCode" dc:"应用编码"`
Type app.AppType `json:"type" dc:"应用类型"`
Status app.AppStatus `json:"status" dc:"应用状态"`
Keyword string `json:"keyword" dc:"关键字(搜索应用名称或编码)"`
}
// ListApplicationRes 获取应用列表响应
type ListApplicationRes struct {
List []ApplicationItem `json:"list" dc:"应用列表"`
Total int `json:"total" dc:"总数"`
}
type ApplicationItem struct {
Id int64 `json:"id,string"`
Name string `json:"name"`
AppCode string `json:"appCode"`
Type app.AppType `json:"type"`
TypeName string `json:"typeName"`
Status app.AppStatus `json:"status"`
StatusName string `json:"statusName"`
Description string `json:"description"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
// GetApplicationReq 获取应用详情请求
type GetApplicationReq struct {
g.Meta `path:"/getApplication" method:"get" tags:"应用管理" summary:"获取应用详情" dc:"获取应用详情"`
Id int64 `json:"id" v:"required" dc:"应用ID"`
}
// GetApplicationRes 获取应用详情响应
type GetApplicationRes struct {
*entity.Application
}
// UpdateApplicationReq 更新应用请求
type UpdateApplicationReq struct {
g.Meta `path:"/updateApplication" method:"put" tags:"应用管理" summary:"更新应用" dc:"更新应用信息"`
Id int64 `json:"id" v:"required" dc:"应用ID"`
Name string `json:"name" dc:"应用名称"`
AppCode string `json:"appCode" dc:"应用编码"`
Type app.AppType `json:"type" dc:"应用类型"`
Status app.AppStatus `json:"status,omitempty" dc:"应用状态"`
Description string `json:"description" dc:"应用描述"`
AccessConfig map[string]interface{} `json:"accessConfig" dc:"接入配置"`
LimitConfig map[string]interface{} `json:"limitConfig" dc:"限流配置"`
CallbackConfig map[string]interface{} `json:"callbackConfig" dc:"回调配置"`
}
// DeleteApplicationReq 删除应用请求
type DeleteApplicationReq struct {
g.Meta `path:"/deleteApplication" method:"delete" tags:"应用管理" summary:"删除应用" dc:"删除应用"`
Id int64 `json:"id" v:"required" dc:"应用ID"`
}
// UpdateApplicationStatusReq 更新应用状态请求
type UpdateApplicationStatusReq struct {
g.Meta `path:"/updateApplicationStatus" method:"put" tags:"应用管理" summary:"更新应用状态" dc:"更新应用状态"`
Id int64 `json:"id" v:"required" dc:"应用ID"`
Status app.AppStatus `json:"status" v:"required|in:active,inactive" dc:"状态active启用/inactive停用"`
}

View File

@@ -1,157 +0,0 @@
package dto
import (
"github.com/gogf/gf/v2/frame/g"
)
// CreateApplicationReq 创建应用请求
type CreateApplicationReq struct {
g.Meta `path:"/createApplication" method:"post" summary:"创建应用"`
TenantID interface{} `json:"tenantId" v:"required#租户ID不能为空"`
Name string `json:"name" v:"required#应用名称不能为空"`
Code string `json:"code" v:"required#应用编码不能为空"`
Description string `json:"description"`
Platform string `json:"platform" v:"required#平台不能为空|in:web,h5,android,ios#平台类型错误"`
PackageName string `json:"packageName"`
AppStoreURL string `json:"appStoreUrl"`
Categories []string `json:"categories"`
Tags []string `json:"tags"`
AdTypes []string `json:"adTypes"`
CallbackURL string `json:"callbackUrl"`
}
// CreateApplicationRes 创建应用响应
type CreateApplicationRes struct {
ID int64 `json:"id"`
AppKey string `json:"appKey"`
AppSecret string `json:"appSecret"`
}
// UpdateApplicationReq 更新应用请求
type UpdateApplicationReq struct {
g.Meta `path:"/updateApplication" method:"put" summary:"更新应用"`
ID int64 `json:"id" v:"required#应用ID不能为空"`
Name string `json:"name"`
Description string `json:"description"`
Platform string `json:"platform" v:"in:web,h5,android,ios#平台类型错误"`
PackageName string `json:"packageName"`
AppStoreURL string `json:"appStoreUrl"`
Categories []string `json:"categories"`
Tags []string `json:"tags"`
AdTypes []string `json:"adTypes"`
CallbackURL string `json:"callbackUrl"`
}
// UpdateApplicationRes 更新应用响应
type UpdateApplicationRes struct {
Success bool `json:"success"`
}
// GetApplicationReq 获取应用请求
type GetApplicationReq struct {
g.Meta `path:"/getApplication" method:"get" summary:"获取应用信息"`
ID int64 `json:"id" v:"required#应用ID不能为空"`
}
// GetApplicationRes 获取应用响应
type GetApplicationRes struct {
ID int64 `json:"id"`
TenantID interface{} `json:"tenantId"`
Name string `json:"name"`
Code string `json:"code"`
Description string `json:"description"`
Platform string `json:"platform"`
PackageName string `json:"packageName"`
AppStoreURL string `json:"appStoreUrl"`
Categories []string `json:"categories"`
Tags []string `json:"tags"`
AdTypes []string `json:"adTypes"`
Status string `json:"status"`
AppKey string `json:"appKey"`
CallbackURL string `json:"callbackUrl"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
// ListApplicationsReq 获取应用列表请求
type ListApplicationsReq struct {
g.Meta `path:"/listApplications" method:"get" summary:"获取应用列表"`
TenantID int64 `json:"tenantId" v:"required#租户ID不能为空"`
Platform string `json:"platform"`
Status string `json:"status"`
Page int `json:"page" d:"1"`
Size int `json:"size" d:"20"`
}
// ListApplicationsRes 获取应用列表响应
type ListApplicationsRes struct {
List []ApplicationItem `json:"list"`
Total int64 `json:"total"`
Page int `json:"page"`
Size int `json:"size"`
}
// ApplicationItem 应用列表项
type ApplicationItem struct {
ID int64 `json:"id"`
Name string `json:"name"`
Code string `json:"code"`
Description string `json:"description"`
Platform string `json:"platform"`
PackageName string `json:"packageName"`
Categories []string `json:"categories"`
Tags []string `json:"tags"`
AdTypes []string `json:"adTypes"`
Status string `json:"status"`
DailyRequests int64 `json:"dailyRequests"`
MonthlyRequests int64 `json:"monthlyRequests"`
CreatedAt int64 `json:"createdAt"`
}
// ResetAPIKeysReq 重置API密钥请求
type ResetAPIKeysReq struct {
g.Meta `path:"/resetAPIKeys" method:"post" summary:"重置API密钥"`
ID int64 `json:"id" v:"required#应用ID不能为空"`
}
// ResetAPIKeysRes 重置API密钥响应
type ResetAPIKeysRes struct {
AppKey string `json:"appKey"`
AppSecret string `json:"appSecret"`
}
// ValidateApplicationReq 验证应用请求
type ValidateApplicationReq struct {
g.Meta `path:"/validateApplication" method:"post" summary:"验证应用权限"`
AppKey string `json:"appKey" v:"required#应用密钥不能为空"`
AppSecret string `json:"appSecret" v:"required#应用密钥不能为空"`
}
// ValidateApplicationRes 验证应用响应
type ValidateApplicationRes struct {
Valid bool `json:"valid"`
AppID int64 `json:"appId"`
AppName string `json:"appName"`
TenantID int64 `json:"tenantId"`
TenantName string `json:"tenantName"`
Platform string `json:"platform"`
AdTypes []string `json:"adTypes"`
}
// DeleteApplicationReq 删除应用请求
type DeleteApplicationReq struct {
g.Meta `path:"/deleteApplication" method:"delete" summary:"删除应用"`
ID int64 `json:"id" v:"required#应用ID不能为空"`
}
// DeleteApplicationRes 删除应用响应
type DeleteApplicationRes struct {
Success bool `json:"success"`
}

View File

@@ -1,70 +0,0 @@
package dto
import (
"github.com/gogf/gf/v2/frame/g"
)
// GenerateCIDReq 生成CID请求
type GenerateCIDReq struct {
g.Meta `path:"/generateCID" method:"post" tags:"CID服务" summary:"生成CID广告" dc:"为当前用户生成CID广告"`
UserId int64 `json:"user_id"` // 用户ID可选如果不提供则从token获取
RequestType string `json:"request_type"` // 请求类型
Parameters map[string]interface{} `json:"parameters"` // 请求参数
Position string `json:"position"` // 广告位置
Count int `json:"count"` // 广告数量
}
// AdInfo 广告信息
type AdInfo struct {
Id int64 `json:"id"` // 广告ID
Title string `json:"title"` // 广告标题
Description string `json:"description"` // 广告描述
ImageUrl string `json:"image_url"` // 广告图片URL
TargetUrl string `json:"target_url"` // 目标链接
ConversionRate float64 `json:"conversion_rate"` // 转化率
Source string `json:"source"` // 广告源
Bid int `json:"bid"` // 出价(分)
}
// GenerateCIDRes 生成CID响应
type GenerateCIDRes struct {
CID string `json:"cid"` // 唯一CID
Ads []*AdInfo `json:"ads"` // 广告列表
TotalAds int `json:"total_ads"` // 总广告数
TenantId interface{} `json:"tenant_id"` // 租户ID
TenantName string `json:"tenant_name"` // 租户名称
GeneratedAt string `json:"generated_at"` // 生成时间
}
// CIDRequestHistory CID请求历史记录
type CIDRequestHistory struct {
Id int64 `json:"id"` // 记录ID
TenantId interface{} `json:"tenant_id"` // 租户ID
UserId int64 `json:"user_id"` // 用户ID
RequestType string `json:"request_type"` // 请求类型
Status string `json:"status"` // 状态
ProcessTime int `json:"process_time"` // 处理时间(ms)
CreatedAt string `json:"created_at"` // 创建时间
}
// GetCIDHistoryReq 获取CID历史请求
type GetCIDHistoryReq struct {
g.Meta `path:"/getCidHistory" method:"get" tags:"CID服务" summary:"获取CID历史记录" dc:"分页获取用户的CID请求历史"`
Page int `json:"page" v:"required|min:1"` // 页码
Size int `json:"size" v:"required|min:1|max:100"` // 每页数量
}
// GetCIDHistoryRes 获取CID历史响应
type GetCIDHistoryRes struct {
List []*CIDRequestHistory `json:"list"` // 历史记录列表
Total int64 `json:"total"` // 总数
Page int `json:"page"` // 当前页
Size int `json:"size"` // 每页数量
}
// TenantInfo 租户信息
type TenantInfo struct {
Id string `json:"id"` // 租户ID
Name string `json:"name"` // 租户名称
Level string `json:"level"` // 租户级别
}

View File

@@ -0,0 +1,102 @@
package data
import (
"cid/consts/data"
entity "cid/model/entity/data"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
)
// CreateApiInterfaceReq 创建接口请求
type CreateApiInterfaceReq struct {
g.Meta `path:"/createApiInterface" method:"post" tags:"接口管理" summary:"创建接口" dc:"创建新的数据接口"`
PlatformId int64 `json:"platformId" v:"required" dc:"所属平台ID"`
Name string `json:"name" v:"required" dc:"接口名称"`
Code string `json:"code" v:"required" dc:"接口编码"`
Url string `json:"url" v:"required" dc:"接口地址"`
Method data.ApiMethod `json:"method" v:"required" dc:"请求方法"`
Status data.PlatformStatus `json:"status" dc:"接口状态" d:"active"`
AuthType string `json:"authType" dc:"认证类型"`
RequestConfig map[string]interface{} `json:"requestConfig" dc:"请求配置"`
ResponseConfig map[string]interface{} `json:"responseConfig" dc:"响应配置"`
LimitConfig map[string]interface{} `json:"limitConfig" dc:"接口独立限流配置"`
}
// CreateApiInterfaceRes 创建接口响应
type CreateApiInterfaceRes struct {
Id int64 `json:"id" dc:"接口ID"`
}
// ListApiInterfaceReq 获取接口列表请求
type ListApiInterfaceReq struct {
g.Meta `path:"/listApiInterfaces" method:"get" tags:"接口管理" summary:"获取接口列表" dc:"分页查询接口列表"`
*beans.Page
PlatformId int64 `json:"platformId" dc:"平台ID"`
Name string `json:"name" dc:"接口名称"`
Code string `json:"code" dc:"接口编码"`
Method data.ApiMethod `json:"method" dc:"请求方法"`
Status data.PlatformStatus `json:"status" dc:"接口状态"`
Keyword string `json:"keyword" dc:"关键字(搜索名称或编码)"`
}
// ListApiInterfaceRes 获取接口列表响应
type ListApiInterfaceRes struct {
List []ApiInterfaceItem `json:"list" dc:"接口列表"`
Total int `json:"total" dc:"总数"`
}
type ApiInterfaceItem struct {
Id int64 `json:"id,string"`
PlatformId int64 `json:"platformId"`
PlatformName string `json:"platformName"`
Name string `json:"name"`
Code string `json:"code"`
Url string `json:"url"`
Method data.ApiMethod `json:"method"`
Status data.PlatformStatus `json:"status"`
StatusName string `json:"statusName"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
// GetApiInterfaceReq 获取接口详情请求
type GetApiInterfaceReq struct {
g.Meta `path:"/getApiInterface" method:"get" tags:"接口管理" summary:"获取接口详情" dc:"获取接口详情"`
Id int64 `json:"id" v:"required" dc:"接口ID"`
}
// GetApiInterfaceRes 获取接口详情响应
type GetApiInterfaceRes struct {
*entity.ApiInterface
PlatformName string `json:"platformName,omitempty"`
}
// UpdateApiInterfaceReq 更新接口请求
type UpdateApiInterfaceReq struct {
g.Meta `path:"/updateApiInterface" method:"put" tags:"接口管理" summary:"更新接口" dc:"更新接口信息"`
Id int64 `json:"id" v:"required" dc:"接口ID"`
PlatformId int64 `json:"platformId" dc:"所属平台ID"`
Name string `json:"name" dc:"接口名称"`
Code string `json:"code" dc:"接口编码"`
Url string `json:"url" dc:"接口地址"`
Method data.ApiMethod `json:"method" dc:"请求方法"`
Status data.PlatformStatus `json:"status,omitempty" dc:"接口状态"`
AuthType string `json:"authType" dc:"认证类型"`
RequestConfig map[string]interface{} `json:"requestConfig" dc:"请求配置"`
ResponseConfig map[string]interface{} `json:"responseConfig" dc:"响应配置"`
LimitConfig map[string]interface{} `json:"limitConfig" dc:"接口独立限流配置"`
}
// DeleteApiInterfaceReq 删除接口请求
type DeleteApiInterfaceReq struct {
g.Meta `path:"/deleteApiInterface" method:"delete" tags:"接口管理" summary:"删除接口" dc:"删除接口"`
Id int64 `json:"id" v:"required" dc:"接口ID"`
}
// UpdateApiInterfaceStatusReq 更新接口状态请求
type UpdateApiInterfaceStatusReq struct {
g.Meta `path:"/updateApiInterfaceStatus" method:"put" tags:"接口管理" summary:"更新接口状态" dc:"更新接口状态"`
Id int64 `json:"id" v:"required" dc:"接口ID"`
Status data.PlatformStatus `json:"status" v:"required|in:active,inactive" dc:"状态active启用/inactive停用"`
}

View File

@@ -0,0 +1,99 @@
package data
import (
"cid/consts/data"
entity "cid/model/entity/data"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
)
// ExecuteDataFetchReq 执行数据获取请求
type ExecuteDataFetchReq struct {
g.Meta `path:"/executeDataFetch" method:"post" tags:"数据获取" summary:"执行数据获取" dc:"执行接口数据获取"`
PlatformId int64 `json:"platformId" v:"required" dc:"平台ID"`
InterfaceId int64 `json:"interfaceId" v:"required" dc:"接口ID"`
RequestParams map[string]interface{} `json:"requestParams" dc:"请求参数"`
}
// ExecuteDataFetchRes 执行数据获取响应
type ExecuteDataFetchRes struct {
RequestId string `json:"requestId" dc:"请求ID"`
Status string `json:"status" dc:"状态"`
Message string `json:"message" dc:"消息"`
}
// ListDataFetchLogReq 获取数据获取日志列表请求
type ListDataFetchLogReq struct {
g.Meta `path:"/listDataFetchLogs" method:"get" tags:"数据获取" summary:"获取数据获取日志" dc:"分页查询数据获取日志"`
*beans.Page
PlatformId int64 `json:"platformId" dc:"平台ID"`
InterfaceId int64 `json:"interfaceId" dc:"接口ID"`
RequestId string `json:"requestId" dc:"请求ID"`
Status data.FetchStatus `json:"status" dc:"执行状态"`
StartTime int64 `json:"startTime" dc:"开始时间(时间戳)"`
EndTime int64 `json:"endTime" dc:"结束时间(时间戳)"`
}
// ListDataFetchLogRes 获取数据获取日志列表响应
type ListDataFetchLogRes struct {
List []DataFetchLogItem `json:"list" dc:"日志列表"`
Total int `json:"total" dc:"总数"`
}
type DataFetchLogItem struct {
Id int64 `json:"id,string"`
PlatformId int64 `json:"platformId"`
PlatformName string `json:"platformName"`
InterfaceId int64 `json:"interfaceId"`
InterfaceName string `json:"interfaceName"`
RequestId string `json:"requestId"`
Status data.FetchStatus `json:"status"`
StatusName string `json:"statusName"`
StartTime int64 `json:"startTime"`
EndTime int64 `json:"endTime"`
Duration int `json:"duration"`
ErrorMessage string `json:"errorMessage"`
RetryCount int `json:"retryCount"`
CreatedAt int64 `json:"createdAt"`
}
// GetDataFetchLogReq 获取数据获取日志详情请求
type GetDataFetchLogReq struct {
g.Meta `path:"/getDataFetchLog" method:"get" tags:"数据获取" summary:"获取数据获取日志详情" dc:"获取数据获取日志详情"`
Id int64 `json:"id" v:"required" dc:"日志ID"`
}
// GetDataFetchLogRes 获取数据获取日志详情响应
type GetDataFetchLogRes struct {
*entity.DataFetchLog
PlatformName string `json:"platformName,omitempty"`
InterfaceName string `json:"interfaceName,omitempty"`
}
// BatchExecuteDataFetchReq 批量执行数据获取请求
type BatchExecuteDataFetchReq struct {
g.Meta `path:"/batchExecuteDataFetch" method:"post" tags:"数据获取" summary:"批量执行数据获取" dc:"批量执行接口数据获取"`
InterfaceIds []int64 `json:"interfaceIds" v:"required" dc:"接口ID列表"`
RequestParams map[string]interface{} `json:"requestParams" dc:"请求参数(所有接口共用)"`
}
// BatchExecuteDataFetchRes 批量执行数据获取响应
type BatchExecuteDataFetchRes struct {
SuccessCount int `json:"successCount" dc:"成功数量"`
FailedCount int `json:"failedCount" dc:"失败数量"`
RequestIds []string `json:"requestIds" dc:"请求ID列表"`
}
// ReExecuteDataFetchReq 重新执行数据获取请求
type ReExecuteDataFetchReq struct {
g.Meta `path:"/reExecuteDataFetch" method:"post" tags:"数据获取" summary:"重新执行数据获取" dc:"重新执行失败的数据获取"`
LogId int64 `json:"logId" v:"required" dc:"日志ID"`
}
// ReExecuteDataFetchRes 重新执行数据获取响应
type ReExecuteDataFetchRes struct {
RequestId string `json:"requestId" dc:"请求ID"`
Status string `json:"status" dc:"状态"`
Message string `json:"message" dc:"消息"`
}

View File

@@ -0,0 +1,91 @@
package data
import (
"cid/consts/data"
entity "cid/model/entity/data"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
)
// CreatePlatformReq 创建平台请求
type CreatePlatformReq struct {
g.Meta `path:"/createPlatform" method:"post" tags:"平台管理" summary:"创建平台" dc:"创建新的数据源平台"`
Name string `json:"name" v:"required" dc:"平台名称"`
Type data.SyncPlatform `json:"type" v:"required" dc:"平台类型"`
Status data.PlatformStatus `json:"status" dc:"平台状态" d:"active"`
Description string `json:"description" dc:"平台描述"`
AuthConfig map[string]interface{} `json:"authConfig" dc:"认证配置"`
LimitConfig map[string]interface{} `json:"limitConfig" dc:"限流配置"`
PlatformConfig map[string]interface{} `json:"platformConfig" dc:"平台专用配置"`
}
// CreatePlatformRes 创建平台响应
type CreatePlatformRes struct {
Id int64 `json:"id" dc:"平台ID"`
}
// ListPlatformReq 获取平台列表请求
type ListPlatformReq struct {
g.Meta `path:"/listPlatforms" method:"get" tags:"平台管理" summary:"获取平台列表" dc:"分页查询平台列表"`
*beans.Page
Name string `json:"name" dc:"平台名称"`
Type data.SyncPlatform `json:"type" dc:"平台类型"`
Status data.PlatformStatus `json:"status" dc:"平台状态"`
Keyword string `json:"keyword" dc:"关键字(搜索平台名称)"`
}
// ListPlatformRes 获取平台列表响应
type ListPlatformRes struct {
List []PlatformItem `json:"list" dc:"平台列表"`
Total int `json:"total" dc:"总数"`
}
type PlatformItem struct {
Id int64 `json:"id,string"`
Name string `json:"name"`
Type data.SyncPlatform `json:"type"`
TypeName string `json:"typeName"`
Status data.PlatformStatus `json:"status"`
StatusName string `json:"statusName"`
Description string `json:"description"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
// GetPlatformReq 获取平台详情请求
type GetPlatformReq struct {
g.Meta `path:"/getPlatform" method:"get" tags:"平台管理" summary:"获取平台详情" dc:"获取平台详情"`
Id int64 `json:"id" v:"required" dc:"平台ID"`
}
// GetPlatformRes 获取平台详情响应
type GetPlatformRes struct {
*entity.Platform
}
// UpdatePlatformReq 更新平台请求
type UpdatePlatformReq struct {
g.Meta `path:"/updatePlatform" method:"put" tags:"平台管理" summary:"更新平台" dc:"更新平台信息"`
Id int64 `json:"id" v:"required" dc:"平台ID"`
Name string `json:"name" dc:"平台名称"`
Type data.SyncPlatform `json:"type" dc:"平台类型"`
Status data.PlatformStatus `json:"status,omitempty" dc:"平台状态"`
Description string `json:"description" dc:"平台描述"`
AuthConfig map[string]interface{} `json:"authConfig" dc:"认证配置"`
LimitConfig map[string]interface{} `json:"limitConfig" dc:"限流配置"`
PlatformConfig map[string]interface{} `json:"platformConfig" dc:"平台专用配置"`
}
// DeletePlatformReq 删除平台请求
type DeletePlatformReq struct {
g.Meta `path:"/deletePlatform" method:"delete" tags:"平台管理" summary:"删除平台" dc:"删除平台"`
Id int64 `json:"id" v:"required" dc:"平台ID"`
}
// UpdatePlatformStatusReq 更新平台状态请求
type UpdatePlatformStatusReq struct {
g.Meta `path:"/updatePlatformStatus" method:"put" tags:"平台管理" summary:"更新平台状态" dc:"更新平台状态"`
Id int64 `json:"id" v:"required" dc:"平台ID"`
Status data.PlatformStatus `json:"status" v:"required|in:active,inactive" dc:"状态active启用/inactive停用"`
}

View File

@@ -0,0 +1,125 @@
package mapping
import (
"cid/consts/mapping"
entity "cid/model/entity/mapping"
"gitea.com/red-future/common/beans"
"github.com/gogf/gf/v2/frame/g"
)
// CreateDataMappingReq 创建数据映射请求
type CreateDataMappingReq struct {
g.Meta `path:"/createDataMapping" method:"post" tags:"数据映射" summary:"创建数据映射" dc:"创建数据映射规则"`
PlatformId int64 `json:"platformId" v:"required" dc:"平台ID"`
InterfaceId int64 `json:"interfaceId" v:"required" dc:"接口ID"`
SourceField string `json:"sourceField" v:"required" dc:"源字段"`
TargetField string `json:"targetField" v:"required" dc:"目标字段"`
FieldType string `json:"fieldType" v:"required" dc:"字段类型"`
DefaultValue string `json:"defaultValue" dc:"默认值"`
TransformRule map[string]interface{} `json:"transformRule" dc:"转换规则"`
Priority int `json:"priority" dc:"优先级" d:"0"`
Status mapping.MappingStatus `json:"status" dc:"状态" d:"active"`
}
// CreateDataMappingRes 创建数据映射响应
type CreateDataMappingRes struct {
Id int64 `json:"id" dc:"映射ID"`
}
// ListDataMappingReq 获取数据映射列表请求
type ListDataMappingReq struct {
g.Meta `path:"/listDataMappings" method:"get" tags:"数据映射" summary:"获取数据映射列表" dc:"分页查询数据映射列表"`
*beans.Page
PlatformId int64 `json:"platformId" dc:"平台ID"`
InterfaceId int64 `json:"interfaceId" dc:"接口ID"`
SourceField string `json:"sourceField" dc:"源字段"`
TargetField string `json:"targetField" dc:"目标字段"`
Status mapping.MappingStatus `json:"status" dc:"状态"`
}
// ListDataMappingRes 获取数据映射列表响应
type ListDataMappingRes struct {
List []DataMappingItem `json:"list" dc:"映射列表"`
Total int `json:"total" dc:"总数"`
}
type DataMappingItem struct {
Id int64 `json:"id,string"`
PlatformId int64 `json:"platformId"`
PlatformName string `json:"platformName"`
InterfaceId int64 `json:"interfaceId"`
InterfaceName string `json:"interfaceName"`
SourceField string `json:"sourceField"`
TargetField string `json:"targetField"`
FieldType string `json:"fieldType"`
DefaultValue string `json:"defaultValue"`
TransformRule map[string]interface{} `json:"transformRule"`
Priority int `json:"priority"`
Status mapping.MappingStatus `json:"status"`
StatusName string `json:"statusName"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
// GetDataMappingReq 获取数据映射详情请求
type GetDataMappingReq struct {
g.Meta `path:"/getDataMapping" method:"get" tags:"数据映射" summary:"获取数据映射详情" dc:"获取数据映射详情"`
Id int64 `json:"id" v:"required" dc:"映射ID"`
}
// GetDataMappingRes 获取数据映射详情响应
type GetDataMappingRes struct {
*entity.DataMapping
PlatformName string `json:"platformName,omitempty"`
InterfaceName string `json:"interfaceName,omitempty"`
}
// UpdateDataMappingReq 更新数据映射请求
type UpdateDataMappingReq struct {
g.Meta `path:"/updateDataMapping" method:"put" tags:"数据映射" summary:"更新数据映射" dc:"更新数据映射规则"`
Id int64 `json:"id" v:"required" dc:"映射ID"`
PlatformId int64 `json:"platformId" dc:"平台ID"`
InterfaceId int64 `json:"interfaceId" dc:"接口ID"`
SourceField string `json:"sourceField" dc:"源字段"`
TargetField string `json:"targetField" dc:"目标字段"`
FieldType string `json:"fieldType" dc:"字段类型"`
DefaultValue string `json:"defaultValue" dc:"默认值"`
TransformRule map[string]interface{} `json:"transformRule" dc:"转换规则"`
Priority int `json:"priority" dc:"优先级"`
Status mapping.MappingStatus `json:"status,omitempty" dc:"状态"`
}
// DeleteDataMappingReq 删除数据映射请求
type DeleteDataMappingReq struct {
g.Meta `path:"/deleteDataMapping" method:"delete" tags:"数据映射" summary:"删除数据映射" dc:"删除数据映射"`
Id int64 `json:"id" v:"required" dc:"映射ID"`
}
// BatchCreateDataMappingReq 批量创建数据映射请求
type BatchCreateDataMappingReq struct {
g.Meta `path:"/batchCreateDataMappings" method:"post" tags:"数据映射" summary:"批量创建数据映射" dc:"批量创建数据映射规则"`
PlatformId int64 `json:"platformId" v:"required" dc:"平台ID"`
InterfaceId int64 `json:"interfaceId" v:"required" dc:"接口ID"`
Mappings []CreateDataMappingReq `json:"mappings" v:"required" dc:"映射规则列表"`
}
// BatchCreateDataMappingRes 批量创建数据映射响应
type BatchCreateDataMappingRes struct {
SuccessCount int `json:"successCount" dc:"成功数量"`
FailedCount int `json:"failedCount" dc:"失败数量"`
Ids []int64 `json:"ids" dc:"映射ID列表"`
}
// ExecuteDataMappingReq 执行数据映射请求
type ExecuteDataMappingReq struct {
g.Meta `path:"/executeDataMapping" method:"post" tags:"数据映射" summary:"执行数据映射" dc:"执行数据字段映射"`
InterfaceId int64 `json:"interfaceId" v:"required" dc:"接口ID"`
SourceData map[string]interface{} `json:"sourceData" v:"required" dc:"源数据"`
}
// ExecuteDataMappingRes 执行数据映射响应
type ExecuteDataMappingRes struct {
TargetData map[string]interface{} `json:"targetData" dc:"目标数据"`
AppliedRules []string `json:"appliedRules" dc:"应用的映射规则"`
}

View File

@@ -1,35 +0,0 @@
package dto
import (
"github.com/gogf/gf/v2/frame/g"
)
// SetTenantRateLimitReq 设置租户限流配置请求
type SetTenantRateLimitReq struct {
g.Meta `path:"/setTenantRateLimit" method:"post" tags:"租户限流" summary:"设置租户限流配置" dc:"设置指定租户的请求次数限制配置(实际使用全局配置)"`
TenantID int64 `json:"tenant_id" v:"required"` // 租户ID(仅用于记录,实际使用全局配置)
RequestsPerSecond float64 `json:"requests_per_second" v:"required"` // 每秒请求数
Burst int `json:"burst" v:"required"` // 突发请求数
WindowSeconds int `json:"window_seconds" v:"required"` // 时间窗口(秒)
}
// SetTenantRateLimitRes 设置租户限流配置响应
type SetTenantRateLimitRes struct {
Success bool `json:"success"` // 是否成功
}
// GetTenantRateLimitUsageReq 获取租户限流使用情况请求
type GetTenantRateLimitUsageReq struct {
g.Meta `path:"/getTenantRateLimitUsage" method:"get" tags:"租户限流" summary:"获取租户限流使用情况" dc:"获取指定租户的请求次数使用情况"`
TenantID int64 `json:"tenant_id" v:"required"` // 租户ID
}
// GetTenantRateLimitUsageRes 获取租户限流使用情况响应
type GetTenantRateLimitUsageRes struct {
TenantID int64 `json:"tenant_id"` // 租户ID
CurrentUsed int64 `json:"current_used"` // 当前已使用请求数
MaxAllowed int64 `json:"max_allowed"` // 最大允许请求数(基于全局配置)
UsagePercent float64 `json:"usage_percent"` // 使用率百分比
}

View File

@@ -1,89 +0,0 @@
package dto
import (
"github.com/gogf/gf/v2/frame/g"
)
// CreateStrategyReq 创建策略请求
type CreateStrategyReq struct {
g.Meta `path:"/create" method:"post" tags:"策略管理" summary:"创建匹配策略" dc:"创建新的广告匹配策略"`
Name string `json:"name" v:"required|length:3,50"` // 策略名称
Description string `json:"description" v:"max:500"` // 描述
TenantLevel string `json:"tenant_level" v:"required|in:basic,standard,premium"` // 租户级别
MinConversion float64 `json:"min_conversion" v:"required|min:0|max:1"` // 最低转化率
MaxConversion float64 `json:"max_conversion" v:"required|min:0|max:1"` // 最高转化率
SourceWeights map[string]int `json:"source_weights" v:"required"` // 广告源权重
MaxAdsPerReq int `json:"max_ads_per_req" v:"required|min:1|max:50"` // 每次请求最大广告数
MaxReqPerHour int `json:"max_req_per_hour" v:"required|min:1"` // 每小时最大请求次数
Priority int `json:"priority" v:"required|min:0|max:100"` // 优先级
Status string `json:"status" v:"required|in:active,inactive"` // 状态
}
// UpdateStrategyReq 更新策略请求
type UpdateStrategyReq struct {
g.Meta `path:"/update" method:"put" tags:"策略管理" summary:"更新匹配策略" dc:"更新现有的广告匹配策略"`
Id int64 `json:"id" v:"required"` // 策略ID
Name string `json:"name" v:"required|length:3,50"` // 策略名称
Description string `json:"description" v:"max:500"` // 描述
TenantLevel string `json:"tenant_level" v:"required|in:basic,standard,premium"` // 租户级别
MinConversion float64 `json:"min_conversion" v:"required|min:0|max:1"` // 最低转化率
MaxConversion float64 `json:"max_conversion" v:"required|min:0|max:1"` // 最高转化率
SourceWeights map[string]int `json:"source_weights" v:"required"` // 广告源权重
MaxAdsPerReq int `json:"max_ads_per_req" v:"required|min:1|max:50"` // 每次请求最大广告数
MaxReqPerHour int `json:"max_req_per_hour" v:"required|min:1"` // 每小时最大请求次数
Priority int `json:"priority" v:"required|min:0|max:100"` // 优先级
Status string `json:"status" v:"required|in:active,inactive"` // 状态
}
// DeleteStrategyReq 删除策略请求
type DeleteStrategyReq struct {
g.Meta `path:"/delete" method:"delete" tags:"策略管理" summary:"删除匹配策略" dc:"删除指定的广告匹配策略"`
Id int64 `json:"id" v:"required"` // 策略ID
}
// GetStrategyReq 获取策略请求
type GetStrategyReq struct {
g.Meta `path:"/getByID" method:"get" tags:"策略管理" summary:"获取策略详情" dc:"获取指定策略的详细信息"`
Id int64 `json:"id" v:"required"` // 策略ID
}
// GetStrategyListReq 获取策略列表请求
type GetStrategyListReq struct {
g.Meta `path:"/getList" method:"get" tags:"策略管理" summary:"获取策略列表" dc:"分页获取策略列表"`
Page int `json:"page" v:"required|min:1"` // 页码
Size int `json:"size" v:"required|min:1|max:100"` // 每页数量
TenantLevel string `json:"tenant_level"` // 租户级别筛选
Status string `json:"status"` // 状态筛选
}
// StrategyRes 策略响应
type StrategyRes struct {
Id int64 `json:"id"` // ID
Name string `json:"name"` // 策略名称
Description string `json:"description"` // 描述
TenantLevel string `json:"tenant_level"` // 租户级别
MinConversion float64 `json:"min_conversion"` // 最低转化率
MaxConversion float64 `json:"max_conversion"` // 最高转化率
SourceWeights map[string]int `json:"source_weights"` // 广告源权重
MaxAdsPerReq int `json:"max_ads_per_req"` // 每次请求最大广告数
MaxReqPerHour int `json:"max_req_per_hour"` // 每小时最大请求次数
Priority int `json:"priority"` // 优先级
Status string `json:"status"` // 状态
CreatedAt string `json:"created_at"` // 创建时间
UpdatedAt string `json:"updated_at"` // 更新时间
CreatedBy int64 `json:"created_by"` // 创建人
UpdatedBy int64 `json:"updated_by"` // 更新人
}
// GetStrategyListRes 获取策略列表响应
type GetStrategyListRes struct {
List []*StrategyRes `json:"list"` // 策略列表
Total int64 `json:"total"` // 总数
Page int `json:"page"` // 当前页
Size int `json:"size"` // 每页数量
}
// DeleteStrategyRes 删除策略响应
type DeleteStrategyRes struct {
Success bool `json:"success"` // 是否成功
}

View File

@@ -1,68 +0,0 @@
package entity
import (
"cid/model/config"
"gitea.com/red-future/common/beans"
)
const AdCreativeCollection = "ad_creative"
// AdCreative 广告创意素材实体
type AdCreative struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
AdvertiserId string `bson:"advertiserId" json:"advertiserId"` // 广告主ID
// 基本信息
Name string `bson:"name" json:"name"` // 创意名称
Title string `bson:"title" json:"title"` // 广告标题
Description string `bson:"description" json:"description"` // 广告描述
AdType string `bson:"adType" json:"adType"` // 广告类型image、video、native、interstitial等
Format string `bson:"format" json:"format"` // 创意格式jpg、png、mp4、html等
// 素材信息
MaterialURL string `bson:"materialUrl" json:"materialUrl"` // 素材URL
ThumbnailURL string `bson:"thumbnailUrl" json:"thumbnailUrl"` // 缩略图URL
LandingPageURL string `bson:"landingPageUrl" json:"landingPageUrl"` // 落地页URL
DisplayURL string `bson:"displayUrl" json:"displayUrl"` // 显示URL
// 尺寸和文件信息
Width int64 `bson:"width" json:"width"` // 宽度(px)
Height int64 `bson:"height" json:"height"` // 高度(px)
Size int64 `bson:"size" json:"size"` // 文件大小(bytes)
Duration int64 `bson:"duration" json:"duration"` // 时长(秒)
HasAudio bool `bson:"hasAudio" json:"hasAudio"` // 是否有音频
AspectRatio string `bson:"aspectRatio" json:"aspectRatio"` // 宽高比
// 技术信息
MimeType string `bson:"mimeType" json:"mimeType"` // MIME类型
Source string `bson:"source" json:"source"` // 来源upload、sync、generate
BackupURL string `bson:"backupUrl" json:"backupUrl"` // 备份URL
CDNURL string `bson:"cdnUrl" json:"cdnUrl"` // CDN加速URL
CompressInfo string `bson:"compressInfo" json:"compressInfo"` // 压缩信息JSON格式
// 平台兼容性
SupportedPlatforms []string `bson:"supportedPlatforms" json:"supportedPlatforms"` // 支持的平台
PlatformSpecific string `bson:"platformSpecific" json:"platformSpecific"` // 平台特定配置JSON格式
// 外部平台信息
ExternalCreativeId string `bson:"externalCreativeId" json:"externalCreativeId"` // 外部创意ID
PlatformId string `bson:"platformId" json:"platformId"` // 平台ID
SyncStatus string `bson:"syncStatus" json:"syncStatus"` // 同步状态
LastSyncTime int64 `bson:"lastSyncTime" json:"lastSyncTime"` // 最后同步时间
// 基础配置
config.BaseConfig `bson:",inline" json:",inline"` // 内联基础配置
// 限制配置
config.RestrictionConfig `bson:",inline" json:",inline"` // 内联限制配置
// 其他信息
Status string `bson:"status" json:"status"` // 状态active、inactive、archived
ExpireTime int64 `bson:"expireTime" json:"expireTime"` // 过期时间
}
// GetCollectionName 获取集合名称
func (a *AdCreative) GetCollectionName() string {
return AdCreativeCollection
}

View File

@@ -1,57 +0,0 @@
package entity
import (
"cid/model/config"
"gitea.com/red-future/common/beans"
)
const AdPlatformCollection = "ad_platform"
// AdPlatform 广告平台实体
type AdPlatform struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
Status string `bson:"status" json:"status"` // 状态active、inactive、maintenance等
// 平台基本信息
Name string `bson:"name" json:"name"` // 平台名称:小红书、抖音、快手、京东、淘宝、百度等
Code string `bson:"code" json:"code"` // 平台编码,唯一标识
DisplayName string `bson:"displayName" json:"displayName"` // 显示名称
Logo string `bson:"logo" json:"logo"` // 平台Logo
Description string `bson:"description" json:"description"` // 平台描述
Category string `bson:"category" json:"category"` // 平台分类social、ecommerce、search、short_video等
// 支持的广告类型
SupportedAdTypes []string `bson:"supportedAdTypes" json:"supportedAdTypes"` // 支持的广告类型
SupportedFormats []string `bson:"supportedFormats" json:"supportedFormats"` // 支持的广告格式
// 技术能力
RealTimeBidding bool `bson:"realTimeBidding" json:"realTimeBidding"` // 是否支持实时竞价
ProgrammaticGuaranteed bool `bson:"programmaticGuaranteed" json:"programmaticGuaranteed"` // 是否支持程序化保障
HeaderBidding bool `bson:"headerBidding" json:"headerBidding"` // 是否支持Header Bidding
// API配置
config.APIConfig `bson:",inline" json:",inline"` // 内联API配置
// 竞价配置
config.BiddingConfig `bson:",inline" json:",inline"` // 内联竞价配置
// 支付配置
config.PaymentConfig `bson:",inline" json:",inline"` // 内联支付配置
// 限流配置
RateLimit int64 `bson:"rateLimit" json:"rateLimit"` // 速率限制
MaxBudgetPerDay int64 `bson:"maxBudgetPerDay" json:"maxBudgetPerDay"` // 每日最大预算
LastSyncTime int64 `bson:"lastSyncTime" json:"lastSyncTime"` // 最后同步时间
// 联系信息
SupportContact string `bson:"supportContact" json:"supportContact"` // 技术支持联系方式
AccountManager string `bson:"accountManager" json:"accountManager"` // 客户经理
TechDocumentation string `bson:"techDocumentation" json:"techDocumentation"` // 技术文档链接
}
// GetCollectionName 获取集合名称
func (a *AdPlatform) GetCollectionName() string {
return AdPlatformCollection
}

View File

@@ -1,85 +0,0 @@
package entity
import (
"cid/model/config"
"gitea.com/red-future/common/beans"
)
const AdPositionCollection = "ad_position"
// AdPosition 广告位实体
type AdPosition struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
Status string `bson:"status" json:"status"` // 状态active、inactive、maintenance等
// 基本信息
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 int64 `bson:"width" json:"width"` // 宽度(px)
Height int64 `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"` // 展示规则
// 限制配置
config.RestrictionConfig `bson:",inline" json:",inline"` // 内联限制配置
// 其他状态
IsExclusive bool `bson:"isExclusive" json:"isExclusive"` // 是否独占广告位
}
// 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"` // 条件值
}
// GetCollectionName 获取集合名称
func (a *AdPosition) GetCollectionName() string {
return AdPositionCollection
}

View File

@@ -1,74 +0,0 @@
package entity
import (
"cid/model/config"
"gitea.com/red-future/common/beans"
)
const AdSourceCollection = "ad_source"
// AdSource 广告源实体
type AdSource struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
Status string `bson:"status" json:"status"` // 状态active、inactive、maintenance等
// 基本信息
Name string `bson:"name" json:"name"` // 广告源名称
Code string `bson:"code" json:"code"` // 广告源编码,唯一标识
Provider string `bson:"provider" json:"provider"` // 提供商self(自营)、chuanshanjia(穿山甲)、gdt(腾讯广点通)、baidu(百度)、byteance(字节跳动)等
Type string `bson:"type" json:"type"` // 类型self(自营)、third_party(第三方)、exchange(广告交易平台)、platform_ad_source(平台广告源)
Category string `bson:"category" json:"category"` // 分类network、ssp、dsp、rtb等
// 连接配置
Config string `bson:"config" json:"config"` // 广告源配置JSON字符串
// API配置
config.APIConfig `bson:",inline" json:",inline"` // 内联API配置
// 创意配置
config.CreativeConfig `bson:",inline" json:",inline"` // 内联创意配置
// 广告源能力
Capabilities *AdSourceCapabilities `bson:"capabilities" json:"capabilities"` // 广告源能力
// 支付配置
config.PaymentConfig `bson:",inline" json:",inline"` // 内联支付配置
}
// AdSourceCapabilities 广告源能力
type AdSourceCapabilities struct {
// 广告格式
SupportedFormats []AdFormat `bson:"supportedFormats" json:"supportedFormats"` // 支持的广告格式
// 功能特性
RealTimeBidding bool `bson:"realTimeBidding" json:"realTimeBidding"` // 实时竞价
HeaderBidding bool `bson:"headerBidding" json:"headerBidding"` // 标题竞价
ProgrammaticDirect bool `bson:"programmaticDirect" json:"programmaticDirect"` // 程序化直购
PrivateMarketplace bool `bson:"privateMarketplace" json:"privateMarketplace"` // 私有交易市场
// 质量控制
FraudDetection bool `bson:"fraudDetection" json:"fraudDetection"` // 反欺诈检测
BrandSafety bool `bson:"brandSafety" json:"brandSafety"` // 品牌安全
Viewability bool `bson:"viewability" json:"viewability"` // 可见度验证
CreativeApproval bool `bson:"creativeApproval" json:"creativeApproval"` // 创意审核
// 数据能力
AudienceTargeting bool `bson:"audienceTargeting" json:"audienceTargeting"` // 受众定向
ContextualTargeting bool `bson:"contextualTargeting" json:"contextualTargeting"` // 上下文定向
CrossDeviceTargeting bool `bson:"crossDeviceTargeting" json:"crossDeviceTargeting"` // 跨设备定向
}
// AdFormat 广告格式
type AdFormat struct {
Type string `bson:"type" json:"type"` // 格式类型banner、video、native、interstitial等
Name string `bson:"name" json:"name"` // 格式名称
Width int `bson:"width" json:"width"` // 宽度
Height int `bson:"height" json:"height"` // 高度
MimeType string `bson:"mimeType" json:"mimeType"` // MIME类型
}
// GetCollectionName 获取集合名称
func (a *AdSource) GetCollectionName() string {
return AdSourceCollection
}

View File

@@ -1,44 +0,0 @@
package entity
import (
"gitea.com/red-future/common/beans"
)
const AdTypeCollection = "ad_type"
// AdType 广告类型实体
type AdType struct {
beans.MongoBaseDO `bson:",inline"`
// 广告类型信息
Name string `bson:"name" json:"name"` // 广告类型名称
Code string `bson:"code" json:"code"` // 广告类型编码
Description string `bson:"description" json:"description"` // 广告类型描述
Icon string `bson:"icon" json:"icon"` // 广告类型图标
// 类型配置
Category string `bson:"category" json:"category"` // 分类display, video, native, interstitial
Platforms []string `bson:"platforms" json:"platforms"` // 支持的平台
Formats []string `bson:"formats" json:"formats"` // 支持格式
Dimensions []string `bson:"dimensions" json:"dimensions"` // 尺寸规格
// 技术要求
MaxFileSize int64 `bson:"maxFileSize" json:"maxFileSize"` // 最大文件大小(bytes)
MaxDuration int64 `bson:"maxDuration" json:"maxDuration"` // 最大时长(秒)
SupportedMimeTypes []string `bson:"supportedMimeTypes" json:"supportedMimeTypes"` // 支持的MIME类型
// 业务配置
BidType string `bson:"bidType" json:"bidType"` // 竞价类型CPM, CPC, CPA
MinBidPrice int64 `bson:"minBidPrice" json:"minBidPrice"` // 最低出价(分)
MaxBidPrice int64 `bson:"maxBidPrice" json:"maxBidPrice"` // 最高出价(分)
// 状态信息
Status string `bson:"status" json:"status"` // 状态active, inactive
SortOrder int `bson:"sortOrder" json:"sortOrder"` // 排序顺序
// 统计信息
DailyImpression int64 `bson:"dailyImpression" json:"dailyImpression"` // 日展示量
DailyClick int64 `bson:"dailyClick" json:"dailyClick"` // 日点击量
Remark string `bson:"remark" json:"remark"` // 备注
}

View File

@@ -1,55 +0,0 @@
package entity
import (
"cid/model/config"
"gitea.com/red-future/common/beans"
)
const AdvertisementCollection = "advertisement"
// Advertisement 广告实体
type Advertisement struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
AdvertiserId string `bson:"advertiserId" json:"advertiserId"` // 广告主ID
// 广告基本信息
Title string `bson:"title" json:"title"` // 广告标题
Description string `bson:"description" json:"description"` // 广告描述
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"` // 目标链接(点击跳转或落地页)
// 平台和广告源信息
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等
// 投放配置
config.BudgetConfig `bson:",inline" json:",inline"` // 内联预算配置
BidAmount int64 `bson:"bidAmount" json:"bidAmount"` // 出价(分)
BillingType string `bson:"billingType" json:"billingType"` // 计费类型CPC、CPM、CPA等
// 定向条件
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"` // 审核人
// 限制配置
config.RestrictionConfig `bson:",inline" json:",inline"` // 内联限制配置
// 其他状态信息
Status string `bson:"status" json:"status"` // 业务状态active、inactive、archived
}
// GetCollectionName 获取集合名称
func (a *Advertisement) GetCollectionName() string {
return AdvertisementCollection
}

View File

@@ -1,53 +0,0 @@
package entity
import (
"gitea.com/red-future/common/beans"
)
const AdvertiserCollection = "advertiser"
// Advertiser 广告主实体
type Advertiser struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
Status string `bson:"status" json:"status"` // 状态active、inactive、maintenance等
// 基本信息
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"` // 公司名称
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"` // 到期日期
// 审核状态
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"` // 授信额度(分)
}
// GetCollectionName 获取集合名称
func (a *Advertiser) GetCollectionName() string {
return AdvertiserCollection
}

View File

@@ -0,0 +1,49 @@
package app
import (
consts "cid/consts/app"
"gitea.com/red-future/common/beans"
)
// Application 应用管理实体
type Application struct {
beans.SQLBaseDO `orm:",inherit"`
// 基础信息
Name string `orm:"name" json:"name" description:"应用名称"`
AppCode string `orm:"app_code" json:"appCode" description:"应用编码(唯一标识)"`
Type consts.AppType `orm:"type" json:"type" description:"应用类型"`
Status consts.AppStatus `orm:"status" json:"status" description:"应用状态active启用/inactive停用"`
Description string `orm:"description" json:"description" description:"应用描述"`
// 接入配置 (JSONB)
AccessConfig map[string]interface{} `orm:"access_config" json:"accessConfig" description:"接入配置"`
// 限流配置 (JSONB)
LimitConfig map[string]interface{} `orm:"limit_config" json:"limitConfig" description:"限流配置"`
// 回调配置 (JSONB)
CallbackConfig map[string]interface{} `orm:"callback_config" json:"callbackConfig" description:"回调配置"`
}
// ApplicationCol 应用表字段定义
type ApplicationCol struct {
beans.SQLBaseCol
Name string
AppCode string
Type string
Status string
Description string
AccessConfig string
LimitConfig string
CallbackConfig string
}
// ApplicationCols 应用表字段常量
var ApplicationCols = ApplicationCol{
SQLBaseCol: beans.DefSQLBaseCol,
Name: "name",
AppCode: "app_code",
Type: "type",
Status: "status",
Description: "description",
AccessConfig: "access_config",
LimitConfig: "limit_config",
CallbackConfig: "callback_config",
}

View File

@@ -1,32 +0,0 @@
package entity
import (
"gitea.com/red-future/common/beans"
)
const AppPlatformConfigCollection = "app_platform_config"
// AppPlatformConfig 应用平台配置实体
type AppPlatformConfig struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
Status string `bson:"status" json:"status"` // 状态active、inactive、maintenance等
// 关联信息
AppID string `bson:"appId" json:"appId"` // 应用ID
PlatformID string `bson:"platformId" json:"platformId"` // 平台ID
// 配置信息
Config string `bson:"config" json:"config"` // 配置信息JSON字符串
MaxAdsPerReq int `bson:"maxAdsPerReq" json:"maxAdsPerReq"` // 每次请求最大广告数
// 定向配置
TargetingRules string `bson:"targetingRules" json:"targetingRules"` // 定向规则JSON字符串
// 过滤配置
FilterRules string `bson:"filterRules" json:"filterRules"` // 过滤规则JSON字符串
}
// GetCollectionName 获取集合名称
func (a *AppPlatformConfig) GetCollectionName() string {
return AppPlatformConfigCollection
}

View File

@@ -1,54 +0,0 @@
package entity
import (
"gitea.com/red-future/common/beans"
)
const ApplicationCollection = "application"
// Application 应用实体
type Application struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
Status string `bson:"status" json:"status"` // 状态active、inactive、maintenance等
// 应用基本信息
Name string `bson:"name" json:"name"` // 应用名称
Code string `bson:"code" json:"code"` // 应用编码
Description string `bson:"description" json:"description"` // 应用描述
AppKey string `bson:"appKey" json:"appKey"` // 应用密钥
AppSecret string `bson:"appSecret" json:"appSecret"` // 应用秘钥
Platform string `bson:"platform" json:"platform"` // 平台web、ios、android、h5
Version string `bson:"version" json:"version"` // 版本号
PackageName string `bson:"packageName" json:"packageName"` // 包名(移动应用)
BundleID string `bson:"bundleId" json:"bundleId"` // Bundle IDiOS应用
AppStoreURL string `bson:"appStoreUrl" json:"appStoreUrl"` // 应用商店URL
// 应用配置
Config string `bson:"config" json:"config"` // 应用配置JSON字符串
Permissions string `bson:"permissions" json:"permissions"` // 权限配置JSON字符串
// 应用分类和标签
Categories []string `bson:"categories" json:"categories"` // 应用分类
Tags []string `bson:"tags" json:"tags"` // 标签
AdTypes []string `bson:"adTypes" json:"adTypes"` // 支持的广告类型
// 回调配置
CallbackURL string `bson:"callbackUrl" json:"callbackUrl"` // 回调URL
// 应用特定统计
DailyActiveUsers int64 `bson:"dailyActiveUsers" json:"dailyActiveUsers"` // 日活用户数
MonthlyActiveUsers int64 `bson:"monthlyActiveUsers" json:"monthlyActiveUsers"` // 月活用户数
TotalRequests int64 `bson:"totalRequests" json:"totalRequests"` // 总请求数
DailyRequests int64 `bson:"dailyRequests" json:"dailyRequests"` // 日请求数
MonthlyRequests int64 `bson:"monthlyRequests" json:"monthlyRequests"` // 月请求数
// 联系信息
ContactName string `bson:"contactName" json:"contactName"` // 联系人姓名
ContactEmail string `bson:"contactEmail" json:"contactEmail"` // 联系邮箱
ContactPhone string `bson:"contactPhone" json:"contactPhone"` // 联系电话
}
// GetCollectionName 获取集合名称
func (a *Application) GetCollectionName() string {
return ApplicationCollection
}

View File

@@ -1,251 +0,0 @@
package entity
import (
"gitea.com/red-future/common/beans"
)
const CidRequestCollection = "cid_request"
// CidRequest CID请求实体合并后的统一版本
type CidRequest struct {
beans.MongoBaseDO `bson:",inline" json:",inline"` // 嵌入基础字段Id, Creator, CreatedAt, Updater, UpdatedAt, IsDeleted
// 请求基础信息
RequestID string `bson:"requestId" json:"requestId"` // 请求唯一ID
SessionID string `bson:"sessionId" json:"sessionId"` // 会话ID
UserID string `bson:"userId" json:"userId"` // 用户ID
// 网络信息
IPAddress string `bson:"ipAddress" json:"ipAddress"` // IP地址
UserAgent string `bson:"userAgent" json:"userAgent"` // 用户代理
Referer string `bson:"referer" json:"referer"` // 来源页面
// 广告位信息(使用内联结构)
PositionCode string `bson:"positionCode" json:"positionCode"` // 广告位编码
PositionSize string `bson:"positionSize" json:"positionSize"` // 广告位尺寸
PositionFormat string `bson:"positionFormat" json:"positionFormat"` // 广告位格式
PositionType string `bson:"positionType" json:"positionType"` // 广告位类型
// 页面信息
PageURL string `bson:"pageUrl" json:"pageUrl"` // 页面URL
PageTitle string `bson:"pageTitle" json:"pageTitle"` // 页面标题
PageCategory string `bson:"pageCategory" json:"pageCategory"` // 页面分类
PageKeywords []string `bson:"pageKeywords" json:"pageKeywords"` // 页面关键词
PageTags map[string]string `bson:"pageTags" json:"pageTags"` // 页面标签
// 用户上下文信息(使用统一版本)
UserContext *UnifiedUserContext `bson:"userContext" json:"userContext"` // 用户上下文
DeviceInfo *DeviceInfo `bson:"deviceInfo" json:"deviceInfo"` // 设备信息
LocationInfo *UnifiedLocationInfo `bson:"locationInfo" json:"locationInfo"` // 位置信息
TemporalInfo *UnifiedTemporalInfo `bson:"temporalInfo" json:"temporalInfo"` // 时间信息
// 请求参数(使用合并版本)
RequestParams *RequestParams `bson:"requestParams" json:"requestParams"` // 请求参数
// 定向规则(使用统一的定向结构)
TargetingRules *UnifiedTargeting `bson:"targetingRules" json:"targetingRules"` // 定向规则
// 策略配置
StrategyConfig *StrategyConfig `bson:"strategyConfig" json:"strategyConfig"` // 策略配置
// 响应信息
Response *CidResponse `bson:"response" json:"response"` // 响应结果
ProcessingTime int64 `bson:"processingTime" json:"processingTime"` // 处理时间(毫秒)
ResponseTime int64 `bson:"responseTime" json:"responseTime"` // 响应时间(毫秒)
// 状态信息
Status string `bson:"status" json:"status"` // 请求状态pending、processing、completed、failed、timeout
ErrorMessage string `bson:"errorMessage" json:"errorMessage"` // 错误信息
ErrorCode string `bson:"errorCode" json:"errorCode"` // 错误代码
// 广告源信息
RequestedAdSources []string `bson:"requestedAdSources" json:"requestedAdSources"` // 请求的广告源列表
RespondedAdSources []string `bson:"respondedAdSources" json:"respondedAdSources"` // 响应的广告源列表
AdSourceResponses map[string]*AdSourceResponse `bson:"adSourceResponses" json:"adSourceResponses"` // 各广告源响应
// 统计信息
TotalAdsReturned int `bson:"totalAdsReturned" json:"totalAdsReturned"` // 返回的广告总数
ValidAdsReturned int `bson:"validAdsReturned" json:"validAdsReturned"` // 有效广告数
FilteredAds int `bson:"filteredAds" json:"filteredAds"` // 过滤的广告数
DuplicateAds int `bson:"duplicateAds" json:"duplicateAds"` // 重复广告数
// 系统信息
ServerInstance string `bson:"serverInstance" json:"serverInstance"` // 服务实例ID
Region string `bson:"region" json:"region"` // 服务区域
Version string `bson:"version" json:"version"` // 系统版本
}
// GetCollectionName 获取集合名称
func (c *CidRequest) GetCollectionName() string {
return CidRequestCollection
}
// UnifiedUserContext 统一的用户上下文
type UnifiedUserContext struct {
UserID string `bson:"userId" json:"userId"` // 用户ID
SessionID string `bson:"sessionId" json:"sessionId"` // 会话ID
CookieID string `bson:"cookieId" json:"cookieId"` // Cookie ID
IP string `bson:"ip" json:"ip"` // IP地址
UserAgent string `bson:"userAgent" json:"userAgent"` // 用户代理
Language string `bson:"language" json:"language"` // 语言
Timezone string `bson:"timezone" json:"timezone"` // 时区
CustomData map[string]interface{} `bson:"customData" json:"customData"` // 自定义数据
}
// UnifiedLocationInfo 统一的位置信息
type UnifiedLocationInfo struct {
Country string `bson:"country" json:"country"` // 国家
Region string `bson:"region" json:"region"` // 地区/省份
City string `bson:"city" json:"city"` // 城市
PostalCode string `bson:"postalCode" json:"postalCode"` // 邮政编码
Latitude float64 `bson:"latitude" json:"latitude"` // 纬度
Longitude float64 `bson:"longitude" json:"longitude"` // 经度
Timezone string `bson:"timezone" json:"timezone"` // 时区
Metro string `bson:"metro" json:"metro"` // 都市区
Area string `bson:"area" json:"area"` // 区域
Network string `bson:"network" json:"network"` // 网络运营商
ConnectionType string `bson:"connectionType" json:"connectionType"` // 连接类型
ISP string `bson:"isp" json:"isp"` // 互联网服务提供商
}
// UnifiedTemporalInfo 统一的时间信息
type UnifiedTemporalInfo struct {
Timestamp int64 `bson:"timestamp" json:"timestamp"` // 时间戳(秒)
Milliseconds int64 `bson:"milliseconds" json:"milliseconds"` // 毫秒数
Timezone string `bson:"timezone" json:"timezone"` // 时区
DayOfWeek int `bson:"dayOfWeek" json:"dayOfWeek"` // 星期几(0-6)
HourOfDay int `bson:"hourOfDay" json:"hourOfDay"` // 小时(0-23)
DayOfMonth int `bson:"dayOfMonth" json:"dayOfMonth"` // 月份中的天数
Month int `bson:"month" json:"month"` // 月份(1-12)
Year int `bson:"year" json:"year"` // 年份
IsWeekend bool `bson:"isWeekend" json:"isWeekend"` // 是否周末
IsBusinessHours bool `bson:"isBusinessHours" json:"isBusinessHours"` // 是否营业时间
Season string `bson:"season" json:"season"` // 季节
Holiday string `bson:"holiday" json:"holiday"` // 节假日
}
// DeviceInfo 设备信息
type DeviceInfo struct {
Type string `bson:"type" json:"type"` // 设备类型desktop、mobile、tablet
Brand string `bson:"brand" json:"brand"` // 设备品牌
Model string `bson:"model" json:"model"` // 设备型号
OS string `bson:"os" json:"os"` // 操作系统
OSVersion string `bson:"osVersion" json:"osVersion"` // 操作系统版本
Browser string `bson:"browser" json:"browser"` // 浏览器
BrowserVersion string `bson:"browserVersion" json:"browserVersion"` // 浏览器版本
ScreenWidth int `bson:"screenWidth" json:"screenWidth"` // 屏幕宽度
ScreenHeight int `bson:"screenHeight" json:"screenHeight"` // 屏幕高度
ViewportWidth int `bson:"viewportWidth" json:"viewportWidth"` // 视口宽度
ViewportHeight int `bson:"viewportHeight" json:"viewportHeight"` // 视口高度
DPI int `bson:"dpi" json:"dpi"` // 设备DPI
IsJavaScript bool `bson:"isJavaScript" json:"isJavaScript"` // 是否支持JavaScript
IsCookie bool `bson:"isCookie" json:"isCookie"` // 是否支持Cookie
IsFlash bool `bson:"isFlash" json:"isFlash"` // 是否支持Flash
IsHTTPS bool `bson:"isHTTPS" json:"isHTTPS"` // 是否HTTPS连接
}
// RequestParams 请求参数(合并版本)
type RequestParams struct {
AdCount int `bson:"adCount" json:"adCount"` // 请求的广告数量
AdTypes []string `bson:"adTypes" json:"adTypes"` // 广告类型
AdSizes []string `bson:"adSizes" json:"adSizes"` // 广告尺寸
ExcludedAdSources []string `bson:"excludedAdSources" json:"excludedAdSources"` // 排除的广告源
RequiredAdSources []string `bson:"requiredAdSources" json:"requiredAdSources"` // 必需的广告源
MinBidAmount int64 `bson:"minBidAmount" json:"minBidAmount"` // 最小出价(分)
MaxBidAmount int64 `bson:"maxBidAmount" json:"maxBidAmount"` // 最大出价(分)
AllowDuplicates bool `bson:"allowDuplicates" json:"allowDuplicates"` // 是否允许重复广告
FloorPrice int64 `bson:"floorPrice" json:"floorPrice"` // 底价(分)
CeilingPrice int64 `bson:"ceilingPrice" json:"ceilingPrice"` // 封顶价(分)
CustomParams map[string]interface{} `bson:"customParams" json:"customParams"` // 自定义参数
}
// StrategyConfig 策略配置(合并版本)
type StrategyConfig struct {
StrategyType string `bson:"strategyType" json:"strategyType"` // 策略类型
Priority int `bson:"priority" json:"priority"` // 优先级
Weight float64 `bson:"weight" json:"weight"` // 权重
MinAds int `bson:"minAds" json:"minAds"` // 最小广告数
MaxAds int `bson:"maxAds" json:"maxAds"` // 最大广告数
AllowDuplicates bool `bson:"allowDuplicates" json:"allowDuplicates"` // 是否允许重复
Timeout int64 `bson:"timeout" json:"timeout"` // 超时时间(毫秒)
RetryCount int `bson:"retryCount" json:"retryCount"` // 重试次数
CustomSettings map[string]interface{} `bson:"customSettings" json:"customSettings"` // 自定义设置
}
// CidResponse CID响应合并版本
type CidResponse struct {
Ads []Ad `bson:"ads" json:"ads"` // 广告列表
TrackingInfo *TrackingInfo `bson:"trackingInfo" json:"trackingInfo"` // 跟踪信息
Metadata *ResponseMetadata `bson:"metadata" json:"metadata"` // 响应元数据
}
// Ad 广告结构(合并版本)
type Ad struct {
ID string `bson:"id" json:"id"` // 广告ID
AdSource string `bson:"adSource" json:"adSource"` // 广告源
Advertiser string `bson:"advertiser" json:"advertiser"` // 广告主
Title string `bson:"title" json:"title"` // 广告标题
Description string `bson:"description" json:"description"` // 广告描述
CreativeURL string `bson:"creativeUrl" json:"creativeUrl"` // 创意URL
LandingURL string `bson:"landingUrl" json:"landingUrl"` // 落地页URL
DisplayURL string `bson:"displayUrl" json:"displayUrl"` // 显示URL
AdType string `bson:"adType" json:"adType"` // 广告类型
Format string `bson:"format" json:"format"` // 广告格式
Width int `bson:"width" json:"width"` // 宽度
Height int `bson:"height" json:"height"` // 高度
MimeType string `bson:"mimeType" json:"mimeType"` // MIME类型
BidAmount int64 `bson:"bidAmount" json:"bidAmount"` // 出价(分)
Revenue int64 `bson:"revenue" json:"revenue"` // 预估收入(分)
CTR float64 `bson:"ctr" json:"ctr"` // 点击率
CVR float64 `bson:"cvr" json:"cvr"` // 转化率
Targeting map[string]interface{} `bson:"targeting" json:"targeting"` // 定向条件
Restrictions map[string]interface{} `bson:"restrictions" json:"restrictions"` // 限制条件
TrackingPixels []string `bson:"trackingPixels" json:"trackingPixels"` // 跟踪像素
CustomData map[string]interface{} `bson:"customData" json:"customData"` // 自定义数据
ExpiresAt int64 `bson:"expiresAt" json:"expiresAt"` // 过期时间
Priority int `bson:"priority" json:"priority"` // 优先级
Score float64 `bson:"score" json:"score"` // 评分
}
// TrackingInfo 跟踪信息(合并版本)
type TrackingInfo struct {
ImpressionURLs []string `bson:"impressionUrls" json:"impressionUrls"` // 展示跟踪URL
ClickURLs []string `bson:"clickUrls" json:"clickUrls"` // 点击跟踪URL
ConversionURLs []string `bson:"conversionUrls" json:"conversionUrls"` // 转化跟踪URL
ViewThroughURLs []string `bson:"viewThroughUrls" json:"viewThroughUrls"` // 查看跟踪URL
EventURLs map[string][]string `bson:"eventUrls" json:"eventUrls"` // 事件跟踪URL
BeaconURLs []string `bson:"beaconUrls" json:"beaconUrls"` // 信标URL
}
// ResponseMetadata 响应元数据(合并版本)
type ResponseMetadata struct {
TotalAvailableAds int `bson:"totalAvailableAds" json:"totalAvailableAds"` // 总可用广告数
SelectedAds int `bson:"selectedAds" json:"selectedAds"` // 选择的广告数
FilteredAds int `bson:"filteredAds" json:"filteredAds"` // 过滤的广告数
DuplicateAds int `bson:"duplicateAds" json:"duplicateAds"` // 重复的广告数
AverageBidAmount int64 `bson:"averageBidAmount" json:"averageBidAmount"` // 平均出价
HighestBidAmount int64 `bson:"highestBidAmount" json:"highestBidAmount"` // 最高出价
LowestBidAmount int64 `bson:"lowestBidAmount" json:"lowestBidAmount"` // 最低出价
AverageCTR float64 `bson:"averageCTR" json:"averageCTR"` // 平均点击率
AverageCVR float64 `bson:"averageCVR" json:"averageCVR"` // 平均转化率
ResponseTime int64 `bson:"responseTime" json:"responseTime"` // 响应时间(毫秒)
CacheHit bool `bson:"cacheHit" json:"cacheHit"` // 是否命中缓存
StrategyUsed string `bson:"strategyUsed" json:"strategyUsed"` // 使用的策略
AdSourcesUsed []string `bson:"adSourcesUsed" json:"adSourcesUsed"` // 使用的广告源
}
// AdSourceResponse 广告源响应(合并版本)
type AdSourceResponse struct {
AdSource string `bson:"adSource" json:"adSource"` // 广告源名称
Status string `bson:"status" json:"status"` // 响应状态success、timeout、error
ResponseTime int64 `bson:"responseTime" json:"responseTime"` // 响应时间(毫秒)
AdsReturned int `bson:"adsReturned" json:"adsReturned"` // 返回的广告数
AdsAccepted int `bson:"adsAccepted" json:"adsAccepted"` // 接受的广告数
AdsFiltered int `bson:"adsFiltered" json:"adsFiltered"` // 过滤的广告数
ErrorMessage string `bson:"errorMessage" json:"errorMessage"` // 错误信息
ErrorCode string `bson:"errorCode" json:"errorCode"` // 错误代码
RetryCount int `bson:"retryCount" json:"retryCount"` // 重试次数
CacheHit bool `bson:"cacheHit" json:"cacheHit"` // 是否命中缓存
TotalRevenue int64 `bson:"totalRevenue" json:"totalRevenue"` // 总收入(分)
AverageBidAmount int64 `bson:"averageBidAmount" json:"averageBidAmount"` // 平均出价(分)
}

View File

@@ -0,0 +1,56 @@
package data
import (
consts "cid/consts/data"
"gitea.com/red-future/common/beans"
)
// ApiInterface 接口管理实体
type ApiInterface struct {
beans.SQLBaseDO `orm:",inherit"`
// 基础信息
PlatformId int64 `orm:"platform_id" json:"platformId" description:"所属平台ID"`
Name string `orm:"name" json:"name" description:"接口名称"`
Code string `orm:"code" json:"code" description:"接口编码"`
Url string `orm:"url" json:"url" description:"接口地址"`
Method consts.ApiMethod `orm:"method" json:"method" description:"请求方法GET/POST/PUT/DELETE等"`
Status consts.PlatformStatus `orm:"status" json:"status" description:"接口状态active启用/inactive停用"`
// 认证类型
AuthType string `orm:"auth_type" json:"authType" description:"认证类型oauth2/apikey/basic等"`
// 请求配置 (JSONB)
RequestConfig map[string]interface{} `orm:"request_config" json:"requestConfig" description:"请求配置"`
// 响应配置 (JSONB)
ResponseConfig map[string]interface{} `orm:"response_config" json:"responseConfig" description:"响应配置"`
// 独立限流配置 (JSONB)
LimitConfig map[string]interface{} `orm:"limit_config" json:"limitConfig" description:"接口独立限流配置(可选,覆盖平台配置)"`
}
// ApiInterfaceCol 接口表字段定义
type ApiInterfaceCol struct {
beans.SQLBaseCol
PlatformId string
Name string
Code string
Url string
Method string
Status string
AuthType string
RequestConfig string
ResponseConfig string
LimitConfig string
}
// ApiInterfaceCols 接口表字段常量
var ApiInterfaceCols = ApiInterfaceCol{
SQLBaseCol: beans.DefSQLBaseCol,
PlatformId: "platform_id",
Name: "name",
Code: "code",
Url: "url",
Method: "method",
Status: "status",
AuthType: "auth_type",
RequestConfig: "request_config",
ResponseConfig: "response_config",
LimitConfig: "limit_config",
}

View File

@@ -0,0 +1,58 @@
package data
import (
consts "cid/consts/data"
"gitea.com/red-future/common/beans"
)
// DataFetchLog 数据获取日志实体
type DataFetchLog struct {
beans.SQLBaseDO `orm:",inherit"`
// 关联信息
PlatformId int64 `orm:"platform_id" json:"platformId" description:"平台ID"`
InterfaceId int64 `orm:"interface_id" json:"interfaceId" description:"接口ID"`
RequestId string `orm:"request_id" json:"requestId" description:"请求ID"`
// 执行状态
Status consts.FetchStatus `orm:"status" json:"status" description:"执行状态pending/running/success/failed/rate_limit"`
StartTime int64 `orm:"start_time" json:"startTime" description:"开始时间(时间戳)"`
EndTime int64 `orm:"end_time" json:"endTime" description:"结束时间(时间戳)"`
Duration int `orm:"duration" json:"duration" description:"执行时长(毫秒)"`
// 请求响应数据
RequestConfig map[string]interface{} `orm:"request_config" json:"requestConfig" description:"请求配置参数"`
ResponseData string `orm:"response_data" json:"responseData" description:"响应数据JSON"`
ErrorMessage string `orm:"error_message" json:"errorMessage" description:"错误信息"`
// 重试信息
RetryCount int `orm:"retry_count" json:"retryCount" description:"重试次数"`
}
// DataFetchLogCol 数据获取日志表字段定义
type DataFetchLogCol struct {
beans.SQLBaseCol
PlatformId string
InterfaceId string
RequestId string
Status string
StartTime string
EndTime string
Duration string
RequestConfig string
ResponseData string
ErrorMessage string
RetryCount string
}
// DataFetchLogCols 数据获取日志表字段常量
var DataFetchLogCols = DataFetchLogCol{
SQLBaseCol: beans.DefSQLBaseCol,
PlatformId: "platform_id",
InterfaceId: "interface_id",
RequestId: "request_id",
Status: "status",
StartTime: "start_time",
EndTime: "end_time",
Duration: "duration",
RequestConfig: "request_config",
ResponseData: "response_data",
ErrorMessage: "error_message",
RetryCount: "retry_count",
}

View File

@@ -0,0 +1,46 @@
package data
import (
consts "cid/consts/data"
"gitea.com/red-future/common/beans"
)
// Platform 平台管理实体
type Platform struct {
beans.SQLBaseDO `orm:",inherit"`
// 基础信息
Name string `orm:"name" json:"name" description:"平台名称"`
Type consts.SyncPlatform `orm:"type" json:"type" description:"平台类型"`
Status consts.PlatformStatus `orm:"status" json:"status" description:"平台状态active启用/inactive停用"`
Description string `orm:"description" json:"description" description:"平台描述"`
// 认证配置 (JSONB)
AuthConfig map[string]interface{} `orm:"auth_config" json:"authConfig" description:"认证配置"`
// 限流配置 (JSONB)
LimitConfig map[string]interface{} `orm:"limit_config" json:"limitConfig" description:"限流配置"`
// 平台专用配置 (JSONB)
PlatformConfig map[string]interface{} `orm:"platform_config" json:"platformConfig" description:"平台专用配置"`
}
// PlatformCol 平台表字段定义
type PlatformCol struct {
beans.SQLBaseCol
Name string
Type string
Status string
Description string
AuthConfig string
LimitConfig string
PlatformConfig string
}
// PlatformCols 平台表字段常量
var PlatformCols = PlatformCol{
SQLBaseCol: beans.DefSQLBaseCol,
Name: "name",
Type: "type",
Status: "status",
Description: "description",
AuthConfig: "auth_config",
LimitConfig: "limit_config",
PlatformConfig: "platform_config",
}

View File

@@ -0,0 +1,52 @@
package mapping
import (
"cid/consts/mapping"
"gitea.com/red-future/common/beans"
)
// DataMapping 数据映射实体
type DataMapping struct {
beans.SQLBaseDO `orm:",inherit"`
// 关联信息
PlatformId int64 `orm:"platform_id" json:"platformId" description:"平台ID"`
InterfaceId int64 `orm:"interface_id" json:"interfaceId" description:"接口ID"`
// 映射规则
SourceField string `orm:"source_field" json:"sourceField" description:"源字段(接口返回字段)"`
TargetField string `orm:"target_field" json:"targetField" description:"目标字段(本地表字段)"`
FieldType string `orm:"field_type" json:"fieldType" description:"字段类型string/int/float/bool/array/object"`
DefaultValue string `orm:"default_value" json:"defaultValue" description:"默认值"`
// 转换规则 (JSONB)
TransformRule map[string]interface{} `orm:"transform_rule" json:"transformRule" description:"转换规则"`
// 优先级和状态
Priority int `orm:"priority" json:"priority" description:"优先级(数字越小优先级越高)"`
Status mapping.MappingStatus `orm:"status" json:"status" description:"状态active启用/inactive停用"`
}
// DataMappingCol 数据映射表字段定义
type DataMappingCol struct {
beans.SQLBaseCol
PlatformId string
InterfaceId string
SourceField string
TargetField string
FieldType string
DefaultValue string
TransformRule string
Priority string
Status string
}
// DataMappingCols 数据映射表字段常量
var DataMappingCols = DataMappingCol{
SQLBaseCol: beans.DefSQLBaseCol,
PlatformId: "platform_id",
InterfaceId: "interface_id",
SourceField: "source_field",
TargetField: "target_field",
FieldType: "field_type",
DefaultValue: "default_value",
TransformRule: "transform_rule",
Priority: "priority",
Status: "status",
}

View File

@@ -1,71 +0,0 @@
package entity
import (
"cid/model/config"
"gitea.com/red-future/common/beans"
)
const PlatformDeliveryRuleCollection = "platform_delivery_rule"
// PlatformDeliveryRule 平台投放规则实体
type PlatformDeliveryRule struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
Status string `bson:"status" json:"status"` // 状态active、inactive、maintenance等
// 关联信息
AppID string `bson:"appId" json:"appId"` // 应用ID
PlatformID string `bson:"platformId" json:"platformId"` // 平台ID
// 规则基本信息
Name string `bson:"name" json:"name"` // 规则名称
Description string `bson:"description" json:"description"` // 规则描述
RuleType string `bson:"ruleType" json:"ruleType"` // 规则类型budget、targeting、bidding、frequency等
// 预算配置
config.BudgetConfig `bson:",inline" json:",inline"` // 内联预算配置
// 出价配置
config.BiddingConfig `bson:",inline" json:",inline"` // 内联竞价配置
// 定向配置
TargetingConfig string `bson:"targetingConfig" json:"targetingConfig"` // 定向配置JSON格式
IncludeAudience []string `bson:"includeAudience" json:"includeAudience"` // 包含受众
ExcludeAudience []string `bson:"excludeAudience" json:"excludeAudience"` // 排除受众
// 频次控制配置
config.FrequencyCapConfig `bson:",inline" json:",inline"` // 内联频次控制配置
// 创意配置
CreativeRotation string `bson:"creativeRotation" json:"creativeRotation"` // 创意轮播方式optimize、even、random
SelectedCreatives []string `bson:"selectedCreatives" json:"selectedCreatives"` // 选中的创意列表
ExcludedCreatives []string `bson:"excludedCreatives" json:"excludedCreatives"` // 排除的创意列表
// 平台特定配置
PlatformSpecific string `bson:"platformSpecific" json:"platformSpecific"` // 平台特定配置JSON格式
// 监控和告警
PerformanceThresholds string `bson:"performanceThresholds" json:"performanceThresholds"` // 性能阈值JSON格式
// 自动优化配置
IsAutoOptimize bool `bson:"isAutoOptimize" json:"isAutoOptimize"` // 是否自动优化
LastOptimizeTime int64 `bson:"lastOptimizeTime" json:"lastOptimizeTime"` // 最后优化时间
AutoOptimizeConfig string `bson:"autoOptimizeConfig" json:"autoOptimizeConfig"` // 自动优化配置JSON格式
// 执行统计
ExecutionCount int64 `bson:"executionCount" json:"executionCount"` // 执行次数
SuccessCount int64 `bson:"successCount" json:"successCount"` // 成功次数
FailureCount int64 `bson:"failureCount" json:"failureCount"` // 失败次数
LastExecutionTime int64 `bson:"lastExecutionTime" json:"lastExecutionTime"` // 最后执行时间
NextExecutionTime int64 `bson:"nextExecutionTime" json:"nextExecutionTime"` // 下次执行时间
// 执行信息
CreatedBy string `bson:"createdBy" json:"createdBy"` // 创建人
LastModifiedBy string `bson:"lastModifiedBy" json:"lastModifiedBy"` // 最后修改人
ModifiedReason string `bson:"modifiedReason" json:"modifiedReason"` // 修改原因
}
// GetCollectionName 获取集合名称
func (p *PlatformDeliveryRule) GetCollectionName() string {
return PlatformDeliveryRuleCollection
}

View File

@@ -1,28 +0,0 @@
package entity
import (
"gitea.com/red-future/common/beans"
)
const StrategyCollection = "strategy"
// Strategy 匹配策略表
type Strategy struct {
beans.MongoBaseDO `bson:",inline" json:",inline"`
Status string `bson:"status" json:"status"` // 状态active、inactive、maintenance等
// 策略基本信息
Name string `bson:"name" json:"name"` // 策略名称
Description string `bson:"description" json:"description"` // 描述
MinConversion float64 `bson:"minConversion" json:"minConversion"` // 最低转化率
MaxConversion float64 `bson:"maxConversion" json:"maxConversion"` // 最高转化率
SourceWeights string `bson:"sourceWeights" json:"sourceWeights"` // 广告源权重 (JSON格式)
MaxAdsPerReq int `bson:"maxAdsPerReq" json:"maxAdsPerReq"` // 每次请求最大广告数
MaxReqPerHour int `bson:"maxReqPerHour" json:"maxReqPerHour"` // 每小时最大请求次数
Priority int `bson:"priority" json:"priority"` // 优先级(用于策略排序)
}
// GetCollectionName 获取集合名称
func (s *Strategy) GetCollectionName() string {
return StrategyCollection
}

View File

@@ -1,68 +0,0 @@
package entity
// UnifiedTargeting 统一的定向条件
type UnifiedTargeting struct {
// 地理定向
Countries []string `bson:"countries" json:"countries"` // 国家列表
Regions []string `bson:"regions" json:"regions"` // 地区列表
Cities []string `bson:"cities" json:"cities"` // 城市列表
PostalCodes []string `bson:"postalCodes" json:"postalCodes"` // 邮政编码列表
// 人口统计定向
AgeRange *UnifiedAgeRange `bson:"ageRange" json:"ageRange"` // 年龄范围
Gender []string `bson:"gender" json:"gender"` // 性别
Income []string `bson:"income" json:"income"` // 收入水平
Education []string `bson:"education" json:"education"` // 教育程度
Occupation []string `bson:"occupation" json:"occupation"` // 职业类型
// 兴趣定向
Interests []string `bson:"interests" json:"interests"` // 兴趣标签
Lifestyle []string `bson:"lifestyle" json:"lifestyle"` // 生活方式
// 行为定向
SearchHistory []string `bson:"searchHistory" json:"searchHistory"` // 搜索历史
BrowseHistory []string `bson:"browseHistory" json:"browseHistory"` // 浏览历史
PurchaseHistory []string `bson:"purchaseHistory" json:"purchaseHistory"` // 购买历史
AdInteractions []string `bson:"adInteractions" json:"adInteractions"` // 广告互动
Behaviors []string `bson:"behaviors" json:"behaviors"` // 行为标签
Segments []string `bson:"segments" json:"segments"` // 用户分群
// 上下文定向
Categories []string `bson:"categories" json:"categories"` // 内容分类
Keywords []string `bson:"keywords" json:"keywords"` // 关键词
Tags []string `bson:"tags" json:"tags"` // 标签
Sentiment string `bson:"sentiment" json:"sentiment"` // 情感倾向
ContentType string `bson:"contentType" json:"contentType"` // 内容类型
ContentRating string `bson:"contentRating" json:"contentRating"` // 内容评级
// 设备定向
DeviceTypes []string `bson:"deviceTypes" json:"deviceTypes"` // 设备类型
OS []string `bson:"os" json:"os"` // 操作系统
Browsers []string `bson:"browsers" json:"browsers"` // 浏览器
Carriers []string `bson:"carriers" json:"carriers"` // 运营商
ConnectionTypes []string `bson:"connectionTypes" json:"connectionTypes"` // 连接类型
// 时间定向
TimeSlots []UnifiedTimeSlot `bson:"timeSlots" json:"timeSlots"` // 时间段
DaysOfWeek []int `bson:"daysOfWeek" json:"daysOfWeek"` // 星期几
Dates []string `bson:"dates" json:"dates"` // 日期范围
Timezone string `bson:"timezone" json:"timezone"` // 时区
ExcludeHolidays bool `bson:"excludeHolidays" json:"excludeHolidays"` // 排除节假日
// 扩展定向条件
CustomTargeting map[string]interface{} `bson:"customTargeting" json:"customTargeting"` // 自定义定向
}
// UnifiedAgeRange 统一的年龄范围
type UnifiedAgeRange struct {
Min int `bson:"min" json:"min"` // 最小年龄
Max int `bson:"max" json:"max"` // 最大年龄
}
// UnifiedTimeSlot 统一的时间段
type UnifiedTimeSlot 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
Timezone string `bson:"timezone" json:"timezone"` // 时区
}