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

Function JDMagicCubeSign

JD_DailyBonus.js:1073–1121  ·  view source on GitHub ↗
(s, id)

Source from the content-addressed store, hash-verified

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

Callers 1

JDMagicCubeFunction · 0.85

Calls 2

getMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected