package web_commend import ( "videoweb/pub/common" "videoweb/pub/common/srvdef" "videoweb/web/service/srv_commend" "github.com/gin-gonic/gin" ) // SearchManyCommend // @Tags 评论 // @Summary 评论列表 // @Description 评论列表 // @Accept json // @Produce json // @Param param body srv_commend.CommendSearch true "参数列表" // @Success 200 {object} srv_commend.CommendSearchResp "成功" // @Failure 400 {string} string "失败" // @Router /api/web/post/comment/list [POST] func SearchManyCommend(ctx *gin.Context) { var req = &srv_commend.CommendSearch{} if err := ctx.ShouldBind(req); err != nil { common.ServerJSON(ctx, srvdef.ErrParamError, nil) return } resp, serr := srv_commend.SearchComandList(ctx, req) if serr != nil { common.ServerJSON(ctx, serr.Code, serr.Tips) return } common.ServerJSON(ctx, srvdef.Success, resp) } type CommendDelReq struct { Id int64 `json:"id" binding:"required"` } type CommendDelIpReq struct { Ip string `json:"ip"` } // DelCommend // @Tags 评论 // @Summary 删除一个评论 // @Description 删除一个评论 // @Accept json // @Produce json // @Param param body CommendDelReq true "参数列表" // @Success 200 {string} string "成功" // @Failure 400 {string} string "获取失败的返回结果" // @Router /api/web/post/comment/del [POST] func DelCommend(ctx *gin.Context) { var req = &CommendDelReq{} if err := ctx.ShouldBind(req); err != nil { common.ServerJSON(ctx, srvdef.ErrParamError, nil) return } serr := srv_commend.DelCommend(ctx, req.Id) if serr != nil { common.ServerJSON(ctx, serr.Code, serr.Tips) return } common.ServerJSON(ctx, srvdef.Success, nil) } // DelUserCommend // @Tags 评论 // @Summary 删除一个用户所有评论 // @Description 删除一个用户所有评论 // @Accept json // @Produce json // @Param param body CommendDelIpReq true "参数列表" // @Success 200 {string} string "成功" // @Failure 400 {string} string "获取失败的返回结果" // @Router /api/web/post/comment/user/del [POST] func DelUserCommend(ctx *gin.Context) { var req = &CommendDelIpReq{} if err := ctx.ShouldBind(req); err != nil { common.ServerJSON(ctx, srvdef.ErrParamError, nil) return } serr := srv_commend.DelUserCommend(ctx, req.Ip) if serr != nil { common.ServerJSON(ctx, serr.Code, serr.Tips) return } common.ServerJSON(ctx, srvdef.Success, nil) } // ReplayPostComment // @Tags 评论 // @Summary 回复评论 // @Description 回复评论 // @Accept json // @Produce json // @Param param body srv_commend.CommendReplay true "参数列表" // @Success 200 {string} string "成功" // @Failure 400 {string} string "获取失败的返回结果" // @Router /api/web/post/comment/replay [POST] func ReplayPostComment(ctx *gin.Context) { var req = &srv_commend.CommendReplay{} if err := ctx.ShouldBind(req); err != nil { common.ServerJSON(ctx, srvdef.ErrParamError, nil) return } serr := srv_commend.AddPostComment(ctx, req) if serr != nil { common.ServerJSON(ctx, serr.Code, serr.Tips) return } common.ServerJSON(ctx, srvdef.Success, nil) } type CommendReviewBatchReq struct { Ids *[]int64 `json:"ids"` ReviewStatus int `json:"reviewStatus"` } // ReviewCommendBatch // @Tags 评论 // @Summary 批量审核评论 // @Description 批量审核评论 // @Accept json // @Produce json // @Param param body CommendReviewBatchReq true "参数列表" // @Success 200 {string} string "成功" // @Failure 400 {string} string "获取失败的返回结果" // @Security ApiKeyAuth // @Router /api/web/post/comment/reviewBatch [POST] func ReviewCommendBatch(ctx *gin.Context) { var req = &CommendReviewBatchReq{} if err := ctx.ShouldBind(req); err != nil { common.ServerJSON(ctx, srvdef.ErrParamError, nil) return } serr := srv_commend.ReviewCommendBatch(ctx, req.Ids, req.ReviewStatus) if serr != nil { common.ServerJSON(ctx, serr.Code, serr.Tips) return } common.ServerJSON(ctx, srvdef.Success, nil) } // ReviewComment // @Tags 评论 // @Summary 审核评论 // @Description 审核评论 // @Accept json // @Produce json // @Param param body srv_commend.CommendReviewReq true "参数列表" // @Success 200 {string} string "成功" // @Failure 400 {string} string "获取失败的返回结果" // @Security ApiKeyAuth // @Router /api/web/post/comment/review [POST] func ReviewComment(ctx *gin.Context) { var req = &srv_commend.CommendReviewReq{} if err := ctx.ShouldBind(req); err != nil { common.ServerJSON(ctx, srvdef.ErrParamError, nil) return } serr := srv_commend.ReviewComment(ctx, req.Id, req.ReviewStatus) if serr != nil { common.ServerJSON(ctx, serr.Code, serr.Tips) return } common.ServerJSON(ctx, srvdef.Success, nil) }