MCPcopy Create free account
hub / github.com/Semporia/Scripts / JDUserSign2

Function JDUserSign2

JD_DailyBonus.js:823–885  ·  view source on GitHub ↗
(s, key, title, tid)

Source from the content-addressed store, hash-verified

821}
822
823async function JDUserSign2(s, key, title, tid) {
824 return console.log(`\n${title} >> 可能需要拼图验证, 跳过签到 ⚠️`);
825 await new Promise(resolve => {
826 $nobyda.get({
827 url: `https://jdjoy.jd.com/api/turncard/channel/detail?turnTableId=${tid}&invokeKey=ztmFUCxcPMNyUq0P`,
828 headers: {
829 Cookie: KEY
830 }
831 }, function(error, response, data) {
832 resolve()
833 })
834 if (out) setTimeout(resolve, out + s)
835 });
836 return new Promise(resolve => {
837 setTimeout(() => {
838 const JDUrl = {
839 url: 'https://jdjoy.jd.com/api/turncard/channel/sign?invokeKey=ztmFUCxcPMNyUq0P',
840 headers: {
841 lkt: '1629984131120',
842 lks: 'd7db92cf40ad5a8d54b9da2b561c5f84',
843 Cookie: KEY
844 },
845 body: `turnTableId=${tid}`
846 };
847 $nobyda.post(JDUrl, function(error, response, data) {
848 try {
849 if (error) {
850 throw new Error(error)
851 } else {
852 const Details = LogDetails ? `response:\n${data}` : '';
853 if (data.match(/\"success\":true/)) {
854 console.log(`\n${title}签到成功(2)${Details}`)
855 if (data.match(/\"jdBeanQuantity\":\d+/)) {
856 merge[key].bean = data.match(/\"jdBeanQuantity\":(\d+)/)[1]
857 }
858 merge[key].notify = `${title}: 成功, 明细: ${merge[key].bean || '无'}京豆 🐶`
859 merge[key].success = 1
860 } else {
861 const captcha = /请进行验证/.test(data);
862 if (data.match(/(已经签到|已经领取)/)) {
863 merge[key].notify = `${title}: 失败, 原因: 已签过 ⚠️`
864 } else if (data.match(/(不存在|已结束|未开始)/)) {
865 merge[key].notify = `${title}: 失败, 原因: 活动已结束 ⚠️`
866 } else if (data.match(/(没有登录|B0001)/)) {
867 merge[key].notify = `${title}: 失败, 原因: Cookie失效‼️`
868 } else if (!captcha) {
869 const ng = data.match(/\"(errorMessage|subCodeMsg)\":\"(.+?)\"/)
870 merge[key].notify = `${title}: 失败, ${ng?ng[2]:`原因: 未知`} ⚠️`
871 }
872 if (!captcha) merge[key].fail = 1;
873 console.log(`\n${title}签到失败(2)${captcha?`\n需要拼图验证, 跳过通知记录 ⚠️`:``}${Details}`)
874 }
875 }
876 } catch (eor) {
877 $nobyda.AnError(title, key, eor, response, data)
878 } finally {
879 resolve()
880 }

Callers 2

JDUserSignPre1Function · 0.85
JDUserSignPre2Function · 0.85

Calls 3

logMethod · 0.45
getMethod · 0.45
postMethod · 0.45

Tested by

no test coverage detected