(scene = 'cww')
| 212 | } |
| 213 | |
| 214 | async run(scene = 'cww') { |
| 215 | const tryRecognize = async () => { |
| 216 | const x = await this.recognize(scene); |
| 217 | |
| 218 | if (x > 0) { |
| 219 | return x; |
| 220 | } |
| 221 | // retry |
| 222 | return await tryRecognize(); |
| 223 | }; |
| 224 | const puzzleX = await tryRecognize(); |
| 225 | // console.log(puzzleX); |
| 226 | const pos = new MousePosFaker(puzzleX).run(); |
| 227 | const d = getCoordinate(pos); |
| 228 | |
| 229 | // console.log(pos[pos.length-1][2] -Date.now()); |
| 230 | // await sleep(4500); |
| 231 | await sleep(pos[pos.length - 1][2] - Date.now()); |
| 232 | const result = await JDJRValidator.jsonp('/slide/s.html', {d, ...this.data}, scene); |
| 233 | |
| 234 | if (result.message === 'success') { |
| 235 | // console.log(result); |
| 236 | console.log('JDJR验证用时: %fs', (Date.now() - this.t) / 1000); |
| 237 | return result; |
| 238 | } else { |
| 239 | console.count("验证失败"); |
| 240 | // console.count(JSON.stringify(result)); |
| 241 | await sleep(300); |
| 242 | return await this.run(scene); |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | async recognize(scene) { |
| 247 | const data = await JDJRValidator.jsonp('/slide/g.html', {e: ''}, scene); |
no test coverage detected