Initial commit
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
package web_cfg
|
||||
|
||||
import (
|
||||
"videoweb/pub/common"
|
||||
"videoweb/pub/common/srvdef"
|
||||
"videoweb/web/service/srv_cfg"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 系统配置
|
||||
// @Summary 获取系统配置
|
||||
// @Description 获取系统配置
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body GetSysConfigReq true "参数列表"
|
||||
// @Success 200 {object} GetSysConfigResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/web/syscfg/get [GET]
|
||||
func GetCfg(ctx *gin.Context) {
|
||||
config, err := srv_cfg.GetSystemConfig(ctx)
|
||||
if err != nil {
|
||||
common.ServerJSON(ctx, err.Code, err.Error())
|
||||
return
|
||||
}
|
||||
resp := &GetSysConfigResp{config}
|
||||
common.ServerJSON(ctx, srvdef.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 系统配置
|
||||
// @Summary 修改系统配置
|
||||
// @Description 修改系统配置
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body SysConfigUpdateReq true "参数列表"
|
||||
// @Success 200 {object} SysConfigUpdateResp "成功"
|
||||
// @Failure 400 {string} string "获取失败的返回结果"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/web/syscfg/update [POST]
|
||||
func UpdateCfg(ctx *gin.Context) {
|
||||
var req SysConfigUpdateReq
|
||||
if err := ctx.ShouldBind(&req); err != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, err.Error())
|
||||
return
|
||||
}
|
||||
if err := srv_cfg.UpdateSystemConfig(ctx, &req.SysCfgUpdate); err != nil {
|
||||
common.ServerJSON(ctx, err.Code, err.Error())
|
||||
return
|
||||
}
|
||||
common.ServerJSON(ctx, srvdef.Success, &SysConfigUpdateResp{})
|
||||
}
|
||||
Reference in New Issue
Block a user