import type { UsAppMyProfileOutputDto } from '../services/usAppAuth' function isCompanyAdminProfile(profile: UsAppMyProfileOutputDto): boolean { const code = (profile.primaryRoleCode ?? '').trim().toLowerCase() if (code === 'companyadmin' || code.includes('partner')) return true const display = (profile.roleDisplay ?? '').trim().toLowerCase() if (!display) return false if (display === 'company admin') return true if (display.includes('partner admin')) return true return false } /** 平台管理员或 Company Admin(App 级联选店) */ export function isAppAdminUser(profile: UsAppMyProfileOutputDto | null | undefined): boolean { if (!profile) return false const code = (profile.primaryRoleCode ?? '').trim().toLowerCase() if (code === 'admin') return true const display = (profile.roleDisplay ?? '').trim().toLowerCase() if (!display) return isCompanyAdminProfile(profile) if (display.includes('administrator')) return true if (display.includes('super admin')) return true return isCompanyAdminProfile(profile) }