| 276 | } |
| 277 | |
| 278 | function getToken() { |
| 279 | let config = { |
| 280 | url: 'https://xinruidddj-isv.isvjcloud.com/api/user/jd/auth', |
| 281 | body: `token=${$.token2}&source=01`, |
| 282 | headers: { |
| 283 | 'Host': 'xinruidddj-isv.isvjcloud.com', |
| 284 | 'Accept': 'application/json, text/plain, */*', |
| 285 | 'Origin': 'https://xinruidddj-isv.isvjcloud.com', |
| 286 | 'Authorization': 'Bearer undefined', |
| 287 | 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;10.0.2;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"), |
| 288 | 'Sec-Fetch-Mode': 'cors', |
| 289 | 'X-Requested-With': 'com.jingdong.app.mall', |
| 290 | 'Sec-Fetch-Site': 'same-origin', |
| 291 | 'Referer': 'https://xinruidddj-isv.isvjcloud.com/exception/?channel=DDLY&sid=fd5e44488241862af88cb40cbebf660w&un_area=12_904_3373_62101', |
| 292 | 'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7', |
| 293 | 'Cookie': `IsvToken=${$.isvToken};` |
| 294 | }, |
| 295 | } |
| 296 | return new Promise(resolve => { |
| 297 | $.post(config, async (err, resp, data) => { |
| 298 | try { |
| 299 | if (err) { |
| 300 | console.log(`${JSON.stringify(err)}`) |
| 301 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 302 | } else { |
| 303 | data = JSON.parse(data); |
| 304 | $.token = data.body.access_token |
| 305 | console.log($.token) |
| 306 | } |
| 307 | } catch (e) { |
| 308 | $.logErr(e, resp) |
| 309 | } finally { |
| 310 | resolve(data); |
| 311 | } |
| 312 | }) |
| 313 | }) |
| 314 | } |
| 315 | |
| 316 | function detail() { |
| 317 | return new Promise(resolve => { |