()
| 484 | } |
| 485 | |
| 486 | function requireConfig() { |
| 487 | return new Promise(resolve => { |
| 488 | console.log('开始获取配置文件\n') |
| 489 | notify = $.isNode() ? require('./sendNotify') : ''; |
| 490 | //Node.js用户请在jdCookie.js处填写京东ck; |
| 491 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; |
| 492 | //IOS等用户直接用NobyDa的jd cookie |
| 493 | if ($.isNode()) { |
| 494 | Object.keys(jdCookieNode).forEach((item) => { |
| 495 | if (jdCookieNode[item]) { |
| 496 | cookiesArr.push(jdCookieNode[item]) |
| 497 | } |
| 498 | }) |
| 499 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => { |
| 500 | }; |
| 501 | } else { |
| 502 | cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item); |
| 503 | } |
| 504 | console.log(`共${cookiesArr.length}个京东账号\n`) |
| 505 | resolve() |
| 506 | }) |
| 507 | } |
| 508 | |
| 509 | function jsonParse(str) { |
| 510 | if (typeof str == "string") { |
no test coverage detected