来源:hgdjnet-server 9bfbafe10d417deea959bd53117bc88a10e60a83 项目身份 HKDJ / JHA-216,独立官网仓库,Jenkins 守卫键 hkdjnet 测试目录 /server/hkdj_net,App/Web API 30331/30332 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
110 lines
3.1 KiB
Go
110 lines
3.1 KiB
Go
package web_announcement
|
|
|
|
import (
|
|
"hkdj-web-server/pub/common"
|
|
"hkdj-web-server/pub/common/srvdef"
|
|
"hkdj-web-server/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, "")
|
|
}
|