2
0
mirror of https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git synced 2025-01-08 22:31:10 +08:00

fix:修正由于uid问题导致扫码绑定出现的请求异常(#65)

This commit is contained in:
ctrlcvs 2023-04-15 07:11:04 +08:00
parent fdf29eddef
commit ee7d0bf5f8
4 changed files with 22 additions and 20 deletions

View File

@ -89,7 +89,7 @@ export async function UserPassLogin(e) {
export async function bindSkCK(e, res) { export async function bindSkCK(e, res) {
e.msg = res?.stoken, e.raw_message = res?.stoken e.msg = res?.stoken, e.raw_message = res?.stoken
e.isPrivate = true e.isPrivate = true
await bindStoken(e) await bindStoken(e,'1')
e.ck = res?.cookie, e.msg = res.cookie, e.raw_message = res.cookie; e.ck = res?.cookie, e.msg = res.cookie, e.raw_message = res.cookie;
if (isV3) { if (isV3) {
let userck = (await import(`file://${_path}/plugins/genshin/model/user.js`)).default let userck = (await import(`file://${_path}/plugins/genshin/model/user.js`)).default

View File

@ -242,7 +242,7 @@ export async function bindLogin_ticket(e) {
return false; return false;
} }
export async function bindStoken(e) { export async function bindStoken(e, uid = '') {
if (!e.isPrivate) { if (!e.isPrivate) {
e.reply("请私聊发送") e.reply("请私聊发送")
return true; return true;
@ -250,10 +250,11 @@ export async function bindStoken(e) {
let msg = e.msg; let msg = e.msg;
let user = new User(e); let user = new User(e);
await user.cookie(e) await user.cookie(e)
e.uid = uid || e.uid
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) 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) { if (!res?.data) {
e.uid = "64" e.uid = "64"
e.region = getServer(e.uid) e.region = getServer(e.uid)
@ -266,7 +267,7 @@ export async function bindStoken(e) {
return true; return true;
} }
} }
await user.getCookie(e) // await user.getCookie(e)
await user.seachUid(res); await user.seachUid(res);
return true; return true;
} }

View File

@ -26,7 +26,7 @@ export default class mysTopLogin {
this.e.reply(this.sendMsgUser) this.e.reply(this.sendMsgUser)
let res = await this.user.getData("qrCodeLogin", { let res = await this.user.getData("qrCodeLogin", {
device: this.device device: this.device
}) },false)
if (!res.data) { if (!res.data) {
return false; return false;
} }
@ -41,14 +41,14 @@ export default class mysTopLogin {
await utils.sleepAsync(5000) await utils.sleepAsync(5000)
res = await this.user.getData("qrCodeQuery", { res = await this.user.getData("qrCodeQuery", {
device: this.device, ticket device: this.device, ticket
}) },false)
if (res?.data?.stat == "Scanned" && RedisData.GetQrCode == 1) { 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) await this.e.reply("二维码已扫描,请确认登录", true)
RedisData.GetQrCode++; RedisData.GetQrCode++;
} }
if (res?.data?.stat == "Confirmed") { if (res?.data?.stat == "Confirmed") {
Bot.logger.mark(`[米哈游登录] ${Bot.logger.mark(JSON.stringify(res))}`) Bot.logger.mark(JSON.stringify(res))
break break
} }
} }
@ -58,8 +58,8 @@ export default class mysTopLogin {
return false return false
} }
let raw = JSON.parse(res?.data?.payload?.raw) let raw = JSON.parse(res?.data?.payload?.raw)
let UserData = await this.user.getData("getTokenByGameToken", raw) let UserData = await this.user.getData("getTokenByGameToken", raw,false)
let ck = await this.user.getData("getCookieAccountInfoByGameToken", raw) let ck = await this.user.getData("getCookieAccountInfoByGameToken", raw,false)
return { return {
cookie: `ltoken=${UserData.data?.token?.token};ltuid=${UserData.data?.user_info?.aid};cookie_token=${ck.data?.cookie_token}`, 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}` 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() { 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.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) 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)

View File

@ -131,6 +131,7 @@ export default class miHoYoApi {
return res return res
} }
getUrl(type, board, data) { getUrl(type, board, data) {
// if(/qrCodeLogin|qrCodeQuery|getTokenByGameToken|getCookieAccountInfoByGameToken/.test(type)) this.isOs=false;
let urlMap = { let urlMap = {
userGameInfo: { //通用查询 userGameInfo: { //通用查询
url: `${this.apiMap.apiWeb}/binding/api/getUserGameRolesByCookie`, url: `${this.apiMap.apiWeb}/binding/api/getUserGameRolesByCookie`,