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

Function JDMagicCubeSign

JD-DailyBonus/JD_DailyBonus.js:1081–1129  ·  view source on GitHub ↗
(s, id)

Source from the content-addressed store, hash-verified

1079}
1080
1081function JDMagicCubeSign(s, id) {
1082 return new Promise(resolve => {
1083 setTimeout(() => {
1084 const JDMCUrl = {
1085 url: `https://api.m.jd.com/client.action?functionId=getNewsInteractionLotteryInfo&appid=smfe${id?`&body=${encodeURIComponent(`{${id.sign?`"sign":${id.sign},`:``}"interactionId":${id.id}}`)}`:``}`,
1086 headers: {
1087 Cookie: KEY,
1088 }
1089 };
1090 $nobyda.get(JDMCUrl, function(error, response, data) {
1091 try {
1092 if (error) {
1093 throw new Error(error)
1094 } else {
1095 const Details = LogDetails ? "response:\n" + data : '';
1096 const cc = JSON.parse(data)
1097 if (data.match(/(\"name\":)/)) {
1098 console.log("\n" + "京东商城-魔方签到成功 " + Details)
1099 merge.JDCube.success = 1
1100 if (data.match(/(\"name\":\"京豆\")/)) {
1101 merge.JDCube.bean = cc.result.lotteryInfo.quantity || 0
1102 merge.JDCube.notify = `京东商城-魔方: 成功, 明细: ${merge.JDCube.bean || `无`}京豆 🐶`
1103 } else {
1104 merge.JDCube.notify = `京东商城-魔方: 成功, 明细: ${cc.result.lotteryInfo.name || `未知`} 🎉`
1105 }
1106 } else {
1107 console.log("\n" + "京东商城-魔方签到失败 " + Details)
1108 merge.JDCube.fail = 1
1109 if (data.match(/(一闪而过|已签到|已领取)/)) {
1110 merge.JDCube.notify = "京东商城-魔方: 失败, 原因: 无机会 ⚠️"
1111 } else if (data.match(/(不存在|已结束)/)) {
1112 merge.JDCube.notify = "京东商城-魔方: 失败, 原因: 活动已结束 ⚠️"
1113 } else if (data.match(/(\"code\":3)/)) {
1114 merge.JDCube.notify = "京东商城-魔方: 失败, 原因: Cookie失效‼️"
1115 } else {
1116 merge.JDCube.notify = "京东商城-魔方: 失败, 原因: 未知 ⚠️"
1117 }
1118 }
1119 }
1120 } catch (eor) {
1121 $nobyda.AnError("京东商城-魔方", "JDCube", eor, response, data)
1122 } finally {
1123 resolve()
1124 }
1125 })
1126 }, s)
1127 if (out) setTimeout(resolve, out + s)
1128 });
1129}
1130
1131function JingDongSubsidy(s) {
1132 merge.subsidy = {};

Callers 1

JDMagicCubeFunction · 0.85

Calls 2

getMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected