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, "") }