2
0
mirror of https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git synced 2024-12-23 11:40:51 +08:00

修正Stoken存在时无tk无法访问社区签到问题

This commit is contained in:
Ctrlcvs 2022-07-30 09:39:00 +08:00 committed by leiyilu
parent 7459b18594
commit a5c27d883a

View File

@ -50,7 +50,7 @@ export async function sign(e) {
let resultMessage=""; let resultMessage="";
let msg = e.msg.replace(/#|签到|井|米游社|mys|社区/g, ""); let msg = e.msg.replace(/#|签到|井|米游社|mys|社区/g, "");
let ForumData = await getDataList(msg); let ForumData = await getDataList(msg);
e.reply(`开始尝试${msg}社区签到`) e.reply(`开始尝试${msg}签到预计2-3分钟~`)
for (let forum of ForumData) { for (let forum of ForumData) {
resultMessage += `**${forum.name}**\n` resultMessage += `**${forum.name}**\n`
try { try {
@ -91,7 +91,7 @@ export async function mysSign(e) {
// Execute task // Execute task
let msg = e.msg.replace(/#|签到|井|米游社|mys|社区/g, ""); let msg = e.msg.replace(/#|签到|井|米游社|mys|社区/g, "");
let ForumData = await getDataList(msg); let ForumData = await getDataList(msg);
e.reply(`开始尝试${msg}社区签到`) e.reply(`开始尝试${msg}社区签到预计2-3分钟~`)
for (let forum of ForumData) { for (let forum of ForumData) {
resultMessage += `\n**${forum.name}**\n` resultMessage += `\n**${forum.name}**\n`
try { try {
@ -160,9 +160,8 @@ async function replyMsg(e,resultMessage){
async function getDataList(name){ async function getDataList(name){
let ForumData = Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/defSet/json`, "mys") let ForumData = Data.readJSON(`${_path}/plugins/xiaoyao-cvs-plugin/defSet/json`, "mys")
for(let item of ForumData){ for(let item of ForumData){
if(item.name=name){ //循环结束未找到的时候返回原数组签到全部 if(item.name==name){ //循环结束未找到的时候返回原数组签到全部
return [item] return [item]
} }
} }
@ -173,6 +172,9 @@ async function cookie(e) {
let cookie, uid; let cookie, uid;
let miHoYoApi = new MihoYoApi(e); let miHoYoApi = new MihoYoApi(e);
let skuid; let skuid;
if(Object.keys((await miHoYoApi.getStoken(e.user_id))).length != 0){
return true;
}
let cookiesDoc=await getcookiesDoc(); let cookiesDoc=await getcookiesDoc();
if (isV3) { if (isV3) {
skuid= await gsCfg.getBingCookie(e.user_id); skuid= await gsCfg.getBingCookie(e.user_id);