package versionApi import ( "stat/api/proto" "stat/common/stdLog" "stat/service/landpageSer" "github.com/gin-gonic/gin" ) // @Tags 落地页资源 // @Summary 分组分页获取落地页资源 // @Description 分组分页获取落地页资源 // @Accept json // @Produce json // @Param param body proto.LandpagePictureSearch true "参数列表" // @Success 200 {object} proto.LandpagePictureSearchResp "成功" // @Failure 400 {string} string "获取失败的返回结果" // @Security ApiKeyAuth // @Router /api/stat/web/landpage/picture/list [POST] func GetLandpagePicture(ctx *gin.Context) { var req = &proto.LandpagePictureSearch{} if err := ctx.ShouldBind(req); err != nil { stdLog.ServerJSON(ctx, stdLog.ParamError, err) return } resp, serr := landpageSer.LandpagePicture(ctx, req) if serr != nil { stdLog.ServerJSON(ctx, stdLog.Failure, serr) return } stdLog.ServerJSON(ctx, stdLog.Success, resp) } // @Tags 落地页资源 // @Summary 添加一个落地页资源 // @Description 添加一个落地页资源 // @Accept json // @Produce json // @Param param body proto.LandpagePictureAddReq true "参数列表" // @Success 200 {string} string "成功" // @Failure 400 {string} string "获取失败的返回结果" // @Security ApiKeyAuth // @Router /api/stat/web/landpage/picture/add [POST] func AddOneLandpage(ctx *gin.Context) { var req = &proto.LandpagePictureAddReq{} if err := ctx.ShouldBind(req); err != nil { stdLog.ServerJSON(ctx, stdLog.ParamError, err) return } serr := landpageSer.AddLandpagePicture(ctx, req) if serr != nil { stdLog.ServerJSON(ctx, stdLog.Failure, serr) return } stdLog.ServerJSON(ctx, stdLog.Success, "") } // @Tags 落地页资源 // @Summary 删除一个落地页资源 // @Description 删除一个落地页资源 // @Accept json // @Produce json // @Param param body proto.LandpagePictureDelReq true "参数列表" // @Failure 400 {string} string "获取失败的返回结果" // @Security ApiKeyAuth // @Router /api/stat/landpage/picture/del [POST] func DelOneLandpage(ctx *gin.Context) { var req = &proto.LandpagePictureDelReq{} if err := ctx.ShouldBind(req); err != nil { stdLog.ServerJSON(ctx, stdLog.ParamError, err) return } serr := landpageSer.DelLandpagePicture(ctx, req.Id) if serr != nil { stdLog.ServerJSON(ctx, stdLog.Failure, serr) return } stdLog.ServerJSON(ctx, stdLog.Success, "") } // @Tags 落地页资源 // @Summary 更新一个落地页资源 // @Description 更新一个落地页资源 // @Accept json // @Produce json // @Param param body proto.LandpagePictureUpdateReq true "参数列表" // @Success 200 {string} string "成功" // @Failure 400 {string} string "获取失败的返回结果" // @Security ApiKeyAuth // @Router /api/stat/landpage/picture/update [POST] func UpdateOneLandpage(ctx *gin.Context) { var req = &proto.LandpagePictureUpdateReq{} if err := ctx.ShouldBind(req); err != nil { stdLog.ServerJSON(ctx, stdLog.ParamError, nil) return } serr := landpageSer.UpdateLandpagePicture(ctx, req) if serr != nil { stdLog.ServerJSON(ctx, stdLog.Failure, serr) return } stdLog.ServerJSON(ctx, stdLog.Success, "") }