@@ -0,0 +1,118 @@
|
||||
package annouctrl
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/constant"
|
||||
"91porn-server/common/stderr"
|
||||
"91porn-server/models/l/operatorlgmod"
|
||||
"91porn-server/models/v/annoumod"
|
||||
"91porn-server/web/service/annouser"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// GetAnnouList doc
|
||||
// @Summary 获取公告列表
|
||||
// @Description 获取公告列表
|
||||
// @Tags annou
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Param pageNumber formData integer true "查询页码"
|
||||
// @Param pageSize formData integer true "页码大小"
|
||||
// @Success 200 {string} json "{"msg": "操作成功"}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/web/annou/list [get]
|
||||
func GetAnnouList(ctx *gin.Context) {
|
||||
req := annoumod.ListReq{}
|
||||
if err := ctx.ShouldBind(&req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
code, data := annouser.GetAnnouList(req)
|
||||
common.ServeJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// UpdateAnnou doc
|
||||
// @Summary 更新公告
|
||||
// @Description 更新公告
|
||||
// @Tags vid
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Param pageNumber formData integer true "查询页码"
|
||||
// @Param pageSize formData integer true "页码大小"
|
||||
// @Success 200 {string} json "{"msg": "操作成功"}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/web/annou/update [post]
|
||||
func UpdateAnnou(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := annoumod.EditReq{}
|
||||
if err = ctx.ShouldBind(&req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
code, data := annouser.UpdateAnnou(req)
|
||||
log, _ := json.Marshal(req)
|
||||
_ = operatorlgmod.RecordOperation(manager, constant.AdsManageAnnousList, constant.Modify, string(log), ctx.Request.URL.RequestURI())
|
||||
common.ServeJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// DeleteAnnou doc
|
||||
// @Summary 删除公告
|
||||
// @Description 删除公告
|
||||
// @Tags follow
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Param vids formData []string true "公告id数组"
|
||||
// @Success 200 {string} json "{"msg": "操作成功"}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/web/annou/del [delete]
|
||||
func DeleteAnnou(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := annoumod.DeleteReq{}
|
||||
if err = ctx.ShouldBind(&req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
code, data := annouser.DeleteAnnou(req.IDs)
|
||||
log, _ := json.Marshal(req)
|
||||
_ = operatorlgmod.RecordOperation(manager, constant.AdsManageAnnousList, constant.Delete, string(log), ctx.Request.URL.RequestURI())
|
||||
common.ServeJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// AddAnnou doc
|
||||
// @Summary 增加一条公告
|
||||
// @Description 增加一条公告
|
||||
// @Tags vid
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Param pageNumber formData integer true "查询页码"
|
||||
// @Param pageSize formData integer true "页码大小"
|
||||
// @Success 200 {string} json "{"msg": "操作成功"}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/web/annou/add [post]
|
||||
func AddAnnou(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := annoumod.AddReq{}
|
||||
if err = ctx.ShouldBind(&req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
code, data := annouser.AddAnnou(req)
|
||||
log, _ := json.Marshal(req)
|
||||
_ = operatorlgmod.RecordOperation(manager, constant.AdsManageAnnousList, constant.Add, string(log), ctx.Request.URL.RequestURI())
|
||||
common.ServeJSON(ctx, code, data)
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
package annouctrl
|
||||
|
||||
import (
|
||||
"91porn-server/common"
|
||||
"91porn-server/common/constant"
|
||||
"91porn-server/common/stderr"
|
||||
"91porn-server/models/l/operatorlgmod"
|
||||
"91porn-server/models/v/annoumod"
|
||||
"91porn-server/web/service/annouser"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// GetAnnounceList doc
|
||||
// @Summary 获取会员中心跑马灯列表
|
||||
// @Description 获取会员中心跑马灯列表
|
||||
// @Tags annou
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Param pageNumber formData integer true "查询页码"
|
||||
// @Param pageSize formData integer true "页码大小"
|
||||
// @Success 200 {string} json "{"msg": "操作成功"}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/web/announce/list [get]
|
||||
func GetAnnounceList(ctx *gin.Context) {
|
||||
req := annoumod.AnnounceInfoReq{}
|
||||
if err := ctx.ShouldBind(&req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
code, data := annouser.GetAnnounceList()
|
||||
common.ServeJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// UpdateAnnounce doc
|
||||
// @Summary 更新会员中心跑马灯
|
||||
// @Description 更新会员中心跑马灯
|
||||
// @Tags vid
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Param id formData integer true "id"
|
||||
// @Param content formData string true "内容"
|
||||
// @Success 200 {string} json "{"msg": "操作成功"}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/web/announce/update [post]
|
||||
func UpdateAnnounce(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := annoumod.EditAnnounceReq{}
|
||||
if err := ctx.ShouldBind(&req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
code, data := annouser.UpdateAnnounce(req)
|
||||
log, _ := json.Marshal(req)
|
||||
_ = operatorlgmod.RecordOperation(manager, constant.AdsManageAnnounceList, constant.Modify, string(log), ctx.Request.URL.RequestURI())
|
||||
common.ServeJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// DeleteAnnounce doc
|
||||
// @Summary 删除会员中心跑马灯
|
||||
// @Description 删除会员中心跑马灯
|
||||
// @Tags follow
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Param vids formData []string true "跑马灯id数组"
|
||||
// @Success 200 {string} json "{"msg": "操作成功"}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/web/announce/del [delete]
|
||||
func DeleteAnnounce(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := annoumod.DeleteAnnounceReq{}
|
||||
if err = ctx.ShouldBind(&req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
code, data := annouser.DeleteAnnounce(req.IDs)
|
||||
log, _ := json.Marshal(req)
|
||||
_ = operatorlgmod.RecordOperation(manager, constant.AdsManageAnnounceList, constant.Delete, string(log), ctx.Request.URL.RequestURI())
|
||||
common.ServeJSON(ctx, code, data)
|
||||
}
|
||||
|
||||
// AddAnnounce doc
|
||||
// @Summary 增加一条会员中心跑马灯
|
||||
// @Description 增加一条会员中心跑马灯
|
||||
// @Tags vid
|
||||
// @Accept mpfd,json
|
||||
// @Produce json,html
|
||||
// @Success 200 {string} json "{"msg": "操作成功"}"
|
||||
// @Failure 400 {string} json "{"msg": "操作失败"}"
|
||||
// @Router /api/web/announce/add [post]
|
||||
func AddAnnounce(ctx *gin.Context) {
|
||||
manager, err := common.GetAdminAct(ctx)
|
||||
if err != nil {
|
||||
common.ServeJSON(ctx, stderr.AdminIDErr, err.Error())
|
||||
return
|
||||
}
|
||||
req := annoumod.AddAnnounceReq{}
|
||||
if err = ctx.ShouldBind(&req); err != nil {
|
||||
common.ServeJSON(ctx, stderr.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
code := annouser.AddAnnounce(req)
|
||||
log, _ := json.Marshal(req)
|
||||
_ = operatorlgmod.RecordOperation(manager, constant.AdsManageAnnounceList, constant.Add, string(log), ctx.Request.URL.RequestURI())
|
||||
common.ServeJSON(ctx, code, nil)
|
||||
}
|
||||
Reference in New Issue
Block a user