forked from all_user/stat_center
- 新增 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>
107 lines
3.0 KiB
Go
107 lines
3.0 KiB
Go
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, "")
|
|
}
|