| 1129 | } |
| 1130 | |
| 1131 | function JingDongSubsidy(s) { |
| 1132 | merge.subsidy = {}; |
| 1133 | return new Promise(resolve => { |
| 1134 | if (disable("subsidy")) return resolve() |
| 1135 | setTimeout(() => { |
| 1136 | const subsidyUrl = { |
| 1137 | url: 'https://ms.jr.jd.com/gw/generic/uc/h5/m/signIn7', |
| 1138 | headers: { |
| 1139 | Referer: "https://active.jd.com/forever/cashback/index", |
| 1140 | Cookie: KEY |
| 1141 | } |
| 1142 | }; |
| 1143 | $nobyda.get(subsidyUrl, function(error, response, data) { |
| 1144 | try { |
| 1145 | if (error) { |
| 1146 | throw new Error(error) |
| 1147 | } else { |
| 1148 | const Details = LogDetails ? "response:\n" + data : ''; |
| 1149 | const cc = JSON.parse(data) |
| 1150 | if (cc.resultCode == 0 && cc.resultData.data && cc.resultData.data.thisAmount) { |
| 1151 | console.log("\n" + "京东商城-金贴签到成功 " + Details) |
| 1152 | merge.subsidy.subsidy = cc.resultData.data.thisAmountStr |
| 1153 | merge.subsidy.notify = `京东商城-金贴: 成功, 明细: ${merge.subsidy.subsidy||`无`}金贴 💰` |
| 1154 | merge.subsidy.success = 1 |
| 1155 | } else { |
| 1156 | console.log("\n" + "京东商城-金贴签到失败 " + Details) |
| 1157 | merge.subsidy.fail = 1 |
| 1158 | if (data.match(/已存在|"thisAmount":0/)) { |
| 1159 | merge.subsidy.notify = "京东商城-金贴: 失败, 原因: 无金贴 ⚠️" |
| 1160 | } else if (data.match(/请先登录/)) { |
| 1161 | merge.subsidy.notify = "京东商城-金贴: 失败, 原因: Cookie失效‼️" |
| 1162 | } else { |
| 1163 | const msg = data.split(/\"msg\":\"([\u4e00-\u9fa5].+?)\"/)[1]; |
| 1164 | merge.subsidy.notify = `京东商城-金贴: 失败, ${msg||`原因: 未知`} ⚠️` |
| 1165 | } |
| 1166 | } |
| 1167 | } |
| 1168 | } catch (eor) { |
| 1169 | $nobyda.AnError("京东商城-金贴", "subsidy", eor, response, data) |
| 1170 | } finally { |
| 1171 | resolve() |
| 1172 | } |
| 1173 | }) |
| 1174 | }, s) |
| 1175 | if (out) setTimeout(resolve, out + s) |
| 1176 | }); |
| 1177 | } |
| 1178 | |
| 1179 | function JingRongDoll(s, key, title, code, type, num, award, belong) { |
| 1180 | merge[key] = {}; |