110 lines
3.1 KiB
Go
110 lines
3.1 KiB
Go
package web_announcement
|
|
|
|
import (
|
|
"videoweb/pub/common"
|
|
"videoweb/pub/common/srvdef"
|
|
"videoweb/web/service/srv_announcement"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// AnnouncementList
|
|
// @Tags 公告
|
|
// @Summary 公告-列表
|
|
// @Description 公告-列表
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body srv_announcement.GetAnnouncementListReq true "参数列表"
|
|
// @Success 200 {object} srv_announcement.GetAnnouncementListResp "成功"
|
|
// @Failure 400 {string} string "获取失败的返回结果"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/web/announcement/list [POST]
|
|
func AnnouncementList(c *gin.Context) {
|
|
var req srv_announcement.GetAnnouncementListReq
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
common.ServerJSON(c, srvdef.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
resp, serr := srv_announcement.GetAnnouncementList(c, &req)
|
|
if serr != nil {
|
|
common.ServerJSON(c, serr.Code, "")
|
|
return
|
|
}
|
|
common.ServerJSON(c, srvdef.Success, resp)
|
|
}
|
|
|
|
// AnnouncementAdd
|
|
// @Tags 公告
|
|
// @Summary 公告-增加
|
|
// @Description 公告-增加
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body srv_announcement.AddAnnouncementReq true "参数列表"
|
|
// @Success 200 {object} string "成功"
|
|
// @Failure 400 {string} string "获取失败的返回结果"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/web/announcement/add [POST]
|
|
func AnnouncementAdd(c *gin.Context) {
|
|
var req srv_announcement.AddAnnouncementReq
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
common.ServerJSON(c, srvdef.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
serr := srv_announcement.AddAnnouncement(c, &req)
|
|
if serr != nil {
|
|
common.ServerJSON(c, serr.Code, "")
|
|
return
|
|
}
|
|
common.ServerJSON(c, srvdef.Success, "")
|
|
}
|
|
|
|
// AnnouncementDel
|
|
// @Tags 公告
|
|
// @Summary 公告-删除
|
|
// @Description 公告-删除
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body srv_announcement.DelAnnouncementReq true "参数列表"
|
|
// @Success 200 {object} string "成功"
|
|
// @Failure 400 {string} string "获取失败的返回结果"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/web/announcement/del [POST]
|
|
func AnnouncementDel(c *gin.Context) {
|
|
var req srv_announcement.DelAnnouncementReq
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
common.ServerJSON(c, srvdef.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
serr := srv_announcement.DelAnnouncement(c, &req)
|
|
if serr != nil {
|
|
common.ServerJSON(c, serr.Code, "")
|
|
return
|
|
}
|
|
common.ServerJSON(c, srvdef.Success, "")
|
|
}
|
|
|
|
// AnnouncementUpdate
|
|
// @Tags 公告
|
|
// @Summary 公告-更新
|
|
// @Description 公告-更新
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param param body srv_announcement.UpdateAnnouncementReq true "参数列表"
|
|
// @Success 200 {object} string "成功"
|
|
// @Failure 400 {string} string "获取失败的返回结果"
|
|
// @Security ApiKeyAuth
|
|
// @Router /api/web/announcement/update [POST]
|
|
func AnnouncementUpdate(c *gin.Context) {
|
|
var req srv_announcement.UpdateAnnouncementReq
|
|
if err := c.ShouldBind(&req); err != nil {
|
|
common.ServerJSON(c, srvdef.ErrParamError, err.Error())
|
|
return
|
|
}
|
|
serr := srv_announcement.UpdateAnnouncement(c, &req)
|
|
if serr != nil {
|
|
common.ServerJSON(c, serr.Code, "")
|
|
return
|
|
}
|
|
common.ServerJSON(c, srvdef.Success, "")
|
|
}
|