(s, key, title, body)
| 780 | } |
| 781 | |
| 782 | function JDUserSign1(s, key, title, body) { |
| 783 | return new Promise(resolve => { |
| 784 | setTimeout(() => { |
| 785 | const JDUrl = { |
| 786 | url: 'https://api.m.jd.com/client.action?functionId=userSign', |
| 787 | headers: { |
| 788 | Cookie: KEY |
| 789 | }, |
| 790 | body: `body=${body}&client=wh5` |
| 791 | }; |
| 792 | $nobyda.post(JDUrl, function(error, response, data) { |
| 793 | try { |
| 794 | if (error) { |
| 795 | throw new Error(error) |
| 796 | } else { |
| 797 | const Details = LogDetails ? `response:\n${data}` : ''; |
| 798 | if (data.match(/签到成功/)) { |
| 799 | console.log(`\n${title}签到成功(1)${Details}`) |
| 800 | if (data.match(/\"text\":\"\d+京豆\"/)) { |
| 801 | merge[key].bean = data.match(/\"text\":\"(\d+)京豆\"/)[1] |
| 802 | } |
| 803 | merge[key].notify = `${title}: 成功, 明细: ${merge[key].bean || '无'}京豆 🐶` |
| 804 | merge[key].success = 1 |
| 805 | } else { |
| 806 | console.log(`\n${title}签到失败(1)${Details}`) |
| 807 | if (data.match(/(已签到|已领取)/)) { |
| 808 | merge[key].notify = `${title}: 失败, 原因: 已签过 ⚠️` |
| 809 | } else if (data.match(/(不存在|已结束|未开始)/)) { |
| 810 | merge[key].notify = `${title}: 失败, 原因: 活动已结束 ⚠️` |
| 811 | } else if (data.match(/\"code\":\"?3\"?/)) { |
| 812 | merge[key].notify = `${title}: 失败, 原因: Cookie失效‼️` |
| 813 | } else { |
| 814 | const ng = data.match(/\"(errorMessage|subCodeMsg)\":\"(.+?)\"/) |
| 815 | merge[key].notify = `${title}: 失败, ${ng?ng[2]:`原因: 未知`} ⚠️` |
| 816 | } |
| 817 | merge[key].fail = 1 |
| 818 | } |
| 819 | } |
| 820 | } catch (eor) { |
| 821 | $nobyda.AnError(title, key, eor, response, data) |
| 822 | } finally { |
| 823 | resolve() |
| 824 | } |
| 825 | }) |
| 826 | }, s) |
| 827 | if (out) setTimeout(resolve, out + s) |
| 828 | }); |
| 829 | } |
| 830 | |
| 831 | async function JDUserSign2(s, key, title, tid) { |
| 832 | return console.log(`\n${title} >> 可能需要拼图验证, 跳过签到 ⚠️`); |
no test coverage detected