67 lines
2.1 KiB
TypeScript
67 lines
2.1 KiB
TypeScript
export type AccountBindingPlatform = 'huya' | 'douyu' | 'weibo'
|
|
export type AccountBindingQueryOwner = 'order_site' | 'live_hub'
|
|
export type AccountBindingKind = 'game_role' | 'account_authorization'
|
|
export type AccountBindingField = 'roleName' | 'roleId' | 'serverZone' | 'loginChannel'
|
|
export type AccountBindingConfirmationMode = 'customer_match' | 'platform_verified'
|
|
export type AccountBindingRebindMode = 'platform_confirm' | 'rescan_qr'
|
|
|
|
export type AccountBindingPolicy = {
|
|
platform: AccountBindingPlatform
|
|
platformLabel: string
|
|
bindingKind: AccountBindingKind
|
|
bindingRequired: boolean
|
|
requiresCustomerProfile: boolean
|
|
supportsRebind: boolean
|
|
queryOwner: AccountBindingQueryOwner
|
|
requiredFields: readonly AccountBindingField[]
|
|
confirmationMode: AccountBindingConfirmationMode
|
|
rebindMode: AccountBindingRebindMode
|
|
defaultTargetUrl: string
|
|
}
|
|
|
|
const POLICIES: Record<AccountBindingPlatform, AccountBindingPolicy> = {
|
|
huya: {
|
|
platform: 'huya',
|
|
platformLabel: '虎牙',
|
|
bindingKind: 'game_role',
|
|
bindingRequired: true,
|
|
requiresCustomerProfile: true,
|
|
supportsRebind: true,
|
|
queryOwner: 'order_site',
|
|
requiredFields: ['roleName', 'roleId', 'serverZone'],
|
|
confirmationMode: 'customer_match',
|
|
rebindMode: 'platform_confirm',
|
|
defaultTargetUrl: 'https://www.huya.com/',
|
|
},
|
|
douyu: {
|
|
platform: 'douyu',
|
|
platformLabel: '斗鱼',
|
|
bindingKind: 'game_role',
|
|
bindingRequired: true,
|
|
requiresCustomerProfile: true,
|
|
supportsRebind: true,
|
|
queryOwner: 'live_hub',
|
|
requiredFields: ['roleName', 'serverZone'],
|
|
confirmationMode: 'customer_match',
|
|
rebindMode: 'platform_confirm',
|
|
defaultTargetUrl: 'https://www.douyu.com/',
|
|
},
|
|
weibo: {
|
|
platform: 'weibo',
|
|
platformLabel: '微博',
|
|
bindingKind: 'game_role',
|
|
bindingRequired: true,
|
|
requiresCustomerProfile: false,
|
|
supportsRebind: true,
|
|
queryOwner: 'order_site',
|
|
requiredFields: ['roleName'],
|
|
confirmationMode: 'platform_verified',
|
|
rebindMode: 'rescan_qr',
|
|
defaultTargetUrl: 'https://weibo.com/',
|
|
},
|
|
}
|
|
|
|
export function getAccountBindingPolicy(platform: AccountBindingPlatform) {
|
|
return POLICIES[platform]
|
|
}
|