mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2024-12-23 03:20:52 +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 sumData=await user.getCkData()
|
||||||
let week = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
|
let week = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
|
||||||
let day = moment(new Date()).format("yyyy年MM月DD日 HH:mm") + " " + week[new Date().getDay()];
|
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`, {
|
return await Common.render(`user/userInfo`, {
|
||||||
uid: e.user_id,
|
uid: e.user_id,
|
||||||
ltuid:ck.get("ltuid"),
|
ltuid:ck.get("ltuid")||e.user_id,
|
||||||
save_id:e.user_id,
|
save_id:e.user_id,
|
||||||
day,
|
day,
|
||||||
sumData
|
sumData
|
||||||
|
@ -93,6 +93,7 @@ export default class MihoYoApi {
|
|||||||
let data = this.getStoken(this.e.user_id);
|
let data = this.getStoken(this.e.user_id);
|
||||||
if (data) {
|
if (data) {
|
||||||
this.cookies = `stuid=${data.stuid};stoken=${data.stoken};ltoken=${data.ltoken};`;
|
this.cookies = `stuid=${data.stuid};stoken=${data.stoken};ltoken=${data.ltoken};`;
|
||||||
|
this.e.cookies=this.cookies
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Data.createDir("", YamlDataUrl, false);
|
Data.createDir("", YamlDataUrl, false);
|
||||||
|
@ -28,52 +28,58 @@ export default class user {
|
|||||||
let sumData={};
|
let sumData={};
|
||||||
await this.cookie(this.e)
|
await this.cookie(this.e)
|
||||||
this.miHoYoApi = new MihoYoApi(this.e);
|
this.miHoYoApi = new MihoYoApi(this.e);
|
||||||
let yunres = await promiseRetry((retry, number) => {
|
if(this.e.yuntoken){
|
||||||
return this.miHoYoApi.logyunGenshen().catch((e) => {
|
let yunres = await promiseRetry((retry, number) => {
|
||||||
return retry(e);
|
return this.miHoYoApi.logyunGenshen().catch((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,
|
|
||||||
"免费时长":yundata?.free_time?.free_time,
|
|
||||||
"总时长":yundata.total_time
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for(let name of nameData){
|
|
||||||
let resSign = await promiseRetry((retry, number) => {
|
|
||||||
return this.miHoYoApi.honkai3rdSignTask(name).catch((e) => {
|
|
||||||
return retry(e);
|
return retry(e);
|
||||||
});
|
});
|
||||||
}, RETRY_OPTIONS);
|
}, RETRY_OPTIONS);
|
||||||
if(resSign?.upData){
|
|
||||||
// console.log(resSign?.upData)
|
let yundata = yunres.data
|
||||||
for(let item of resSign?.upData){
|
if(yunres.retcode===0){
|
||||||
let num= lodash.random(0, 9999);
|
sumData["云原神"]={
|
||||||
item.upName=item.upName=="原神"?"ys":item.upName=="崩坏3"?"bh3":item.upName=="崩坏2"?"bh2":item.upName=="未定事件簿"?"wdy":""
|
"今日可获取":yundata?.coin?.coin_num,
|
||||||
sumData[item.upName+""+num]={
|
"免费时长":yundata?.free_time?.free_time,
|
||||||
"uid":item.game_uid,
|
"总时长":yundata.total_time
|
||||||
"游戏昵称":item.nickname,
|
}
|
||||||
"等级":item.level,
|
}
|
||||||
"今日签到":item.is_sign?"已签到":"未签到"
|
}
|
||||||
|
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) => {
|
||||||
|
return retry(e);
|
||||||
|
});
|
||||||
|
}, RETRY_OPTIONS);
|
||||||
|
if(resSign?.upData){
|
||||||
|
// console.log(resSign?.upData)
|
||||||
|
for(let item of resSign?.upData){
|
||||||
|
let num= lodash.random(0, 9999);
|
||||||
|
item.upName=item.upName=="原神"?"ys":item.upName=="崩坏3"?"bh3":item.upName=="崩坏2"?"bh2":item.upName=="未定事件簿"?"wdy":""
|
||||||
|
sumData[item.upName+""+num]={
|
||||||
|
"uid":item.game_uid,
|
||||||
|
"游戏昵称":item.nickname,
|
||||||
|
"等级":item.level,
|
||||||
|
"今日签到":item.is_sign?"已签到":"未签到"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sumData;
|
return sumData;
|
||||||
}
|
}
|
||||||
getCookieMap(cookie) {
|
getCookieMap(cookie) {
|
||||||
|
Loading…
Reference in New Issue
Block a user