37 lines
1.3 KiB
Go
37 lines
1.3 KiB
Go
package appconfig
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"hyapp-admin-server/internal/appctx"
|
|
"hyapp-admin-server/internal/modules/shared"
|
|
"hyapp-admin-server/internal/response"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func (h *Handler) GetRuntimeCapabilitiesConfig(c *gin.Context) {
|
|
item, err := h.service.GetRuntimeCapabilitiesConfig(appctx.FromContext(c.Request.Context()))
|
|
if err != nil {
|
|
response.ServerError(c, "获取运行能力配置失败")
|
|
return
|
|
}
|
|
response.OK(c, item)
|
|
}
|
|
|
|
func (h *Handler) UpdateRuntimeCapabilitiesConfig(c *gin.Context) {
|
|
var request runtimeCapabilitiesConfigRequest
|
|
if err := c.ShouldBindJSON(&request); err != nil {
|
|
response.BadRequest(c, "参数不正确")
|
|
return
|
|
}
|
|
item, err := h.service.UpdateRuntimeCapabilitiesConfig(appctx.FromContext(c.Request.Context()), request)
|
|
if err != nil {
|
|
response.BadRequest(c, err.Error())
|
|
return
|
|
}
|
|
// 审计只记录规范化枚举和 App 作用域;它们决定 Gateway 选用哪个榜单投影以及是否强制业务幂等键。
|
|
shared.OperationLog(c, h.audit, "update-runtime-capabilities", "admin_app_configs", "success", fmt.Sprintf("app_code=%s activity_leaderboard_scope=%s resource_equip_command_id_policy=%s", item.AppCode, item.ActivityLeaderboardScope, item.ResourceEquipCommandIDPolicy))
|
|
response.OK(c, item)
|
|
}
|