chore: fix mise envs panel

This commit is contained in:
engigu
2026-03-17 14:38:20 +08:00
parent 5310c54d47
commit 583287fb7b
5 changed files with 53 additions and 8 deletions
+21
View File
@@ -96,3 +96,24 @@ func (c *MiseController) UseGlobal(ctx *gin.Context) {
}
utils.Success(ctx, nil)
}
// UnsetGlobal 取消全局默认版本
func (c *MiseController) UnsetGlobal(ctx *gin.Context) {
var req struct {
Plugin string `json:"plugin"`
Version string `json:"version"`
}
if err := ctx.ShouldBindJSON(&req); err != nil {
utils.BadRequest(ctx, "参数错误: "+err.Error())
return
}
if req.Plugin == "" {
utils.BadRequest(ctx, "参数 plugin 不能为空")
return
}
if err := c.service.UnsetGlobal(req.Plugin, req.Version); err != nil {
utils.ServerError(ctx, "取消全局版本失败: "+err.Error())
return
}
utils.Success(ctx, nil)
}