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; }