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

fix:兼容喵崽(有狗,我不说是谁)

This commit is contained in:
ctrlcvs 2023-06-01 21:58:24 +08:00
parent 36a6eb1f28
commit 33ee4fd09e
2 changed files with 39 additions and 20 deletions

View File

@ -202,9 +202,7 @@ export default class mysTopLogin {
order["pay_type"] = iswx order["pay_type"] = iswx
order["pay_vendor"] = iswx order["pay_vendor"] = iswx
} }
console.log(order)
let res = await this.user.getData('createOrder', { order, headers: { "x-rpc-device_id": device_id } }) let res = await this.user.getData('createOrder', { order, headers: { "x-rpc-device_id": device_id } })
console.log(res)
if (!res) return false; if (!res) return false;
if (res?.code != 200 && res?.retcode != 0) { if (res?.code != 200 && res?.retcode != 0) {
this.e.reply('生成充值订单失败:' + res.message) this.e.reply('生成充值订单失败:' + res.message)

View File

@ -60,7 +60,7 @@ export default class user {
for (let item of resSign?.upData) { for (let item of resSign?.upData) {
let num = lodash.random(0, 9999); let num = lodash.random(0, 9999);
item.upName = item.upName == "原神" ? "ys" : item.upName == "崩坏3" ? "bh3" : item.upName == item.upName = item.upName == "原神" ? "ys" : item.upName == "崩坏3" ? "bh3" : item.upName ==
"崩坏2" ? "bh2" : item.upName == "未定事件簿" ? "wdy" : item.upName "崩坏2" ? "bh2" : item.upName == "未定事件簿" ? "wdy" : item.upName
sumData[item.upName + "" + num] = { sumData[item.upName + "" + num] = {
"uid": item.game_uid, "uid": item.game_uid,
"游戏昵称": item.nickname, "游戏昵称": item.nickname,
@ -369,7 +369,29 @@ export default class user {
let userIdList = []; let userIdList = [];
let dir = './data/MysCookie/' let dir = './data/MysCookie/'
if (isV3) { if (isV3) {
userIdList = (await gsCfg.getBingAllCk()).ckQQ if (!fs.existsSync(dir)) {
let NoteUser = (await import(`file://${_path}/plugins/genshin/model/mys/NoteUser.js`)).default
await NoteUser.forEach(async (user) => {
await user.eachMysUser(async (mys) => {
let { qq } = user
let { ck, ltuid, device_id } = mys
if (Object.keys(userIdList).includes(qq+'')) {
let seed_id = lodash.sample('abcdefghijklmnopqrstuvwxyz', 4).replace(/,/g, '')
userIdList[qq + seed_id] = {
qq, ck, device_id,
ltuid,
}
} else {
userIdList[qq] = {
qq, ck, device_id,
ltuid,
}
}
})
})
} else {
userIdList = (await gsCfg.getBingAllCk()).ckQQ
}
} else { } else {
userIdList = NoteCookie; userIdList = NoteCookie;
} }
@ -440,10 +462,11 @@ export default class user {
} }
} }
for (let qq of userIdkeys) { for (let qq of userIdkeys) {
let user_id = qq; let user_id = qq.replace(/\s+(?:n$)?/gi, '');
let ltuid=userIdList[qq]?.ltuid
let e = { let e = {
user_id, user_id,
qq, qq: user_id,
isTask: true, isTask: true,
uid: userIdList[qq].uid, uid: userIdList[qq].uid,
cookie: userIdList[qq].cookie || userIdList[qq].ck, cookie: userIdList[qq].cookie || userIdList[qq].ck,
@ -453,7 +476,7 @@ export default class user {
} else { } else {
e.msg = "全部" e.msg = "全部"
} }
Bot.logger.mark(`正在为qq${user_id}米社签到中...`); Bot.logger.mark(`正在为qq:${user_id},通行证id:${ltuid}米社签到中...`);
this.e = e; this.e = e;
let res = await this.multiSign(this.getDataList(e.msg)); let res = await this.multiSign(this.getDataList(e.msg));
@ -463,7 +486,7 @@ export default class user {
return; return;
} }
if (msg.includes("OK")) { if (msg.includes("OK")) {
utils.relpyPrivate(qq, msg + "\n自动签到成功"); utils.relpyPrivate(user_id, msg + "\n自动签到成功");
} }
}; };
e.reply(res.message) e.reply(res.message)
@ -710,17 +733,15 @@ export default class user {
async getCookie(e) { async getCookie(e) {
let skuid, cookie, uid let skuid, cookie, uid
if (isV3) { if (isV3) {
skuid = await gsCfg.getBingCookie(e.user_id); skuid = await gsCfg.getBingCookie(e.user_id);
cookie = skuid?.ck; cookie = skuid?.ck;
uid = skuid?.item; uid = skuid?.item;
if (!uid && e.user?.mainUid) { //获取uid为空时进行后续处理获取 (临时处理方式后续会进行解耦以避免这种情况。。待咕中.)s if (!uid && e.user) {
uid = e.user?.mainUid[e.isSr ? 'sr' : 'gs'] //由于目前只支持原神功能暂时先写死 uid = e.user.getUid('gs')
lodash.mapValues(e.user.mysUsers, function (o) { cookie = e.user.mysUser.ck
if (o.uids[e.isSr ? 'sr' : 'gs'].includes(uid)) {
cookie = o.ck
}
});
} }
// if (!uid && e.user) { //获取uid为空时进行后续处理获取 (临时处理方式后续会进行解耦以避免这种情况。。待咕中.)s
// }
} else { } else {
if (NoteCookie[e.user_id]) { if (NoteCookie[e.user_id]) {
cookie = NoteCookie[e.user_id].cookie; cookie = NoteCookie[e.user_id].cookie;
@ -799,10 +820,10 @@ export default class user {
let res; let res;
if (this.e.sk) { if (this.e.sk) {
if (this.e.sk.get('stoken').includes('v2_')) { if (this.e.sk.get('stoken').includes('v2_')) {
res = await this.getData('getLtoken', {cookies: this.e.raw_message}, false) res = await this.getData('getLtoken', { cookies: this.e.raw_message }, false)
ltoken = res?.data?.ltoken ltoken = res?.data?.ltoken
} else { } else {
v2Sk = await this.getData('getByStokenV2', {headers: {Cookie: this.e.raw_message}}, false) v2Sk = await this.getData('getByStokenV2', { headers: { Cookie: this.e.raw_message } }, false)
} }
this.e.cookie = this.e.cookie =
`ltoken=${this.e.sk?.get('ltoken') || ltoken};ltuid=${this.e.sk?.get('stuid')};cookie_token=${data.data.cookie_token}; account_id=${this.e.sk?.get('stuid')};` `ltoken=${this.e.sk?.get('ltoken') || ltoken};ltuid=${this.e.sk?.get('stuid')};cookie_token=${data.data.cookie_token}; account_id=${this.e.sk?.get('stuid')};`
@ -813,8 +834,8 @@ export default class user {
} else { } else {
this.e.cookie = this.e.original_msg //发送的为cookies this.e.cookie = this.e.original_msg //发送的为cookies
this.cookies = `stuid=${this.e.stuid};stoken=${data?.data?.list[0].token};ltoken=${data?.data?.list[1].token}` this.cookies = `stuid=${this.e.stuid};stoken=${data?.data?.list[0].token};ltoken=${data?.data?.list[1].token}`
res = await this.getData('getLtoken', {cookies: this.cookies}, false) res = await this.getData('getLtoken', { cookies: this.cookies }, false)
v2Sk = await this.getData('getByStokenV2', {headers: {Cookie: this.cookies}}, false) v2Sk = await this.getData('getByStokenV2', { headers: { Cookie: this.cookies } }, false)
} }
let list = [] let list = []
for (let item of ['崩坏星穹铁道', '原神']) { for (let item of ['崩坏星穹铁道', '原神']) {