From 1cef91a741fd8665994c64333b14d7b82b0d4e0e Mon Sep 17 00:00:00 2001 From: CalciumIon <1808837298@qq.com> Date: Fri, 27 Dec 2024 21:25:44 +0800 Subject: [PATCH] fix: prevent duplicate models in user group retrieval --- controller/user.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/controller/user.go b/controller/user.go index 01f79179..b9b0393f 100644 --- a/controller/user.go +++ b/controller/user.go @@ -458,7 +458,11 @@ func GetUserModels(c *gin.Context) { groups := setting.GetUserUsableGroups(user.Group) var models []string for group := range groups { - models = append(models, model.GetGroupModels(group)...) + for _, g := range model.GetGroupModels(group) { + if !common.StringsContains(models, g) { + models = append(models, g) + } + } } c.JSON(http.StatusOK, gin.H{ "success": true,