mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 05:07:46 +00:00
feat:enka适配国际服数据
This commit is contained in:
parent
38939c366e
commit
e9d912f118
2 changed files with 23 additions and 6 deletions
|
|
@ -12,4 +12,4 @@ mysCode:
|
|||
# 自定义绑定设备下载url
|
||||
url: https://ghproxy.mihomo.me/https://raw.githubusercontent.com/forchannot/get_device_info/main/app/build/outputs/apk/debug/app-debug.apk
|
||||
# 自定义enkaApi地址
|
||||
enkaApi:
|
||||
enkaApi: https://enka.network/api/zzz/uid/
|
||||
|
|
@ -4,18 +4,35 @@ import settings from '../../lib/settings.js'
|
|||
import _ from 'lodash'
|
||||
|
||||
const config = settings.getConfig('config')
|
||||
const EnkaApi = _.get(config, 'enkaApi') || 'https://enka.network/api/zzz/uid/'
|
||||
const defConfig = settings.getdefSet('config')
|
||||
const EnkaApi = _.get(config, 'enkaApi') || _.get(defConfig, 'enkaApi')
|
||||
|
||||
export function getGameRoles(uid, region = false) {
|
||||
const _uid = String(uid)
|
||||
switch (_uid.slice(0, -8)) {
|
||||
case '10':
|
||||
return region == true ? 'prod_gf_us' : 'America' // 美服
|
||||
case '15':
|
||||
return region == true ? 'prod_gf_eu' :'Europe' // 欧服
|
||||
case '13':
|
||||
return region == true ? 'prod_gf_jp' :'Asia' // 亚服
|
||||
case '17':
|
||||
return region == true ? 'prod_gf_sg' : 'TW,HK,MO' // 港澳台服
|
||||
}
|
||||
return region == true ? 'prod_gf_cn' : '新艾利都' // 官服
|
||||
}
|
||||
|
||||
export function parsePlayerInfo(SocialDetail = {}) {
|
||||
const ProfileDetail = SocialDetail.ProfileDetail || {}
|
||||
const game_uid = ProfileDetail.Uid || SocialDetail.uid || '114514'
|
||||
return {
|
||||
game_biz: 'nap_cn',
|
||||
region: 'prod_gf_cn',
|
||||
game_uid: ProfileDetail.Uid || SocialDetail.uid || '114514',
|
||||
game_biz: String(game_uid).length < 10 ? 'nap_cn' : 'nap_global',
|
||||
region: getGameRoles(game_uid, true),
|
||||
game_uid: game_uid,
|
||||
nickname: ProfileDetail.Nickname || 'Fairy',
|
||||
level: ProfileDetail.Level || 60,
|
||||
is_chosen: true,
|
||||
region_name: '新艾利都',
|
||||
region_name: getGameRoles(game_uid, false),
|
||||
is_official: true,
|
||||
desc: SocialDetail.Desc || '',
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue