广告点击添加

This commit is contained in:
谢宇宁
2026-10-29 16:41:17 +07:00
parent 9c0695b305
commit 8be05db0e6
12 changed files with 194 additions and 4 deletions
+37
View File
@@ -0,0 +1,37 @@
package adsser
import (
"encoding/json"
"videoweb/app/service/upstream"
"github.com/gin-gonic/gin"
)
const clickPath = "/api/app/ads/click"
// ClickAppID 广告点击上报固定 appId。
const ClickAppID int64 = 12
// ClickReq 对应上游 AdsClickInfo:appId / adsId / location 均必填。
type ClickReq struct {
AppId int64 `json:"appId"`
AdsId int64 `json:"adsId"`
Location int64 `json:"location"`
}
// APIEnvelope 上游通用响应。
type APIEnvelope struct {
Code int `json:"code"`
Msg string `json:"msg"`
Tip string `json:"tip"`
Data json.RawMessage `json:"data"`
}
// Click 调用上游上报广告点击。
func Click(c *gin.Context, req ClickReq) (*APIEnvelope, error) {
var env APIEnvelope
if _, err := upstream.PostJSON(c, clickPath, req, &env); err != nil {
return nil, err
}
return &env, nil
}