MCPcopy Index your code
hub / github.com/NobyDa/Script / JDUserSign1

Function JDUserSign1

JD-DailyBonus/JD_DailyBonus.js:782–829  ·  view source on GitHub ↗
(s, key, title, body)

Source from the content-addressed store, hash-verified

780}
781
782function 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
831async function JDUserSign2(s, key, title, tid) {
832 return console.log(`\n${title} >> 可能需要拼图验证, 跳过签到 ⚠️`);

Callers 2

JDUserSignPre1Function · 0.85
JDUserSignPre2Function · 0.85

Calls 2

postMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected