mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-16 21:27:47 +00:00
fix: 部分逻辑
This commit is contained in:
parent
34cd8b15dc
commit
70836ab785
9 changed files with 204 additions and 173 deletions
|
|
@ -110,6 +110,9 @@ export default class MysZZZApi extends MysApi {
|
|||
if (this._device) {
|
||||
headers['x-rpc-device_id'] = this._device;
|
||||
}
|
||||
if (data.deviceId) {
|
||||
headers['x-rpc-device_id'] = data.deviceId;
|
||||
}
|
||||
if (data?.deviceInfo && data?.modelName) {
|
||||
const deviceBrand = data.deviceInfo?.split('/')[0];
|
||||
try {
|
||||
|
|
@ -143,6 +146,9 @@ export default class MysZZZApi extends MysApi {
|
|||
if (this._device) {
|
||||
body = JSON.parse(body);
|
||||
body.device_id = this._device;
|
||||
if (data.deviceId) {
|
||||
body.device_id = data.deviceId;
|
||||
}
|
||||
body = JSON.stringify(body);
|
||||
}
|
||||
}
|
||||
|
|
@ -256,7 +262,7 @@ export default class MysZZZApi extends MysApi {
|
|||
case 10041:
|
||||
case 5003:
|
||||
this.e.reply(
|
||||
`UID:${this.uid},米游社账号异常,暂时无法查询,请尝试 %绑定设备帮助`
|
||||
`UID:${this.uid},米游社账号异常,暂时无法查询,请发送 %绑定设备帮助 查看如何绑定设备`
|
||||
);
|
||||
break;
|
||||
case 10035:
|
||||
|
|
@ -300,6 +306,12 @@ export default class MysZZZApi extends MysApi {
|
|||
logger.mark(
|
||||
`[米游社zzz接口报错]${JSON.stringify(res)},UID:${this.uid}`
|
||||
);
|
||||
throw new Error({
|
||||
type: 'mysApi',
|
||||
uid: this.uid,
|
||||
retcode: res.retcode,
|
||||
result: res,
|
||||
});
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
@ -308,12 +320,12 @@ export default class MysZZZApi extends MysApi {
|
|||
* 获取米游社数据
|
||||
* @param {*} e 消息e
|
||||
* @param {keyof ZZZApiTool['zzzUrlMap']} type 请求类型
|
||||
* @param {{deviceFp: string; query: Record<string, any>; headers: object;}} data
|
||||
* @param {{deviceFp?: string; query: Record<string, any>; headers: object;}} data
|
||||
* @param {boolean} cached
|
||||
*/
|
||||
async getFinalData(e, type, data = {}, cached = false) {
|
||||
if (!data.headers) data.headers = {};
|
||||
if (data.deviceFp) {
|
||||
if (!data.headers) data.headers = {};
|
||||
data.headers['x-rpc-device_fp'] = data.deviceFp;
|
||||
}
|
||||
// 从 this.cookie 中获取ltuid
|
||||
|
|
@ -322,22 +334,33 @@ export default class MysZZZApi extends MysApi {
|
|||
if (ltuid) {
|
||||
ltuid = ltuid[1];
|
||||
}
|
||||
|
||||
let bindInfo = await redis.get(`ZZZ:DEVICE_FP:${ltuid}:BIND`);
|
||||
if (bindInfo) {
|
||||
try {
|
||||
bindInfo = JSON.parse(bindInfo);
|
||||
data = {
|
||||
...data,
|
||||
productName: bindInfo?.deviceProduct,
|
||||
deviceType: bindInfo?.deviceName,
|
||||
modelName: bindInfo?.deviceModel,
|
||||
oaid: bindInfo?.oaid,
|
||||
deviceInfo: bindInfo?.deviceFingerprint,
|
||||
board: bindInfo?.deviceBoard,
|
||||
};
|
||||
} catch (error) {
|
||||
bindInfo = null;
|
||||
if (ltuid) {
|
||||
let bindInfo = await redis.get(`ZZZ:DEVICE_FP:${ltuid}:BIND`);
|
||||
if (bindInfo) {
|
||||
try {
|
||||
bindInfo = JSON.parse(bindInfo);
|
||||
data = {
|
||||
...data,
|
||||
productName: bindInfo?.deviceProduct,
|
||||
deviceType: bindInfo?.deviceName,
|
||||
modelName: bindInfo?.deviceModel,
|
||||
oaid: bindInfo?.oaid,
|
||||
deviceInfo: bindInfo?.deviceFingerprint,
|
||||
board: bindInfo?.deviceBoard,
|
||||
};
|
||||
} catch (error) {
|
||||
bindInfo = null;
|
||||
}
|
||||
}
|
||||
const device_fp = await redis.get(`ZZZ:DEVICE_FP:${ltuid}:FP`);
|
||||
if (device_fp) {
|
||||
data.deviceFp = device_fp;
|
||||
data.headers['x-rpc-device_fp'] = device_fp;
|
||||
}
|
||||
const device_id = await redis.get(`ZZZ:DEVICE_FP:${ltuid}:ID`);
|
||||
if (device_id) {
|
||||
data.deviceId = device_id;
|
||||
data.headers['x-rpc-device_id'] = device_id;
|
||||
}
|
||||
}
|
||||
const result = await this.getData(type, data, cached);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue