156 lines
4.3 KiB
Go
156 lines
4.3 KiB
Go
package appInfoApi
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"stat/api/proto"
|
|
"stat/common/stdLog"
|
|
"stat/common/utils"
|
|
"stat/models/landPageConfig"
|
|
"stat/service/appInfoSer"
|
|
"stat/service/opLogSer"
|
|
)
|
|
|
|
// @Tags 落地页配置
|
|
// @Summary 落地页配置列表
|
|
// @Description 落地页配置列表
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body proto.FindLandPageConfigReq true "参数列表"
|
|
// @Success 200 {object} proto.LandPageConfigListResp "成功"
|
|
// @Failure 400 {string} string "失败"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/stat/landPageConfig/list [POST]
|
|
func ListLandPageConfig(ctx *gin.Context) {
|
|
param := &proto.FindLandPageConfigReq{}
|
|
if err := ctx.ShouldBind(¶m); err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
|
return
|
|
}
|
|
code, data, err := appInfoSer.GetLandPageConfigList(ctx, param)
|
|
if err != nil {
|
|
stdLog.ServerJSON(ctx, code, err)
|
|
return
|
|
}
|
|
stdLog.ServerJSON(ctx, code, data)
|
|
}
|
|
|
|
// @Tags 落地页配置
|
|
// @Summary 添加落地页配置
|
|
// @Description 添加落地页配置
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body proto.AddLandPageConfigReq true "参数列表"
|
|
// @Success 200 {string} string "成功"
|
|
// @Failure 400 {string} string "失败"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/stat/landPageConfig/add [POST]
|
|
func AddLandPageConfig(ctx *gin.Context) {
|
|
account, err := utils.GetAdmin(ctx)
|
|
if err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
|
return
|
|
}
|
|
|
|
param := &proto.AddLandPageConfigReq{}
|
|
if err := ctx.ShouldBind(¶m); err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
|
return
|
|
}
|
|
code, data, err := appInfoSer.AddLandPageConfig(ctx, param)
|
|
if err != nil {
|
|
stdLog.ServerJSON(ctx, code, err)
|
|
return
|
|
}
|
|
// 增加操作日志
|
|
opLogSer.AddOpLog(ctx, account, true, param)
|
|
stdLog.ServerJSON(ctx, code, data)
|
|
}
|
|
|
|
// @Tags 落地页配置
|
|
// @Summary 修改落地页配置
|
|
// @Description 修改落地页配置
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body landPageConfig.LandPageConfig true "参数列表"
|
|
// @Success 200 {string} string "成功"
|
|
// @Failure 400 {string} string "失败"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/stat/landPageConfig/update [POST]
|
|
func UpdateLandPageConfig(ctx *gin.Context) {
|
|
account, err := utils.GetAdmin(ctx)
|
|
if err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
|
return
|
|
}
|
|
|
|
param := &landPageConfig.LandPageConfig{}
|
|
if err := ctx.ShouldBind(¶m); err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
|
return
|
|
}
|
|
code, data, err := appInfoSer.UpdateLandPageConfig(ctx, param)
|
|
if err != nil {
|
|
stdLog.ServerJSON(ctx, code, err)
|
|
return
|
|
}
|
|
|
|
// 增加操作日志
|
|
opLogSer.AddOpLog(ctx, account, true, param)
|
|
|
|
stdLog.ServerJSON(ctx, code, data)
|
|
}
|
|
|
|
// @Tags 落地页配置
|
|
// @Summary 删除落地页配置
|
|
// @Description 删除落地页配置
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body proto.DelLandPageConfigReq true "参数列表"
|
|
// @Success 200 {string} string "成功"
|
|
// @Failure 400 {string} string "失败"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/stat/landPageConfig/del [POST]
|
|
func DelLandPageConfig(ctx *gin.Context) {
|
|
account, err := utils.GetAdmin(ctx)
|
|
if err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error())
|
|
return
|
|
}
|
|
param := &proto.DelLandPageConfigReq{}
|
|
if err := ctx.ShouldBind(¶m); err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
|
return
|
|
}
|
|
code, data, err := appInfoSer.DelLandPageConfig(ctx, param)
|
|
if err != nil {
|
|
stdLog.ServerJSON(ctx, code, err)
|
|
return
|
|
}
|
|
// 增加操作日志
|
|
opLogSer.AddOpLog(ctx, account, true, param)
|
|
stdLog.ServerJSON(ctx, code, data)
|
|
}
|
|
|
|
// @Tags 落地页配置
|
|
// @Summary 根据类型获取落地页配置
|
|
// @Description 根据类型获取落地页配置
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body proto.GetLandPageConfigByTypeReq true "参数列表"
|
|
// @Success 200 {object} proto.LandingPageConfigList "成功"
|
|
// @Failure 400 {string} string "失败"
|
|
// @Router /api/stat/landPageConfig/getByType [POST]
|
|
func GetLandPageConfigByType(ctx *gin.Context) {
|
|
param := &proto.GetLandPageConfigByTypeReq{}
|
|
if err := ctx.ShouldBind(¶m); err != nil {
|
|
stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error())
|
|
return
|
|
}
|
|
code, data, err := appInfoSer.GetLandPageConfigByType(ctx, param)
|
|
if err != nil {
|
|
stdLog.ServerJSON(ctx, code, err)
|
|
return
|
|
}
|
|
stdLog.ServerJSON(ctx, code, data)
|
|
}
|