Initial commit
This commit is contained in:
@@ -0,0 +1,142 @@
|
||||
package advertiseApi
|
||||
|
||||
import (
|
||||
"stat/api/proto"
|
||||
"stat/common/stdLog"
|
||||
"stat/common/utils"
|
||||
"stat/service/advertiseSer"
|
||||
"stat/service/opLogSer"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 广告管理
|
||||
// @Summary 广告位置列表
|
||||
// @Description 广告位置列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Security ApiKeyAuth
|
||||
// @Param param body proto.ListAdsLocReq true "参数"
|
||||
// @Success 200 {object} proto.ListAdsLocRes "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/adsLoc/list [POST]
|
||||
func ListAdsLoc(ctx *gin.Context) {
|
||||
param := proto.ListAdsLocReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := advertiseSer.ListAdsLoc(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.AddAdsLocReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/adsLoc/add [POST]
|
||||
func AddAdsLoc(ctx *gin.Context) {
|
||||
param := proto.AddAdsLocReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := advertiseSer.AddAdsLoc(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.UpdateAdsLocReq true "参数列表"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/adsLoc/update [POST]
|
||||
func UpdateAdsLoc(ctx *gin.Context) {
|
||||
param := proto.UpdateAdsLocReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
code, data, err := advertiseSer.UpdateAdsLoc(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.DelAdsLocReq true "参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Success 400 {string} string "失败"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/stat/adsLoc/del [POST]
|
||||
func DelAdsLoc(ctx *gin.Context) {
|
||||
param := proto.DelAdsLocReq{}
|
||||
if err := ctx.ShouldBindJSON(¶m); err != nil {
|
||||
stdLog.ServerJSON(ctx, stdLog.ParamError, err)
|
||||
return
|
||||
}
|
||||
|
||||
code, data, err := advertiseSer.DelAdsLoc(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)
|
||||
}
|
||||
Reference in New Issue
Block a user