fix: 修复绑定ck出错问题。 (#100)

Co-authored-by: Kokomi <102026640+yoimiya-kokomi@users.noreply.github.com>
This commit is contained in:
小飞 2023-05-07 02:11:47 +08:00 committed by GitHub
parent 7f49a92665
commit f1b8466695
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 6 deletions

View File

@ -378,12 +378,26 @@ export default class MysUser extends BaseModel {
mys: 'https://api-takumi.mihoyo.com/binding/api/getUserGameRolesByCookie', mys: 'https://api-takumi.mihoyo.com/binding/api/getUserGameRolesByCookie',
hoyolab: 'https://api-os-takumi.mihoyo.com/binding/api/getUserGameRolesByCookie?game_biz=hk4e_global' hoyolab: 'https://api-os-takumi.mihoyo.com/binding/api/getUserGameRolesByCookie?game_biz=hk4e_global'
} }
let list=[];
let res = await fetch(url[serv], { method: 'get', headers: { Cookie: ck } }) let result;
if (!res.ok) return false if(serv=='mys'){
res = await res.json() for(let item of biz){
result=await fetch(url[serv]+item, { method: 'get', headers: { Cookie: ck } })
return res if(result.ok){
result=await result.json()
if(result?.data?.list.length>0){
list.push(...result.data.list)
}
}
}
if (!result?.data) result = { data: {} };
result.data.list = list
}else{
let res = await fetch(url[serv], { method: 'get', headers: { Cookie: ck } })
if (!res.ok) return false
result = await res.json()
}
return result
} }
// 获取米游社通行证id // 获取米游社通行证id