(fn,scene = 'cww')
| 492 | } |
| 493 | |
| 494 | function injectToRequest(fn,scene = 'cww') { |
| 495 | return (opts, cb) => { |
| 496 | fn(opts, async (err, resp, data) => { |
| 497 | if (err) { |
| 498 | console.error(JSON.stringify(err)); |
| 499 | return; |
| 500 | } |
| 501 | if (data.search('验证') > -1) { |
| 502 | console.log('JDJR验证中......'); |
| 503 | const res = await new JDJRValidator().run(scene); |
| 504 | |
| 505 | opts.url += `&validate=${res.validate}`; |
| 506 | fn(opts, cb); |
| 507 | } else { |
| 508 | cb(err, resp, data); |
| 509 | } |
| 510 | }); |
| 511 | }; |
| 512 | } |
| 513 | |
| 514 | exports.injectToRequest = injectToRequest; |