mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
🎈 pref: 优化代码
This commit is contained in:
parent
25a7c39d91
commit
6f809cd6ee
@ -1380,8 +1380,8 @@ export class tools extends plugin {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 网易云登录状态
|
||||
async neteaseStatus(e, reck) {
|
||||
// 网易云登录状态
|
||||
async neteaseStatus(e, reck) {
|
||||
// 优先判断是否使用自建 API
|
||||
let autoSelectNeteaseApi
|
||||
// 判断海外
|
||||
@ -1400,7 +1400,7 @@ export class tools extends plugin {
|
||||
"Cookie": reck ? reck : this.neteaseCookie
|
||||
},
|
||||
}).then(res => {
|
||||
// logger.info('登录状态', res.data)
|
||||
logger.info('登录状态', res.data)
|
||||
const userInfo = res.data.data.profile
|
||||
if (userInfo) {
|
||||
axios.get(`${autoSelectNeteaseApi}/vip/info?uid=${userInfo.userId}`, {
|
||||
@ -1409,24 +1409,25 @@ export class tools extends plugin {
|
||||
"Cookie": reck ? reck : this.neteaseCookie
|
||||
},
|
||||
}).then(res => {
|
||||
// logger.info('vip信息', res.data)
|
||||
logger.info('vip信息', res.data)
|
||||
const vipInfo = res.data.data
|
||||
if (vipInfo.redplus.vipCode != 0) {
|
||||
const expireTime = new Date(vipInfo.redplus.expireTime);
|
||||
if (expireTime > Date.now()) {
|
||||
e.reply([segment.image(`${userInfo.avatarUrl}?param=170y170`), `网易云已登录:\n${userInfo.nickname}\n会员等级:\nSVIP${vipInfo.redplus.vipLevel}\n最高解析音质:\njymaster(超清母带)\n会员到期时间:\n${expireTime.toLocaleString()}`]);
|
||||
const checkVipStatus = (vipLevel, expireTime, nickname, avatarUrl, e) => {
|
||||
const expireDate = new Date(expireTime);
|
||||
if (expireDate > Date.now()) {
|
||||
e.reply([segment.image(`${avatarUrl}?param=170y170`), `网易云已登录:\n${nickname}\n会员等级:\n${vipLevel}\n会员到期时间:\n${expireDate.toLocaleString()}`]);
|
||||
} else {
|
||||
e.reply([segment.image(`${userInfo.avatarUrl}?param=170y170`), `网易云已登录:\n${userInfo.nickname}\n会员等级:\nVIP已过期\n最高解析音质:\standard(标准)`]);
|
||||
return false; // 返回 false 以继续检查下一个 VIP 状态
|
||||
}
|
||||
} else if (vipInfo.associator.vipCode != 0) {
|
||||
const expireTime = new Date(vipInfo.associator.expireTime);
|
||||
if (expireTime > Date.now()) {
|
||||
e.reply([segment.image(`${userInfo.avatarUrl}?param=170y170`), `网易云已登录:\n${userInfo.nickname}\n会员等级:\nVIP${vipInfo.associator.vipLevel}\n最高解析音质:\nlossless(无损)\n会员到期时间:\n${expireTime.toLocaleString()}`]);
|
||||
return true;
|
||||
};
|
||||
|
||||
if (vipInfo.redplus.vipCode != 0 && checkVipStatus(`SVIP${vipInfo.redplus.vipLevel}\n最高解析音质:\n jymaster(超清母带)`, vipInfo.redplus.expireTime, userInfo.nickname, userInfo.avatarUrl, e)) {
|
||||
// SVIP 有效,不执行后续逻辑
|
||||
} else if (vipInfo.associator.vipCode != 0 && checkVipStatus(`VIP${vipInfo.associator.vipLevel}\n最高解析音质:\n jyeffect(高清环绕音)`, vipInfo.associator.expireTime, userInfo.nickname, userInfo.avatarUrl, e)) {
|
||||
// VIP 有效,不执行后续逻辑
|
||||
} else {
|
||||
e.reply([segment.image(`${userInfo.avatarUrl}?param=170y170`), `网易云已登录:\n${userInfo.nickname}\n会员等级:\nVIP已过期\n最高解析音质:\standard(标准)`]);
|
||||
}
|
||||
} else {
|
||||
e.reply([segment.image(`${userInfo.avatarUrl}?param=170y170`), `网易云已登录:\n${userInfo.nickname}\n会员等级:\nVIP已过期\n最高解析音质:\standard(标准)`]);
|
||||
// 如果都已过期,发送 VIP 已过期信息
|
||||
e.reply([segment.image(`${userInfo.avatarUrl}?param=170y170`), `网易云已登录:\n${userInfo.nickname}\n会员等级:\nVIP已过期\n最高解析音质:\nstandard(标准)`]);
|
||||
}
|
||||
})
|
||||
// e.reply([segment.image(userInfo.avatarUrl), `网易云已登录:${userInfo.nickname}\n会员等级:\n`,segment.image(vipInfo.iconUrl)]);
|
||||
@ -1434,7 +1435,7 @@ export class tools extends plugin {
|
||||
e.reply('暂未登录,请发#网易云扫码登陆进行登陆绑定ck')
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
// 网易扫码登录
|
||||
async netease_scan(e) {
|
||||
// 优先判断是否使用自建 API
|
||||
|
Loading…
x
Reference in New Issue
Block a user