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

Function JDFlashSale

JD_DailyBonus.js:887–936  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

885}
886
887function JDFlashSale(s) {
888 merge.JDFSale = {};
889 return new Promise(resolve => {
890 if (disable("JDFSale")) return resolve()
891 setTimeout(() => {
892 const JDPETUrl = {
893 url: 'https://api.m.jd.com/client.action?functionId=partitionJdSgin',
894 headers: {
895 Cookie: KEY
896 },
897 body: "body=%7B%22version%22%3A%22v2%22%7D&client=apple&clientVersion=9.0.8&openudid=1fce88cd05c42fe2b054e846f11bdf33f016d676&sign=6768e2cf625427615dd89649dd367d41&st=1597248593305&sv=121"
898 };
899 $nobyda.post(JDPETUrl, async function(error, response, data) {
900 try {
901 if (error) {
902 throw new Error(error)
903 } else {
904 const Details = LogDetails ? "response:\n" + data : '';
905 const cc = JSON.parse(data)
906 if (cc.result && cc.result.code == 0) {
907 console.log("\n" + "京东商城-闪购签到成功 " + Details)
908 merge.JDFSale.bean = cc.result.jdBeanNum || 0
909 merge.JDFSale.notify = "京东商城-闪购: 成功, 明细: " + (merge.JDFSale.bean || "无") + "京豆 🐶"
910 merge.JDFSale.success = 1
911 } else {
912 console.log("\n" + "京东商城-闪购签到失败 " + Details)
913 if (data.match(/(已签到|已领取|\"2005\")/)) {
914 merge.JDFSale.notify = "京东商城-闪购: 失败, 原因: 已签过 ⚠️"
915 } else if (data.match(/不存在|已结束|\"2008\"|\"3001\"/)) {
916 await FlashSaleDivide(s); //瓜分京豆
917 return
918 } else if (data.match(/(\"code\":\"3\"|\"1003\")/)) {
919 merge.JDFSale.notify = "京东商城-闪购: 失败, 原因: Cookie失效‼️"
920 } else {
921 const msg = data.match(/\"msg\":\"([\u4e00-\u9fa5].+?)\"/)
922 merge.JDFSale.notify = `京东商城-闪购: 失败, ${msg ? msg[1] : `原因: 未知`} ⚠️`
923 }
924 merge.JDFSale.fail = 1
925 }
926 }
927 } catch (eor) {
928 $nobyda.AnError("京东商城-闪购", "JDFSale", eor, response, data)
929 } finally {
930 resolve()
931 }
932 })
933 }, s)
934 if (out) setTimeout(resolve, out + s)
935 });
936}
937
938function FlashSaleDivide(s) {
939 return new Promise(resolve => {

Callers 1

allFunction · 0.85

Calls 4

disableFunction · 0.85
FlashSaleDivideFunction · 0.85
postMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected