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

修正手动过码接口,修正国际服sk绑定逻辑以及国际服#刷新ck

This commit is contained in:
ctrlcvs 2023-02-18 00:11:15 +08:00
parent b4e01e0f35
commit 35bb322884
5 changed files with 32 additions and 15 deletions

View File

@ -36,7 +36,6 @@ export const rule = {
export async function payOrder(e){ export async function payOrder(e){
console.log(e)
let Mys = new mys(e) let Mys = new mys(e)
if(/商品列表/.test(e.msg)){ if(/商品列表/.test(e.msg)){
return await Mys.showgoods() return await Mys.showgoods()

View File

@ -252,13 +252,21 @@ export async function bindStoken(e) {
await user.cookie(e) await user.cookie(e)
e.region = getServer(e.uid) e.region = getServer(e.uid)
e.cks = msg.replace(/;/g, '&').replace(/stuid/, "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 })
if (!res?.data) {
e.uid="64"
e.region = getServer(e.uid)
res = await user.getData("bbsGetCookie", { cookies: e.cks,method:'post'},false)
if(!res?.data){ if(!res?.data){
await e.reply(`绑定Stoken失败异常${res?.message}\n请发送【stoken帮助】查看配置教程重新配置~`); await e.reply(`绑定Stoken失败异常${res?.message}\n请发送【stoken帮助】查看配置教程重新配置~`);
return true; return true;
}else{
await user.seachUid(res);
return true;
}
} }
await user.getCookie(e) await user.getCookie(e)
e.sk = await utils.getCookieMap(msg)
await user.seachUid(res); await user.seachUid(res);
return true; return true;
} }
@ -327,7 +335,9 @@ export async function updCookie(e) {
e.uid = stoken[item].uid e.uid = stoken[item].uid
let cookies = `uid=${stoken[item].stuid}&stoken=${stoken[item].stoken}` let cookies = `uid=${stoken[item].stuid}&stoken=${stoken[item].stoken}`
if (stoken[item]?.mid) cookies += `&mid=${stoken[item]?.mid}` 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) { if (!res?.data) {
e.reply(`uid:${stoken[item].uid},请求异常:${res.message}`) e.reply(`uid:${stoken[item].uid},请求异常:${res.message}`)
continue; continue;

View File

@ -82,16 +82,16 @@ export default class mysTopLogin {
this.aigis_captcha_data = JSON.parse(res.aigis_data.data) this.aigis_captcha_data = JSON.parse(res.aigis_data.data)
let vlData = await this.crack_geetest() let vlData = await this.crack_geetest()
// let validate = await this.user.getData("validate", this.aigis_captcha_data, false) // let validate = await this.user.getData("validate", this.aigis_captcha_data, false)
if (vlData?.geetest_validate) { if (vlData?.data?.geetest_seccode) {
Bot.logger.mark("[米哈游登录] 验证成功") Bot.logger.mark("[米哈游登录] 验证成功")
} else { } else {
Bot.logger.error("[米哈游登录] 验证失败") Bot.logger.error("[米哈游登录] 验证失败")
this.e.reply('接口效验失败,请重新尝试~') this.e.reply('接口效验失败,请重新尝试~')
return false 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({ 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_seccode: validate + "|jordan",
geetest_validate: validate geetest_validate: validate
})).toString("base64") })).toString("base64")
@ -116,14 +116,14 @@ export default class mysTopLogin {
} }
} }
async crack_geetest() { 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))}`) 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++) { for (let n = 1; n < 60; n++) {
await utils.sleepAsync(5000) await utils.sleepAsync(5000)
try { try {
res = await this.user.getData("microggVl", this.aigis_captcha_data, false) res = await this.user.getData("microggVl", this.aigis_captcha_data, false)
if (res.geetest_validate) { if (res?.data?.geetest_seccode) {
return res return res
} }
} catch (err) { } catch (err) {

View File

@ -93,6 +93,10 @@ export default class miHoYoApi {
} else { } else {
param.method = 'get' param.method = 'get'
} }
//用于处理特殊情况
if(data.method){
param.method=data.method
}
let response = {} let response = {}
let start = Date.now() let start = Date.now()
try { try {
@ -251,11 +255,11 @@ export default class miHoYoApi {
}, },
//用于手动过验证码,账号密码登录需要 //用于手动过验证码,账号密码登录需要
microgg: { 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}` query: `gt=${data.gt}&challenge=${data.challenge}`
}, },
microggVl: { microggVl: {
url: `https://validate.microgg.cn/`, url: `https://challenge.minigg.cn/manual/`,
query: `callback=${data.challenge}` query: `callback=${data.challenge}`
}, },
loginByPassword: { loginByPassword: {

View File

@ -610,6 +610,7 @@ export default class user {
bbsTask = false; bbsTask = false;
} }
async bbsGeetest() { async bbsGeetest() {
if(!this.getToken) return ""
try { try {
let res = await this.getData('bbsGetCaptcha', false) let res = await this.getData('bbsGetCaptcha', false)
// let challenge = res.data["challenge"] // let challenge = res.data["challenge"]
@ -628,6 +629,7 @@ export default class user {
return "" return ""
} }
async geetest(data) { async geetest(data) {
if(!this.getToken) return ""
try { try {
data.getToken = this.getToken data.getToken = this.getToken
let res = await this.getData("validate", data, false) let res = await this.getData("validate", data, false)
@ -783,6 +785,7 @@ export default class user {
if (res?.retcode != 0) { if (res?.retcode != 0) {
return false; return false;
} }
console.log(res,this.e.sk)
let uids = [] let uids = []
for (let s of res.data.list) { for (let s of res.data.list) {
let datalist = {} let datalist = {}
@ -809,6 +812,7 @@ export default class user {
this.e.reply(msg) this.e.reply(msg)
} }
} }
async delSytk(path = yamlDataUrl, e, type = "stoken") { async delSytk(path = yamlDataUrl, e, type = "stoken") {
await this.getCookie(e); await this.getCookie(e);
if (type != "stoken") { if (type != "stoken") {