From d6ab61fe5a9625c5c9cbc5f1640ffd32079e0e1f Mon Sep 17 00:00:00 2001 From: bietiaop <1527109126@qq.com> Date: Mon, 15 Jul 2024 15:38:19 +0800 Subject: [PATCH] fix:ck --- lib/mysapi.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/mysapi.js b/lib/mysapi.js index eb57bb3..df93d62 100644 --- a/lib/mysapi.js +++ b/lib/mysapi.js @@ -26,9 +26,11 @@ export default class MysZZZApi extends MysApi { this.uid = uid; this.server = this.getServer(uid); this.apiTool = new ZZZApiTool(uid, this.server); - if (typeof this.cookie != 'string' && this.cookie) { - let ck = - this.cookie[Object.keys(this.cookie).filter(k => this.cookie[k].ck)[0]]; + if (typeof this.cookie !== 'string' && this.cookie) { + const ck = Object.values(this.cookie).find(item => { + return item.ck && item.uid === uid; + }); + logger.debug(ck); this._device = ck?.device_id || ck?.device; this.cookie = ck?.ck; }