diff --git a/.github/workflows/deploy_tencent_scf.yml b/.github/workflows/deploy_tencent_scf.yml index b41fa481..883e53fa 100644 --- a/.github/workflows/deploy_tencent_scf.yml +++ b/.github/workflows/deploy_tencent_scf.yml @@ -25,6 +25,7 @@ jobs: - name: "将Secrets里面配置的变量添加到severless.yml里面作为环境变量" run: | + if [ $SCF_REGION ]; then sed -i "s/region:.*$/region: $SCF_REGION/g" serverless.yml; fi; if [ $JD_COOKIE ]; then sed -i "/variables/a\ JD_COOKIE: $JD_COOKIE" serverless.yml; fi; if [ $JD_DEBUG ]; then sed -i "/variables/a\ JD_DEBUG: $JD_DEBUG" serverless.yml; fi; if [ $JD_USER_AGENT ]; then sed -i "/variables/a\ JD_USER_AGENT: $JD_USER_AGENT" serverless.yml; fi; @@ -54,6 +55,7 @@ jobs: if [ $BOOKSHOP_SHARECODES ]; then sed -i "/variables/a\ BOOKSHOP_SHARECODES: $BOOKSHOP_SHARECODES" serverless.yml; fi; if [ $JD_CASH_SHARECODES ]; then sed -i "/variables/a\ JD_CASH_SHARECODES: $JD_CASH_SHARECODES" serverless.yml; fi; if [ $JXNC_SHARECODES ]; then sed -i "/variables/a\ JXNC_SHARECODES: $JXNC_SHARECODES" serverless.yml; fi; + if [ $JDNIAN_SHARECODES ]; then sed -i "/variables/a\ JDNIAN_SHARECODES: $JDNIAN_SHARECODES" serverless.yml; fi; if [ $JD_BEAN_STOP ]; then sed -i "/variables/a\ JD_BEAN_STOP: $JD_BEAN_STOP" serverless.yml; fi; if [ $JD_BEAN_SIGN_STOP_NOTIFY ]; then sed -i "/variables/a\ JD_BEAN_SIGN_STOP_NOTIFY: $JD_BEAN_SIGN_STOP_NOTIFY" serverless.yml; fi; if [ $JD_BEAN_SIGN_NOTIFY_SIMPLE ]; then sed -i "/variables/a\ JD_BEAN_SIGN_NOTIFY_SIMPLE: $JD_BEAN_SIGN_NOTIFY_SIMPLE" serverless.yml; fi; @@ -84,6 +86,7 @@ jobs: cat serverless.yml env env: #因为直接读取secrets里面的值很多字符不会自动转译,导致写入serverless.yml异常,所以设置到环境变量,在读取环境变量转译过的值 + SCF_REGION: ${{ secrets.SCF_REGION }} JD_COOKIE: ${{ secrets.JD_COOKIE}} JD_DEBUG: ${{ secrets.JD_DEBUG}} JD_USER_AGENT: ${{ secrets.JD_USER_AGENT}} @@ -113,6 +116,7 @@ jobs: BOOKSHOP_SHARECODES: ${{ secrets.BOOKSHOP_SHARECODES}} JD_CASH_SHARECODES: ${{ secrets.JD_CASH_SHARECODES}} JXNC_SHARECODES: ${{ secrets.JXNC_SHARECODES}} + JDNIAN_SHARECODES: ${{ secrets.JDNIAN_SHARECODES}} JD_BEAN_STOP: ${{ secrets.JD_BEAN_STOP}} JD_BEAN_SIGN_STOP_NOTIFY: ${{ secrets.JD_BEAN_SIGN_STOP_NOTIFY}} JD_BEAN_SIGN_NOTIFY_SIMPLE: ${{ secrets.JD_BEAN_SIGN_NOTIFY_SIMPLE}} diff --git a/Env.min.js b/Env.min.js index e478632d..32cd5dc6 100644 --- a/Env.min.js +++ b/Env.min.js @@ -1 +1 @@ -function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,o)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let o=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");o=o?1*o:20,o=e&&e.timeout?e.timeout:o;const[r,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":r,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),o=JSON.stringify(this.data);s?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(e,o):this.fs.writeFileSync(t,o)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return s;return o}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),o=s?this.getval(s):"";if(o)try{const t=JSON.parse(o);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(e),r=this.getval(i),h=i?"null"===r?null:r||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,o,t),s=this.setval(JSON.stringify(e),i)}catch(e){const r={};this.lodash_set(r,o,t),s=this.setval(JSON.stringify(r),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:o,body:r}=t;e(null,{status:s,statusCode:i,headers:o,body:r},r)},t=>e(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:o,body:r}=t;e(null,{status:s,statusCode:i,headers:o,body:r},r)},t=>e(t)))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:o,body:r}=t;e(null,{status:s,statusCode:i,headers:o,body:r},r)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:o,body:r}=t;e(null,{status:s,statusCode:i,headers:o,body:r},r)},t=>e(t))}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",o){const r=t=>{if(!t||!this.isLoon()&&this.isSurge())return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,r(o)):this.isQuanX()&&$notify(e,s,i,r(o)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file +function Env(t,e){process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/README.md b/README.md index 6dd31876..27c6f184 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,11 @@ > ***您使用或者复制了本仓库且本人制作的任何脚本,则视为`已接受`此声明,请仔细阅读*** ## Script脚本列表 + #### 说明 + 1. 其中 [jd_bean_sign.js](https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_bean_sign.js) 可N个京东账号,Node.js专用,核心脚本是JD_DailyBonus.js, IOS软件用户请使用NobyDa的 [JD_DailyBonus.js](https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js) + 2. 以字母排序。 | 活动时长 | 名称 | 脚本 | @@ -73,50 +76,63 @@ 搬运脚本 1. 【[@yangtingxiao](https://github.com/yangtingxiao)】京东抽奖机([jd_lotteryMachine.js](https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_lotteryMachine.js)) + 2. 【[@yangtingxiao](https://github.com/yangtingxiao)】京东排行榜([jd_rankingList.js](https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_rankingList.js)) **脚本兼容: [QuantumultX](https://apps.apple.com/us/app/quantumult-x/id1443988620), [Surge](https://apps.apple.com/us/app/surge-4/id1442620678), [Loon](https://apps.apple.com/us/app/loon/id1373567447), 小火箭, JSBox, Node.js** **TODO** + - [x] 所有活动互助码在一个脚本打印 ## 邀请码互助 - - [邀请码互助入口](https://github.com/LXK9301/jd_scripts/discussions) - - [获取各类活动互助码脚本 jd_get_share_code.js](https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_get_share_code.js) - - [邀请码使用规范](githubAction.md#互助码类环境变量)(仅限云端) + +- [邀请码互助入口](https://github.com/LXK9301/jd_scripts/discussions) + +- [获取各类活动互助码脚本 jd_get_share_code.js](https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_get_share_code.js) + +- [邀请码使用规范](githubAction.md#互助码类环境变量)(仅限云端) + ## 食用方法 -### 方法一:本地安装Node.js,下载本库脚本 +### 1. Docker1 - - 教程请见:[EvineDeng/jd-base](https://github.com/EvineDeng/jd-base),适用于以下系统: +- [部署方法](https://github.com/LXK9301/jd_scripts/tree/master/docker) - 1. Armbian/OpenWrt/Debian/Ubuntu/CentOS/Fedora/RedHat等Linux系统 - - 2. Android - - 3. MacOS +- [环境变量集合](https://github.com/LXK9301/jd_scripts/blob/master/githubAction.md) -### 方法二:Docker(NAS或VPS用户) - - - 可以精确控制任务运行时间,有二种办法:[docker办法一](https://github.com/LXK9301/jd_scripts/tree/master/docker)、[docker办法二(和本地安装Node.js类似)](https://github.com/EvineDeng/jd-base) - - [环境变量集合](https://github.com/LXK9301/jd_scripts/blob/master/githubAction.md) - -#### 注:以上2种运行机制都是Node.js,故您需仔细阅读下面几点 - - - 获取京东cookie教程可参考 [浏览器获取京东cookie教程](https://github.com/LXK9301/jd_scripts/blob/master/backUp/GetJdCookie.md) , [插件获取京东cookie教程](https://github.com/LXK9301/jd_scripts/blob/master/backUp/GetJdCookie2.md) - - - 京东APP扫码获取cookie(此种方式获取的cookie有效期为90天)(执行`node getJDCookie.js`即可) +- 获取京东cookie教程可参考: + + + [浏览器获取京东cookie教程](https://github.com/LXK9301/jd_scripts/blob/master/backUp/GetJdCookie.md) - - 方法二Docker安装Cookie请见各自的说明。 + + [插件获取京东cookie教程](https://github.com/LXK9301/jd_scripts/blob/master/backUp/GetJdCookie2.md) + + + 京东APP扫码获取cookie(此种方式获取的cookie有效期为90天)(执行`node getJDCookie.js`即可) -### 方法三:iOS系统的代理软件(QuantumultX, Surge, Loon, 小火箭) +### 2. Docker2 - - [京东cookie获取脚本 JD_extra_cookie.js](https://raw.githubusercontent.com/LXK9301/jd_scripts/master/JD_extra_cookie.js) +教程请见:[EvineDeng/jd-base](https://github.com/EvineDeng/jd-base) + +### 3. 系统直装 + +教程请见:[EvineDeng/jd-base](https://github.com/EvineDeng/jd-base),适用于以下系统: + + 1. Armbian/OpenWrt/Debian/Ubuntu/CentOS/Fedora/RedHat等Linux系统 + + 2. Android + + 3. MacOS + +### 4. iOS代理软件(QuantumultX, Surge, Loon, 小火箭) + +- [京东cookie获取脚本 JD_extra_cookie.js](https://raw.githubusercontent.com/LXK9301/jd_scripts/master/JD_extra_cookie.js) + +## 赞赏码(开发维护不易,请赏杯茶水费) -### 赞赏码(开发维护不易,请赏杯茶水费)
-### 特别感谢(排名不分先后): +## 特别感谢(排名不分先后): + * [@NobyDa](https://github.com/NobyDa) * [@chavyleung](https://github.com/chavyleung) @@ -127,5 +143,4 @@ * [@uniqueque](https://github.com/uniqueque) - * [@nzw9314](https://github.com/nzw9314) diff --git a/Surge/lxk0301_Task.sgmodule.sgmodule b/Surge/lxk0301_Task.sgmodule.sgmodule index f5c54e5a..f95e89d5 100644 --- a/Surge/lxk0301_Task.sgmodule.sgmodule +++ b/Surge/lxk0301_Task.sgmodule.sgmodule @@ -73,10 +73,10 @@ cron "30 8 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scrip #京东家庭号 京东家庭号 = type=cron,cronexp="1 * * * *",wake-system=1,timeout=2220,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_family.js #京东口袋书城 -口袋书店 = type=cron,cronexp="1 8,12,18 * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_bookshop.js +口袋书店 = type=cron,cronexp="12 8,12,18 * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_bookshop.js #京喜签到 京喜签到 = type=cron,cronexp="5 8 * * *",wake-system=1,timeout=1220,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jx_sign.js #以为为短期活动 #京东年货节 -京东年货节 = type=cron,cronexp="0 8 * * *",wake-system=1,timeout=2220,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nh.js +京东年货节 = type=cron,cronexp="20 8 * * *",wake-system=1,timeout=2220,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nh.js diff --git a/USER_AGENTS.js b/USER_AGENTS.js index 2752842b..81c33f92 100644 --- a/USER_AGENTS.js +++ b/USER_AGENTS.js @@ -1,58 +1,9 @@ const USER_AGENTS = [ - "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36", - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36", - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2226.0 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.4; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2225.0 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2225.0 Safari/537.36", - "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2224.3 Safari/537.36", - "Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.93 Safari/537.36", - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36", - "Mozilla/5.0 (Windows NT 4.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2049.0 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.67 Safari/537.36", - "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.67 Safari/537.36", - "Mozilla/5.0 (X11; OpenBSD i386) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36", - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1944.0 Safari/537.36", - "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.3319.102 Safari/537.36", - "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2309.372 Safari/537.36", - "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.2117.157 Safari/537.36", - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36", - "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1866.237 Safari/537.36", - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/4E423F", - "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36 Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10", - "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.517 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36", - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1664.3 Safari/537.36", - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1664.3 Safari/537.36", - "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.16 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1623.0 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.17 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36", - "Mozilla/5.0 (X11; CrOS i686 4319.74.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.57 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.2 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1468.0 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1467.0 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1464.0 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1500.55 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36", - "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36", - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36", - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.90 Safari/537.36", - "Mozilla/5.0 (X11; NetBSD) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36", - "Mozilla/5.0 (X11; CrOS i686 3912.101.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36", - "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.60 Safari/537.17", - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1309.0 Safari/537.17", - "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.15 (KHTML, like Gecko) Chrome/24.0.1295.0 Safari/537.15", - "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.14 (KHTML, like Gecko) Chrome/24.0.1292.0 Safari/537.14", - "JD4iPhone/167490 (iPhone; iOS 14.3; Scale/2.00)", "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0", "jdapp;android;9.3.5;10;2346663656561603-4353564623932316;network/wifi;model/ONEPLUS A5010;addressid/138709979;aid/2dfceea045ed292a;oaid/;osVer/29;appBuild/86390;partner/jingdong;eufv/1;Mozilla/5.0 (Linux; Android 10; ONEPLUS A5010 Build/QKQ1.191014.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", "jdapp;iPhone;9.3.4;14.3;88732f840b77821b345bf07fd71f609e6ff12f43;network/4g;ADID/1C141FDD-C62F-425B-8033-9AAB7E4AE6A3;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone11,8;addressid/2005183373;supportBestPay/0;appBuild/167502;jdSupportDarkMode/0;pv/414.19;apprpd/Babel_Native;ref/TTTChannelViewContoller;psq/5;ads/;psn/88732f840b77821b345bf07fd71f609e6ff12f43|1701;jdv/0|iosapp|t_335139774|appshare|CopyURL|1610885480412|1610885486;adk/;app_device/IOS;pap/JA2015_311210|9.3.4|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", + "jdapp;android;9.3.4;9;D266436653462-6665326466626;network/4g;model/Mi Note 3;addressid/137888479;aid/15225879b8538ee7;oaid/f3157082db9da676;osVer/28;appBuild/86388;partner/xiaomi001;eufv/1;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 9; Mi Note 3 Build/PKQ1.181007.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045131 Mobile Safari/537.36", + "jdapp;android;9.3.4;10;5353235373364666-4693734373436656;network/wifi;model/GM1910;addressid/993893557;aid/55257cdfd97474fe;oaid/;osVer/29;appBuild/86388;partner/oppo;eufv/1;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 10; GM1910 Build/QKQ1.190716.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36" ] /** * 生成随机数字 @@ -66,4 +17,4 @@ const USER_AGENT = USER_AGENTS[randomNumber(0, USER_AGENTS.length)]; module.exports = { USER_AGENT -} \ No newline at end of file +} diff --git a/docker/Readme.md b/docker/Readme.md index f46bccfc..48437d02 100644 --- a/docker/Readme.md +++ b/docker/Readme.md @@ -1,3 +1,4 @@ +![Docker Pulls](https://img.shields.io/docker/pulls/lxk0301/jd_scripts?style=for-the-badge) ### Usage ```diff + 2021-01-03更新 增加 CUSTOM_SHELL_FILE 参数配置执行自定义shell脚本 diff --git a/docker/crontab_list.sh b/docker/crontab_list.sh index 3db5ede5..803e1b17 100644 --- a/docker/crontab_list.sh +++ b/docker/crontab_list.sh @@ -6,6 +6,10 @@ ##############短期活动############## #年货节(活动时间:2021年1月9日-2021年2月9日) 10 8 * * * node /scripts/jd_nh.js >> /scripts/logs/jd_nh.log 2>&1 +#京东炸年兽集爆竹(活动时间:2021-1-18至2021-2-11)怕有遗漏故多运行几次 +0 * * * * node /scripts/jd_nian.js >> /scripts/logs/jd_nian.log 2>&1 +#专门收集每秒产生的爆竹(1小时运行一次) +30 * * * * node /scripts/jd_nianCollect.js >> /scripts/logs/jd_nianCollect.log 2>&1 ##############长期活动############## # 签到 0 0,18 * * * cd /scripts && node jd_bean_sign.js >> /scripts/logs/jd_bean_sign.log 2>&1 @@ -22,7 +26,7 @@ # 宠汪汪积分兑换奖品 0 0-16/8 * * * node /scripts/jd_joy_reward.js >> /scripts/logs/jd_joy_reward.log 2>&1 # 宠汪汪偷好友积分与狗粮 -0 0,6 * * * node /scripts/jd_joy_steal.js >> /scripts/logs/jd_joy_steal.log 2>&1 +0 0-10/2 * * * node /scripts/jd_joy_steal.js >> /scripts/logs/jd_joy_steal.log 2>&1 # 摇钱树 0 */2 * * * node /scripts/jd_moneyTree.js >> /scripts/logs/jd_moneyTree.log 2>&1 # 东东萌宠 diff --git a/docker/default_task.sh b/docker/default_task.sh index 8ccd94b3..63df090e 100644 --- a/docker/default_task.sh +++ b/docker/default_task.sh @@ -11,7 +11,7 @@ fi mergedListFile="/scripts/docker/merged_list_file.sh" echo "合并后定时任务文件路径为 ${mergedListFile}" -echo "第3步将默认定时任务列表添加到并后定时任务文件..." +echo "第1步将默认定时任务列表添加到并后定时任务文件..." cat $defaultListFile >$mergedListFile echo "第2步判断是否存在自定义任务任务列表并追加..." @@ -35,18 +35,19 @@ else echo "当前只使用了默认定时任务文件 $DEFAULT_LIST_FILE ..." fi +##可能存在旧版crontab里面有default_task.sh任务有就直接删除,否则可能会任务重复 +sed -i "/default_task.sh/d" $mergedListFile + echo "第3步判断是否配置了默认脚本更新任务..." -if [ $(grep -c "default_task.sh" $mergedListFile) -eq '0' ]; then +if [ $(grep -c "docker_entrypoint.sh" $mergedListFile) -eq '0' ]; then echo "合并后的定时任务文件,未包含必须的默认定时任务,增加默认定时任务..." echo -e >>$mergedListFile echo "52 */1 * * * docker_entrypoint.sh >> /scripts/logs/default_task.log 2>&1" >>$mergedListFile else - sed -i "/default_task.sh/d" $mergedListFile - echo "#脚本追加默认定时任务" >>$mergedListFile - echo "52 */1 * * * docker_entrypoint.sh >> /scripts/logs/default_task.log 2>&1" >>$mergedListFile + echo "已配置默认脚本更新任务。" fi -echo "第5步判断是否配置了随即延迟参数..." +echo "第4步判断是否配置了随即延迟参数..." if [ $RANDOM_DELAY_MAX ]; then if [ $RANDOM_DELAY_MAX -ge 1 ]; then echo "已设置随机延迟为 $RANDOM_DELAY_MAX , 设置延迟任务中..." @@ -56,7 +57,7 @@ else echo "未配置随即延迟对应的环境变量,故不设置延迟任务..." fi -echo "第6步判断是否配置自定义shell执行脚本..." +echo "第5步判断是否配置自定义shell执行脚本..." if [ 0"$CUSTOM_SHELL_FILE" = "0" ]; then echo "未配置自定shell脚本文件,跳过执行。" else @@ -79,14 +80,14 @@ else fi fi -echo "第7步增加 |ts 任务日志输出时间戳..." +echo "第6步增加 |ts 任务日志输出时间戳..." sed -i "/\( ts\| |ts\|| ts\)/!s/>>/\|ts >>/g" $mergedListFile -echo "第8步执行proc_file.sh脚本任务..." +echo "第7步执行proc_file.sh脚本任务..." sh -x /scripts/docker/proc_file.sh -echo "第9步加载最新的定时任务文件..." +echo "第8步加载最新的定时任务文件..." crontab $mergedListFile -echo "第10步将仓库的docker_entrypoint.sh脚本更新至系统/usr/local/bin/docker_entrypoint.sh内..." +echo "第9步将仓库的docker_entrypoint.sh脚本更新至系统/usr/local/bin/docker_entrypoint.sh内..." cat /scripts/docker/docker_entrypoint.sh >/usr/local/bin/docker_entrypoint.sh diff --git a/docker/docker_entrypoint.sh b/docker/docker_entrypoint.sh index 6fc71550..811b8556 100644 --- a/docker/docker_entrypoint.sh +++ b/docker/docker_entrypoint.sh @@ -11,7 +11,7 @@ cd /scripts git remote set-url origin $REPO_URL git reset --hard echo "git pull拉取最新代码..." -git -C /scripts pull +git -C /scripts pull --rebase echo "npm install 安装最新依赖" npm install --prefix /scripts diff --git a/githubAction.md b/githubAction.md index 6780d8b0..19f4656b 100644 --- a/githubAction.md +++ b/githubAction.md @@ -2,84 +2,87 @@ ##### 京东(必须) -| Name | 归属 | 属性 | 说明 | -| :---------------------: | :----------: | --------- | ------------------------------------------------------------ | -| `JD_COOKIE` | 京东 | 必须 | 京东cookie,多个账号的cookie使用`&`隔开或者换行。具体获取参考[浏览器获取京东cookie教程](https://github.com/LXK9301/jd_scripts/blob/master/backUp/GetJdCookie.md) 或者 [插件获取京东cookie教程](https://github.com/LXK9301/jd_scripts/blob/master/backUp/GetJdCookie2.md) | +| Name | 归属 | 属性 | 说明 | +| :---------: | :--: | ---- | ------------------------------------------------------------ | +| `JD_COOKIE` | 京东 | 必须 | 京东cookie,多个账号的cookie使用`&`隔开或者换行。具体获取参考[浏览器获取京东cookie教程](https://github.com/LXK9301/jd_scripts/blob/master/backUp/GetJdCookie.md) 或者 [插件获取京东cookie教程](https://github.com/LXK9301/jd_scripts/blob/master/backUp/GetJdCookie2.md) | ##### 京东隐私安全 环境变量 -| Name | 归属 | 属性 | 说明 | -| :---------------------: | :----------: | --------- | ------------------------------------------------------------ | -| `JD_DEBUG` | 脚本打印log | 非必须 | 运行脚本时,是否显示log,默认显示。改成false表示不显示,注重隐私的人可以在设置secret -> `Name:JD_DEBUG,Value:false` | -| `JD_USER_AGENT` | 京东 | 非必须 | 自定义此库里京东系列脚本的UserAgent,不懂不知不会UserAgent的请不要随意填写内容。如需使用此功能建议填写京东APP的UA | +| Name | 归属 | 属性 | 默认值 | 说明 | +| :-------------: | :---------: | :----: | :----: | ------------------------------------------------------------ | +| `JD_DEBUG` | 脚本打印log | 非必须 | true | 运行脚本时,是否显示log,默认显示。改成false表示不显示,注重隐私的人可以在设置secret -> `Name:JD_DEBUG,Value:false` | +| `JD_USER_AGENT` | 京东 | 非必须 | | 自定义此库里京东系列脚本的UserAgent,不懂不知不会UserAgent的请不要随意填写内容。如需使用此功能建议填写京东APP的UA | ##### 推送通知环境变量(目前提供`微信server酱`、`pushplus(推送加)`、`iOS Bark APP`、`telegram机器人`、`钉钉机器人`、`企业微信机器人`、`iGot`、`QQ酷推`等通知方式) -| Name | 归属 | 属性 | 说明 | -| :---------------------: | :----------: | --------- | ------------------------------------------------------------ | -| `PUSH_KEY` | 微信server酱推送 | 非必须 | server酱的微信通知[官方文档](http://sc.ftqq.com/3.version) | -| `BARK_PUSH` | [BARK推送](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) | 非必须 | IOS用户下载BARK这个APP,填写内容是app提供的`设备码`,例如:https://api.day.app/123 ,那么此处的设备码就是`123`,再不懂看 [这个图](icon/bark.jpg)(注:支持自建填完整链接即可) | -| `BARK_SOUND` | [BARK推送](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) | 非必须 | bark推送声音设置,例如`choo`,具体值请在`bark`-`推送铃声`-`查看所有铃声` | -| `TG_BOT_TOKEN` | telegram推送 | 非必须 | tg推送(需设备可连接外网),`TG_BOT_TOKEN`和`TG_USER_ID`两者必需,填写自己申请[@BotFather](https://t.me/BotFather)的Token,如`10xxx4:AAFcqxxxxgER5uw` , [具体教程](./backUp/TG_PUSH.md) | -| `TG_USER_ID` | telegram推送 | 非必须 | tg推送(需设备可连接外网),`TG_BOT_TOKEN`和`TG_USER_ID`两者必需,填写[@getuseridbot](https://t.me/getuseridbot)中获取到的纯数字ID, [具体教程](./backUp/TG_PUSH.md) | -| `DD_BOT_TOKEN` | 钉钉推送 | 非必须 | 钉钉推送(`DD_BOT_TOKEN`和`DD_BOT_SECRET`两者必需)[官方文档](https://ding-doc.dingtalk.com/doc#/serverapi2/qf2nxq) ,只需`https://oapi.dingtalk.com/robot/send?access_token=XXX` 等于`=`符号后面的XXX即可 | -| `DD_BOT_SECRET` | 钉钉推送 | 非必须 | (`DD_BOT_TOKEN`和`DD_BOT_SECRET`两者必需) ,密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的`SECXXXXXXXXXX`等字符 , 注:钉钉机器人安全设置只需勾选`加签`即可,其他选项不要勾选,再不懂看 [这个图](icon/DD_bot.png) | -| `QYWX_KEY` | 企业微信推送 | 非必须 | 密钥,企业微信推送 webhook 后面的 key [详见官方说明文档](https://work.weixin.qq.com/api/doc/90000/90136/91770) | -| `IGOT_PUSH_KEY` | iGot推送 | 非必须 | iGot聚合推送,支持多方式推送,确保消息可达。 [参考文档](https://wahao.github.io/Bark-MP-helper ) | -| `QQ_SKEY` | 酷推(Cool Push)推送 | 非必须 | 推送所需的Skey,登录后获取Skey [参考文档](https://cp.xuthus.cc/) | -| `QQ_MODE` | 酷推(Cool Push)推送 | 非必须 | 推送方式(send或group或者wx,默认send) [参考文档](https://cp.xuthus.cc/) | -| `PUSH_PLUS_TOKEN` | pushplus推送 | 非必须 | 微信扫码登录后一对一推送或一对多推送下面的token(您的Token) [官方网站](http://pushplus.hxtrip.com/) | -| `PUSH_PLUS_USER` | pushplus推送 | 非必须 | 一对多推送的“群组编码”(一对多推送下面->您的群组(如无则新建)->群组编码)注:(1、需订阅者扫描二维码 2、如果您是创建群组所属人,也需点击“查看二维码”扫描绑定,否则不能接受群组消息推送),只填`PUSH_PLUS_TOKEN`默认为一对一推送 | -| `TG_PROXY_HOST` | Telegram 代理的 IP | 非必须 | 代理类型为 http。例子:http代理 http://127.0.0.1:1080 则填写 127.0.0.1 | -| `TG_PROXY_PORT` | Telegram 代理的端口 | 非必须 | 例子:http代理 http://127.0.0.1:1080 则填写 1080 | +| Name | 归属 | 属性 | 说明 | +| :---------------: | :----------------------------------------------------------: | :----: | ------------------------------------------------------------ | +| `PUSH_KEY` | 微信server酱推送 | 非必须 | server酱的微信通知[官方文档](http://sc.ftqq.com/3.version) | +| `BARK_PUSH` | [BARK推送](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) | 非必须 | IOS用户下载BARK这个APP,填写内容是app提供的`设备码`,例如:https://api.day.app/123 ,那么此处的设备码就是`123`,再不懂看 [这个图](icon/bark.jpg)(注:支持自建填完整链接即可) | +| `BARK_SOUND` | [BARK推送](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) | 非必须 | bark推送声音设置,例如`choo`,具体值请在`bark`-`推送铃声`-`查看所有铃声` | +| `TG_BOT_TOKEN` | telegram推送 | 非必须 | tg推送(需设备可连接外网),`TG_BOT_TOKEN`和`TG_USER_ID`两者必需,填写自己申请[@BotFather](https://t.me/BotFather)的Token,如`10xxx4:AAFcqxxxxgER5uw` , [具体教程](./backUp/TG_PUSH.md) | +| `TG_USER_ID` | telegram推送 | 非必须 | tg推送(需设备可连接外网),`TG_BOT_TOKEN`和`TG_USER_ID`两者必需,填写[@getuseridbot](https://t.me/getuseridbot)中获取到的纯数字ID, [具体教程](./backUp/TG_PUSH.md) | +| `DD_BOT_TOKEN` | 钉钉推送 | 非必须 | 钉钉推送(`DD_BOT_TOKEN`和`DD_BOT_SECRET`两者必需)[官方文档](https://ding-doc.dingtalk.com/doc#/serverapi2/qf2nxq) ,只需`https://oapi.dingtalk.com/robot/send?access_token=XXX` 等于`=`符号后面的XXX即可 | +| `DD_BOT_SECRET` | 钉钉推送 | 非必须 | (`DD_BOT_TOKEN`和`DD_BOT_SECRET`两者必需) ,密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的`SECXXXXXXXXXX`等字符 , 注:钉钉机器人安全设置只需勾选`加签`即可,其他选项不要勾选,再不懂看 [这个图](icon/DD_bot.png) | +| `QYWX_KEY` | 企业微信推送 | 非必须 | 密钥,企业微信推送 webhook 后面的 key [详见官方说明文档](https://work.weixin.qq.com/api/doc/90000/90136/91770) | +| `IGOT_PUSH_KEY` | iGot推送 | 非必须 | iGot聚合推送,支持多方式推送,确保消息可达。 [参考文档](https://wahao.github.io/Bark-MP-helper ) | +| `QQ_SKEY` | 酷推(Cool Push)推送 | 非必须 | 推送所需的Skey,登录后获取Skey [参考文档](https://cp.xuthus.cc/) | +| `QQ_MODE` | 酷推(Cool Push)推送 | 非必须 | 推送方式(send或group或者wx,默认send) [参考文档](https://cp.xuthus.cc/) | +| `PUSH_PLUS_TOKEN` | pushplus推送 | 非必须 | 微信扫码登录后一对一推送或一对多推送下面的token(您的Token) [官方网站](http://pushplus.hxtrip.com/) | +| `PUSH_PLUS_USER` | pushplus推送 | 非必须 | 一对多推送的“群组编码”(一对多推送下面->您的群组(如无则新建)->群组编码)注:(1、需订阅者扫描二维码 2、如果您是创建群组所属人,也需点击“查看二维码”扫描绑定,否则不能接受群组消息推送),只填`PUSH_PLUS_TOKEN`默认为一对一推送 | +| `TG_PROXY_HOST` | Telegram 代理的 IP | 非必须 | 代理类型为 http。例子:http代理 http://127.0.0.1:1080 则填写 127.0.0.1 | +| `TG_PROXY_PORT` | Telegram 代理的端口 | 非必须 | 例子:http代理 http://127.0.0.1:1080 则填写 1080 | ##### 互助码类环境变量 -| Name | 归属 | 属性 | 说明 | -| --------------------------- | ------------------ | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `FRUITSHARECODES` | 东东农场互助码 | 非必须 | 填写规则请看[jdFruitShareCodes.js](https://github.com/LXK9301/jd_scripts/blob/master/jdFruitShareCodes.js)或见下方[互助码的填写规则](#互助码的填写规则) | -| `PETSHARECODES` | 东东萌宠互助码 | 非必须 | 填写规则请看[jdPetShareCodes.js](https://github.com/LXK9301/jd_scripts/blob/master/jdPetShareCodes.js)或见下方[互助码的填写规则](#互助码的填写规则) | -| `PLANT_BEAN_SHARECODES` | 种豆得豆互助码 | 非必须 | 填写规则请看[jdPlantBeanShareCodes.js](https://github.com/LXK9301/jd_scripts/blob/master/jdPlantBeanShareCodes.js)或见下方[互助码的填写规则](#互助码的填写规则) | -| `SUPERMARKET_SHARECODES` | 东东超市商圈互助码 | 非必须 | 填写规则请看[jdSuperMarketShareCodes.js](https://github.com/LXK9301/jd_scripts/blob/master/jdSuperMarketShareCodes.js)或见下方[互助码的填写规则](#互助码的填写规则) | -| `DDFACTORY_SHARECODES` | 东东工厂互助码 | 非必须 | 填写规则请看[jdFactoryShareCodes.js](https://github.com/LXK9301/jd_scripts/blob/master/jdFactoryShareCodes.js)或见下方[互助码的填写规则](#互助码的填写规则) | -| `DREAM_FACTORY_SHARE_CODES` | 京喜工厂互助码 | 非必须 | 填写规则请看[jdDreamFactoryShareCodes.js](https://github.com/LXK9301/jd_scripts/blob/master/jdDreamFactoryShareCodes.js)或见下方[互助码的填写规则](#互助码的填写规则) | -| `JDZZ_SHARECODES` | 京东赚赚互助码 | 非必须 | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) | -| `JDJOY_SHARECODES` | 疯狂的JOY互助码 | 非必须 | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) | -| `BOOKSHOP_SHARECODES` | 京东书店互助码 | 非必须 | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) | -| `JD_CASH_SHARECODES` | 签到领现金互助码 | 非必须 | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) | -| `JXNC_SHARECODES` | 京喜农场互助码 | 非必须 | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) | +| Name | 归属 | 属性 | 需要助力次数/提供助力次数 | 说明 | +| :-------------------------: | :----------------: | :----: | :-----------------------: | ------------------------------------------------------------ | +| `FRUITSHARECODES` | 东东农场互助码 | 非必须 | 5/4 | 填写规则请看[jdFruitShareCodes.js](https://github.com/LXK9301/jd_scripts/blob/master/jdFruitShareCodes.js)或见下方[互助码的填写规则](#互助码的填写规则) | +| `PETSHARECODES` | 东东萌宠互助码 | 非必须 | 5/5 | 填写规则请看[jdPetShareCodes.js](https://github.com/LXK9301/jd_scripts/blob/master/jdPetShareCodes.js)或见下方[互助码的填写规则](#互助码的填写规则) | +| `PLANT_BEAN_SHARECODES` | 种豆得豆互助码 | 非必须 | 9/3 | 填写规则请看[jdPlantBeanShareCodes.js](https://github.com/LXK9301/jd_scripts/blob/master/jdPlantBeanShareCodes.js)或见下方[互助码的填写规则](#互助码的填写规则) | +| `SUPERMARKET_SHARECODES` | 东东超市商圈互助码 | 非必须 | / | 填写规则请看[jdSuperMarketShareCodes.js](https://github.com/LXK9301/jd_scripts/blob/master/jdSuperMarketShareCodes.js)或见下方[互助码的填写规则](#互助码的填写规则) | +| `DDFACTORY_SHARECODES` | 东东工厂互助码 | 非必须 | 5/3 | 填写规则请看[jdFactoryShareCodes.js](https://github.com/LXK9301/jd_scripts/blob/master/jdFactoryShareCodes.js)或见下方[互助码的填写规则](#互助码的填写规则) | +| `DREAM_FACTORY_SHARE_CODES` | 京喜工厂互助码 | 非必须 | 不固定/3 | 填写规则请看[jdDreamFactoryShareCodes.js](https://github.com/LXK9301/jd_scripts/blob/master/jdDreamFactoryShareCodes.js)或见下方[互助码的填写规则](#互助码的填写规则) | +| `JDZZ_SHARECODES` | 京东赚赚互助码 | 非必须 | 5/2 | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) | +| `JDJOY_SHARECODES` | 疯狂的JOY互助码 | 非必须 | 6/ | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) | +| `BOOKSHOP_SHARECODES` | 京东书店互助码 | 非必须 | 10/ | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) | +| `JD_CASH_SHARECODES` | 签到领现金互助码 | 非必须 | 10/ | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) | +| `JXNC_SHARECODES` | 京喜农场互助码 | 非必须 | / | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) | +| `JDNIAN_SHARECODES` | 炸年兽互助码 | 非必须 | 10/ | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) | ##### 控制脚本功能环境变量 -| Name | 归属 | 属性 | 说明 | -| ---------------------------- | --------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `JD_BEAN_STOP` | 京东 | 非必须 | `jd_bean_sign.js`自定义延迟签到,单位毫秒.默认分批并发无延迟.延迟作用于每个签到接口,如填入延迟则切换顺序签到(耗时较长),如需填写建议输入数字`1`,详见[此处说明](https://github.com/NobyDa/Script/blob/master/JD-DailyBonus/JD_DailyBonus.js#L93) | -| `JD_BEAN_SIGN_STOP_NOTIFY` | 京东 | 非必须 | `jd_bean_sign.js`脚本运行后不推送签到结果通知,默认推送,填`true`表示不发送通知 | -| `JD_BEAN_SIGN_NOTIFY_SIMPLE` | 京东 | 非必须 | `jd_bean_sign.js`脚本运行后推送签到结果简洁版通知,默认推送全部签到结果,填`true`表示推送简洁通知,[效果图](./icon/bean_sign_simple.jpg) | -| `PET_NOTIFY_CONTROL` | 东东萌宠推送开关 | 非必须 | 控制京东萌宠是否静默运行,`false`为否(发送推送通知消息),`true`为是(即:不发送推送通知消息) | -| `FRUIT_NOTIFY_CONTROL` | 东东农场推送开关 | 非必须 | 控制京东农场是否静默运行,`false`为否(发送推送通知消息),`true`为是(即:不发送推送通知消息) | -| `JD_JOY_REWARD_NOTIFY` | 宠汪汪兑换京豆推送开关 | 非必须 | 控制`jd_joy_reward.js`脚本是否静默运行,`false`为否(发送推送通知消息),`true`为是(即:不发送推送通知消息) | -| `JD_818_SHAREID_NOTIFY` | 京东818互助码通知开关 | 非必须 | 控制`jd_818.js`脚本是否在获取互助码后通知,`true`为是(发送推送通知消息),`false`为否(即:不发送推送通知消息) | -| `JOY_FEED_COUNT` | 宠汪汪喂食数量 | 非必须 | 控制`jd_joy_feedPets.js`脚本喂食数量,可以填的数字10,20,40,80,其他数字不可. | -| `JOY_HELP_FEED` | 宠汪汪帮好友喂食 | 非必须 | 控制`jd_joy_steal.js`脚本是否给好友喂食,`false`为否,`true`为是(给好友喂食) | -| `JOY_RUN_FLAG` | 宠汪汪是否赛跑 | 非必须 | 控制`jd_joy.js`脚本是否参加赛跑(默认参加双人赛跑),`false`为否,`true`为是,脚本默认是`true` | -| `JOY_TEAM_LEVEL` | 宠汪汪参加什么级别的赛跑 | 非必须 | 控制`jd_joy.js`脚本参加几人的赛跑,可选数字为`2`,`10`,`50`,其中2代表参加双人PK赛,10代表参加10人突围赛,50代表参加50人挑战赛(注:此项功能在`JOY_RUN_FLAG`为true的时候才生效),如若想设置不同账号参加不同类别的比赛则用&区分即可(如下三个账号:`2&10&50`) | -| `JD_JOY_REWARD_NAME` | 宠汪汪积分兑换多少京豆 | 非必须 | 目前可填值为`20`或者`500`,脚本默认`20`,`0`表示不兑换京豆 | -| `MARKET_COIN_TO_BEANS` | 京小超兑换京豆数量 | 非必须 | 控制`jd_blueCoin.js`兑换京豆数量,可输入值为`20`或者`1000`的数字或者其他商品的名称,例如`碧浪洗衣凝珠` | -| `MARKET_REWARD_NOTIFY` | 京小超兑换奖品推送开关 | 非必须 | 控制`jd_blueCoin.js`兑换奖品成功后是否静默运行,`false`为否(发送推送通知消息),`true`为是(即:不发送推送通知消息) | -| `SUPERMARKET_UPGRADE` | 京小超自动升级 | 非必须 | 自动升级,顺序:解锁升级商品、升级货架,`true`表示自动升级,`false`表示关闭自动升级 | -| `BUSINESS_CIRCLE_JUMP` | 京小超自动更换商圈 | 非必须 | 小于对方300热力值自动更换商圈队伍,`true`表示运行,`false`表示禁止 | -| `SUPERMARKET_LOTTERY` | 京小超抽奖 | 非必须 | 每天运行脚本是否使用金币去抽奖,`true`表示抽奖,`false`表示不抽奖 | -| `FRUIT_BEAN_CARD` | 农场使用水滴换豆卡 | 非必须 | 农场使用水滴换豆卡(如果出现限时活动时100g水换20豆,此时比浇水划算,推荐换豆),`true`表示换豆(不浇水),`false`表示不换豆(继续浇水),脚本默认是浇水 | -| `UN_SUBSCRIBES` | jd_unsubscribe.js | 非必须 | 共四个参数,换行隔开.四个参数分别表示`取关商品数量`,`取关店铺数量`,`遇到此商品不再进行取关`,`遇到此店铺不再进行取关`,[具体使用往下看](#取关店铺secret的说明) | -| `UN_BIND_CARD_NUM` | jd_unbind.js | 非必须 | 注销京东已开的店铺会员,不是注销京东plus会员,个别店铺无法注销。此参数控制每次运行脚本时注销多少个店铺会员,默认200。 | -| `UN_BIND_STOP_CARD` | jd_unbind.js | 非必须 | 注销京东已开的店铺会员,不是注销京东plus会员,个别店铺无法注销。遇到此参数设定的会员卡则跳过不注销,多个会员卡之间以`&`分隔,默认值"京东PLUS会员"。 | -| `JDJOY_HELPSELF` | 疯狂的JOY | 非必须 | 疯狂的JOY循环助力,`true`表示循环助力,`false`表示不循环助力,默认不开启循环助力。 | -| `JDJOY_APPLYJDBEAN` | 疯狂的JOY | 非必须 | 疯狂的JOY京豆兑换,目前最小值为2000京豆(详情请查看活动页面-提现京豆),默认数字`0`不开启京豆兑换。 | -| `BUY_JOY_LEVEL` | 疯狂的JOY | 非必须 | 疯狂的JOY自动购买什么等级的JOY | -| `MONEY_TREE_SELL_FRUIT` | 摇钱树是否卖出金果 | 非必须 | 控制摇钱树脚本是否自动卖出金果兑换成金币,`true`卖出,`false`不卖出,默认`false` | -| `FACTORAY_WANTPRODUCT_NAME` | 东东工厂心仪商品 | 非必须 | 提供心仪商品名称(请尽量填写完整和别的商品有区分度),达到条件后兑换,如不提供则会兑换当前所选商品 | -| `JXNCTOKENS` | 京喜农场TOKEN | 非必须 | 每个账号 token 是一个 json,示例:{"farm_jstoken":"749a90f871adsfads8ffda7bf3b1576760","timestamp":"1610165423873","phoneid":"42c7e3dadfadsfdsaac-18f0e4f4a0cf"},多账单间使用`&`或换行分开。 | + +| Name | 归属 | 属性 | 说明 | +| :--------------------------: | :--------------------------: | :----: | ------------------------------------------------------------ | +| `JD_BEAN_STOP` | 京东 | 非必须 | `jd_bean_sign.js`自定义延迟签到,单位毫秒.默认分批并发无延迟,
延迟作用于每个签到接口,如填入延迟则切换顺序签到(耗时较长),
如需填写建议输入数字`1`,详见[此处说明](https://github.com/NobyDa/Script/blob/master/JD-DailyBonus/JD_DailyBonus.js#L93) | +| `JD_BEAN_SIGN_STOP_NOTIFY` | 京东 | 非必须 | `jd_bean_sign.js`脚本运行后不推送签到结果通知,默认推送,填`true`表示不发送通知 | +| `JD_BEAN_SIGN_NOTIFY_SIMPLE` | 京东 | 非必须 | `jd_bean_sign.js`脚本运行后推送签到结果简洁版通知,
默认推送全部签到结果,填`true`表示推送简洁通知,[效果图](./icon/bean_sign_simple.jpg) | +| `PET_NOTIFY_CONTROL` | 东东萌宠
推送开关 | 非必须 | 控制京东萌宠是否静默运行,
`false`为否(发送推送通知消息),`true`为是(即:不发送推送通知消息) | +| `FRUIT_NOTIFY_CONTROL` | 东东农场
推送开关 | 非必须 | 控制京东农场是否静默运行,
`false`为否(发送推送通知消息),`true`为是(即:不发送推送通知消息) | +| `JD_JOY_REWARD_NOTIFY` | 宠汪汪
兑换京豆推送开关 | 非必须 | 控制`jd_joy_reward.js`脚本是否静默运行,
`false`为否(发送推送通知消息),`true`为是(即:不发送推送通知消息) | +| `JD_818_SHAREID_NOTIFY` | 京东818互助码
通知开关 | 非必须 | 控制`jd_818.js`脚本是否在获取互助码后通知,
`true`为是(发送推送通知消息),`false`为否(即:不发送推送通知消息) | +| `JOY_FEED_COUNT` | 宠汪汪喂食数量 | 非必须 | 控制`jd_joy_feedPets.js`脚本喂食数量,可以填的数字10,20,40,80,其他数字不可. | +| `JOY_HELP_FEED` | 宠汪汪帮好友喂食 | 非必须 | 控制`jd_joy_steal.js`脚本是否给好友喂食,`false`为否,`true`为是(给好友喂食) | +| `JOY_RUN_FLAG` | 宠汪汪是否赛跑 | 非必须 | 控制`jd_joy.js`脚本是否参加赛跑(默认参加双人赛跑),
`false`为否,`true`为是,脚本默认是`true` | +| `JOY_TEAM_LEVEL` | 宠汪汪
参加什么级别的赛跑 | 非必须 | 控制`jd_joy.js`脚本参加几人的赛跑,可选数字为`2`,`10`,`50`,
其中2代表参加双人PK赛,10代表参加10人突围赛,
50代表参加50人挑战赛(注:此项功能在`JOY_RUN_FLAG`为true的时候才生效),
如若想设置不同账号参加不同类别的比赛则用&区分即可(如下三个账号:`2&10&50`) | +| `JD_JOY_REWARD_NAME` | 宠汪汪
积分兑换多少京豆 | 非必须 | 目前可填值为`20`或者`500`,脚本默认`20`,`0`表示不兑换京豆 | +| `MARKET_COIN_TO_BEANS` | 京小超
兑换京豆数量 | 非必须 | 控制`jd_blueCoin.js`兑换京豆数量,
可输入值为`20`或者`1000`的数字或者其他商品的名称,例如`碧浪洗衣凝珠` | +| `MARKET_REWARD_NOTIFY` | 京小超
兑换奖品推送开关 | 非必须 | 控制`jd_blueCoin.js`兑换奖品成功后是否静默运行,
`false`为否(发送推送通知消息),`true`为是(即:不发送推送通知消息) | +| `SUPERMARKET_UPGRADE` | 京小超自动升级 | 非必须 | 自动升级,顺序:解锁升级商品、升级货架,`true`表示自动升级,`false`表示关闭自动升级 | +| `BUSINESS_CIRCLE_JUMP` | 京小超
自动更换商圈 | 非必须 | 小于对方300热力值自动更换商圈队伍,`true`表示运行,`false`表示禁止 | +| `SUPERMARKET_LOTTERY` | 京小超抽奖 | 非必须 | 每天运行脚本是否使用金币去抽奖,`true`表示抽奖,`false`表示不抽奖 | +| `FRUIT_BEAN_CARD` | 农场
使用水滴换豆卡 | 非必须 | 农场使用水滴换豆卡(如果出现限时活动时100g水换20豆,此时比浇水划算,推荐换豆),
`true`表示换豆(不浇水),`false`表示不换豆(继续浇水),脚本默认是浇水 | +| `UN_SUBSCRIBES` | jd_unsubscribe.js | 非必须 | 共四个参数,换行隔开.四个参数分别表示
`取关商品数量`,`取关店铺数量`,`遇到此商品不再进行取关`,`遇到此店铺不再进行取关`,[具体使用往下看](#取关店铺secret的说明) | +| `UN_BIND_CARD_NUM` | jd_unbind.js | 非必须 | 注销京东已开的店铺会员,不是注销京东plus会员,个别店铺无法注销。
此参数控制每次运行脚本时注销多少个店铺会员,默认200。 | +| `UN_BIND_STOP_CARD` | jd_unbind.js | 非必须 | 注销京东已开的店铺会员,不是注销京东plus会员,个别店铺无法注销。
遇到此参数设定的会员卡则跳过不注销,多个会员卡之间以`&`分隔,默认值"京东PLUS会员"。 | +| `JDJOY_HELPSELF` | 疯狂的JOY
循环助力 | 非必须 | 疯狂的JOY循环助力,`true`表示循环助力,`false`表示不循环助力,默认不开启循环助力。 | +| `JDJOY_APPLYJDBEAN` | 疯狂的JOY
京豆兑换 | 非必须 | 疯狂的JOY京豆兑换,目前最小值为2000京豆(详情请查看活动页面-提现京豆),
默认数字`0`不开启京豆兑换。 | +| `BUY_JOY_LEVEL` | 疯狂的JOY
购买joy等级 | 非必须 | 疯狂的JOY自动购买什么等级的JOY | +| `MONEY_TREE_SELL_FRUIT` | 摇钱树
是否卖出金果 | 非必须 | 控制摇钱树脚本是否自动卖出金果兑换成金币,`true`卖出,`false`不卖出,默认`false` | +| `FACTORAY_WANTPRODUCT_NAME` | 东东工厂
心仪商品 | 非必须 | 提供心仪商品名称(请尽量填写完整和别的商品有区分度),达到条件后兑换,
如不提供则会兑换当前所选商品 | +| `JXNCTOKENS` | 京喜农场TOKEN | 非必须 | 每个账号 token 是一个 json,json 需要用单引号包裹且是一行字符串,
否则设置环境变量时会出错,示例:'{"farm_jstoken":"749a90f871adsfads8ffda7bf3b1576760",
"timestamp":"1610165423873",
"phoneid":"42c7e3dadfadsfdsaac-18f0e4f4a0cf"}',多账单间使用`&`或换行分开。 | + ##### 互助码的填写规则 diff --git a/jd_bean_sign.js b/jd_bean_sign.js index 9c26d6ef..a06b2d3b 100644 --- a/jd_bean_sign.js +++ b/jd_bean_sign.js @@ -4,7 +4,7 @@ /* 京豆签到,自用,可N个京东账号,IOS软件用户请使用 https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js Node.JS专用 -更新时间:2021-1-7 +更新时间:2021-1-19 从 github @ruicky改写而来 version v0.0.1 create by ruicky @@ -124,7 +124,20 @@ async function downFile () { url = 'https://cdn.jsdelivr.net/gh/NobyDa/Script@master/JD-DailyBonus/JD_DailyBonus.js'; } try { - await download(url, outPutUrl); + const options = {} + if (process.env.TG_PROXY_HOST && process.env.TG_PROXY_PORT) { + const tunnel = require("tunnel"); + const agent = { + https: tunnel.httpsOverHttp({ + proxy: { + host: process.env.TG_PROXY_HOST, + port: process.env.TG_PROXY_PORT * 1 + } + }) + } + Object.assign(options, { agent }) + } + await download(url, outPutUrl, options); console.log('文件下载完毕'); } catch (e) { console.log("文件下载异常:" + e); @@ -201,7 +214,20 @@ function TotalBean() { } function downloadUrl(url = 'https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js') { return new Promise(resolve => { - $.get({url}, async (err, resp, data) => { + const options = { url }; + if (process.env.TG_PROXY_HOST && process.env.TG_PROXY_PORT) { + const tunnel = require("tunnel"); + const agent = { + https: tunnel.httpsOverHttp({ + proxy: { + host: process.env.TG_PROXY_HOST, + port: process.env.TG_PROXY_PORT * 1 + } + }) + } + Object.assign(options, { agent }) + } + $.get(options, async (err, resp, data) => { try { if (err) { console.log(`${JSON.stringify(err)}`) @@ -238,4 +264,5 @@ function timeFormat(time) { } return date.getFullYear() + '-' + ((date.getMonth() + 1) >= 10 ? (date.getMonth() + 1) : '0' + (date.getMonth() + 1)) + '-' + (date.getDate() >= 10 ? date.getDate() : '0' + date.getDate()); } + function Env(t,e){process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/jd_dreamFactory.js b/jd_dreamFactory.js index f3afe082..149ae051 100644 --- a/jd_dreamFactory.js +++ b/jd_dreamFactory.js @@ -1,6 +1,6 @@ /* 京东京喜工厂 -更新时间:2021-1-17 +更新时间:2021-1-19 活动入口 :京东APP->游戏与互动->查看更多->京喜工厂 或者: 京东APP首页搜索 "玩一玩" ,造物工厂即可 @@ -894,6 +894,10 @@ async function tuanActivity() { const QueryTuanRes = await QueryTuan(activeId, tuanId); if (QueryTuanRes && QueryTuanRes.ret === 0) { const { tuanInfo } = QueryTuanRes.data; + if ((tuanInfo && tuanInfo[0]['endTime']) <= QueryTuanRes['nowTime'] && surplusOpenTuanNum > 0) { + $.log(`之前的团已过期,准备重新开团\n`) + await CreateTuan(); + } for (let item of tuanInfo) { const { realTuanNum, tuanNum, userInfo } = item; $.log(`\n开团情况:${realTuanNum}/${tuanNum}\n`); @@ -1024,6 +1028,7 @@ function CreateTuan() { data = JSON.parse(data); if (data['ret'] === 0) { console.log(`开团成功tuanId为\n${data.data['tuanId']}`); + $.tuanIds.push(data.data['tuanId']); } else { console.log(`异常:${JSON.stringify(data)}`); } diff --git a/jd_joy.js b/jd_joy.js index 1d164907..035051f3 100644 --- a/jd_joy.js +++ b/jd_joy.js @@ -121,7 +121,7 @@ async function deskGoodsTask() { } } } else { - console.log(`限时商品货架已下架`); + console.log(`\n限时商品货架已下架`); } } } @@ -220,13 +220,50 @@ async function petTask() { //每日签到 if (item['taskType'] === 'SignEveryDay') { if (item['receiveStatus'] === 'chance_left') { - console.log('未完成,需要自己手动去微信小程序【来客有礼】签到,可获得京豆奖励') + console.log('每日签到未完成,需要自己手动去微信小程序【来客有礼】签到,可获得京豆奖励') } else if (item['receiveStatus'] === 'unreceive') { //已签到,领取签到后的狗粮 const res = await getFood('SignEveryDay'); console.log(`领取每日签到狗粮结果:${res.data}`); } } + //每日赛跑 + if (item['taskType'] === 'race') { + if (item['receiveStatus'] === 'chance_left') { + console.log('每日赛跑未完成') + } else if (item['receiveStatus'] === 'unreceive') { + const res = await getFood('race'); + console.log(`领取每日赛跑狗粮结果:${res.data}`); + } + } + //每日兑换 + if (item['taskType'] === 'exchange') { + if (item['receiveStatus'] === 'chance_left') { + console.log('每日兑换未完成') + } else if (item['receiveStatus'] === 'unreceive') { + const res = await getFood('exchange'); + console.log(`领取每日兑换狗粮结果:${res.data}`); + } + } + //每日帮好友喂一次狗粮 + if (item['taskType'] === 'HelpFeed') { + if (item['receiveStatus'] === 'chance_left') { + console.log('每日帮好友喂一次狗粮未完成') + } else if (item['receiveStatus'] === 'unreceive') { + const res = await getFood('HelpFeed'); + console.log(`领取每日帮好友喂一次狗粮 狗粮结果:${res.data}`); + } + } + //每日喂狗粮 + if (item['taskType'] === 'FeedEveryDay') { + if (item['taskStatus'] === 'processing') { + console.log(`\n${item['taskName']}任务进行中\n`) + } else if (item['receiveStatus'] === 'unreceive') { + const res = await getFood('FeedEveryDay'); + console.log(`领取每日帮好友喂一次狗粮 狗粮结果:${res.data}`); + } + } + // //邀请用户助力,领狗粮.(需手动去做任务) if (item['taskType'] === 'InviteUser') { if (item['receiveStatus'] === 'chance_left') { diff --git a/jd_joy_steal.js b/jd_joy_steal.js index e490137f..34fb9594 100644 --- a/jd_joy_steal.js +++ b/jd_joy_steal.js @@ -1,4 +1,5 @@ /* +最近经常出现给偷好友积分与狗粮失败的情况,故建议cron设置为多次 jd宠汪汪偷好友积分与狗粮,及给好友喂食 偷好友积分上限是20个好友(即获得100积分),帮好友喂食上限是20个好友(即获得200积分),偷好友狗粮上限也是20个好友(最多获得120g狗粮) IOS用户支持京东双账号,NodeJs用户支持N个京东账号 @@ -10,12 +11,12 @@ IOS用户支持京东双账号,NodeJs用户支持N个京东账号 // quantumultx // [task_local] // #宠汪汪偷好友积分与狗粮 -// 0 0,6 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_joy_steal.js, tag=宠汪汪偷好友积分与狗粮, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdcww.png, enabled=true +// 0 0-10/2 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_joy_steal.js, tag=宠汪汪偷好友积分与狗粮, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdcww.png, enabled=true // Loon // [Script] -// cron "0 0,6 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_joy_steal.js,tag=宠汪汪偷好友积分与狗粮 +// cron "0 0-10/2 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_joy_steal.js,tag=宠汪汪偷好友积分与狗粮 // Surge -// 宠汪汪偷好友积分与狗粮 = type=cron,cronexp="0 0,6 * * *",wake-system=1,timeout=320,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_joy_steal.js +// 宠汪汪偷好友积分与狗粮 = type=cron,cronexp="0 0-10/2 * * *",wake-system=1,timeout=320,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_joy_steal.js const $ = new Env('宠汪汪偷好友积分与狗粮'); const notify = $.isNode() ? require('./sendNotify') : ''; //Node.js用户请在jdCookie.js处填写京东ck; @@ -73,6 +74,8 @@ if ($.isNode() && process.env.jdJoyStealCoin) { $.index = i + 1; $.isLogin = true; $.nickName = ''; + $.HelpFeed = ctrTemp; + if (!ctrTemp) $.HelpFeed = true await TotalBean(); console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`); if (!$.isLogin) { @@ -148,7 +151,7 @@ async function jdJoySteal() { console.log('帮好友喂食失败,狗粮不足10g 跳出\n'); break } - if (!ctrTemp) { + if (!$.HelpFeed) { console.log('您已设置不为好友喂食,现在跳过喂食,如需为好友喂食请在BoxJs打开喂食开关或者更改脚本 jdJoyHelpFeed 处'); break } @@ -217,7 +220,7 @@ async function stealFriendCoinFun() { //给好友喂食 async function helpFriendsFeed() { if ($.help_feed !== 200) { - if (ctrTemp) { + if ($.HelpFeed) { console.log(`\n开始给好友喂食`); for (let friends of $.allFriends) { const { friendPin, status, stealStatus } = friends; @@ -228,6 +231,11 @@ async function helpFriendsFeed() { $.helpFeedStatus = helpFeedRes.errorCode; if (helpFeedRes && helpFeedRes.errorCode === 'help_ok' && helpFeedRes.success) { console.log(`帮好友[${friendPin}]喂食10g狗粮成功,你获得10积分\n`); + if (!ctrTemp) { + $.log('为完成为好友单独喂食一次的任务,故此处进行喂食一次') + $.HelpFeed = false; + break + } $.helpFood += 10; } else if (helpFeedRes && helpFeedRes.errorCode === 'chance_full') { console.log('喂食已达上限,不再喂食\n') @@ -253,7 +261,7 @@ async function helpFriendsFeed() { function getFriends(currentPage = '1') { return new Promise(resolve => { const options = { - url: `${JD_API_HOST}/getFriends?itemsPerPage=20¤tPage=${currentPage}`, + url: `${JD_API_HOST}/getFriends?itemsPerPage=20¤tPage=${currentPage * 1}&reqSource=h5`, headers: { 'Cookie': cookie, 'reqSource': 'h5', @@ -264,7 +272,8 @@ function getFriends(currentPage = '1') { 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"), 'Accept-Language': 'zh-cn', 'Accept-Encoding': 'gzip, deflate, br', - } + }, + timeout: 10000 } $.get(options, (err, resp, data) => { try { @@ -485,13 +494,13 @@ function showMsg() { message += $.stealFriendCoin; message += $.stealFood; message += $.helpFood; - let ctrTemp; + let flag; if ($.getdata('jdJoyStealNotify')) { - ctrTemp = `${$.getdata('jdJoyStealNotify')}` === 'false'; + flag = `${$.getdata('jdJoyStealNotify')}` === 'false'; } else { - ctrTemp = `${jdNotify}` === 'false'; + flag = `${jdNotify}` === 'false'; } - if (ctrTemp) { + if (flag) { $.msg($.name, '', message); } else { $.log(`\n${message}\n`); diff --git a/jd_jxnc.js b/jd_jxnc.js index 2040d55d..6c978c81 100644 --- a/jd_jxnc.js +++ b/jd_jxnc.js @@ -55,7 +55,7 @@ $.detail = []; // 今日明细列表 $.helpTask = null; $.allTask = []; // 任务列表 $.info = {}; // 用户信息 -$.answer = 0; +$.answer = 3; $.drip = 0; $.maxHelpNum = $.isNode() ? 8 : 3; // 助力 ret 1011 错误最大计数 $.helpNum = 0; // 当前账号 助力 ret 1011 次数 @@ -90,7 +90,7 @@ let assistUserShareCode = 0; // 随机助力用户 share code subTitle = ''; message = ''; option = {}; - $.answer = 0; + $.answer = 3; $.helpNum = 0; $.helpSelfNum = 0; notifyBool = notifyLevel > 0; // 初始化是否推送 @@ -319,6 +319,7 @@ function browserTask() { if (status[0] === 1032) { $.log('任务执行失败,种植的 APP 专属种子,请提供 token 或种植非 APP 种子'); message += '任务执行失败,种植的 APP 专属种子,请提供 token 或种植非 APP 种子\n'; + notifyBool = notifyBool && notifyLevel >= 2; resolve(false); return; } @@ -360,8 +361,8 @@ function answerTask() { resolve(); return; } - if (((ret !== 0 && ret !== 1029) || retmsg === 'ans err') && $.answer < 4) { - $.answer++; + if (((ret !== 0 && ret !== 1029) || retmsg === 'ans err') && $.answer > 0) { + $.answer--; await $.wait(1000); await answerTask(); } diff --git a/jd_nian.js b/jd_nian.js index 78e85b8d..62cbb546 100644 --- a/jd_nian.js +++ b/jd_nian.js @@ -1,5 +1,8 @@ /* 京东炸年兽🧨 +活动时间:2021-1-18至2021-2-11 +暂不加入品牌会员 +活动入口:https://wbbny.m.jd.com/babelDiy/Zeus/2cKMj86srRdhgWcKonfExzK4ZMBy/index.html 活动地址:京东app左侧浮动窗口 已支持IOS双京东账号,Node.js支持N个京东账号 脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js @@ -43,8 +46,8 @@ if ($.isNode()) { } const JD_API_HOST = 'https://api.m.jd.com/client.action'; const inviteCodes = [ - `cgxZaDXWZPCmiUa2akPVmFMI27K6antJzucULQPYNim_BPEW1Dwd@cgxZdTXtIrPYuAqfDgSpusxr97nagU6hwFa3TXxnqM95u3ib-xt4nWqZdz8@cgxZdTXtIO-O6QmYDVf67KCEJ19JcybuMB2_hYu8NSNQg0oS2Z_FpMce45g@cgxZdTXtILiLvg7OAASp61meehou4OeZvqbjghsZlc3rI5SBk7b3InUqSQ0`, - `cgxZaDXWZPCmiUa2akPVmFMI27K6antJzucULQPYNim_BPEW1Dwd@cgxZdTXtIrPYuAqfDgSpusxr97nagU6hwFa3TXxnqM95u3ib-xt4nWqZdz8@cgxZdTXtIO-O6QmYDVf67KCEJ19JcybuMB2_hYu8NSNQg0oS2Z_FpMce45g@cgxZdTXtILiLvg7OAASp61meehou4OeZvqbjghsZlc3rI5SBk7b3InUqSQ0` + `cgxZaDXWZPCmiUa2akPVmFMI27K6antJzucULQPYNim_BPEW1Dwd@cgxZdTXtIrPYuAqfDgSpusxr97nagU6hwFa3TXxnqM95u3ib-xt4nWqZdz8@cgxZdTXtIO-O6QmYDVf67KCEJ19JcybuMB2_hYu8NSNQg0oS2Z_FpMce45g@cgxZdTXtILiLvg7OAASp61meehou4OeZvqbjghsZlc3rI5SBk7b3InUqSQ0@cgxZ9_MZ8gByP7FZ368dN8oTZBwGieaH5HvtnvXuK1Epn_KK8yol8OYGw7h3M2j_PxSZvYA`, + `cgxZaDXWZPCmiUa2akPVmFMI27K6antJzucULQPYNim_BPEW1Dwd@cgxZdTXtIrPYuAqfDgSpusxr97nagU6hwFa3TXxnqM95u3ib-xt4nWqZdz8@cgxZdTXtIO-O6QmYDVf67KCEJ19JcybuMB2_hYu8NSNQg0oS2Z_FpMce45g@cgxZdTXtILiLvg7OAASp61meehou4OeZvqbjghsZlc3rI5SBk7b3InUqSQ0@cgxZdTXtIumO4w2cDgSqvYcqHwjaAzLxu0S371Dh_fctFJtN0tXYzdR7JaY` ]; !(async () => { await requireConfig(); @@ -82,14 +85,26 @@ const inviteCodes = [ $.done(); }) async function jdNian() { - await getHomeData() - if(!$.secretp) return - await getTaskList() - await $.wait(1000) - await doTask() - await helpFriends() - await getHomeData(true) - await showMsg() + try { + await getHomeData() + if(!$.secretp) return + await $.wait(2000) + await killCouponList() + await $.wait(2000) + await map() + await $.wait(2000) + await queryMaterials() + await getTaskList() + await $.wait(1000) + await doTask() + await $.wait(2000) + await helpFriends() + await $.wait(2000) + await getHomeData(true) + await showMsg() + } catch (e) { + $.logErr(e) + } } function encode(data, aa, extraData) { const temp = { @@ -104,6 +119,8 @@ function getRnd() { } function showMsg() { return new Promise(resolve => { + console.log('任务已做完!\n如有未完成的任务,请多执行几次。注:目前入会任务不会做') + console.log('如出现taskVos错误的,请更新USER_AGENTS.js或使用自定义UA功能') if (!jdNotify) { $.msg($.name, '', `${message}`); } else { @@ -258,6 +275,11 @@ function getHomeData(info=false) { await raise() } } + else{ + $.secretp = null + console.log(`账号被风控,无法参与活动`) + message += `账号被风控,无法参与活动\n` + } } } catch (e) { $.logErr(e, resp); @@ -304,7 +326,7 @@ function collectProduceScore(taskId= "collectProducedCoin") { }) }) } -function collectScore(taskId,itemId,actionType,inviteId) { +function collectScore(taskId,itemId,actionType=null,inviteId=null,shopSign=null) { let temp = { "taskId": taskId, "rnd": getRnd(), @@ -314,6 +336,7 @@ function collectScore(taskId,itemId,actionType,inviteId) { if(itemId) temp['itemId'] = itemId if(actionType) temp['actionType'] = actionType if(inviteId) temp['inviteId'] = inviteId + if(shopSign) temp['shopSign'] = shopSign const extraData = { "jj": 6, "buttonid": "jmdd-react-smash_0", @@ -327,6 +350,7 @@ function collectScore(taskId,itemId,actionType,inviteId) { } if(actionType) body['actionType'] = actionType if(inviteId) body['inviteId'] = inviteId + if(shopSign) body['shopSign'] = shopSign return new Promise(resolve => { $.post(taskPostUrl("nian_collectScore", body, "nian_collectScore"), async (err, resp, data) => { try { @@ -336,22 +360,24 @@ function collectScore(taskId,itemId,actionType,inviteId) { } else { if (safeGet(data)) { data = JSON.parse(data); - if (data.data.bizCode === 0) { - if(data.data.result.score) - console.log(`任务完成,获得${data.data.result.score}爆竹`) - else if(data.data.result.maxAssistTimes) { - console.log(`助力好友成功`) - } else{ - console.log(`任务上报成功`) - await $.wait(10*1000) - if(data.data.result.taskToken){ - await doTask2(data.data.result.taskToken) + if (data.code === 0) { + if (data.data && data.data.bizCode === 0) { + if(data.data.result.score) + console.log(`任务完成,获得${data.data.result.score}爆竹🧨`) + else if(data.data.result.maxAssistTimes) { + console.log(`助力好友成功`) + } else{ + console.log(`任务上报成功`) + await $.wait(10*1000) + if(data.data.result.taskToken){ + await doTask2(data.data.result.taskToken) + } } + // $.userInfo = data.data.result.userInfo; + } + else{ + console.log(data.data.bizMsg) } - // $.userInfo = data.data.result.userInfo; - } - else{ - console.log(data.data.bizMsg) } } } @@ -465,7 +491,7 @@ function getFriendData(inviteId) { console.log(`${$.name} API请求失败,请检查网路重试`) } else { data = JSON.parse(data); - if (data && data.data['bizCode'] === 0) { + if (data.data && data.data['bizCode'] === 0) { $.itemId = data.data.result.homeMainInfo.guestInfo.itemId await collectScore('2',$.itemId,null,inviteId) } @@ -478,10 +504,323 @@ function getFriendData(inviteId) { }) }) } +function map() { + return new Promise(resolve => { + $.post(taskPostUrl("nian_myMap", {}, "nian_myMap"), async (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} API请求失败,请检查网路重试`) + } else { + if (safeGet(data)) { + data = JSON.parse(data); + if (data.data.bizCode === 0) { + let msg = '当前已开启的地图:' + for(let vo of data.data.result.monsterInfoList){ + if(vo.curLevel) msg+= vo.name +' ' + } + console.log(msg) + // $.userInfo = data.data.result.userInfo; + } + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} +function queryMaterials() { + let body = {"qryParam":"[{\"type\":\"advertGroup\",\"mapTo\":\"viewLogo\",\"id\":\"05149412\"},{\"type\":\"advertGroup\",\"mapTo\":\"bottomLogo\",\"id\":\"05149413\"}]","activityId":"2cKMj86srRdhgWcKonfExzK4ZMBy","pageId":"","reqSrc":"","applyKey":"21beast"} + return new Promise(resolve => { + $.post(taskPostUrl("qryCompositeMaterials", body, "qryCompositeMaterials"), async (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} API请求失败,请检查网路重试`) + } else { + if (safeGet(data)) { + data = JSON.parse(data); + if(data.code==='0') { + let shopList = data.data.viewLogo.list.concat(data.data.bottomLogo.list) + let nameList = [] + for(let vo of shopList){ + if(nameList.includes(vo.name)) continue + nameList.push(vo.name) + console.log(`去做${vo.name}店铺任务`) + await shopLotteryInfo(vo.desc) + await $.wait(2000) + } + } + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} + +function shopLotteryInfo(shopSign) { + let body = {"shopSign":shopSign} + return new Promise(resolve => { + $.post(taskPostUrl("nian_shopLotteryInfo", body, "nian_shopLotteryInfo"), async (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} API请求失败,请检查网路重试`) + } else { + if (safeGet(data)) { + data = JSON.parse(data); + if(data.code===0) { + for(let vo of data.data.result.taskVos){ + if(vo.status===1){ + if(vo.taskType===12){ + console.log(`去做${vo.taskName}任务`) + await $.wait(2000) + await collectScore(vo.taskId,vo.simpleRecordInfoVo.itemId,null,null,shopSign) + } + else if (vo.taskType === 3 || vo.taskType === 26) { + if(vo.shoppingActivityVos) { + if (vo.status === 1) { + console.log(`准备做此任务:${vo.taskName}`) + for (let task of vo.shoppingActivityVos) { + if (task.status === 1) { + await $.wait(2000) + await collectScore(vo.taskId, task.advId,null,null,shopSign); + } + } + } else if (vo.status === 2) { + console.log(`${vo.taskName}已做完`) + } + } + } + } + } + for(let i=0;i { + $.post(taskPostUrl("nian_doShopLottery", body, "nian_doShopLottery"), async (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} API请求失败,请检查网路重试`) + } else { + if (safeGet(data)) { + data = JSON.parse(data); + if(data.code===0 && data.data && data.data.result) { + let result = data.data.result + if(result.awardType===4) + console.log(`抽奖成功,获得${result.score}爆竹🧨`) + else if(result.awardType===2 || result.awardType===3) + console.log(`抽奖成功,获得优惠卷`) + else + console.log(`抽奖成功,获得${JSON.stringify(result)}`) + }else{ + console.log(`抽奖失败`) + } + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} + +function pkInfo() { + return new Promise(resolve => { + $.post(taskPostUrl("nian_pk_getHomeData", {}, "nian_pk_getHomeData"), async (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} API请求失败,请检查网路重试`) + } else { + if (safeGet(data)) { + data = JSON.parse(data); + console.log(data) + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} +function pkCollectScore() { + return new Promise(resolve => { + $.post(taskPostUrl("nian_pk_collectScore", {}, "nian_pk_collectScore"), async (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} API请求失败,请检查网路重试`) + } else { + if (safeGet(data)) { + data = JSON.parse(data); + console.log(data) + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} +function pkTaskDetail() { + return new Promise(resolve => { + $.post(taskPostUrl("nian_pk_getTaskDetail", {}, "nian_pk_getTaskDetail"), async (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} API请求失败,请检查网路重试`) + } else { + if (safeGet(data)) { + data = JSON.parse(data); + console.log(data) + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} +function pkAssignGroup(inviteId) { + let temp = { + "confirmFlag": 1, + "inviteId": inviteId, + } + const extraData = { + "jj": 6, + "buttonid": "jmdd-react-smash_0", + "sceneid": "homePageh5", + "appid": '50073' + } + let body = { + ...encode(temp, $.secretp, extraData), + inviteId:inviteId + } + return new Promise(resolve => { + $.post(taskPostUrl("nian_pk_assistGroup", body, "nian_pk_assistGroup"), async (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} API请求失败,请检查网路重试`) + } else { + if (safeGet(data)) { + data = JSON.parse(data); + console.log(data) + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} +function killCouponList() { + return new Promise(resolve => { + $.post(taskPostUrl("nian_killCouponList", {}, "nian_killCouponList"), async (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} API请求失败,请检查网路重试`) + } else { + if (safeGet(data)) { + data = JSON.parse(data); + if (data.data && data.data.bizCode === 0) { + await $.wait(2000) + for(let vo of data.data.result){ + if(!vo.status){ + console.log(`去领取${vo['productName']}优惠券`) + await killCoupon(vo['skuId']) + await $.wait(2000) + } + } + } + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} +function killCoupon(skuId) { + let temp = { + "skuId": skuId, + "rnd": getRnd(), + "inviteId": "-1", + "stealId": "-1" + } + const extraData = { + "jj": 6, + "buttonid": "jmdd-react-smash_0", + "sceneid": "homePageh5", + "appid": '50073' + } + let body = encode(temp, $.secretp, extraData); + body['skuId'] = skuId + return new Promise(resolve => { + $.post(taskPostUrl("nian_killCoupon", body, "nian_killCoupon"), async (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} API请求失败,请检查网路重试`) + } else { + if (safeGet(data)) { + data = JSON.parse(data); + if (data.data && data.data.bizCode === 0) { + console.log(`领取成功,获得${data.data.result.score}爆竹🧨`) + }else{ + console.log(data.data.bizMsg) + } + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} function readShareCode() { console.log(`开始`) return new Promise(async resolve => { - $.get({url: `http://api.turinglabs.net/api/v1/jd/nian/read/${randomCount}/`}, (err, resp, data) => { + $.get({url: `https://code.chiang.fun/api/v1/jd/jdnian/read/${randomCount}/`, 'timeout': 10000}, (err, resp, data) => { try { if (err) { console.log(`${JSON.stringify(err)}`) @@ -498,8 +837,8 @@ function readShareCode() { resolve(data); } }) - // await $.wait(2000); - // resolve() + await $.wait(2000); + resolve() }) } //格式化助力码 @@ -514,7 +853,7 @@ function shareCodesFormat() { const tempIndex = $.index > inviteCodes.length ? (inviteCodes.length - 1) : ($.index - 1); $.newShareCodes = inviteCodes[tempIndex].split('@'); } - const readShareCodeRes = null //await readShareCode(); + const readShareCodeRes = await readShareCode(); if (readShareCodeRes && readShareCodeRes.code === 200) { $.newShareCodes = [...new Set([...$.newShareCodes, ...(readShareCodeRes.data || [])])]; } @@ -526,8 +865,15 @@ function requireConfig() { return new Promise(resolve => { console.log(`开始获取${$.name}配置文件\n`); //Node.js用户请在jdCookie.js处填写京东ck; - const shareCodes = [] + let shareCodes = [] console.log(`共${cookiesArr.length}个京东账号\n`); + if ($.isNode() && process.env.JDNIAN_SHARECODES) { + if (process.env.JDNIAN_SHARECODES.indexOf('\n') > -1) { + shareCodes = process.env.JDNIAN_SHARECODES.split('\n'); + } else { + shareCodes = process.env.JDNIAN_SHARECODES.split('&'); + } + } $.shareCodesArr = []; if ($.isNode()) { Object.keys(shareCodes).forEach((item) => { @@ -554,7 +900,7 @@ function taskPostUrl(function_id, body = {}, function_id2) { "origin": "https://h5.m.jd.com", "referer": "https://h5.m.jd.com/", 'Content-Type': 'application/x-www-form-urlencoded', - "User-Agent": "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0", + "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") } } } diff --git a/jd_nianCollect.js b/jd_nianCollect.js index 87212e27..9e659cba 100644 --- a/jd_nianCollect.js +++ b/jd_nianCollect.js @@ -1,9 +1,22 @@ /* +#炸年兽专门收集爆竹 京东炸年兽领爆竹🧨 仅仅是收集一下京东炸年兽领爆竹活动每秒产生的爆竹🧨 - 每小时的第20分运行一次 -20 * * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nianCollect.js +============Quantumultx=============== +[task_local] +#京东炸年兽🧨 +20 * * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nianCollect.js, tag=京东收🧨, enabled=true + +================Loon============== +[Script] +cron "20 * * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nianCollect.js,tag=京东收🧨 + +===============Surge================= +京东收🧨 = type=cron,cronexp="20 * * * *",wake-system=1,timeout=200,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nianCollect.js + +============小火箭========= +京东收🧨 = type=cron,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nianCollect.js, cronexpr="20 * * * *", timeout=200, enable=true */ const $ = new Env('京东炸年兽领爆竹🧨'); //Node.js用户请在jdCookie.js处填写京东ck; @@ -15,10 +28,9 @@ if ($.isNode()) { Object.keys(jdCookieNode).forEach((item) => { cookiesArr.push(jdCookieNode[item]) }) - if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => { - }; + if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {}; } else { - let cookiesData = $.getdata('CookiesJD') || "[]"; + let cookiesData = $.getdata('CookiesJD') || "[]"; cookiesData = jsonParse(cookiesData); cookiesArr = cookiesData.map(item => item.cookie); cookiesArr.reverse(); @@ -39,6 +51,14 @@ const JD_API_HOST = `https://api.m.jd.com/client.action`; if (cookie) { $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1]) $.index = i + 1; + $.isLogin = true; + $.nickName = ''; + await TotalBean(); + if (!$.isLogin) { + $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"}); + continue + } + console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`); await collectProduceScore() } } @@ -76,9 +96,9 @@ function stall_collectProduceScore(body) { if (data) { data = JSON.parse(data); if (data && data.data.bizCode === 0) { - console.log(`京东账号${$.index} ${$.UserName}成功收集爆竹🧨:${data.data.result.produceScore}个`) + console.log(`京东账号${$.index} ${$.nickName}成功收集爆竹🧨:${data.data.result.produceScore}个`) } else { - console.log(`京东账号${$.index} ${$.UserName}成功收集爆竹🧨失败:${data.data.bizMsg}`) + console.log(`京东账号${$.index} ${$.nickName}成功收集爆竹🧨失败:${data.data.bizMsg}`) } } else { console.log(`请检查自身设备原因`); @@ -138,7 +158,46 @@ function taskPostUrl(functionId, body = {}) { } } } - +function TotalBean() { + return new Promise(async resolve => { + const options = { + "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`, + "headers": { + "Accept": "application/json,text/plain, */*", + "Content-Type": "application/x-www-form-urlencoded", + "Accept-Encoding": "gzip, deflate, br", + "Accept-Language": "zh-cn", + "Connection": "keep-alive", + "Cookie": cookie, + "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2", + "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") + } + } + $.post(options, (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} API请求失败,请检查网路重试`) + } else { + if (data) { + data = JSON.parse(data); + if (data['retcode'] === 13) { + $.isLogin = false; //cookie过期 + return + } + $.nickName = data['base'].nickname; + } else { + console.log(`京东服务器返回空数据`) + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} function jsonParse(str) { if (typeof str == "string") { try { @@ -150,4 +209,5 @@ function jsonParse(str) { } } } + function Env(t,e){process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/jd_pet.js b/jd_pet.js index f333768a..6dace592 100644 --- a/jd_pet.js +++ b/jd_pet.js @@ -1,6 +1,6 @@ /* 东东萌宠 更新地址: https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_pet.js -更新时间:2021-01-16 +更新时间:2021-01-19 已支持IOS双京东账号,Node.js支持N个京东账号 脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js @@ -86,7 +86,9 @@ async function jdPet() { if (initPetTownRes.code === '0' && initPetTownRes.resultCode === '0' && initPetTownRes.message === 'success') { $.petInfo = initPetTownRes.result; if ($.petInfo.userStatus === 0) { - $.msg($.name, '', `【提示】京东账号${$.index}${$.nickName}\n萌宠活动未开启\n请手动去京东APP开启活动\n入口:我的->游戏与互动->查看更多开启`, { "open-url": "openapp.jdmoble://" }); + // $.msg($.name, '', `【提示】京东账号${$.index}${$.nickName}\n萌宠活动未开启\n请手动去京东APP开启活动\n入口:我的->游戏与互动->查看更多开启`, { "open-url": "openapp.jdmoble://" }); + await slaveHelp();//助力好友 + $.log($.name, '', `【提示】京东账号${$.index}${$.nickName}\n萌宠活动未开启\n请手动去京东APP开启活动\n入口:我的->游戏与互动->查看更多开启`); return } if (!$.petInfo.goodsInfo) { diff --git a/lxk0301.boxjs.json b/lxk0301.boxjs.json index 0f973302..4e02b154 100644 --- a/lxk0301.boxjs.json +++ b/lxk0301.boxjs.json @@ -12,7 +12,8 @@ "descs_html": [ "请勿随意在输入框修改内容,建议通过脚本去获取cookie,若要修改,请按照JSON 格式修改。", "脚本地址【京东多 CK获取】,并按照此脚本注释进行配置", - "使用方式【个人中心】获取对应的数据Code" + "使用方式【个人中心】获取对应的数据Code", + "注:如与NobyDa的京东cookie出现重复,建议在此处删除重复的cookie" ], "settings": [ { @@ -39,13 +40,17 @@ "keys": [ "JDUA" ], + "descs_html": [ + "自行抓包京东APP获得,UserAgent类似下面:", + "jdapp;iPhone;9.3.0;14.2;88732f840b77821b345bf07fd71f609e6ff12f43;network/4g;ADID/0E38E9F1-4B4C-40A4-A479-DD15E58A5623;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone11,8;addressid/2005183373;supportBestPay/0;appBuild/167436;pushNoticeIsOpen/0;jdSupportDarkMode/0;pv/142.46;apprpd/CouponCenter;ref/NewCouponCenterViewController;psq/44;ads/;psn/88732f840b77821b345bf07fd71f609e6ff12f43|551;jdv/0|kong|t_1000170135|tuiguang|notset|1607732510603|1607732510;adk/;app_device/IOS;pap/JA2015_311210|9.2.5|IOS 14.2;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1" + ], "settings": [ { "id": "JDUA", "name": "自定义京东脚本的UserAgent", "val": "", "type": "text", - "desc": "不懂不知不会UserAgent的请不要随意填写内容" + "desc": "不懂不知不会UserAgent的请不要随意填写内容,如需填写使用建议使用京东APP的UserAgent" } ], "author": "@LXK9301", diff --git a/serverless.yml b/serverless.yml index 4da99d21..b565a9f2 100644 --- a/serverless.yml +++ b/serverless.yml @@ -34,12 +34,12 @@ inputs: cronExpression: "0 5 6-18/6,8 * * * *" enable: true argument: jd_fruit&jd_pet&jd_bookshop&jd_jxnc - - timer: # 宠汪汪喂食# 宠汪汪# 摇钱树# 京东种豆得豆# 京喜工厂 #东东工厂 + - timer: # 宠汪汪喂食# 宠汪汪# 摇钱树# 京东种豆得豆# 京喜工厂 #东东工厂 #京东炸年兽领爆竹 parameters: - name: joy_feedPets_joy_moneyTree_plantBean_dreamFactory_jdfactory + name: joy_feedPets_joy_moneyTree_plantBean_dreamFactory_jdfactory_nianCollect cronExpression: "0 3 */1 * * * *" enable: true - argument: jd_joy_feedPets&jd_joy&jd_moneyTree&jd_plantBean&jd_dreamFactory&jd_jdfactory + argument: jd_joy_feedPets&jd_joy&jd_moneyTree&jd_plantBean&jd_dreamFactory&jd_jdfactory&jd_nianCollect - timer: # 宠汪汪积分兑换奖品# 宠汪汪偷好友积分与狗# 点点券# 京东直播18豆 parameters: name: joy_reward_joy_steal_necklace_live @@ -52,12 +52,12 @@ inputs: cronExpression: "0 10 0 * * * *" enable: true argument: jd_redPacket&jd_shop&jd_unsubscribe&jd_unbind&jd_lotteryMachine&jd_small_home - - timer: # 京东天天加速# 天天提鹅 + - timer: #京东天天加速 #天天提鹅 #京东炸年兽 parameters: - name: jd_speed_jd_daily_egg + name: jd_speed_jd_daily_egg_nian cronExpression: "0 8 */3 * * * *" enable: true - argument: jd_speed&jd_daily_egg + argument: jd_speed&jd_daily_egg&jd_nian - timer: #东东超市 #京东家庭号 parameters: name: superMarket_family