批量优化

This commit is contained in:
hero920103 committed 2026-10-08 15:30:37 +08:00
1 parent 438145cae7
commit c925b198d1
50 files changed
+5716 -291

No files matched your search

+17
View File
@@ -26,3 +26,20 @@ func GetTenantAdminRole() (uint64, error) {
}
return role.ID, nil
}
// GetTenantUserRole 返回全局「租户用户」角色(cid=2, tenant_id=0)的 ID。
// 自助注册通过企业编码加入企业时默认绑定此角色(受限权限)。
func GetTenantUserRole() (uint64, error) {
if Orm == nil {
return 0, orm.ErrNoRows
}
var role AdminRole
if err := Orm.QueryTable(new(AdminRole)).
Filter("cid", 2).
Filter("tenant_id", 0).
Filter("name", "租户用户").
One(&role); err != nil {
return 0, err
}
return role.ID, nil
}