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

Function JDUserSign2

JD-DailyBonus/JD_DailyBonus.js:831–893  ·  view source on GitHub ↗
(s, key, title, tid)

Source from the content-addressed store, hash-verified

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

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