Files
cid/model/dto/ad_position_dto.go
2026-02-24 16:24:47 +08:00

150 lines
5.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package 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"`
}