mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2024-12-22 19:10:53 +08:00
修正bug
This commit is contained in:
parent
67aecf1538
commit
b5cddce1c6
10
apps/user.js
10
apps/user.js
@ -30,10 +30,16 @@ export async function userInfo(e,{render}){
|
||||
let sumData=await user.getCkData()
|
||||
let week = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
|
||||
let day = moment(new Date()).format("yyyy年MM月DD日 HH:mm") + " " + week[new Date().getDay()];
|
||||
let ck= user.getCookieMap(e.cookie);
|
||||
if(Object.keys(sumData).length==0){
|
||||
return true;
|
||||
}
|
||||
let ck="";
|
||||
if(e.cookie){
|
||||
ck= user.getCookieMap(e.cookie);
|
||||
}
|
||||
return await Common.render(`user/userInfo`, {
|
||||
uid: e.user_id,
|
||||
ltuid:ck.get("ltuid"),
|
||||
ltuid:ck.get("ltuid")||e.user_id,
|
||||
save_id:e.user_id,
|
||||
day,
|
||||
sumData
|
||||
|
@ -93,6 +93,7 @@ export default class MihoYoApi {
|
||||
let data = this.getStoken(this.e.user_id);
|
||||
if (data) {
|
||||
this.cookies = `stuid=${data.stuid};stoken=${data.stoken};ltoken=${data.ltoken};`;
|
||||
this.e.cookies=this.cookies
|
||||
}
|
||||
}
|
||||
Data.createDir("", YamlDataUrl, false);
|
||||
|
@ -28,24 +28,14 @@ export default class user {
|
||||
let sumData={};
|
||||
await this.cookie(this.e)
|
||||
this.miHoYoApi = new MihoYoApi(this.e);
|
||||
if(this.e.yuntoken){
|
||||
let yunres = await promiseRetry((retry, number) => {
|
||||
return this.miHoYoApi.logyunGenshen().catch((e) => {
|
||||
return retry(e);
|
||||
});
|
||||
}, RETRY_OPTIONS);
|
||||
let mysres = await promiseRetry((retry, number) => {
|
||||
return this.miHoYoApi.getTasksList().catch((e) => {
|
||||
return retry(e);
|
||||
});
|
||||
}, RETRY_OPTIONS);
|
||||
|
||||
let yundata = yunres.data
|
||||
if(mysres.retcode===0){
|
||||
sumData["米游社"]={
|
||||
"米游币余额":mysres.data.total_points,
|
||||
"今日剩余可获取":mysres.data.can_get_points
|
||||
}
|
||||
}
|
||||
if(yunres.retcode===0){
|
||||
sumData["云原神"]={
|
||||
"今日可获取":yundata?.coin?.coin_num,
|
||||
@ -53,6 +43,22 @@ export default class user {
|
||||
"总时长":yundata.total_time
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this.e.cookies){
|
||||
let mysres = await promiseRetry((retry, number) => {
|
||||
return this.miHoYoApi.getTasksList().catch((e) => {
|
||||
return retry(e);
|
||||
});
|
||||
}, RETRY_OPTIONS);
|
||||
if(mysres.retcode===0){
|
||||
sumData["米游社"]={
|
||||
"米游币余额":mysres.data.total_points,
|
||||
"今日剩余可获取":mysres.data.can_get_points
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(this.e.cookie){
|
||||
for(let name of nameData){
|
||||
let resSign = await promiseRetry((retry, number) => {
|
||||
return this.miHoYoApi.honkai3rdSignTask(name).catch((e) => {
|
||||
@ -73,7 +79,7 @@ export default class user {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return sumData;
|
||||
}
|
||||
getCookieMap(cookie) {
|
||||
|
Loading…
Reference in New Issue
Block a user