Files
web_hghl_server/web/api/web_contactus/contactus.go
T
2026-10-26 16:28:14 +08:00

82 lines
2.3 KiB
Go

package web_contactus
import (
"videoweb/pub/common"
"videoweb/pub/common/srvdef"
"videoweb/web/service/srv_contactus"
"github.com/gin-gonic/gin"
)
// @Tags 联系我们
// @Summary 联系我们列表
// @Description 联系我们列表
// @Accept json
// @Produce json
// @Param param body srv_contactus.GetContactusListReq true "参数列表"
// @Success 200 {object} srv_contactus.GetContactusListResp "成功"
// @Failure 400 {string} string "失败"
// @Router /api/web/contactus/list [POST]
func ContactusList(ctx *gin.Context) {
var req = &srv_contactus.GetContactusListReq{}
if err := ctx.ShouldBind(req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
resp, serr := srv_contactus.GetContactusList(ctx, req)
if serr != nil {
common.ServerJSON(ctx, serr.Code, serr.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, resp)
}
// @Tags 联系我们
// @Summary 删除一个联系我们
// @Description 删除一个联系我们
// @Accept json
// @Produce json
// @Param param body srv_contactus.DelOneContactusReq true "参数列表"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Router /api/web/contactus/del [POST]
func Del(ctx *gin.Context) {
var req = &srv_contactus.DelOneContactusReq{}
if err := ctx.ShouldBind(req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
serr := srv_contactus.DelContactus(ctx, req.Id)
if serr != nil {
common.ServerJSON(ctx, serr.Code, serr.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, nil)
}
// @Tags 联系我们
// @Summary 修改联系我们状态
// @Description 修改联系我们状态
// @Accept json
// @Produce json
// @Param param body srv_contactus.UpdateContactusReq true "参数列表"
// @Success 200 {string} string "成功"
// @Failure 400 {string} string "获取失败的返回结果"
// @Security ApiKeyAuth
// @Router /api/web/contactus/update [POST]
func Update(ctx *gin.Context) {
var req = &srv_contactus.UpdateContactusReq{}
if err := ctx.ShouldBind(req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
serr := srv_contactus.UpdateContactus(ctx, req.Id, req.Status)
if serr != nil {
common.ServerJSON(ctx, serr.Code, serr.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, nil)
}