diff --git a/apps/mhyTopUpLogin.js b/apps/mhyTopUpLogin.js index e938683..1c5877a 100644 --- a/apps/mhyTopUpLogin.js +++ b/apps/mhyTopUpLogin.js @@ -89,7 +89,7 @@ export async function UserPassLogin(e) { export async function bindSkCK(e, res) { e.msg = res?.stoken, e.raw_message = res?.stoken e.isPrivate = true - await bindStoken(e) + await bindStoken(e,'1') e.ck = res?.cookie, e.msg = res.cookie, e.raw_message = res.cookie; if (isV3) { let userck = (await import(`file://${_path}/plugins/genshin/model/user.js`)).default diff --git a/apps/user.js b/apps/user.js index 11b7d9b..06d36cd 100644 --- a/apps/user.js +++ b/apps/user.js @@ -242,7 +242,7 @@ export async function bindLogin_ticket(e) { return false; } -export async function bindStoken(e) { +export async function bindStoken(e, uid = '') { if (!e.isPrivate) { e.reply("请私聊发送") return true; @@ -250,23 +250,24 @@ export async function bindStoken(e) { let msg = e.msg; let user = new User(e); await user.cookie(e) + e.uid = uid || e.uid e.region = getServer(e.uid) e.cks = msg.replace(/;/g, '&').replace(/stuid/, "uid") e.sk = await utils.getCookieMap(msg) - let res = await user.getData("bbsGetCookie", { cookies: e.cks }) + let res = await user.getData("bbsGetCookie", { cookies: e.cks }, false) if (!res?.data) { - e.uid="64" + e.uid = "64" e.region = getServer(e.uid) - res = await user.getData("bbsGetCookie", { cookies: e.cks,method:'post'},false) - if(!res?.data){ + res = await user.getData("bbsGetCookie", { cookies: e.cks, method: 'post' }, false) + if (!res?.data) { await e.reply(`绑定Stoken失败,异常:${res?.message}\n请发送【stoken帮助】查看配置教程重新配置~`); return true; - }else{ + } else { await user.seachUid(res); return true; } } - await user.getCookie(e) + // await user.getCookie(e) await user.seachUid(res); return true; } @@ -278,7 +279,7 @@ export async function cloudToken(e) { e.reply(`格式支持\nai=*;ci=*;oi=*;ct=***********;si=**************;bi=***********;devId=***********`) return false; } - let msg = e.msg.replace(/dev(i|l|I|L)d/g,'devId').split("devId") + let msg = e.msg.replace(/dev(i|l|I|L)d/g, 'devId').split("devId") if (msg.length < 2) { Bot.logger.mark(`云原神绑定失败:未包含devId字段~`) return false; @@ -333,15 +334,15 @@ export async function updCookie(e) { for (let item of Object.keys(stoken)) { e.region = getServer(stoken[item].uid) e.uid = stoken[item].uid - if(!e?.uid){ + if (!e?.uid) { Bot.logger.mark(`[刷新ck][stoken读取]qq:${e?.user_id};uid:${e?.uid}`) continue; //奇怪的东西 - } + } let cookies = `uid=${stoken[item].stuid}&stoken=${stoken[item].stoken}` if (stoken[item]?.mid) cookies += `&mid=${stoken[item]?.mid}` let data = { cookies: cookies } - if(e?.uid[0]>5) data.method='post' - let res = await user.getData("bbsGetCookie",data, false) + if (e?.uid[0] > 5) data.method = 'post' + let res = await user.getData("bbsGetCookie", data, false) if (!res?.data) { e.reply(`uid:${stoken[item].uid},请求异常:${res.message}`) continue; diff --git a/model/mhyTopUpLogin.js b/model/mhyTopUpLogin.js index 64c2969..18fa6ba 100644 --- a/model/mhyTopUpLogin.js +++ b/model/mhyTopUpLogin.js @@ -26,7 +26,7 @@ export default class mysTopLogin { this.e.reply(this.sendMsgUser) let res = await this.user.getData("qrCodeLogin", { device: this.device - }) + },false) if (!res.data) { return false; } @@ -41,14 +41,14 @@ export default class mysTopLogin { await utils.sleepAsync(5000) res = await this.user.getData("qrCodeQuery", { device: this.device, ticket - }) + },false) if (res?.data?.stat == "Scanned" && RedisData.GetQrCode == 1) { - Bot.logger.mark(`[米哈游登录] ${Bot.logger.mark(JSON.stringify(res))}`) + Bot.logger.mark(JSON.stringify(res)) await this.e.reply("二维码已扫描,请确认登录", true) RedisData.GetQrCode++; } if (res?.data?.stat == "Confirmed") { - Bot.logger.mark(`[米哈游登录] ${Bot.logger.mark(JSON.stringify(res))}`) + Bot.logger.mark(JSON.stringify(res)) break } } @@ -58,8 +58,8 @@ export default class mysTopLogin { return false } let raw = JSON.parse(res?.data?.payload?.raw) - let UserData = await this.user.getData("getTokenByGameToken", raw) - let ck = await this.user.getData("getCookieAccountInfoByGameToken", raw) + let UserData = await this.user.getData("getTokenByGameToken", raw,false) + let ck = await this.user.getData("getCookieAccountInfoByGameToken", raw,false) return { cookie: `ltoken=${UserData.data?.token?.token};ltuid=${UserData.data?.user_info?.aid};cookie_token=${ck.data?.cookie_token}`, stoken: `stoken=${UserData.data?.token?.token};stuid=${UserData.data?.user_info?.aid};mid=${UserData?.data?.user_info.mid}` @@ -120,7 +120,7 @@ export default class mysTopLogin { } async crack_geetest() { let res = ""; //await this.user.getData("microgg", this.aigis_captcha_data, false) - Bot.logger.mark(`[米哈游登录] ${Bot.logger.mark(JSON.stringify(res))}`) + // Bot.logger.mark(`[米哈游登录] ${Bot.logger.mark(JSON.stringify(res))}`) await this.e.reply(`请完成验证:https://challenge.minigg.cn/manual/index.html?gt=${this.aigis_captcha_data.gt}&challenge=${this.aigis_captcha_data.challenge}`, true) for (let n = 1; n < 60; n++) { await utils.sleepAsync(5000) diff --git a/model/mys/mihoyoApi.js b/model/mys/mihoyoApi.js index c21071b..411000c 100644 --- a/model/mys/mihoyoApi.js +++ b/model/mys/mihoyoApi.js @@ -131,6 +131,7 @@ export default class miHoYoApi { return res } getUrl(type, board, data) { + // if(/qrCodeLogin|qrCodeQuery|getTokenByGameToken|getCookieAccountInfoByGameToken/.test(type)) this.isOs=false; let urlMap = { userGameInfo: { //通用查询 url: `${this.apiMap.apiWeb}/binding/api/getUserGameRolesByCookie`,