mirror of
https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git
synced 2024-12-22 19:10:53 +08:00
fix:修正由于uid问题导致扫码绑定出现的请求异常(#65)
This commit is contained in:
parent
fdf29eddef
commit
ee7d0bf5f8
@ -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
|
||||||
|
25
apps/user.js
25
apps/user.js
@ -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,23 +250,24 @@ 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)
|
||||||
res = await user.getData("bbsGetCookie", { cookies: e.cks,method:'post'},false)
|
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{
|
} else {
|
||||||
await user.seachUid(res);
|
await user.seachUid(res);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await user.getCookie(e)
|
// await user.getCookie(e)
|
||||||
await user.seachUid(res);
|
await user.seachUid(res);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -278,7 +279,7 @@ export async function cloudToken(e) {
|
|||||||
e.reply(`格式支持\nai=*;ci=*;oi=*;ct=***********;si=**************;bi=***********;devId=***********`)
|
e.reply(`格式支持\nai=*;ci=*;oi=*;ct=***********;si=**************;bi=***********;devId=***********`)
|
||||||
return false;
|
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) {
|
if (msg.length < 2) {
|
||||||
Bot.logger.mark(`云原神绑定失败:未包含devId字段~`)
|
Bot.logger.mark(`云原神绑定失败:未包含devId字段~`)
|
||||||
return false;
|
return false;
|
||||||
@ -333,15 +334,15 @@ export async function updCookie(e) {
|
|||||||
for (let item of Object.keys(stoken)) {
|
for (let item of Object.keys(stoken)) {
|
||||||
e.region = getServer(stoken[item].uid)
|
e.region = getServer(stoken[item].uid)
|
||||||
e.uid = 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}`)
|
Bot.logger.mark(`[刷新ck][stoken读取]qq:${e?.user_id};uid:${e?.uid}`)
|
||||||
continue; //奇怪的东西
|
continue; //奇怪的东西
|
||||||
}
|
}
|
||||||
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 data = { cookies: cookies }
|
let data = { cookies: cookies }
|
||||||
if(e?.uid[0]>5) data.method='post'
|
if (e?.uid[0] > 5) data.method = 'post'
|
||||||
let res = await user.getData("bbsGetCookie",data, false)
|
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;
|
||||||
|
@ -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)
|
||||||
|
@ -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`,
|
||||||
|
Loading…
Reference in New Issue
Block a user