| 21 | } |
| 22 | |
| 23 | async api(fn: string, body: object) { |
| 24 | let h5st: string = await this.h5stTool.__genH5st({ |
| 25 | appid: 'plus_business', |
| 26 | body: JSON.stringify(body), |
| 27 | functionId: fn, |
| 28 | }) |
| 29 | return await this.post( |
| 30 | `https://api.m.jd.com/api?functionId=${fn}`, |
| 31 | new URLSearchParams({ |
| 32 | appid: 'plus_business', |
| 33 | loginType: '2', |
| 34 | loginWQBiz: '', |
| 35 | functionId: fn, |
| 36 | body: '{}', |
| 37 | h5st: h5st, |
| 38 | }), |
| 39 | { |
| 40 | 'Host': 'api.m.jd.com', |
| 41 | 'x-rp-client': 'h5_1.0.0', |
| 42 | 'Origin': 'https://plus.m.jd.com', |
| 43 | 'User-Agent': this.user.UserAgent, |
| 44 | 'Referer': 'https://plus.m.jd.com/rights/windControl', |
| 45 | 'x-referer-page': 'https://plus.m.jd.com/rights/windControl', |
| 46 | 'Cookie': this.user.cookie, |
| 47 | } |
| 48 | ) |
| 49 | } |
| 50 | |
| 51 | async main(user: User) { |
| 52 | try { |