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

修改方法名避免冲突

This commit is contained in:
ctrlcvs 2022-09-09 10:24:10 +08:00
parent c5d50a9919
commit a45c3c404e
2 changed files with 18 additions and 18 deletions

View File

@ -215,20 +215,19 @@ export async function delSign(e) {
return true;
}
export async function updCookie(e) {
let stoken=await gsCfg.getBingStoken(e.user_id);
let stoken=await gsCfg.getUserStoken(e.user_id);
if (Object.keys(stoken).length==0) {
e.reply("请先绑定stoken")
return true;
}
let stokenData=stoken[0]
let miHoYoApi = new MihoYoApi(e);
let sendMsg = [];
e._reply = e.reply;
e.reply = (msg) => {
sendMsg.push(msg)
}
for(let item of Object.keys(stokenData)){
miHoYoApi.cookies= `stuid=${stokenData[item].stuid};stoken=${stokenData[item].stoken};ltoken=${stokenData[item].ltoken};`;
for(let item of Object.keys(stoken)){
miHoYoApi.cookies= `stuid=${stoken[item].stuid};stoken=${stoken[item].stoken};ltoken=${stoken[item].ltoken};`;
let resObj = await miHoYoApi.updCookie();
if (!resObj?.data) {
e._reply(`请求异常:${resObj.message}`)

View File

@ -59,11 +59,12 @@ class GsCfg {
ckQQ
}
}
async getBingStoken(userId){
async getUserStoken(userId){
try {
return YAML.parse(
let ck=YAML.parse(
fs.readFileSync(`plugins/${plugin}/data/yaml/${userId}.yaml`, 'utf8')
)
return ck||{}
}catch (ex) {
return {}
}