功能返回,不是管理员则返回默认消息

This commit is contained in:
junleea 2025-04-06 16:02:46 +08:00
parent 925de432e7
commit f4433d8398
1 changed files with 5 additions and 1 deletions

View File

@ -107,7 +107,11 @@ func FindFuncModelByUserID(userID int) ([]dao.FunctionModel, error) {
return nil, errors.New("user not exist")
}
if user.Role != "admin" {
return nil, errors.New("user not admin,no permission")
res := dao.FindFunctionModelByUserID(1)
for i := 0; i < len(res); i++ {
res[i].Info = "" //隐藏信息
}
return res, nil
}
return dao.FindFunctionModelByUserID(userID), nil
}