| 138 | }) |
| 139 | } |
| 140 | function unsubscribeCard(vendorId) { |
| 141 | return new Promise(resolve => { |
| 142 | const option = { |
| 143 | url: `${JD_API_HOST}unBindCard?appid=jd_shop_member&functionId=unBindCard&body=%7B%22venderId%22:%22${vendorId}%22%7D&clientVersion=1.0.0&client=wh5`, |
| 144 | headers: { |
| 145 | "Host": "api.m.jd.com", |
| 146 | "Accept": "*/*", |
| 147 | "Connection": "keep-alive", |
| 148 | 'origin': 'https://shopmember.m.jd.com', |
| 149 | '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"), |
| 150 | 'Referer': `https://shopmember.m.jd.com/member/memberCloseAccount?venderId=${vendorId}`, |
| 151 | 'Cookie': cookie, |
| 152 | "Accept-Language": "zh-cn", |
| 153 | "Accept-Encoding": "gzip, deflate, br" |
| 154 | }, |
| 155 | } |
| 156 | $.post(option, (err, resp, data) => { |
| 157 | try { |
| 158 | if (err) { |
| 159 | console.log(`${JSON.stringify(err)}`) |
| 160 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 161 | } else { |
| 162 | if (safeGet(data)) { |
| 163 | data = JSON.parse(data) |
| 164 | console.log(data.message) |
| 165 | } |
| 166 | } |
| 167 | } catch (e) { |
| 168 | $.logErr(e, resp); |
| 169 | } finally { |
| 170 | resolve(data); |
| 171 | } |
| 172 | }); |
| 173 | }) |
| 174 | } |
| 175 | function TotalBean() { |
| 176 | return new Promise(async resolve => { |
| 177 | const options = { |