2
0
mirror of https://github.com/ctrlcvs/xiaoyao-cvs-plugin.git synced 2024-12-22 19:10:53 +08:00

修正未绑定ck时,无法刷新ck的问题

This commit is contained in:
Ctrlcvs 2022-09-07 00:13:14 +08:00
parent 57489b68c0
commit bd35367007
2 changed files with 25 additions and 21 deletions

View File

@ -120,7 +120,6 @@ export async function checkAuth (e, cfg) {
/* 检查user ck */
let isCookieUser = await MysInfo.checkUidBing(uid)
if (auth === 'cookie' && !isCookieUser) {
e.reply('尚未绑定Cookie...')
return false
}
e.selfUser = new User({ id: e.user_id, uid })

View File

@ -18,6 +18,9 @@ import {
} from "oicq";
import YAML from 'yaml'
import User from "../model/user.js"
import {
checkAuth
} from "../adapter/mys.js"
export const rule = {
userInfo: {
reg: "^#*(ck|stoken|cookie|cookies|签到)查询$",
@ -216,6 +219,8 @@ export async function delSign(e){
export async function updCookie(e) {
let user = new User(e);
await user.getCookie(e)
let userCk = (await checkAuth(e, "cookie"))
e.uid = userCk.uid
let miHoYoApi = new MihoYoApi(e);
if (!e.cookies || e.cookies.includes("undefined")) {
e.reply("请先绑定stoken")
@ -231,9 +236,9 @@ export async function updCookie(e){
e.reply = (msg) => {
sendMsg.push(msg)
}
let sk = await utils.getCookieMap(e.cookie)
let sk = await utils.getCookieMap(e.cookies)
let ck = resObj["data"]["cookie_token"];
e.msg=`ltoken=${sk.get("ltoken")};ltuid=${sk.get("ltuid")};cookie_token=${ck}; account_id=${sk.get("ltuid")};`
e.msg = `ltoken=${sk.get("ltoken")};ltuid=${sk.get("stuid")};cookie_token=${ck}; account_id=${sk.get("stuid")};`
if (isV3) {
let userck = (await import(`file:///${_path}/plugins/genshin/model/user.js`)).default
e.ck = e.msg;