新增广告V2模块,双端下载落地页调整
- 新增 advitise v2: info/location/bind/click-stat/day-click-stat 模型与 对应的 service、api、router、proto 定义 - models/index.go 注册 5 个新模型的索引初始化 - 鉴权白名单: /rsdownload/ 改为 /download/,放行 advitise v2 的 get/click 接口 - statg/config: proxyUrl 增加 fileRes1 - common/genId: lid 生成逻辑补充 - 新增 91fans / huangguo 的 mobileconfig 描述文件 - 新增 deploy/nginx/cpcdownload.mfcg.me.conf 网关配置 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
package advitiseV2Api
|
||||
|
||||
import (
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/common/utils"
|
||||
"stat/service/advitiseV2Ser"
|
||||
"stat/service/opLogSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 广告管理V2/绑定
|
||||
// @Summary 绑定关系列表
|
||||
// @Router /api/stat/advitise/v2/bind/list [POST]
|
||||
// @Param param body proto.AdvitiseBindListReq true "参数"
|
||||
// @Success 200 {object} proto.AdvitiseBindListResp "成功"
|
||||
// @Security ApiKeyAuth
|
||||
func BindList(ctx *gin.Context) {
|
||||
req := &proto.AdvitiseBindListReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
resp, err := advitiseV2Ser.BindList(ctx, req)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 广告管理V2/绑定
|
||||
// @Summary 新增绑定
|
||||
// @Router /api/stat/advitise/v2/bind/add [POST]
|
||||
// @Param param body proto.AddAdvitiseBindReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Security ApiKeyAuth
|
||||
func BindAdd(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
req := &proto.AddAdvitiseBindReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
if err := advitiseV2Ser.BindAdd(ctx, req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
opLogSer.AddOpLog(ctx, account, true, req)
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 广告管理V2/绑定
|
||||
// @Summary 更新绑定
|
||||
// @Router /api/stat/advitise/v2/bind/update [POST]
|
||||
// @Param param body proto.UpdateAdvitiseBindReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Security ApiKeyAuth
|
||||
func BindUpdate(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
req := &proto.UpdateAdvitiseBindReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
if err := advitiseV2Ser.BindUpdate(ctx, req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
opLogSer.AddOpLog(ctx, account, true, req)
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 广告管理V2/绑定
|
||||
// @Summary 删除绑定
|
||||
// @Router /api/stat/advitise/v2/bind/del [POST]
|
||||
// @Param param body proto.DelAdvitiseBindReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Security ApiKeyAuth
|
||||
func BindDel(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
req := &proto.DelAdvitiseBindReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
if err := advitiseV2Ser.BindDel(ctx, req.Id); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
opLogSer.AddOpLog(ctx, account, true, req)
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package advitiseV2Api
|
||||
|
||||
import (
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/service/advitiseV2Ser"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 广告管理V2/外部
|
||||
// @Summary 拉广告列表(客户端)
|
||||
// @Description 按 (appId, locationId?) 返回可展示广告;结构对齐老 /ads/get(advertiseList);每条 item 多带 bindId 供点击回传
|
||||
// @Router /api/stat/advitise/v2/get [POST]
|
||||
// @Param param body proto.GetAdvitiseV2Req true "参数"
|
||||
// @Success 200 {object} proto.AdvertiseRes "成功"
|
||||
func GetAdvitises(ctx *gin.Context) {
|
||||
req := &proto.GetAdvitiseV2Req{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
resp, err := advitiseV2Ser.GetAdvitises(ctx, req)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
// 对齐老 GetAds 直接 ctx.JSON(200, data) 的行为
|
||||
ctx.JSON(200, resp)
|
||||
}
|
||||
|
||||
// @Tags 广告管理V2/外部
|
||||
// @Summary 广告点击(客户端)
|
||||
// @Description 根据 GetAds 返回的 bindId 上报点击,服务端反查 (广告, 位置) 并沿用老统计逻辑(redis 时段 hash + doc 累计)
|
||||
// @Router /api/stat/advitise/v2/click [POST]
|
||||
// @Param param body proto.ClickAdvitiseV2Req true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
func ClickAdvitise(ctx *gin.Context) {
|
||||
req := &proto.ClickAdvitiseV2Req{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
if err := advitiseV2Ser.ClickAdvitise(ctx, req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package advitiseV2Api
|
||||
|
||||
import (
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/common/utils"
|
||||
"stat/service/advitiseV2Ser"
|
||||
"stat/service/opLogSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 广告管理V2/素材
|
||||
// @Summary 素材列表
|
||||
// @Router /api/stat/advitise/v2/info/list [POST]
|
||||
// @Param param body proto.AdvitiseInfoListReq true "参数"
|
||||
// @Success 200 {object} proto.AdvitiseInfoListResp "成功"
|
||||
// @Security ApiKeyAuth
|
||||
func InfoList(ctx *gin.Context) {
|
||||
req := &proto.AdvitiseInfoListReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
resp, err := advitiseV2Ser.InfoList(ctx, req)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 广告管理V2/素材
|
||||
// @Summary 新增素材
|
||||
// @Router /api/stat/advitise/v2/info/add [POST]
|
||||
// @Param param body proto.AddAdvitiseInfoReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Security ApiKeyAuth
|
||||
func InfoAdd(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
req := &proto.AddAdvitiseInfoReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
if err := advitiseV2Ser.InfoAdd(ctx, req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
opLogSer.AddOpLog(ctx, account, true, req)
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 广告管理V2/素材
|
||||
// @Summary 更新素材
|
||||
// @Router /api/stat/advitise/v2/info/update [POST]
|
||||
// @Param param body proto.UpdateAdvitiseInfoReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Security ApiKeyAuth
|
||||
func InfoUpdate(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
req := &proto.UpdateAdvitiseInfoReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
if err := advitiseV2Ser.InfoUpdate(ctx, req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
opLogSer.AddOpLog(ctx, account, true, req)
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 广告管理V2/素材
|
||||
// @Summary 删除素材
|
||||
// @Router /api/stat/advitise/v2/info/del [POST]
|
||||
// @Param param body proto.DelAdvitiseInfoReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Security ApiKeyAuth
|
||||
func InfoDel(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
req := &proto.DelAdvitiseInfoReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
if err := advitiseV2Ser.InfoDel(ctx, req.Id); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
opLogSer.AddOpLog(ctx, account, true, req)
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package advitiseV2Api
|
||||
|
||||
import (
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/common/utils"
|
||||
"stat/service/advitiseV2Ser"
|
||||
"stat/service/opLogSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 广告管理V2/位置
|
||||
// @Summary 广告位列表
|
||||
// @Router /api/stat/advitise/v2/location/list [POST]
|
||||
// @Param param body proto.AdvitiseLocationListReq true "参数"
|
||||
// @Success 200 {object} proto.AdvitiseLocationListResp "成功"
|
||||
// @Security ApiKeyAuth
|
||||
func LocationList(ctx *gin.Context) {
|
||||
req := &proto.AdvitiseLocationListReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
resp, err := advitiseV2Ser.LocationList(ctx, req)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 广告管理V2/位置
|
||||
// @Summary 新增广告位
|
||||
// @Router /api/stat/advitise/v2/location/add [POST]
|
||||
// @Param param body proto.AddAdvitiseLocationReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Security ApiKeyAuth
|
||||
func LocationAdd(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
req := &proto.AddAdvitiseLocationReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
if err := advitiseV2Ser.LocationAdd(ctx, req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
opLogSer.AddOpLog(ctx, account, true, req)
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 广告管理V2/位置
|
||||
// @Summary 更新广告位
|
||||
// @Router /api/stat/advitise/v2/location/update [POST]
|
||||
// @Param param body proto.UpdateAdvitiseLocationReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Security ApiKeyAuth
|
||||
func LocationUpdate(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
req := &proto.UpdateAdvitiseLocationReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
if err := advitiseV2Ser.LocationUpdate(ctx, req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
opLogSer.AddOpLog(ctx, account, true, req)
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
|
||||
// @Tags 广告管理V2/位置
|
||||
// @Summary 删除广告位
|
||||
// @Router /api/stat/advitise/v2/location/del [POST]
|
||||
// @Param param body proto.DelAdvitiseLocationReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Security ApiKeyAuth
|
||||
func LocationDel(ctx *gin.Context) {
|
||||
account, err := utils.GetAdmin(ctx)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
||||
return
|
||||
}
|
||||
req := &proto.DelAdvitiseLocationReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
if err := advitiseV2Ser.LocationDel(ctx, req.Id); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
opLogSer.AddOpLog(ctx, account, true, req)
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, "")
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package advitiseV2Api
|
||||
|
||||
import (
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/service/advitiseV2Ser"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 广告管理V2/统计
|
||||
// @Summary 广告每日点击列表(汇总)
|
||||
// @Router /api/stat/advitise/v2/day/click/list [POST]
|
||||
// @Param param body proto.AdvitiseDayClickListReq true "参数"
|
||||
// @Success 200 {object} proto.AdvitiseDayClickListResp "成功"
|
||||
// @Security ApiKeyAuth
|
||||
func DayClickList(ctx *gin.Context) {
|
||||
req := &proto.AdvitiseDayClickListReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
resp, err := advitiseV2Ser.DayClickList(ctx, req)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 广告管理V2/统计
|
||||
// @Summary 广告点击详情(细维度)
|
||||
// @Router /api/stat/advitise/v2/day/click/info [POST]
|
||||
// @Param param body proto.AdvitiseClickListReq true "参数"
|
||||
// @Success 200 {object} proto.AdvitiseClickListResp "成功"
|
||||
// @Security ApiKeyAuth
|
||||
func DayClickInfo(ctx *gin.Context) {
|
||||
req := &proto.AdvitiseClickListReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
resp, err := advitiseV2Ser.ClickList(ctx, req)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 广告管理V2/统计
|
||||
// @Summary 广告细维度点击列表(广告位查看统计入口)
|
||||
// @Router /api/stat/advitise/v2/click/list [POST]
|
||||
// @Param param body proto.AdvitiseClickListReq true "参数"
|
||||
// @Success 200 {object} proto.AdvitiseClickListResp "成功"
|
||||
// @Security ApiKeyAuth
|
||||
func ClickList(ctx *gin.Context) {
|
||||
// 与 DayClickInfo 语义一致,复用同一入口
|
||||
DayClickInfo(ctx)
|
||||
}
|
||||
|
||||
// @Tags 广告管理V2/统计
|
||||
// @Summary 按时间范围汇总广告点击量(每广告一行)
|
||||
// @Router /api/stat/advitise/v2/day/click/summary [POST]
|
||||
// @Param param body proto.AdvitiseClickSummaryReq true "参数"
|
||||
// @Success 200 {object} proto.AdvitiseClickSummaryResp "成功"
|
||||
// @Security ApiKeyAuth
|
||||
func ClickSummary(ctx *gin.Context) {
|
||||
req := &proto.AdvitiseClickSummaryReq{}
|
||||
if err := ctx.ShouldBindJSON(req); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
||||
return
|
||||
}
|
||||
resp, err := advitiseV2Ser.ClickSummary(ctx, req)
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
return
|
||||
}
|
||||
stdLog.ServerJSON(ctx, stdLog.Success, resp)
|
||||
}
|
||||
+2
-1
@@ -25,9 +25,10 @@ func FileUpload(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
// 上传到桶2
|
||||
data, err := file.PutObject(ctx, statg.Conf.ProxyUrl.FileRes, &file.FileObject{
|
||||
data, err := file.PutObject(ctx, statg.Conf.ProxyUrl.FileRes1, &file.FileObject{
|
||||
File: f,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.Failure, err.Error())
|
||||
}
|
||||
|
||||
+14
-12
@@ -107,21 +107,23 @@ type AdvertiseRes struct {
|
||||
|
||||
// 外部广告信息
|
||||
type AdvertiseInfo struct {
|
||||
Id int64 `json:"id"` // 广告id
|
||||
Title string `json:"title"` // 广告标题
|
||||
CoverImg string `json:"coverImg"` // 封面
|
||||
LocId int32 `json:"locId"` // 位置id
|
||||
JumpType advertiseMod.JumpType `json:"jumpType"` // 跳转方式 0:外部浏览器跳转 1:内部浏览器跳转 2:app内部跳转
|
||||
Link string `json:"link"` // 链接地址
|
||||
Sort int64 `json:"sort"` // 排序
|
||||
Tags string `json:"tags"` // 标签
|
||||
Remark string `json:"remark"` // 备注描述
|
||||
AmbientColor string `json:"ambientColor"` // 氛围色(逼哩漫画)
|
||||
Type int // 0:系统 1:渠道
|
||||
Id int64 `json:"id"` // 广告id(V2 = advitiseId)
|
||||
Title string `json:"title"` // 广告标题
|
||||
CoverImg string `json:"coverImg"` // 封面
|
||||
LocId int32 `json:"locId"` // 位置id
|
||||
JumpType advertiseMod.JumpType `json:"jumpType"` // 跳转方式 0:外部浏览器跳转 1:内部浏览器跳转 2:app内部跳转
|
||||
Link string `json:"link"` // 链接地址
|
||||
Sort int64 `json:"sort"` // 排序
|
||||
Tags string `json:"tags"` // 标签
|
||||
Remark string `json:"remark"` // 备注描述
|
||||
AmbientColor string `json:"ambientColor"` // 氛围色(逼哩漫画)
|
||||
Type int // 0:系统 1:渠道
|
||||
BindId int64 `json:"bindId,omitempty"` // V2 点击回传凭证(老接口不填,omitempty 隐藏)
|
||||
}
|
||||
|
||||
// 广告点击请求
|
||||
type AdsClickReq struct {
|
||||
Id *int64 `from:"id" json:"id" binding:"required"` // 广告id
|
||||
Id *int64 `from:"id" json:"id" binding:"required"` // 广告id(客户端上报,可能已过期)
|
||||
AppId *int32 `from:"appId" json:"appId" binding:"required"` // 应用id
|
||||
LocId *int32 `from:"locId" json:"locId"` // 位置id(可选;传入后,Id 失效时会按 AppId+LocId 定位最新广告)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,232 @@
|
||||
package proto
|
||||
|
||||
import (
|
||||
"stat/models/advitiseBindMod"
|
||||
"stat/models/advitiseInfoMod"
|
||||
"stat/models/advitiseLocationMod"
|
||||
|
||||
"time"
|
||||
)
|
||||
|
||||
// ============ 广告素材(Info) ============
|
||||
|
||||
type AdvitiseInfoListReq struct {
|
||||
Title string `json:"title" form:"title"`
|
||||
Remark string `json:"remark" form:"remark"`
|
||||
Status *bool `json:"status" form:"status"`
|
||||
PageNum int64 `json:"pageNum" form:"pageNum" binding:"required,gte=1"`
|
||||
PageSize int64 `json:"pageSize" form:"pageSize" binding:"required,gte=1,lte=500"`
|
||||
}
|
||||
|
||||
type AdvitiseInfoListResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List advitiseInfoMod.AdvitiseInfoList `json:"list"`
|
||||
}
|
||||
|
||||
type AddAdvitiseInfoReq struct {
|
||||
Title string `json:"title" binding:"required"`
|
||||
FullScreenImgs []string `json:"fullScreenImgs"`
|
||||
Banner720300Imgs []string `json:"banner720300Imgs"`
|
||||
Banner720150Imgs []string `json:"banner720150Imgs"`
|
||||
Banner750700Imgs []string `json:"banner750700Imgs"`
|
||||
Banner800450Imgs []string `json:"banner800450Imgs"`
|
||||
PopUps600800Imgs []string `json:"popUps600800Imgs"`
|
||||
PopUps512512Imgs []string `json:"popUps512512Imgs"`
|
||||
SmallCubeImgs []string `json:"smallCubeImgs"`
|
||||
VerticalCubeImgs []string `json:"verticalCubeImgs"`
|
||||
RandomNames []string `json:"randomNames"`
|
||||
Link string `json:"link"`
|
||||
Status bool `json:"status"`
|
||||
StartTime time.Time `json:"startTime"`
|
||||
EndTime time.Time `json:"endTime"`
|
||||
Remark string `json:"remark"`
|
||||
Desc string `json:"desc"`
|
||||
}
|
||||
|
||||
type UpdateAdvitiseInfoReq struct {
|
||||
Id int64 `json:"id" binding:"required"`
|
||||
Title *string `json:"title"`
|
||||
FullScreenImgs *[]string `json:"fullScreenImgs"`
|
||||
Banner720300Imgs *[]string `json:"banner720300Imgs"`
|
||||
Banner720150Imgs *[]string `json:"banner720150Imgs"`
|
||||
Banner750700Imgs *[]string `json:"banner750700Imgs"`
|
||||
Banner800450Imgs *[]string `json:"banner800450Imgs"`
|
||||
PopUps600800Imgs *[]string `json:"popUps600800Imgs"`
|
||||
PopUps512512Imgs *[]string `json:"popUps512512Imgs"`
|
||||
SmallCubeImgs *[]string `json:"smallCubeImgs"`
|
||||
VerticalCubeImgs *[]string `json:"verticalCubeImgs"`
|
||||
RandomNames *[]string `json:"randomNames"`
|
||||
Link *string `json:"link"`
|
||||
Status *bool `json:"status"`
|
||||
StartTime *time.Time `json:"startTime"`
|
||||
EndTime *time.Time `json:"endTime"`
|
||||
Remark *string `json:"remark"`
|
||||
Desc *string `json:"desc"`
|
||||
}
|
||||
|
||||
type DelAdvitiseInfoReq struct {
|
||||
Id int64 `json:"id" binding:"required"`
|
||||
}
|
||||
|
||||
// ============ 广告位(Location) ============
|
||||
|
||||
type AdvitiseLocationListReq struct {
|
||||
AppId *int32 `json:"appId" form:"appId"`
|
||||
LocId *int32 `json:"locId" form:"locId"`
|
||||
Name string `json:"name" form:"name"`
|
||||
PageNum int64 `json:"pageNum" form:"pageNum" binding:"required,gte=1"`
|
||||
PageSize int64 `json:"pageSize" form:"pageSize" binding:"required,gte=1,lte=500"`
|
||||
}
|
||||
|
||||
type AdvitiseLocationListResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List advitiseLocationMod.AdvitiseLocationList `json:"list"`
|
||||
}
|
||||
|
||||
type AddAdvitiseLocationReq struct {
|
||||
AppId int32 `json:"appId" binding:"required"`
|
||||
LocId int32 `json:"locId" binding:"required"`
|
||||
Name string `json:"name" binding:"required"`
|
||||
AdvitiseSize advitiseLocationMod.AdvitiseSizeType `json:"advitiseSize"`
|
||||
ImgSizeDesc string `json:"imgSizeDesc"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
type UpdateAdvitiseLocationReq struct {
|
||||
Id int64 `json:"id" binding:"required"`
|
||||
AppId *int32 `json:"appId"`
|
||||
LocId *int32 `json:"locId"`
|
||||
Name *string `json:"name"`
|
||||
AdvitiseSize *advitiseLocationMod.AdvitiseSizeType `json:"advitiseSize"`
|
||||
ImgSizeDesc *string `json:"imgSizeDesc"`
|
||||
Remark *string `json:"remark"`
|
||||
}
|
||||
|
||||
type DelAdvitiseLocationReq struct {
|
||||
Id int64 `json:"id" binding:"required"`
|
||||
}
|
||||
|
||||
// ============ 广告绑定(Bind) ============
|
||||
|
||||
type AdvitiseBindListReq struct {
|
||||
AppId *int32 `json:"appId" form:"appId"`
|
||||
AdvitiseId *int64 `json:"advitiseId" form:"advitiseId"`
|
||||
LocationId *int32 `json:"locationId" form:"locationId"`
|
||||
PageNum int64 `json:"pageNum" form:"pageNum" binding:"required,gte=1"`
|
||||
PageSize int64 `json:"pageSize" form:"pageSize" binding:"required,gte=1,lte=500"`
|
||||
}
|
||||
|
||||
type AdvitiseBindListResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List advitiseBindMod.AdvitiseBindList `json:"list"`
|
||||
}
|
||||
|
||||
type AddAdvitiseBindReq struct {
|
||||
AppId int32 `json:"appId" binding:"required"`
|
||||
AdvitiseId int64 `json:"advitiseId" binding:"required"`
|
||||
LocationId []int32 `json:"locationId" binding:"required"`
|
||||
Sort int64 `json:"sort"`
|
||||
}
|
||||
|
||||
type UpdateAdvitiseBindReq struct {
|
||||
Id int64 `json:"id" binding:"required"`
|
||||
AppId *int32 `json:"appId"`
|
||||
AdvitiseId *int64 `json:"advitiseId"`
|
||||
LocationId *[]int32 `json:"locationId"`
|
||||
Sort *int64 `json:"sort"`
|
||||
}
|
||||
|
||||
type DelAdvitiseBindReq struct {
|
||||
Id int64 `json:"id" binding:"required"`
|
||||
}
|
||||
|
||||
// ============ 外部获取广告 / 点击 ============
|
||||
|
||||
// GetAdvitiseV2Req 客户端拉广告列表
|
||||
type GetAdvitiseV2Req struct {
|
||||
AppId int32 `json:"appId" binding:"required"`
|
||||
LocationId *int32 `json:"locationId"` // 可选,指定位置
|
||||
}
|
||||
|
||||
// 响应结构直接复用老 proto.AdvertiseRes (advertiseList) — V2 客户端从 item.bindId 拿点击回传凭证
|
||||
|
||||
// ClickAdvitiseV2Req 客户端点击回传
|
||||
// LocationId 必须传:细维度统计表(advitise_click_stat)按 (appId, advitiseId, locationId, day) 聚合
|
||||
type ClickAdvitiseV2Req struct {
|
||||
Id int64 `from:"id" json:"id" binding:"required"` // 广告id
|
||||
// LocationId int32 `json:"locationId" binding:"required"` // 客户端展示时选中的位置
|
||||
}
|
||||
|
||||
// ============ 统计管理 ============
|
||||
|
||||
// AdvitiseDayClickListReq 每日点击列表(汇总,来自 advitise_day_click_stat)
|
||||
type AdvitiseDayClickListReq struct {
|
||||
Id *int64 `json:"id" form:"id"` // 广告id(advitiseId)
|
||||
StatStartDate string `json:"statStartDate" form:"statStartDate"` // yyyy-MM-dd HH:mm:ss
|
||||
StatEndDate string `json:"statEndDate" form:"statEndDate"`
|
||||
PageNum int64 `json:"pageNum" form:"pageNum" binding:"required,gte=1"`
|
||||
PageSize int64 `json:"pageSize" form:"pageSize" binding:"required,gte=1,lte=500"`
|
||||
}
|
||||
|
||||
type AdvitiseDayClickItem struct {
|
||||
AdsId int64 `json:"adsId"` // 广告id (advitiseId)
|
||||
AdsName string `json:"adsName"` // 广告标题
|
||||
Clicks int64 `json:"clicks"`
|
||||
StatDate string `json:"statDate"` // yyyy-MM-dd
|
||||
}
|
||||
|
||||
type AdvitiseDayClickListResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List []*AdvitiseDayClickItem `json:"list"`
|
||||
}
|
||||
|
||||
// AdvitiseClickListReq 细维度列表(来自 advitise_click_stat)
|
||||
type AdvitiseClickListReq struct {
|
||||
AdsId *int64 `json:"adsId" form:"adsId"` // 广告id(advitiseId)
|
||||
AppId *int32 `json:"appId" form:"appId"`
|
||||
LocationId *int32 `json:"locationId" form:"locationId"`
|
||||
StatStartDate string `json:"statStartDate" form:"statStartDate"`
|
||||
StatEndDate string `json:"statEndDate" form:"statEndDate"`
|
||||
PageNum int64 `json:"pageNum" form:"pageNum" binding:"required,gte=1"`
|
||||
PageSize int64 `json:"pageSize" form:"pageSize" binding:"required,gte=1,lte=500"`
|
||||
}
|
||||
|
||||
type AdvitiseClickItem struct {
|
||||
AppId int32 `json:"appId"`
|
||||
AppName string `json:"appName"`
|
||||
AdsId int64 `json:"adsId"`
|
||||
AdsName string `json:"adsName"`
|
||||
LocationId int32 `json:"locationId"`
|
||||
LocationName string `json:"locationName"`
|
||||
Clicks int64 `json:"clicks"`
|
||||
StatDate string `json:"statDate"`
|
||||
}
|
||||
|
||||
type AdvitiseClickListResp struct {
|
||||
Total int64 `json:"total"`
|
||||
List []*AdvitiseClickItem `json:"list"`
|
||||
}
|
||||
|
||||
// AdvitiseClickSummaryReq 按时间范围汇总广告点击量,每个广告一行
|
||||
// StatStartDate/StatEndDate 至少填一个;可选 id/appId/locationId 缩窄范围
|
||||
type AdvitiseClickSummaryReq struct {
|
||||
Id *int64 `json:"id" form:"id"`
|
||||
AppId *int32 `json:"appId" form:"appId"`
|
||||
LocationId *int32 `json:"locationId" form:"locationId"`
|
||||
StatStartDate string `json:"statStartDate" form:"statStartDate"`
|
||||
StatEndDate string `json:"statEndDate" form:"statEndDate"`
|
||||
PageNum int64 `json:"pageNum" form:"pageNum" binding:"required,gte=1"`
|
||||
PageSize int64 `json:"pageSize" form:"pageSize" binding:"required,gte=1,lte=500"`
|
||||
}
|
||||
|
||||
type AdvitiseClickSummaryItem struct {
|
||||
AdsId int64 `json:"adsId"`
|
||||
AdsName string `json:"adsName"`
|
||||
TotalClicks int64 `json:"totalClicks"`
|
||||
}
|
||||
|
||||
type AdvitiseClickSummaryResp struct {
|
||||
Total int64 `json:"total"` // 匹配到的广告数
|
||||
GrandTotal int64 `json:"grandTotal"` // 时间范围内所有点击总量
|
||||
List []*AdvitiseClickSummaryItem `json:"list"`
|
||||
}
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
// @Success 200 {file} file "ios返回mobileconfig文件"
|
||||
// @Success 302 {string} string "android跳转下载地址"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Router /rsdownload/{appId}/{channel} [get]
|
||||
// @Router /download/{appId}/{channel} [get]
|
||||
func CpcDownload(ctx *gin.Context) {
|
||||
// 第一个参数 appId
|
||||
appId, err := strconv.Atoi(ctx.Param("appId"))
|
||||
|
||||
Reference in New Issue
Block a user