mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-08-28 15:05:01 +08:00
发布v2.15.1版本,更新内容请查看:https://github.com/bufanyun/hotgo/blob/v2.0/docs/guide-zh-CN/start-update-log.md
This commit is contained in:
@@ -96,6 +96,35 @@ func GetRoleKey(ctx context.Context) string {
|
||||
return user.RoleKey
|
||||
}
|
||||
|
||||
// GetDeptType 获取用户部门类型
|
||||
func GetDeptType(ctx context.Context) string {
|
||||
user := GetUser(ctx)
|
||||
if user == nil {
|
||||
return ""
|
||||
}
|
||||
return user.DeptType
|
||||
}
|
||||
|
||||
// IsCompanyDept 是否为公司部门
|
||||
func IsCompanyDept(ctx context.Context) bool {
|
||||
return GetDeptType(ctx) == consts.DeptTypeCompany
|
||||
}
|
||||
|
||||
// IsTenantDept 是否为租户部门
|
||||
func IsTenantDept(ctx context.Context) bool {
|
||||
return GetDeptType(ctx) == consts.DeptTypeTenant
|
||||
}
|
||||
|
||||
// IsMerchantDept 是否为商户部门
|
||||
func IsMerchantDept(ctx context.Context) bool {
|
||||
return GetDeptType(ctx) == consts.DeptTypeMerchant
|
||||
}
|
||||
|
||||
// IsUserDept 是否为普通用户部门
|
||||
func IsUserDept(ctx context.Context) bool {
|
||||
return GetDeptType(ctx) == consts.DeptTypeUser
|
||||
}
|
||||
|
||||
// GetModule 获取应用模块
|
||||
func GetModule(ctx context.Context) string {
|
||||
c := Get(ctx)
|
||||
|
Reference in New Issue
Block a user