Initial commit

This commit is contained in:
2026-05-20 16:13:58 +08:00
commit ceffbe382e
500 changed files with 157469 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
package applicationapi
import (
"github.com/gin-gonic/gin"
"net/http"
"stat/api/proto"
"stat/common/log"
"stat/common/stdLog"
"stat/service/applicationser"
)
// @Tags 配置应用app管理
// @Summary 外部app获取统计中心配置应用app信息
// @Description 外部app获取配置应用app信息
// @Accept json
// @Produce json
// @Param param body proto.CenterApplicationReq true "参数"
// @Success 200 {object} proto.CenterApplicationRes "成功"
// @Success 400 {string} string "失败"
// @Router /api/stat/web/apps/get [POST]
func GetApplication(ctx *gin.Context) {
req := proto.CenterApplicationReq{}
if err := ctx.ShouldBindJSON(&req); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
return
}
code, data, err := applicationser.GetApplication(ctx, req)
if err != nil {
stdLog.ServerJSON(ctx, code, err)
return
}
ctx.JSON(http.StatusOK, data)
}
// @Tags 配置应用app管理
// @Summary app点击申请到统计中心redis
// @Description app点击
// @Accept json
// @Produce json
// @Param param body proto.ApplicationClickReq true "参数"
// @Success 200 {string} string "成功"
// @Success 400 {string} string "失败"
// @Router /api/stat/web/apps/click [POST]
func ApplicationClick(ctx *gin.Context) {
param := &proto.ApplicationClickReq{}
if err := ctx.ShouldBindJSON(&param); err != nil {
log.Error("ApplicationClick ShouldBindJSON", log.Any("err ", err))
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
return
}
serr := applicationser.IncApplicationClickCount(ctx, param)
if serr != nil {
log.Error("ApplicationClick", log.Any("serr", serr), log.Any("param", param))
stdLog.ServerJSON(ctx, serr.Code, serr)
return
}
stdLog.ServerJSON(ctx, stdLog.Success, nil)
}
+142
View File
@@ -0,0 +1,142 @@
package applicationapi
import (
"stat/api/proto"
"stat/common/stdLog"
"stat/common/utils"
"stat/service/applicationser"
"stat/service/opLogSer"
"github.com/gin-gonic/gin"
)
// @Tags 广告管理
// @Summary 广告位置列表
// @Description 广告位置列表
// @Accept json
// @Produce json
// @Security ApiKeyAuth
// @Param param body proto.ListAppLocReq true "参数"
// @Success 200 {object} proto.ListAppLocRes "成功"
// @Success 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/stat/appLoc/list [POST]
func ListAppLoc(ctx *gin.Context) {
param := proto.ListAppLocReq{}
if err := ctx.ShouldBindJSON(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
return
}
code, data, err := applicationser.ListAppLoc(ctx, param)
if err != nil {
stdLog.ServerJSON(ctx, code, err)
return
}
stdLog.ServerJSON(ctx, code, data)
}
// @Tags 广告管理
// @Summary 新增广告位置信息
// @Description 谷歌验证
// @Accept json
// @Produce json
// @Security ApiKeyAuth
// @Param param body proto.AddAppLocReq true "参数"
// @Success 200 {string} string "成功"
// @Success 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/stat/appLoc/add [POST]
func AddAppLoc(ctx *gin.Context) {
param := proto.AddAppLocReq{}
if err := ctx.ShouldBindJSON(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
return
}
code, data, err := applicationser.AddAppLoc(ctx, param)
if err != nil {
stdLog.ServerJSON(ctx, code, err)
return
}
account, err := utils.GetAdmin(ctx)
if err != nil {
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
return
}
// 增加操作日志
opLogSer.AddOpLog(ctx, account, true, param)
stdLog.ServerJSON(ctx, code, data)
}
// @Tags 广告管理
// @Summary 修改广告位置信息
// @Description 修改广告位置信息
// @Accept json
// @Produce json
// @Security ApiKeyAuth
// @Param param body proto.UpdateAppLocReq true "参数列表"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/stat/appLoc/update [POST]
func UpdateAppLoc(ctx *gin.Context) {
param := proto.UpdateAppLocReq{}
if err := ctx.ShouldBindJSON(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
return
}
code, data, err := applicationser.UpdateAppLoc(ctx, param)
if err != nil {
stdLog.ServerJSON(ctx, code, err)
return
}
account, err := utils.GetAdmin(ctx)
if err != nil {
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
return
}
// 增加操作日志
opLogSer.AddOpLog(ctx, account, true, param)
stdLog.ServerJSON(ctx, code, data)
}
// @Tags 广告管理
// @Summary 删除广告位置信息
// @Description 删除广告位置信息
// @Accept json
// @Produce json
// @Security ApiKeyAuth
// @Param param body proto.DelAppLocReq true "参数"
// @Success 200 {string} string "成功"
// @Success 400 {string} string "失败"
// @Security ApiKeyAuth
// @Router /api/stat/appLoc/del [POST]
func DelAppLoc(ctx *gin.Context) {
param := proto.DelAppLocReq{}
if err := ctx.ShouldBindJSON(&param); err != nil {
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
return
}
code, data, err := applicationser.DelAppLoc(ctx, param)
if err != nil {
stdLog.ServerJSON(ctx, code, err)
return
}
account, err := utils.GetAdmin(ctx)
if err != nil {
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
return
}
// 增加操作日志
opLogSer.AddOpLog(ctx, account, true, param)
stdLog.ServerJSON(ctx, code, data)
}