()
| 125 | |
| 126 | // 加载配置 cookie token shareCode |
| 127 | function requireConfig() { |
| 128 | return new Promise(async resolve => { |
| 129 | $.log('开始获取配置文件\n') |
| 130 | notify = $.isNode() ? require('./sendNotify') : ''; |
| 131 | //Node.js用户请在jdCookie.js处填写京东ck; |
| 132 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; |
| 133 | // const jdTokenNode = $.isNode() ? require('./jdJxncTokens.js') : ''; |
| 134 | const jdJxncShareCodeNode = $.isNode() ? require('./jdJxncShareCodes.js') : {}; |
| 135 | //IOS等用户直接用NobyDa的jd cookie |
| 136 | if ($.isNode()) { |
| 137 | Object.keys(jdCookieNode).forEach((item) => { |
| 138 | if (jdCookieNode[item]) { |
| 139 | cookieArr.push(jdCookieNode[item]); |
| 140 | } |
| 141 | }) |
| 142 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {}; |
| 143 | } else { |
| 144 | cookieArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item); |
| 145 | } |
| 146 | |
| 147 | $.log(`共${cookieArr.length}个京东账号\n`); |
| 148 | |
| 149 | // if ($.isNode()) { |
| 150 | // Object.keys(jdTokenNode).forEach((item) => { |
| 151 | // tokenArr.push(jdTokenNode[item] ? JSON.parse(jdTokenNode[item]) : tokenNull) |
| 152 | // }) |
| 153 | // } else { |
| 154 | // let tmpTokens = JSON.parse($.getdata('jx_tokens') || '[]'); |
| 155 | // tokenArr.push(...tmpTokens) |
| 156 | // } |
| 157 | |
| 158 | if ($.isNode()) { |
| 159 | Object.keys(jdJxncShareCodeNode).forEach((item) => { |
| 160 | if (jdJxncShareCodeNode[item]) { |
| 161 | jxncShareCodeArr.push(jdJxncShareCodeNode[item]) |
| 162 | } else { |
| 163 | jxncShareCodeArr.push(''); |
| 164 | } |
| 165 | }) |
| 166 | } |
| 167 | |
| 168 | // 检查互助码是否为 json [smp,active,joinnum] 格式,否则进行通知 |
| 169 | for (let i = 0; i < jxncShareCodeArr.length; i++) { |
| 170 | if (jxncShareCodeArr[i]) { |
| 171 | let tmpJxncShareStr = jxncShareCodeArr[i]; |
| 172 | let tmpjsonShareCodeArr = tmpJxncShareStr.split('@'); |
| 173 | if (!changeShareCodeJson(tmpjsonShareCodeArr[0])) { |
| 174 | $.log('互助码格式已变更,请重新填写互助码'); |
| 175 | $.msg($.name, '互助码格式变更通知', '互助码格式变更,请重新填写 ‼️‼️', option); |
| 176 | if ($.isNode()) { |
| 177 | await notify.sendNotify(`${$.name}`, `互助码格式变更,请重新填写 ‼️‼️`); |
| 178 | } |
| 179 | } |
| 180 | break; |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | // console.log(`jdFruitShareArr::${JSON.stringify(jxncShareCodeArr)}`) |
no test coverage detected