This commit is contained in:
bietiaop 2024-08-16 12:00:25 +08:00
parent 4a54442fae
commit 14f24bbd4d
4 changed files with 150 additions and 27 deletions

View file

@ -56,7 +56,7 @@ export class ZZZPlugin extends plugin {
// 创建米游社 API 对象
const api = new MysZZZApi(uid, ck);
// 获取设备指纹
let deviceFp = await redis.get(`ZZZ:DEVICE_FP:${uid}`);
let deviceFp = await redis.get(`ZZZ:DEVICE_FP:${uid}:FP`);
if (!deviceFp) {
const sdk = api.getUrl('getFp');
const res = await fetch(sdk.url, {
@ -65,9 +65,10 @@ export class ZZZPlugin extends plugin {
body: sdk.body,
});
const fpRes = await res.json();
logger.debug(`[米游社][设备指纹]${JSON.stringify(fpRes)}`);
deviceFp = fpRes?.data?.device_fp;
if (deviceFp) {
await redis.set(`ZZZ:DEVICE_FP:${uid}`, deviceFp, {
await redis.set(`ZZZ:DEVICE_FP:${uid}:FP`, deviceFp, {
EX: 86400 * 7,
});
}
@ -86,10 +87,12 @@ export class ZZZPlugin extends plugin {
*/
async getPlayerInfo() {
// 获取 米游社 API
const { api, uid } = await this.getAPI();
const { api, uid, deviceFp } = await this.getAPI();
if (!api) return false;
// 获取用户信息
let userData = await api.getFinalData(this.e, 'zzzUser');
let userData = await api.getFinalData(this.e, 'zzzUser', {
deviceFp,
});
if (!userData) return false;
// 取第一个用户信息
userData =