| 103 | } |
| 104 | } |
| 105 | function getCards() { |
| 106 | return new Promise((resolve) => { |
| 107 | const option = { |
| 108 | url: `${JD_API_HOST}client.action?functionId=getWalletReceivedCardList`, |
| 109 | body: 'body=%7B%22version%22%3A1580659200%7D&build=167490&client=apple&clientVersion=9.3.2&openudid=53f4d9c70c1c81f1c8769d2fe2fef0190a3f60d2&rfs=0000&scope=01&sign=aa00f715800e252fcebcb11573f4a505&st=1608612985755&sv=102', |
| 110 | headers: { |
| 111 | "Host": "api.m.jd.com", |
| 112 | "Accept": "*/*", |
| 113 | "Connection": "keep-alive", |
| 114 | "Cookie": cookie, |
| 115 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('../USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;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"), |
| 116 | "Accept-Language": "zh-cn", |
| 117 | "Accept-Encoding": "gzip, deflate, br" |
| 118 | }, |
| 119 | } |
| 120 | $.post(option, (err, resp, data) => { |
| 121 | try { |
| 122 | if (err) { |
| 123 | console.log(`${JSON.stringify(err)}`) |
| 124 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 125 | } else { |
| 126 | if (safeGet(data)) { |
| 127 | data = JSON.parse(data); |
| 128 | $.cardsTotalNum = data.result.cardList ? data.result.cardList.length : 0; |
| 129 | $.cardList = data.result.cardList || [] |
| 130 | } |
| 131 | } |
| 132 | } catch (e) { |
| 133 | $.logErr(e, resp); |
| 134 | } finally { |
| 135 | resolve(data); |
| 136 | } |
| 137 | }); |
| 138 | }) |
| 139 | } |
| 140 | function unsubscribeCard(vendorId) { |
| 141 | return new Promise(resolve => { |
| 142 | const option = { |