| 7 | import {H5ST} from './utils/h5st_pro' |
| 8 | |
| 9 | class jd_WindControl extends JDHelloWorld { |
| 10 | user: User |
| 11 | h5stTool: H5ST |
| 12 | fp: string |
| 13 | |
| 14 | constructor() { |
| 15 | super() |
| 16 | } |
| 17 | |
| 18 | async init() { |
| 19 | this.fp = await this.getFp() |
| 20 | await this.run(this) |
| 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 { |
| 53 | this.user = user |
| 54 | let res: any |
| 55 | this.h5stTool = new H5ST('b63ff', this.user.UserAgent, this.fp, 'https://plus.m.jd.com/rights/windControl', 'https://plus.m.jd.com') |
| 56 | await this.h5stTool.__genAlgo() |
| 57 | res = await this.api('windControl_queryScore_v1', {}) |
| 58 | |
| 59 | console.log('综合:',res.rs.userSynthesizeScore.totalScore) |
| 60 | console.log('信用:', res.rs.userDimensionScore.baiScore) |
| 61 | console.log('购物合规:', res.rs.userDimensionScore.shop) |
| 62 | console.log('售后行为:', res.rs.userDimensionScore.active) |
| 63 | console.log('账户信息:', res.rs.userDimensionScore.accountInfo) |
| 64 | } catch (e) { |
| 65 | console.log(e.message) |
| 66 | } |
nothing calls this directly
no outgoing calls
no test coverage detected