扩展认证逻辑支持 API Token 和动态权限解析,更新配置结构及 Swagger 文档

This commit is contained in:
2026-01-14 16:31:58 +08:00
parent fe656fb298
commit 2ea2c93bb4
13 changed files with 634 additions and 207 deletions

View File

@@ -21,10 +21,10 @@ func NewConfigHandler() *ConfigHandler {
// @Tags Admin
// @Security AdminAuth
// @Produce json
// @Success 200 {object} config.Config
// @Success 200 {object} model.Response{data=config.Config}
// @Router /admin/config [get]
func (h *ConfigHandler) GetConfig(c *gin.Context) {
c.JSON(http.StatusOK, config.GlobalConfig)
c.JSON(http.StatusOK, model.SuccessResponse(config.GlobalConfig))
}
// UpdateConfig 更新配置
@@ -35,7 +35,7 @@ func (h *ConfigHandler) GetConfig(c *gin.Context) {
// @Accept json
// @Produce json
// @Param config body config.Config true "新配置内容"
// @Success 200 {object} model.Response
// @Success 200 {object} model.Response{data=config.Config}
// @Failure 400 {object} model.Response
// @Failure 500 {object} model.Response
// @Router /admin/config [put]
@@ -66,5 +66,5 @@ func (h *ConfigHandler) UpdateConfig(c *gin.Context) {
return
}
c.JSON(http.StatusOK, model.SuccessResponse("Config updated successfully and hot-reloaded"))
c.JSON(http.StatusOK, model.SuccessResponse(config.GlobalConfig))
}