- 新增 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>
50 lines
1.6 KiB
Go
50 lines
1.6 KiB
Go
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, "")
|
|
}
|