MCPcopy Create free account
hub / github.com/NobyDa/Script / JingRongDoll

Function JingRongDoll

JD-DailyBonus/JD_DailyBonus.js:1179–1266  ·  view source on GitHub ↗
(s, key, title, code, type, num, award, belong)

Source from the content-addressed store, hash-verified

1177}
1178
1179function JingRongDoll(s, key, title, code, type, num, award, belong) {
1180 merge[key] = {};
1181 return new Promise(resolve => {
1182 if (disable(key)) return resolve()
1183 setTimeout(() => {
1184 const DollUrl = {
1185 url: "https://nu.jr.jd.com/gw/generic/jrm/h5/m/process",
1186 headers: {
1187 Cookie: KEY
1188 },
1189 body: `reqData=${encodeURIComponent(`{"actCode":"${code}","type":${type?type:`3`}${code=='F68B2C3E71'?`,"frontParam":{"belong":"${belong}"}`:code==`1DF13833F7`?`,"frontParam":{"channel":"JR","belong":4}`:``}}`)}`
1190 };
1191 $nobyda.post(DollUrl, async function(error, response, data) {
1192 try {
1193 if (error) {
1194 throw new Error(error)
1195 } else {
1196 var cc = JSON.parse(data)
1197 const Details = LogDetails ? "response:\n" + data : '';
1198 if (cc.resultCode == 0) {
1199 if (cc.resultData.data.businessData != null) {
1200 console.log(`\n${title}查询成功 ${Details}`)
1201 if (cc.resultData.data.businessData.pickStatus == 2) {
1202 if (data.match(/\"rewardPrice\":\"\d.*?\"/)) {
1203 const JRDoll_bean = data.match(/\"rewardPrice\":\"(\d.*?)\"/)[1]
1204 const JRDoll_type = data.match(/\"rewardName\":\"金贴奖励\"/) ? true : false
1205 await JingRongDoll(s, key, title, code, '4', JRDoll_bean, JRDoll_type)
1206 } else {
1207 merge[key].success = 1
1208 merge[key].notify = `${title}: 成功, 明细: 无奖励 🐶`
1209 }
1210 } else if (code == 'F68B2C3E71' || code == '1DF13833F7') {
1211 if (!data.match(/"businessCode":"30\dss?q"/)) {
1212 merge[key].success = 1
1213 const ct = data.match(/\"count\":\"?(\d.*?)\"?,/)
1214 if (code == 'F68B2C3E71' && belong == 'xianjin') {
1215 merge[key].Money = ct ? ct[1] > 9 ? `0.${ct[1]}` : `0.0${ct[1]}` : 0
1216 merge[key].notify = `${title}: 成功, 明细: ${merge[key].Money||`无`}现金 💰`
1217 } else if (code == 'F68B2C3E71' && belong == 'jingdou') {
1218 merge[key].bean = ct ? ct[1] : 0;
1219 merge[key].notify = `${title}: 成功, 明细: ${merge[key].bean||`无`}京豆 🐶`
1220 } else if (code == '1DF13833F7') {
1221 merge[key].subsidy = ct ? ct[1] : 0;
1222 merge[key].notify = `${title}: 成功, 明细: ${merge[key].subsidy||`无`}金贴 💰`
1223 }
1224 } else {
1225 const es = cc.resultData.data.businessMsg
1226 const ep = cc.resultData.data.businessData.businessMsg
1227 const tp = data.match(/已领取|300ss?q/) ? `已签过` : `${ep||es||cc.resultMsg||`未知`}`
1228 merge[key].notify = `${title}: 失败, 原因: ${tp} ⚠️`
1229 merge[key].fail = 1
1230 }
1231 } else {
1232 merge[key].notify = `${title}: 失败, 原因: 已签过 ⚠️`;
1233 merge[key].fail = 1
1234 }
1235 } else if (cc.resultData.data.businessCode == 200) {
1236 console.log(`\n${title}签到成功 ${Details}`)

Callers 1

allFunction · 0.85

Calls 3

disableFunction · 0.85
postMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected