| 21 | } |
| 22 | |
| 23 | async api(fn: string, body: object): Promise<any> { |
| 24 | let ts: number = Date.now() |
| 25 | let h5st: string = this.h5stTool.genH5st('hot_channel', body, 'android', '8.21.260', fn, ts) |
| 26 | return await this.post(`https://api.m.jd.com/${fn}`, |
| 27 | `loginType=2&client=android&clientVersion=8.21.260&functionId=${fn}&t=${ts}&body=${encodeURIComponent(JSON.stringify(body))}&appid=hot_channel&d_name=&h5st=${h5st}&_ste=2`, |
| 28 | { |
| 29 | 'Host': 'api.m.jd.com', |
| 30 | 'User-Agent': this.user.UserAgent, |
| 31 | 'Cookie': this.user.cookie, |
| 32 | 'X-Referer-Package': 'wx91d27dbf599dff74', |
| 33 | 'wqreferer': 'http://wq.jd.com/wxapp/pages/yixiaoshida/index/index', |
| 34 | 'X-Rp-Client': 'mini_2.0.0', |
| 35 | 'X-Referer-Page': '/pages/yixiaoshida/index/index', |
| 36 | 'referer': 'https://servicewechat.com/wx91d27dbf599dff74/728/page-frame.html' |
| 37 | }) |
| 38 | } |
| 39 | |
| 40 | async main(user: User) { |
| 41 | try { |