(teamLevel, timeout = 5000)
| 807 | } |
| 808 | //参加赛跑API |
| 809 | function runMatch(teamLevel, timeout = 5000) { |
| 810 | if (teamLevel === 10 || teamLevel === 50) timeout = 60000; |
| 811 | console.log(`正在参赛中,请稍等${timeout / 1000}秒,以防多个账号匹配到统一赛场\n`) |
| 812 | return new Promise(async resolve => { |
| 813 | await $.wait(timeout); |
| 814 | // const url = `${JD_API_HOST}/combat/match?teamLevel=${teamLevel}`; |
| 815 | const host = `jdjoy.jd.com`; |
| 816 | const reqSource = 'h5'; |
| 817 | let opt = { |
| 818 | url: `//jdjoy.jd.com/common/pet/combat/match?teamLevel=${teamLevel}&reqSource=h5&invokeKey=Oex5GmEuqGep1WLC`, |
| 819 | // url: `//draw.jdfcloud.com/common/pet/combat/match?teamLevel=${teamLevel}&reqSource=h5`, |
| 820 | method: "GET", |
| 821 | data: {}, |
| 822 | credentials: "include", |
| 823 | header: {"content-type": "application/json"} |
| 824 | } |
| 825 | const url = "https:"+ taroRequest(opt)['url'] |
| 826 | $.get(taskUrl(url, host, reqSource), (err, resp, data) => { |
| 827 | try { |
| 828 | if (err) { |
| 829 | console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️') |
| 830 | } else { |
| 831 | // console.log('参加赛跑API', JSON.parse(data)) |
| 832 | // $.appGetPetTaskConfigRes = JSON.parse(data); |
| 833 | $.runMatchResult = JSON.parse(data); |
| 834 | } |
| 835 | } catch (e) { |
| 836 | $.logErr(e, resp); |
| 837 | } finally { |
| 838 | resolve(); |
| 839 | } |
| 840 | }) |
| 841 | }) |
| 842 | } |
| 843 | //查询应援团信息API |
| 844 | function getBackupInfo() { |
| 845 | return new Promise(resolve => { |
no test coverage detected