Initial commit
This commit is contained in:
@@ -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(¶m); 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)
|
||||
}
|
||||
Reference in New Issue
Block a user