知识库增加租户隔离

This commit is contained in:
2025-11-05 17:50:02 +08:00
parent b00463cb14
commit 9c67793fc3
19 changed files with 473 additions and 87 deletions
+8
View File
@@ -64,5 +64,13 @@ func JWTAuthMiddleware() web.FilterFunc {
ctx.Input.SetData("userId", claims.UserID)
ctx.Input.SetData("username", claims.Username)
ctx.Input.SetData("tenantId", claims.TenantId)
// 判断用户类型:检查userId是否在员工表中
// 如果userId在yz_tenant_employees表中存在,则为员工登录;否则为用户登录
userType := "user"
if models.IsEmployee(claims.UserID) {
userType = "employee"
}
ctx.Input.SetData("userType", userType)
}
}