package appInfoApi import ( "stat/api/proto" "stat/common/stdLog" "stat/common/utils" "stat/service/appInfoSer" "stat/service/opLogSer" "github.com/gin-gonic/gin" ) // @Tags 落地页 // @Summary 落地页列表 // @Description 落地页列表 // @Accept json // @Produce json // @Security ApiKeyAuth // @Param param body proto.FindLandingPageReq true "参数列表" // @Success 200 {object} proto.LandingPageListRes "成功" // @Failure 400 {string} string "失败" // @Security ApiKeyAuth // @Router /api/stat/landingPage/list [POST] func ListLandingPageInfo(ctx *gin.Context) { param := proto.FindLandingPageReq{} if err := ctx.ShouldBind(¶m); err != nil { stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error()) return } code, data, err := appInfoSer.GetLandingPageList(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.AddLandingPageReq true "参数列表" // @Success 200 {string} string "成功" // @Failure 400 {string} string "失败" // @Security ApiKeyAuth // @Router /api/stat/landingPage/add [POST] func AddLandingPageInfo(ctx *gin.Context) { account, err := utils.GetAdmin(ctx) if err != nil { stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error()) return } param := proto.AddLandingPageReq{} if err := ctx.ShouldBind(¶m); err != nil { stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error()) return } code, data, err := appInfoSer.AddLandingPage(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 // @Security ApiKeyAuth // @Param param body proto.UpdateLandingPageReq true "参数列表" // @Success 200 {string} string "成功" // @Failure 400 {string} string "失败" // @Security ApiKeyAuth // @Router /api/stat/landingPage/update [POST] func UpdateLandingPageInfo(ctx *gin.Context) { account, err := utils.GetAdmin(ctx) if err != nil { stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error()) return } param := proto.UpdateLandingPageReq{} if err := ctx.ShouldBind(¶m); err != nil { stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error()) return } code, data, err := appInfoSer.UpdateLandingPage(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 // @Security ApiKeyAuth // @Param param body proto.DelLandingPageReq true "参数列表" // @Success 200 {string} string "成功" // @Failure 400 {string} string "失败" // @Security ApiKeyAuth // @Router /api/stat/landingPage/del [DELETE] func DelLandingPageInfo(ctx *gin.Context) { account, err := utils.GetAdmin(ctx) if err != nil { stdLog.ServerJSON(ctx, stdLog.NoToken, err.Error()) return } param := proto.DelLandingPageReq{} if err := ctx.ShouldBind(¶m); err != nil { stdLog.ServerJSON(ctx, stdLog.ParamError, err.Error()) return } code, data, err := appInfoSer.DelLandingPage(ctx, param) if err != nil { stdLog.ServerJSON(ctx, code, err) return } // 增加操作日志 opLogSer.AddOpLog(ctx, account, true, param) stdLog.ServerJSON(ctx, code, data) }