Files
web_huangguo2_h5/app/service/adsser/click.go
T
2026-10-29 16:41:17 +07:00

38 lines
873 B
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 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
}