()
| 65 | } |
| 66 | |
| 67 | async getVcode() { |
| 68 | try { |
| 69 | let VcodeKey = '', VcodeToken = '', tg = '', bg = '', data = '', ocrRes = '', d = '', aesStr = '', aesRes = '', checkRes = '', aesStrStar = '' |
| 70 | let options = { |
| 71 | url: 'https://scrm-prod.shuyi.org.cn/saas-gateway/api/agg-trade/v1/signIn/getVCode', |
| 72 | headers: { |
| 73 | 'Host': 'scrm-prod.shuyi.org.cn', |
| 74 | 'Connection': 'keep-alive', |
| 75 | 'charset': 'utf-8', |
| 76 | 'auth': this.ck, |
| 77 | 'sessionkey': '', |
| 78 | 'channel': 'wechat_micro', |
| 79 | 'User-Agent': 'Mozilla/5.0 (Linux; Android 10; MI 8 Lite Build/QKQ1.190910.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/107.0.5304.141 Mobile Safari/537.36 XWEB/5023 MMWEBSDK/20221206 MMWEBID/2585 MicroMessenger/8.0.32.2300(0x2800205D) WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 MiniProgramEnv/android', |
| 80 | 'terminal-code': 'member_wechat_micro', |
| 81 | 'releaseversion': '2026331', |
| 82 | 'hostname': 'scrm-prod.shuyi.org.cn', |
| 83 | 'httpt-taceid': '', |
| 84 | 'Content-Type': 'application/json', |
| 85 | 'channelid': '', |
| 86 | 'Referer': 'https://servicewechat.com/wxa778c3d895442625/287/page-frame.html' |
| 87 | }, |
| 88 | body: JSON.stringify({ |
| 89 | captchaType: 'blockPuzzle', |
| 90 | clientUid: 'slider-f55cf63d-2806-460a-a57f-5d0d7b56a0c0', |
| 91 | ts: this.timestamp |
| 92 | }) |
| 93 | }; |
| 94 | //console.log(options); |
| 95 | let result = await httpRequest(options); |
| 96 | //console.log(result); |
| 97 | if (result.resultCode == '0000') { |
| 98 | VcodeToken = result.data.token |
| 99 | VcodeKey = result.data.secretKey |
| 100 | bg = result.data.originalImageBase64 |
| 101 | tg = result.data.jigsawImageBase64 |
| 102 | data = JSON.stringify({ "target_img": tg, "bg_img": bg }) |
| 103 | data = base64_encode(data) //B64编码 |
| 104 | //data = base64_decode(data) |
| 105 | //console.log(data); |
| 106 | ocrRes = await ocr('/slide/match/b64/json', data) |
| 107 | //console.log(ocrRes); |
| 108 | d = ocrRes.result.target[0] |
| 109 | //console.log(`滑动距离${d}`); |
| 110 | aesStr = JSON.stringify({ "x": d, "y": 5 }).toString() |
| 111 | aesStrStar = `{"x": ${d}, "y": 5}` |
| 112 | aesStr = aesStr.replace(/\ +/g, ""); |
| 113 | //console.log(`加密前${aesStr}`); |
| 114 | //AES的ECB模式加密方法 |
| 115 | aesRes = aesEncrypt(VcodeKey, aesStr) |
| 116 | aesRes = aesRes.substring(0, 22) |
| 117 | aesRes += '==' |
| 118 | //console.log(`加密后${aesRes}`); |
| 119 | //console.log(VcodeKey); |
| 120 | for (let i = 0; i < 10; i++) { |
| 121 | checkRes = await this.checkVcode(aesRes, VcodeToken, VcodeKey, aesStrStar) |
| 122 | if (checkRes == '0') { |
| 123 | return |
| 124 | } |
no test coverage detected