diff --git a/apps/mhyTopUpLogin.js b/apps/mhyTopUpLogin.js index d63c777..8551c1a 100644 --- a/apps/mhyTopUpLogin.js +++ b/apps/mhyTopUpLogin.js @@ -36,7 +36,6 @@ export const rule = { export async function payOrder(e){ - console.log(e) let Mys = new mys(e) if(/商品列表/.test(e.msg)){ return await Mys.showgoods() diff --git a/apps/user.js b/apps/user.js index 9b1b6c2..1ad39a5 100644 --- a/apps/user.js +++ b/apps/user.js @@ -252,13 +252,21 @@ export async function bindStoken(e) { await user.cookie(e) 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 }) if (!res?.data) { - await e.reply(`绑定Stoken失败,异常:${res?.message}\n请发送【stoken帮助】查看配置教程重新配置~`); - return true; + e.uid="64" + e.region = getServer(e.uid) + 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{ + await user.seachUid(res); + return true; + } } await user.getCookie(e) - e.sk = await utils.getCookieMap(msg) await user.seachUid(res); return true; } @@ -327,7 +335,9 @@ export async function updCookie(e) { e.uid = stoken[item].uid let cookies = `uid=${stoken[item].stuid}&stoken=${stoken[item].stoken}` if (stoken[item]?.mid) cookies += `&mid=${stoken[item]?.mid}` - let res = await user.getData("bbsGetCookie", { cookies: cookies }, false) + let data = { cookies: cookies } + 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 b67094f..b37c004 100644 --- a/model/mhyTopUpLogin.js +++ b/model/mhyTopUpLogin.js @@ -82,16 +82,16 @@ export default class mysTopLogin { this.aigis_captcha_data = JSON.parse(res.aigis_data.data) let vlData = await this.crack_geetest() // let validate = await this.user.getData("validate", this.aigis_captcha_data, false) - if (vlData?.geetest_validate) { + if (vlData?.data?.geetest_seccode) { Bot.logger.mark("[米哈游登录] 验证成功") } else { Bot.logger.error("[米哈游登录] 验证失败") this.e.reply('接口效验失败,请重新尝试~') return false } - let validate = vlData.geetest_validate + let validate =vlData?.data?.geetest_seccode.replace("|jordan",'') let aigis = res.aigis_data.session_id + ";" + Buffer.from(JSON.stringify({ - geetest_challenge: vlData?.geetest_challenge, + geetest_challenge: vlData?.data?.geetest_challenge, geetest_seccode: validate + "|jordan", geetest_validate: validate })).toString("base64") @@ -116,14 +116,14 @@ export default class mysTopLogin { } } async crack_geetest() { - let res = await this.user.getData("microgg", this.aigis_captcha_data, false) + let res =""; //await this.user.getData("microgg", this.aigis_captcha_data, false) Bot.logger.mark(`[米哈游登录] ${Bot.logger.blue(JSON.stringify(res))}`) - await this.e.reply(`请完成验证:${res.shorturl}`, true) + 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) try { res = await this.user.getData("microggVl", this.aigis_captcha_data, false) - if (res.geetest_validate) { + if (res?.data?.geetest_seccode) { return res } } catch (err) { diff --git a/model/mys/mihoyoApi.js b/model/mys/mihoyoApi.js index 47386c3..14bba0b 100644 --- a/model/mys/mihoyoApi.js +++ b/model/mys/mihoyoApi.js @@ -93,6 +93,10 @@ export default class miHoYoApi { } else { param.method = 'get' } + //用于处理特殊情况 + if(data.method){ + param.method=data.method + } let response = {} let start = Date.now() try { @@ -251,11 +255,11 @@ export default class miHoYoApi { }, //用于手动过验证码,账号密码登录需要 microgg: { - url: `https://s.microgg.cn/gt/https://validate.microgg.cn/`, + url: `https://challenge.minigg.cn/manual/index.html`, query: `gt=${data.gt}&challenge=${data.challenge}` }, microggVl: { - url: `https://validate.microgg.cn/`, + url: `https://challenge.minigg.cn/manual/`, query: `callback=${data.challenge}` }, loginByPassword: { diff --git a/model/user.js b/model/user.js index 2b75ad8..ffd28eb 100644 --- a/model/user.js +++ b/model/user.js @@ -610,11 +610,12 @@ export default class user { bbsTask = false; } async bbsGeetest() { + if(!this.getToken) return "" try { let res = await this.getData('bbsGetCaptcha', false) // let challenge = res.data["challenge"] // await this.getData("geeType", res.data, false) - res.data.getToken=this.getToken + res.data.getToken = this.getToken res = await this.getData("validate", res.data, false) if (res?.data?.validate) { res = await this.getData("bbsCaptchaVerify", res.data, false) @@ -628,8 +629,9 @@ export default class user { return "" } async geetest(data) { + if(!this.getToken) return "" try { - data.getToken=this.getToken + data.getToken = this.getToken let res = await this.getData("validate", data, false) if (res?.data?.validate) { let validate = res?.data?.validate @@ -783,6 +785,7 @@ export default class user { if (res?.retcode != 0) { return false; } + console.log(res,this.e.sk) let uids = [] for (let s of res.data.list) { let datalist = {} @@ -809,6 +812,7 @@ export default class user { this.e.reply(msg) } } + async delSytk(path = yamlDataUrl, e, type = "stoken") { await this.getCookie(e); if (type != "stoken") {