diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
deleted file mode 100644
index 00a9d7e..0000000
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ /dev/null
@@ -1,79 +0,0 @@
----
-name: Bug 反馈
-about: 运行js脚本时出现bug
-title: ''
-labels: ''
-assignees: ''
-
----
-
-
-
-
-
-
-
-
-
-
-
-
-## 1.关于你要提交的问题
-
-Q:是否搜索了issue(包括已关闭的issue)
-- [ ] 没有类似的issue
-
-Q:是否仔细阅读了教程
-- [ ] 已仔细阅读教程
-
-## 2. 你使用的哪种部署方法
-
-
-
-
-
-
-- [ ] 方法一:本地安装Node.js
-- [ ] 方法二:腾讯云函数
-- [ ] 方法三:Docker办法一
-- [ ] 方法三:Docker办法二
-- [ ] 方法三:Docker办法三
-- [ ] 方法四:iOS系统的代理软件
-
-
-## 3. 详细叙述
-### (1) 具体问题
-A:
-
-### (2) 详细日志
-A:
-
-
-
-
-
-## 4.软件版本和 npm install 结果
-### (1) Node.js版本
-
-A:
-
-### (2) npm版本
-
-A:
-
-### (3)npm install的日志
-
-A:
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
deleted file mode 100644
index d741913..0000000
--- a/.github/ISSUE_TEMPLATE/feature_request.md
+++ /dev/null
@@ -1,44 +0,0 @@
----
-name: 功能建议
-about: 请求实现新功能或改进已有功能
-title: ''
-labels: ''
-assignees: ''
-
----
-
-
-
-
-
-
-
-
-
-
-
-
-## 期望增加的功能
-
-A:
-
-
-
-
-
-## 入口
-
-A:
diff --git a/.github/workflows/deploy_tencent_scf.yml b/.github/workflows/deploy_tencent_scf.yml
deleted file mode 100644
index 2246679..0000000
--- a/.github/workflows/deploy_tencent_scf.yml
+++ /dev/null
@@ -1,112 +0,0 @@
-name: 部署到腾讯云函数
-
-on:
- workflow_dispatch:
-
-jobs:
- build:
- runs-on: ubuntu-latest
- if: github.event.repository.owner.id == github.event.sender.id
- steps:
- - name: Checkout
- uses: actions/checkout@v2
- with:
- repository: ${{ github.repository }}
-
- - name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v1
- with:
- node-version: ${{ matrix.node-version }}
-
- - name: "安装依赖和serverless工具"
- run: |
- npm install
- sudo npm install serverless -g
-
- - name: "将Secrets里面配置的变量添加到severless.yml里面作为环境变量"
- run: |
- if [ $JD_COOKIE ]; then sed -i "/variables/a\ JD_COOKIE: $JD_COOKIE" serverless.yml; fi;
- if [ $JD_USER_AGENT ]; then sed -i "/variables/a\ JD_USER_AGENT: $JD_USER_AGENT" 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;
- if [ $PUSH_KEY ]; then sed -i "/variables/a\ PUSH_KEY: $PUSH_KEY" serverless.yml; fi;
- if [ $BARK_PUSH ]; then sed -i "/variables/a\ BARK_PUSH: $BARK_PUSH" serverless.yml; fi;
- if [ $BARK_SOUND ]; then sed -i "/variables/a\ BARK_SOUND: $BARK_SOUND" serverless.yml; fi;
- if [ $TG_BOT_TOKEN ]; then sed -i "/variables/a\ TG_BOT_TOKEN: $TG_BOT_TOKEN" serverless.yml; fi;
- if [ $TG_USER_ID ]; then sed -i "/variables/a\ TG_USER_ID: $TG_USER_ID" serverless.yml; fi;
- if [ $DD_BOT_TOKEN ]; then sed -i "/variables/a\ DD_BOT_TOKEN: $DD_BOT_TOKEN" serverless.yml; fi;
- if [ $DD_BOT_SECRET ]; then sed -i "/variables/a\ DD_BOT_SECRET: $DD_BOT_SECRET" serverless.yml; fi;
- if [ $IGOT_PUSH_KEY ]; then sed -i "/variables/a\ IGOT_PUSH_KEY: $IGOT_PUSH_KEY" serverless.yml; fi;
- if [ $PET_NOTIFY_CONTROL ]; then sed -i "/variables/a\ PET_NOTIFY_CONTROL: $PET_NOTIFY_CONTROL" serverless.yml; fi;
- if [ $FRUIT_NOTIFY_CONTROL ]; then sed -i "/variables/a\ FRUIT_NOTIFY_CONTROL: $FRUIT_NOTIFY_CONTROL" serverless.yml; fi;
- if [ $JD_JOY_REWARD_NOTIFY ]; then sed -i "/variables/a\ JD_JOY_REWARD_NOTIFY: $JD_JOY_REWARD_NOTIFY" serverless.yml; fi;
- if [ $JD_818_SHAREID_NOTIFY ]; then sed -i "/variables/a\ JD_818_SHAREID_NOTIFY: $JD_818_SHAREID_NOTIFY" serverless.yml; fi;
- if [ $JOY_FEED_COUNT ]; then sed -i "/variables/a\ JOY_FEED_COUNT: $JOY_FEED_COUNT" serverless.yml; fi;
- if [ $JOY_HELP_FEED ]; then sed -i "/variables/a\ JOY_HELP_FEED: $JOY_HELP_FEED" serverless.yml; fi;
- if [ $JOY_RUN_FLAG ]; then sed -i "/variables/a\ JOY_RUN_FLAG: $JOY_RUN_FLAG" serverless.yml; fi;
- if [ $JD_JOY_REWARD_NAME ]; then sed -i "/variables/a\ JD_JOY_REWARD_NAME: $JD_JOY_REWARD_NAME" serverless.yml; fi;
- if [ $MARKET_COIN_TO_BEANS ]; then sed -i "/variables/a\ MARKET_COIN_TO_BEANS: $MARKET_COIN_TO_BEANS" serverless.yml; fi;
- if [ $MARKET_REWARD_NOTIFY ]; then sed -i "/variables/a\ MARKET_REWARD_NOTIFY: $MARKET_REWARD_NOTIFY" serverless.yml; fi;
- if [ $SUPERMARKET_UPGRADE ]; then sed -i "/variables/a\ SUPERMARKET_UPGRADE: $SUPERMARKET_UPGRADE" serverless.yml; fi;
- if [ $BUSINESS_CIRCLE_JUMP ]; then sed -i "/variables/a\ BUSINESS_CIRCLE_JUMP: $BUSINESS_CIRCLE_JUMP" serverless.yml; fi;
- if [ $SUPERMARKET_LOTTERY ]; then sed -i "/variables/a\ SUPERMARKET_LOTTERY: $SUPERMARKET_LOTTERY" serverless.yml; fi;
- if [ $FRUIT_BEAN_CARD ]; then sed -i "/variables/a\ FRUIT_BEAN_CARD: $FRUIT_BEAN_CARD" serverless.yml; fi;
- if [ $UN_SUBSCRIBES ]; then sed -i "/variables/a\ UN_SUBSCRIBES: $UN_SUBSCRIBES" serverless.yml; fi;
- if [ $FRUITSHARECODES ]; then sed -i "/variables/a\ FRUITSHARECODES: $FRUITSHARECODES" serverless.yml; fi;
- if [ $PETSHARECODES ]; then sed -i "/variables/a\ PETSHARECODES: $PETSHARECODES" serverless.yml; fi;
- if [ $PLANT_BEAN_SHARECODES ]; then sed -i "/variables/a\ PLANT_BEAN_SHARECODES: $PLANT_BEAN_SHARECODES" serverless.yml; fi;
- if [ $SUPERMARKET_SHARECODES ]; then sed -i "/variables/a\ SUPERMARKET_SHARECODES: $SUPERMARKET_SHARECODES" serverless.yml; fi;
- if [ $DDFACTORY_SHARECODES ]; then sed -i "/variables/a\ DDFACTORY_SHARECODES: $DDFACTORY_SHARECODES" serverless.yml; fi;
- if [ $TG_PROXY_HOST ]; then sed -i "/variables/a\ TG_PROXY_HOST: $TG_PROXY_HOST" serverless.yml; fi;
- if [ $TG_PROXY_PORT ]; then sed -i "/variables/a\ TG_PROXY_PORT: $TG_PROXY_PORT" serverless.yml; fi;
- if [ $MONEY_TREE_SELL_FRUIT ]; then sed -i "/variables/a\ MONEY_TREE_SELL_FRUIT: $MONEY_TREE_SELL_FRUIT" serverless.yml; fi;
- if [ $FACTORAY_WANTPRODUCT_NAME ]; then sed -i "/variables/a\ FACTORAY_WANTPRODUCT_NAME: $FACTORAY_WANTPRODUCT_NAME" serverless.yml; fi;
- cat serverless.yml
- env
- env: #因为直接读取secrets里面的值很多字符不会自动转译,导致写入serverless.yml异常,所以设置到环境变量,在读取环境变量转译过的值
- JD_COOKIE: ${{ secrets.JD_COOKIE}}
- JD_USER_AGENT: ${{ secrets.JD_USER_AGENT}}
- 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}}
- PUSH_KEY: ${{ secrets.PUSH_KEY}}
- BARK_PUSH: ${{ secrets.BARK_PUSH}}
- BARK_SOUND: ${{ secrets.BARK_SOUND}}
- TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN}}
- TG_USER_ID: ${{ secrets.TG_USER_ID}}
- DD_BOT_TOKEN: ${{ secrets.DD_BOT_TOKEN}}
- DD_BOT_SECRET: ${{ secrets.DD_BOT_SECRET}}
- IGOT_PUSH_KEY: ${{ secrets.IGOT_PUSH_KEY}}
- PET_NOTIFY_CONTROL: ${{ secrets.PET_NOTIFY_CONTROL}}
- FRUIT_NOTIFY_CONTROL: ${{ secrets.FRUIT_NOTIFY_CONTROL}}
- JD_JOY_REWARD_NOTIFY: ${{ secrets.JD_JOY_REWARD_NOTIFY}}
- JD_818_SHAREID_NOTIFY: ${{ secrets.JD_818_SHAREID_NOTIFY}}
- JOY_FEED_COUNT: ${{ secrets.JOY_FEED_COUNT}}
- JOY_HELP_FEED: ${{ secrets.JOY_HELP_FEED}}
- JOY_RUN_FLAG: ${{ secrets.JOY_RUN_FLAG}}
- JD_JOY_REWARD_NAME: ${{ secrets.JD_JOY_REWARD_NAME}}
- MARKET_COIN_TO_BEANS: ${{ secrets.MARKET_COIN_TO_BEANS}}
- MARKET_REWARD_NOTIFY: ${{ secrets.MARKET_REWARD_NOTIFY}}
- SUPERMARKET_UPGRADE: ${{ secrets.SUPERMARKET_UPGRADE}}
- BUSINESS_CIRCLE_JUMP: ${{ secrets.BUSINESS_CIRCLE_JUMP}}
- SUPERMARKET_LOTTERY: ${{ secrets.SUPERMARKET_LOTTERY}}
- FRUIT_BEAN_CARD: ${{ secrets.FRUIT_BEAN_CARD}}
- UN_SUBSCRIBES: ${{ secrets.UN_SUBSCRIBES}}
- FRUITSHARECODES: ${{ secrets.FRUITSHARECODES}}
- PETSHARECODES: ${{ secrets.PETSHARECODES}}
- PLANT_BEAN_SHARECODES: ${{ secrets.PLANT_BEAN_SHARECODES}}
- SUPERMARKET_SHARECODES: ${{ secrets.SUPERMARKET_SHARECODES}}
- DDFACTORY_SHARECODES: ${{ secrets.DDFACTORY_SHARECODES}}
- TG_PROXY_HOST: ${{ secrets.TG_PROXY_HOST}}
- TG_PROXY_PORT: ${{ secrets.TG_PROXY_PORT}}
- MONEY_TREE_SELL_FRUIT: ${{ secrets.MONEY_TREE_SELL_FRUIT}}
- FACTORAY_WANTPRODUCT_NAME: ${{ secrets.FACTORAY_WANTPRODUCT_NAME}}
-
- - name: "部署到腾讯云函数"
- run: serverless deploy
- env:
- STAGE: dev
- SERVERLESS_PLATFORM_VENDOR: tencent
- TENCENT_SECRET_ID: ${{ secrets.TENCENT_SECRET_ID }}
- TENCENT_SECRET_KEY: ${{ secrets.TENCENT_SECRET_KEY }}
diff --git a/.github/workflows/repo_sync.yml b/.github/workflows/repo_sync.yml
deleted file mode 100644
index 2a40c3a..0000000
--- a/.github/workflows/repo_sync.yml
+++ /dev/null
@@ -1,42 +0,0 @@
-# File: .github/workflows/repo-sync.yml
-name: sync-lxk0301-scripts
-on:
- schedule:
- - cron: '1 0,15 * * *'
- workflow_dispatch:
- watch:
- types: started
- push:
- branches: [ master ]
- repository_dispatch:
- types: sync-lxk0301-scripts
-jobs:
- repo-sync:
- env:
- PAT: ${{ secrets.PAT }} #此处PAT需要申请,教程详见:https://www.jianshu.com/p/bb82b3ad1d11
- dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} # 我自己同步到gitee使用,其他人可忽略
- runs-on: ubuntu-latest
- if: github.event.repository.owner.id == github.event.sender.id
- steps:
- - uses: actions/checkout@v2
- with:
- persist-credentials: false
-
- - name: sync lxk0301-scripts
- uses: repo-sync/github-sync@v2
- if: env.PAT
- with:
- source_repo: "https://github.com/lxk0301/jd_scripts.git"
- source_branch: "master"
- destination_branch: "master"
- github_token: ${{ secrets.PAT }}
- # 我自己同步到gitee使用,其他人可忽略
- - name: sync github -> gitee
- uses: Yikun/hub-mirror-action@master
- if: env.dst_key
- with:
- src: github/lxk0301
- dst: gitee/lxk0301
- static_list: "jd_scripts"
- dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
- dst_token: ${{ secrets.GITEE_TOKEN }}
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index a8ffa8b..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,6 +0,0 @@
-/node_modules/
-/.idea
-/index.js
-/.history
-/box.dat
-/CookieSet.json
diff --git a/Env.min.js b/Env.min.js
deleted file mode 100644
index e478632..0000000
--- a/Env.min.js
+++ /dev/null
@@ -1 +0,0 @@
-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
diff --git a/JD_extra_cookie.js b/JD_extra_cookie.js
deleted file mode 100644
index f1eed49..0000000
--- a/JD_extra_cookie.js
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-感谢github@dompling的PR
-
-Author: 2Ya
-
-Github: https://github.com/dompling
-
-===================
-特别说明:
-1.获取多个京东cookie文件,不和野比大佬的文件冲突。暂不支持野比大佬脚本签到。
-2.若是要使用京东多合一签到,请使用修改版地址:https://raw.githubusercontent.com/dompling/Script/master/jd/JD_extra.js
-===================
-===================
-使用方式:复制 https://home.m.jd.com/myJd/newhome.action 到浏览器打开 ,在个人中心自动获取 cookie,
-若弹出成功则正常使用。否则继续再此页面继续刷新一下试试
-===================
-
-===================
-[MITM]
-hostname = wq.jd.com
-
-【Surge脚本配置】:
-===================
-[Script]
-获取京东Cookie = type=http-request,pattern=^https:\/\/wq\.jd\.com\/user_new\/info\/GetJDUserInfoUnion,requires-body=1,max-size=0,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/JD_extra_cookie.js,script-update-interval=0
-
-===================
-【Loon脚本配置】:
-===================
-[Script]
-http-request https:\/\/wq\.jd\.com\/user_new\/info\/GetJDUserInfoUnion tag=获取京东Cookie, script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/JD_extra_cookie.js
-
-
-===================
-【 QX 脚本配置 】 :
-===================
-
-[rewrite_local]
-https:\/\/wq\.jd\.com\/user_new\/info\/GetJDUserInfoUnion url script-request-header https://raw.githubusercontent.com/lxk0301/jd_scripts/master/JD_extra_cookie.js
-
- */
-
-const APIKey = "CookiesJD";
-$ = new API(APIKey, true);
-const CacheKey = `#${APIKey}`;
-if ($request) GetCookie();
-
-function getCache() {
- var cache = $.read(CacheKey) || "[]";
- $.log(cache);
- return JSON.parse(cache);
-}
-
-function GetCookie() {
- try {
- if ($request.headers && $request.url.indexOf("GetJDUserInfoUnion") > -1) {
- var CV = $request.headers["Cookie"] || $request.headers["cookie"];
- if (CV.match(/(pt_key=.+?pt_pin=|pt_pin=.+?pt_key=)/)) {
- var CookieValue = CV.match(/pt_key=.+?;/) + CV.match(/pt_pin=.+?;/);
- var UserName = CookieValue.match(/pt_pin=(.+?);/)[1];
- var DecodeName = decodeURIComponent(UserName);
- var CookiesData = getCache();
- var updateCookiesData = [...CookiesData];
- var updateIndex;
- var CookieName = "【账号】";
- var updateCodkie = CookiesData.find((item, index) => {
- var ck = item.cookie;
- var Account = ck
- ? ck.match(/pt_pin=.+?;/)
- ? ck.match(/pt_pin=(.+?);/)[1]
- : null
- : null;
- const verify = UserName === Account;
- if (verify) {
- updateIndex = index;
- }
- return verify;
- });
- var tipPrefix = "";
- if (updateCodkie) {
- updateCookiesData[updateIndex].cookie = CookieValue;
- CookieName = `【账号${updateIndex + 1}】`;
- tipPrefix = "更新京东";
- } else {
- updateCookiesData.push({
- userName: DecodeName,
- cookie: CookieValue,
- });
- CookieName = "【账号" + updateCookiesData.length + "】";
- tipPrefix = "首次写入京东";
- }
- const cacheValue = JSON.stringify(updateCookiesData, null, "\t");
- $.write(cacheValue, CacheKey);
- $.notify(
- "用户名: " + DecodeName,
- "",
- tipPrefix + CookieName + "Cookie成功 🎉"
- );
- } else {
- $.notify("写入京东Cookie失败", "", "请查看脚本内说明, 登录网页获取 ‼️");
- }
- $.done();
- return;
- } else {
- $.notify("写入京东Cookie失败", "", "请检查匹配URL或配置内脚本类型 ‼️");
- }
- } catch (eor) {
- $.write("", CacheKey);
- $.notify("写入京东Cookie失败", "", "已尝试清空历史Cookie, 请重试 ⚠️");
- console.log(
- `\n写入京东Cookie出现错误 ‼️\n${JSON.stringify(
- eor
- )}\n\n${eor}\n\n${JSON.stringify($request.headers)}\n`
- );
- }
- $.done();
-}
-
-// prettier-ignore
-function ENV(){const isQX=typeof $task!=="undefined";const isLoon=typeof $loon!=="undefined";const isSurge=typeof $httpClient!=="undefined"&&!isLoon;const isJSBox=typeof require=="function"&&typeof $jsbox!="undefined";const isNode=typeof require=="function"&&!isJSBox;const isRequest=typeof $request!=="undefined";const isScriptable=typeof importModule!=="undefined";return{isQX,isLoon,isSurge,isNode,isJSBox,isRequest,isScriptable}}
-// prettier-ignore
-function HTTP(baseURL,defaultOptions={}){const{isQX,isLoon,isSurge,isScriptable,isNode}=ENV();const methods=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"];function send(method,options){options=typeof options==="string"?{url:options}:options;options.url=baseURL?baseURL+options.url:options.url;options={...defaultOptions,...options};const timeout=options.timeout;const events={...{onRequest:()=>{},onResponse:(resp)=>resp,onTimeout:()=>{},},...options.events,};events.onRequest(method,options);let worker;if(isQX){worker=$task.fetch({method,...options})}else if(isLoon||isSurge||isNode){worker=new Promise((resolve,reject)=>{const request=isNode?require("request"):$httpClient;request[method.toLowerCase()](options,(err,response,body)=>{if(err)reject(err);else resolve({statusCode:response.status||response.statusCode,headers:response.headers,body,})})})}else if(isScriptable){const request=new Request(options.url);request.method=method;request.headers=options.headers;request.body=options.body;worker=new Promise((resolve,reject)=>{request.loadString().then((body)=>{resolve({statusCode:request.response.statusCode,headers:request.response.headers,body,})}).catch((err)=>reject(err))})}let timeoutid;const timer=timeout?new Promise((_,reject)=>{timeoutid=setTimeout(()=>{events.onTimeout();return reject(`${method}URL:${options.url}exceeds the timeout ${timeout}ms`)},timeout)}):null;return(timer?Promise.race([timer,worker]).then((res)=>{clearTimeout(timeoutid);return res}):worker).then((resp)=>events.onResponse(resp))}const http={};methods.forEach((method)=>(http[method.toLowerCase()]=(options)=>send(method,options)));return http}
-// prettier-ignore
-function API(name="untitled",debug=false){const{isQX,isLoon,isSurge,isNode,isJSBox,isScriptable}=ENV();return new(class{constructor(name,debug){this.name=name;this.debug=debug;this.http=HTTP();this.env=ENV();this.node=(()=>{if(isNode){const fs=require("fs");return{fs}}else{return null}})();this.initCache();const delay=(t,v)=>new Promise(function(resolve){setTimeout(resolve.bind(null,v),t)});Promise.prototype.delay=function(t){return this.then(function(v){return delay(t,v)})}}initCache(){if(isQX)this.cache=JSON.parse($prefs.valueForKey(this.name)||"{}");if(isLoon||isSurge)this.cache=JSON.parse($persistentStore.read(this.name)||"{}");if(isNode){let fpath="root.json";if(!this.node.fs.existsSync(fpath)){this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"wx"},(err)=>console.log(err))}this.root={};fpath=`${this.name}.json`;if(!this.node.fs.existsSync(fpath)){this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"wx"},(err)=>console.log(err));this.cache={}}else{this.cache=JSON.parse(this.node.fs.readFileSync(`${this.name}.json`))}}}persistCache(){const data=JSON.stringify(this.cache);if(isQX)$prefs.setValueForKey(data,this.name);if(isLoon||isSurge)$persistentStore.write(data,this.name);if(isNode){this.node.fs.writeFileSync(`${this.name}.json`,data,{flag:"w"},(err)=>console.log(err));this.node.fs.writeFileSync("root.json",JSON.stringify(this.root),{flag:"w"},(err)=>console.log(err))}}write(data,key){this.log(`SET ${key}`);if(key.indexOf("#")!==-1){key=key.substr(1);if(isSurge||isLoon){return $persistentStore.write(data,key)}if(isQX){return $prefs.setValueForKey(data,key)}if(isNode){this.root[key]=data}}else{this.cache[key]=data}this.persistCache()}read(key){this.log(`READ ${key}`);if(key.indexOf("#")!==-1){key=key.substr(1);if(isSurge||isLoon){return $persistentStore.read(key)}if(isQX){return $prefs.valueForKey(key)}if(isNode){return this.root[key]}}else{return this.cache[key]}}delete(key){this.log(`DELETE ${key}`);if(key.indexOf("#")!==-1){key=key.substr(1);if(isSurge||isLoon){$persistentStore.write(null,key)}if(isQX){$prefs.removeValueForKey(key)}if(isNode){delete this.root[key]}}else{delete this.cache[key]}this.persistCache()}notify(title,subtitle="",content="",options={}){const openURL=options["open-url"];const mediaURL=options["media-url"];if(isQX)$notify(title,subtitle,content,options);if(isSurge){$notification.post(title,subtitle,content+`${mediaURL?"\n多媒体:"+mediaURL:""}`,{url:openURL})}if(isLoon){let opts={};if(openURL)opts["openUrl"]=openURL;if(mediaURL)opts["mediaUrl"]=mediaURL;if(JSON.stringify(opts)=="{}"){$notification.post(title,subtitle,content)}else{$notification.post(title,subtitle,content,opts)}}if(isNode||isScriptable){const content_=content+(openURL?`\n点击跳转:${openURL}`:"")+(mediaURL?`\n多媒体:${mediaURL}`:"");if(isJSBox){const push=require("push");push.schedule({title:title,body:(subtitle?subtitle+"\n":"")+content_,})}else{console.log(`${title}\n${subtitle}\n${content_}\n\n`)}}}log(msg){if(this.debug)console.log(msg)}info(msg){console.log(msg)}error(msg){console.log("ERROR: "+msg)}wait(millisec){return new Promise((resolve)=>setTimeout(resolve,millisec))}done(value={}){if(isQX||isLoon||isSurge){$done(value)}else if(isNode&&!isJSBox){if(typeof $context!=="undefined"){$context.headers=value.headers;$context.statusCode=value.statusCode;$context.body=value.body}}}})(name,debug)}
diff --git a/LICENSE b/LICENSE
deleted file mode 100644
index f288702..0000000
--- a/LICENSE
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
diff --git a/Loon/lxk0301_LoonTask.conf b/Loon/lxk0301_LoonTask.conf
deleted file mode 100644
index b3d8a57..0000000
--- a/Loon/lxk0301_LoonTask.conf
+++ /dev/null
@@ -1,101 +0,0 @@
-# Loon软件Task配置 By lxk0301
-# GitHub主页(https://github.com/lxk0301/jd_scripts)
-# TG讨论组 (https://t.me/JD_fruit_pet)
-# TG通知频道 (https://t.me/jdfruit)
-# Loon的Task脚本订阅链接: https://raw.githubusercontent.com/lxk0301/jd_scripts/master/Loon/lxk0301_LoonTask.conf
-# 使用方法:打开APP,顶部的配置 -> 脚本 -> 订阅脚本- > 点击右上角+号 -> 添加url链接 (https://raw.githubusercontent.com/lxk0301/jd_scripts/master/Loon/lxk0301_LoonTask.conf)
-
-hostname = api.m.jd.com, draw.jdfcloud.com, jdjoy.jd.com, account.huami.com
-# 东东农场
-cron "5 6-18/6 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_fruit.js,tag=东东农场
-
-# 东东萌宠
-cron "10 7-19/6 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pet.js,tag=东东萌宠
-
-# 京东种豆得豆
-cron "1 7-21/2 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_plantBean.js,tag=京东种豆得豆
-
-# 宠汪汪(主要是日常任务,不过里面也有喂食和领取三餐狗粮)
-cron "15 */2 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy.js,tag=宠汪汪
-
-# 宠汪汪喂食
-cron "12 */1 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_feedPets.js,tag=宠汪汪喂食
-
-# 宠汪汪偷好友积分与狗粮
-cron "0 0,6 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_steal.js,tag=宠汪汪偷好友积分与狗粮
-
-# 宠汪汪积分兑换奖品
-cron "1 0,8,12,16 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_reward.js,tag=宠汪汪积分兑换奖品
-
-# 京东天天加速
-cron "8 */3 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_speed.js,tag=京东天天加速
-
-# 京东摇钱树
-cron "3 */3 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_moneyTree.js,tag=京东摇钱树
-
-# 京小超
-cron "11 1-23/2 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_superMarket.js,tag=京小超
-
-# 京小超兑换奖品
-cron "0 0 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_blueCoin.js,tag=京小超兑换奖品
-
-# 取关京东店铺商品
-cron "55 23 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_unsubscribe.js,tag=取关京东店铺商品
-
-# 进店领豆
-cron "10 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_shop.js,tag=进店领豆
-
-#摇京豆
-cron "5 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_club_lottery.js,tag=摇京豆
-
-# 京东手机狂欢城
-cron "1 0-18/6 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_818.js, tag=京东手机狂欢城
-
-# 京东星推官
-cron "0 0 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_xtg.js, tag=京东星推官
-
-#京东全民开红包
-cron "1 1 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_redPacket.js, tag=京东全民开红包
-
-#京豆变动通知
-cron "2 9 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_bean_change.js, tag=京豆变动通知
-
-#点点券
-cron "20 0,20 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_necklace.js, tag=点点券
-
-#十元街
-cron "10 7 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_syj.js, tag=十元街
-
-#东东小窝
-cron "16 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_small_home.js, tag=东东小窝
-
-#京喜工厂
-cron "26 * * * *" script-path= https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_dreamFactory.js, tag=京喜工厂
-
-#东东工厂
-cron "10 * * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdfactory.js,tag=东东工厂
-
-
-#京东全民营业领金币
-cron "20 * * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_collectProduceScore.js, tag=京东全民营业领金币
-
-#宠汪汪邀请助力与赛跑助力
-cron "15 10 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_run.js, tag=宠汪汪邀请助力与赛跑助力
-
-#小米运动
-cron "25 17 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/backUp/xmSports.js, tag=小米运动
-
-#宠汪汪助力更新Token
-http-response ^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/api\/user\/addUser\?code= script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_run.js, requires-body=true, timeout=10, tag=宠汪汪助力更新Token
-
-#宠汪汪助力获取Token
-http-request ^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/api\/user\/user\/detail\?openId= script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_run.js, requires-body=true, timeout=10, tag=宠汪汪助力获取Token
-
-# 宠汪汪强制为别人助力
-http-request ^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/pet\/enterRoom\/h5\?reqSource=weapp&invitePin=.*+(&inviteSource=task_invite&shareSource=\w+&inviteTimeStamp=\d+&openId=\w+)?|^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/pet\/helpFriend\?friendPin script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_help.js, requires-body=true, timeout=10, tag=宠汪汪强制为别人助力
-
-#聚宝盆投狗粮辅助(github@Zero-S1搬的)
-http-response ^https:\/\/jdjoy\.jd\.com\/pet\/getPetTreasureBox|^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/pet\/getPetTreasureBox script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_petTreasureBox.js, requires-body=true, timeout=10, tag=聚宝盆投狗粮辅助
-
-# 小米运动获取Token
-http-response ^https:\/\/account\.huami\.com\/v2\/client\/login script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/backUp/xmSports.js, requires-body=true, timeout=10, tag=小米运动获取Token
\ No newline at end of file
diff --git a/README.md b/README.md
index 6bad1de..48a4a7b 100644
--- a/README.md
+++ b/README.md
@@ -1,187 +1 @@
-## 不要fork! 不然下次GitHub还会继续封这个仓库
-
-## 特别声明:
-
-* 本仓库发布的Script项目中涉及的任何解锁和解密分析脚本,仅用于测试和学习研究,禁止用于商业用途,不能保证其合法性,准确性,完整性和有效性,请根据情况自行判断.
-
-* 本项目内所有资源文件,禁止任何公众号、自媒体进行任何形式的转载、发布。
-
-* lxk0301对任何脚本问题概不负责,包括但不限于由任何脚本错误导致的任何损失或损害.
-
-* 间接使用脚本的任何用户,包括但不限于建立VPS或在某些行为违反国家/地区法律或相关法规的情况下进行传播, lxk0301 对于由此引起的任何隐私泄漏或其他后果概不负责.
-
-* 请勿将Script项目的任何内容用于商业或非法目的,否则后果自负.
-
-* 如果任何单位或个人认为该项目的脚本可能涉嫌侵犯其权利,则应及时通知并提供身份证明,所有权证明,我们将在收到认证文件后删除相关脚本.
-
-* 任何以任何方式查看此项目的人或直接或间接使用该Script项目的任何脚本的使用者都应仔细阅读此声明。lxk0301 保留随时更改或补充此免责声明的权利。一旦使用并复制了任何相关脚本或Script项目的规则,则视为您已接受此免责声明.
-
- **您必须在下载后的24小时内从计算机或手机中完全删除以上内容.**
-> ***您使用或者复制了本仓库且本人制作的任何脚本,则视为`已接受`此声明,请仔细阅读***
-
-## Script脚本列表
-
-1. 京东水果([jd_fruit.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_fruit.js))
-2. 东东萌宠([jd_pet.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pet.js))
-4. 种豆得豆([jd_plantBean.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_plantBean.js))
-5. 天天加速([jd_speed.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_speed.js))
-6. 摇钱树([jd_moneyTree.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_moneyTree.js))
-6. 宠汪汪([jd_joy.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy.js))
-7. 宠汪汪偷好友狗粮与积分([jd_joy_steal.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_steal.js))
-8. 宠汪汪单独喂食([jd_joy_feedPets.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_feedPets.js))
-9. 宠汪汪兑换奖品([jd_joy_reward.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_reward.js))
-10. 宠汪汪强制为好友助力(刷好友)([jd_joy_help.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_help.js))
-11. 宠汪汪赛跑助力([jd_joy_run.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_run.js))
-12. 宠汪汪聚宝盆辅助脚本([jd_petTreasureBox.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_petTreasureBox.js))
-13. 取关京东店铺和商品([jd_unsubscribe.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_unsubscribe.js))
-14. 东东超市([jd_superMarket.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_superMarket.js))
-15. 东东超市兑换奖品([jd_blueCoin.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_blueCoin.js))
-16. 进店领豆([jd_shop.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_shop.js))
-17. 摇京豆([jd_club_lottery.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_club_lottery.js))
-18. 全名开红包([jd_redPacket.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_redPacket.js))
-19. 京东多合一签到([jd_bean_sign.js](https://raw.githubusercontent.com/lxk0301/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) 】
-20. 京豆变动通知([jd_bean_change.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_bean_change.js))
-21. 京喜工厂([jd_dreamFactory.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_dreamFactory.js))
-22. 东东小窝([jd_small_home.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_small_home.js))
-23. 东东工厂([jd_jdfactory.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdfactory.js))
-24. 点点券([jd_necklace.js](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_necklace.js))
-26. 以及其他一部分在特定时间可用的薅京豆脚本,如 [手机狂欢城](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_818.js) 、[星推官](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_xtg.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**
-
-- [ ] 东东工厂相互助力
-- [ ] 京喜工厂相互助力
-
-## 食用方法
-
-### 方法一:本地安装Node.js,下载本库脚本
-
- - 教程请见:[EvineDeng/jd-base](https://github.com/EvineDeng/jd-base),适用于以下系统:
-
- 1. Armbian/OpenWrt/Debian/Ubuntu/CentOS/Fedora/RedHat等Linux系统
-
- 2. Android
-
- 3. MacOS
-
-### 方法二:云服务器、腾讯云函数等等
-
- - 需自行有云服务器,云函数等
- - 腾讯云云函数 [快速部署教程](tencentscf.md)(免费)
- - 腾讯云云函数控制台使用 [教程说明](iCloud.md)
- - 腾讯云云函数 [GitHub Action部署教程](tencentscf.md#github-action-部署)
-
-
-### 方法三:Docker(NAS或VPS用户)
-
- - 可以精确控制任务运行时间,有三种办法:[docker办法一](https://github.com/lxk0301/jd_scripts/tree/master/docker)、[docker办法二(和本地安装Node.js类似)](https://github.com/EvineDeng/jd-base)、[docker办法三](https://github.com/chinnkarahoi/jd-scripts-docker)
- - [环境变量](https://github.com/lxk0301/jd_scripts/blob/master/githubAction.md#%E4%B8%8B%E6%96%B9%E6%8F%90%E4%BE%9B%E4%BD%BF%E7%94%A8%E5%88%B0%E7%9A%84-secrets%E5%85%A8%E9%9B%86%E5%90%88)
-
-#### 注:以上三种运行机制都是Node.js,故您需仔细阅读下面几点
-
-
- - 如果使用方法一与方法二,需自行提供京东cookie填写到 [jdCookie.js](https://github.com/lxk0301/jd_scripts/blob/master/jdCookie.js) 里面
-
-
- - 获取京东cookie教程可参考 [浏览器获取京东cookie教程](https://github.com/lxk0301/jd_scripts/blob/master/backUp/GetJdCookie.md) , [插件获取京东cookie教程](https://github.com/lxk0301/jd_scripts/blob/master/backUp/GetJdCookie2.md)
-
- - 方法三Docker安装Cookie请见各自的说明。
-
-### 方法四:iOS系统的代理软件(QuantumultX, Surge, Loon, 小火箭)
-
-#### 以下内容只针对iOS用户
-
-#### ios使用多个京东账号,需要使用BoxJs保存多会话进行切换
-
-##### BoxJs简单说明可看作者[BoxJs仓库地址](https://github.com/chavyleung/scripts/)
-
-使用box可以实现远程订阅助力好友(需订阅此 [链接](https://raw.githubusercontent.com/lxk0301/jd_scripts/master/lxk0301.boxjs.json))
-
-- [BoxJs使用教程](https://chavyleung.gitbook.io/boxjs/)
-
-- [BoxJs教程视频](https://youtu.be/eIpBrRxiy0w)
-
-
-【用box订阅的好处】
-
- 1、脚本也可以远程挂载。京东活动助力功能的分享码只需在box里面填写。以后只需远程更新就行。
-
- 2、所有脚本的cookie都可以备份,方便你迁移到其他支持box的软件。
-
- 3、box可以支持多账号
-
-```
-# QuantumultX
-
-#东东农场
-5 6-18/6 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_fruit.js, tag=东东农场, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdnc.png, enabled=true
-
-#东东萌宠
-15 6-18/6 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pet.js, tag=东东萌宠, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdmc.png, enabled=true
-
-# 种豆得豆
-1 7-21/2 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_plantBean.js, tag=种豆得豆, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdzd.png, enabled=true
-
-#天天加速
-8 */3 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_speed.js, tag=京东天天加速, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdjs.png, enabled=true
-
-#京东摇钱树
-3 */2 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_moneyTree.js, tag=京东摇钱树, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdyqs.png, enabled=true
-
-#京东宠汪汪
-15 */2 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy.js, tag=京东宠汪汪, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdcww.png, enabled=true
-
-#宠汪汪偷好友积分与狗粮
-0 0,6 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_steal.js, tag=宠汪汪偷好友积分与狗粮, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdcww.png, enabled=true
-
-#京东宠汪汪喂食
-15 */1 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_feedPets.js, tag=京东宠汪汪喂食, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdcww.png, enabled=true
-
-#宠汪汪积分兑换奖品
-0 0-16/8,12 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_reward.js, tag=宠汪汪积分兑换奖品, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdcww.png, enabled=true
-
-# 宠汪汪邀请助力与赛跑助力
-15 10 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_run.js, tag=宠汪汪邀请助力与赛跑助力, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdcww.png, enabled=true
-
-#京小超
-11 1-23/5 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_superMarket.js, tag=京小超, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jxc.png, enabled=true
-
-#京小超兑换奖品
-0 0 0 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_blueCoin.js, tag=京小超兑换奖品, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jxc.png, enabled=true
-
-#进店领豆
-10 0 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_shop.js, tag=进店领豆, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_shop.png, enabled=true
-
-#摇京豆
-5 0 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_club_lottery.js, tag=摇京豆, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdyjd.png, enabled=true
-
-#京东全民开红包
-1 1 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_redPacket.js, tag=京东全民开红包, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_redPacket.png, enabled=true
-
-#京豆变动通知
-2 9 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_bean_change.js, tag=京豆变动通知, enabled=true
-
-#京东手机狂欢城
-1 0-18/6 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_818.js, tag=京东手机狂欢城, enabled=true
-
-#京东星推官
-2 0 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_xtg.js, tag=京东星推官, enabled=true
-```
-### 赞赏码(开发维护不易,请赏杯茶水费)
-
-
-### 特别感谢(排名不分先后):
-* [@NobyDa](https://github.com/NobyDa)
-
-* [@chavyleung](https://github.com/chavyleung)
-
-* [@liuxiaoyucc](https://github.com/liuxiaoyucc)
-
-* [@Zero-S1](https://github.com/Zero-S1)
-
-* [@uniqueque](https://github.com/uniqueque)
-
-
-* [@nzw9314](https://github.com/nzw9314)
+## See you later
\ No newline at end of file
diff --git a/Surge/lxk0301_Task.sgmodule.sgmodule b/Surge/lxk0301_Task.sgmodule.sgmodule
deleted file mode 100644
index 68fbcc7..0000000
--- a/Surge/lxk0301_Task.sgmodule.sgmodule
+++ /dev/null
@@ -1,33 +0,0 @@
-#!name=lxk0301 iOS Tasks&Cookies Module
-#!desc=iOS Tasks 模块配置
-#!system=ios
-
-# Task模块配置 By lxk0301
-# GitHub主页(https://github.com/lxk0301/jd_scripts)
-# TG讨论组 (https://t.me/JD_fruit_pet)
-# TG通知频道 (https://t.me/jdfruit)
-# Surge的Task脚本模块地址: https://raw.githubusercontent.com/lxk0301/jd_scripts/master/Surge/lxk0301_Task.sgmodule.sgmodule
-
-[Script]
-
-cron "5 6-18/6 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_fruit.js,timeout=530, wake-system=1, tag=东东农场
-cron "20 7-19/6 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pet.js,timeout=530, wake-system=1, tag=东东萌宠
-cron "10 7-21/2 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_plantBean.js,timeout=630, wake-system=1, tag=京东种豆得豆
-cron "15 */2 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy.js,timeout=330, wake-system=1, tag=宠汪汪
-cron "12 */1 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_feedPets.js,timeout=30, wake-system=1, tag=宠汪汪喂食
-cron "0 0,6 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_steal.js,timeout=420, wake-system=1, tag=宠汪汪偷好友积分与狗粮
-cron "1 0,8,12,16 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_reward.js,timeout=30, wake-system=1, tag=宠汪汪积分兑换奖品
-cron "8 */3 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_speed.js,timeout=130, wake-system=1, tag=京东天天加速
-cron "15 */5 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_moneyTree.js,timeout=130, wake-system=1, tag=京东摇钱树
-cron "5 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_club_lottery.js, timeout=50, wake-system=1, tag=摇京豆
-cron "11 1-23/5 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_superMarket.js,timeout=530, wake-system=1, tag=京小超
-cron "0 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_blueCoin.js,timeout=30, wake-system=1, tag=京小超领蓝币(兑换京豆)
-cron "55 23 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_unsubscribe.js,timeout=250, wake-system=1, tag=取关京东店铺商品
-cron "10 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_shop.js,timeout=30, wake-system=1, tag=进店领豆
-# cron "1 0-18/6 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_818.js, timeout=150, wake-system=1, tag=京东手机狂欢城
-cron "15 10 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_run.js, timeout=30, wake-system=1, tag=宠汪汪邀请助力与赛跑助力
-cron "1 1 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_redPacket.js, wake-system=1, tag=京东全民开红包
-# cron "0 0 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_xtg.js, timeout=550, wake-system=1, tag=京东星推官
-cron "2 9 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_bean_change.js, timeout=650, wake-system=1, tag=京豆变动通知
-cron "20 0,20 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_necklace.js, timeout=650, wake-system=1, tag=点点券
-# cron "20 * * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_collectProduceScore.js, wake-system=1, tag=京东全民营业领金币
diff --git a/backUp/AlipayManor.js b/backUp/AlipayManor.js
deleted file mode 100644
index 70efa1b..0000000
--- a/backUp/AlipayManor.js
+++ /dev/null
@@ -1,14 +0,0 @@
-// qx 及 loon 可用。
-// 半自动提醒支付宝蚂蚁庄园喂食。
-// 15 */4 * * * AlipayManor.js
-// 自用 Modified from zZPiglet
-
-const $ = new Env('蚂蚁庄园');
-const manor = "alipays://platformapi/startapp?appId=66666674";
-
-$.msg("支付宝", "蚂蚁庄园喂食啦", "alipays://platformapi/startapp?appId=66666674", manor);
-
-$.done()
-
-// prettier-ignore
-function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{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=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"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 e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)}
\ No newline at end of file
diff --git a/backUp/GetJdCookie.md b/backUp/GetJdCookie.md
deleted file mode 100644
index 0dc377a..0000000
--- a/backUp/GetJdCookie.md
+++ /dev/null
@@ -1,32 +0,0 @@
-## 浏览器获取京东cookie教程
-
- **以下浏览器都行**
-
- - Chrome浏览器
- - 新版Edge浏览器
- - 国产360,QQ浏览器切换到极速模式
-
-### 操作步骤
-
-1. 电脑浏览器打开京东网址 [https://m.jd.com/](https://m.jd.com/)
-2. 按键盘F12键打开开发者工具,然后点下图中的图标
- 
-3. 此时是未登录状态(使用手机短信验证码登录),如已登录请忽略此步骤
- - 使用手机短信验证码登录(此方式cookie有效时长大概31天,其他登录方式比较短)
-4. 登录后,选择Network,有很多链接的话点箭头这里清空下
- 
-5. 然后再点我的,链接就变少了
- 
-6. 点第一个链接(log.gif)进去,找到cookie,复制出来,新建一个TXT文本临时保存一下,下面需要用到
- 
-7. 第六步复制出来的cookie比较长,我们只需要`pt_pin=xxxx;`和 `pt_key=xxxx;`部分的内容即可(注:英文引号`;`是必要的)。可以用下面的脚本,在Chrome浏览器按F12,console里面输入下面脚本按enter回车键
- ```
- var CV = '单引号里面放第六步拿到的cookie';
- var CookieValue = CV.match(/pt_pin=.+?;/) + CV.match(/pt_key=.+?;/);
- copy(CookieValue);
- ```
-8. 这样子整理出关键的的cookie已经在你的剪贴板上, 可直接粘贴
-
-9. 如果需获取第二个京东账号的cookie,不要在刚才的浏览器上面退出登录账号一(否则刚才获取的cookie会失效),需另外换一个浏览器(Chrome浏览器 `ctr+shift+n` 打开无痕模式也行),然后继续按上面步骤操作即可
-
-
diff --git a/backUp/GetJdCookie2.md b/backUp/GetJdCookie2.md
deleted file mode 100644
index eadf9a5..0000000
--- a/backUp/GetJdCookie2.md
+++ /dev/null
@@ -1,34 +0,0 @@
-## 浏览器插件获取京东cookie教程
- > 此教程内容由tg用户@wukongdada提供,特此感谢
-
- **以下浏览器都行**
-
- - Chrome浏览器
- - 新版Edge浏览器(chrome内核)
-
-### 操作步骤
-
-1. 电脑浏览器打开京东网址 [https://m.jd.com/](https://m.jd.com/)
-2. Chrome类浏览器安装EditThisCookie插件
- - Chrome插件商店搜EditThisCookie, 或者[打开此网站](https://chrome.google.com/webstore/detail/editthiscookie/fngmhnnpilhplaeedifhccceomclgfbg?utm_source=chrome-ntp-icon) 进行安装
- - 仅使用百分浏览器,谷歌浏览器测试过,其他谷歌类浏览器请自行测试。
- - 无法登录Chrome插件商店或者打不开网址建议使用edge chrome版。
-3. edge chrome浏览器安装Cookie Editor插件
- - [edge插件商店](edge://extensions/)搜Cookie Editor,或[打开以下网址](https://microsoftedge.microsoft.com/addons/detail/cookie-editor/ajfboaconbpkglpfanbmlfgojgndmhmc?hl=zh-CN) 完成插件安装
-4. 以下是chrome和edge的相关设置截图,输入的网址是 ``jd.com``
-
- 
-
- 
-
-5. 现在点击回到京东触屏版,再点击EditThisCookie/Cookie Editor,再点击搜索,输入key或pin,如下图所示的pt_key,复制pt_key的value值。此插件可以看到cookie的有效期。
-
- 
-
-6. 按照以下格式形成自己的jd_cookie
- - `pt_key=复制插件搜索出来的key值;pt_pin=复制插件搜索出来的pin值;` ,后面的英文引号`;`是必须要的
- - 给一个京东cookie具体示例 `pt_key=jdDC2F833333EFDGTCE5BD4AD1A952D4F4DF84A46052;pt_pin=jd_123456;`
-
-7. 如果需获取第二个京东账号的cookie,不要在刚才的浏览器上面退出登录账号一(否则刚才获取的cookie会失效),需另外换一个浏览器(Chrome浏览器 `ctr+shift+n` 打开无痕模式也行),然后继续按上面步骤操作即可
-
-
diff --git a/backUp/TG_PUSH.md b/backUp/TG_PUSH.md
deleted file mode 100644
index 4004b29..0000000
--- a/backUp/TG_PUSH.md
+++ /dev/null
@@ -1,17 +0,0 @@
-**TG_PUSH教程**
-
-利用Telegram机器人推送通知,需要在环境变量填入正确的```TG_BOT_TOKEN```以及```TG_USER_ID```,以下教程简明阐述如何获取token以及UserID
-
-Ⅰ.首先在Telegram上搜索[BotFather](https://t.me/BotFather)机器人
-
-
-
-Ⅱ.利用[BotFather](https://t.me/BotFather)创建一个属于自己的通知机器人,按照下图中的1、2、3步骤拿到token,格式形如```10xxx4:AAFcqxxxxgER5uw```。填入```TG_BOT_TOKEN```
-
-
-
-Ⅲ.再次在Telegram上搜索[getuserIDbot](https://t.me/getuserIDbot)机器人,获取UserID。填入```TG_USER_ID```
-
-
-
-至此,获取**TG_BOT_TOKEN**以及**TG_USER_ID**的教程结束
diff --git a/backUp/cashSign.js b/backUp/cashSign.js
deleted file mode 100644
index 869d0da..0000000
--- a/backUp/cashSign.js
+++ /dev/null
@@ -1,197 +0,0 @@
-//暂有功能:每日签到
-// nobyda大佬的京东签到里面, 已添加了此功能,如果用了京东签到脚本,此脚本可以停用了。
-const $ = new Env('天天签到领现金');
-const Key = '';//单引号内自行填写您抓取的京东Cookie
-//直接用NobyDa的jd cookie
-const cookie = Key ? Key : $.getdata('CookieJD');
-const JD_API_HOST = 'https://api.m.jd.com/client.action';
-!(async () => {
- if (!cookie) {
- $.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- await cash_sign();
- await cash_homePage();
- // await cash_doTask(2, '1000002389')
- await msgShow();
- // if ($.isLogin) {
- // if (!jdNotify || jdNotify === 'false') {
- // $.msg($.name, subTitle, message);
- // }
- // }
- // $.msg($.name, subTitle, message);
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-//每日签到
-function cash_sign() {
- let functionId = arguments.callee.name.toString();
- let body = {"remind":0,"inviteCode":"","type":0,"breakReward":0};
- return new Promise((resolve) => {
- $.post(taskUrl(functionId, body), (err, resp, data) => {
- try {
- data = JSON.parse(data);
- // console.log(`data${JSON.stringify(data)}`)
- $.data = data;
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve()
- }
- // if (err) {
- // console.log("=== request error -s--");
- // console.log("=== request error -e--");
- // } else {
- // try {
- // data = JSON.parse(data);
- // console.log(`data${JSON.stringify(data)}`)
- // $.data = data;
- // } catch (e) {
- // $.logErr(e, resp);
- // } finally {
- // resolve()
- // }
- // }
- })
- })
-}
-//做任务
-function cash_doTask(type, taskInfo) {
- const body = {
- 'type': type,
- 'taskInfo': taskInfo
- };
- return new Promise((resolve) => {
- const doTaskUrl = {
- url: JD_API_HOST + `?functionId=cash_doTask`,
- body: `adid=3B3AD5BC-B5E6-4A08-B32A-030CD805B5DD&area=19_1601_50258_51885&body=${escape(JSON.stringify(body))}&build=167283&client=apple&clientVersion=9.0.4&d_brand=apple&d_model=iPhone11%2C8&eid=eidI42550111OTc2RjFCQzgtMTYxQy00OA%3D%3DrCYdObgFE80GYJdgxMLJ0RlHfdF1uWSVuAwDfNOV%2BH%2BArP2K4Ht7t9Cscz%2B/mkYaC70ypbQutgv8vqJr&isBackground=N&joycious=298&lang=zh_CN&networkType=wifi&networklibtype=JDNetworkBaseAF&openudid=e35caf0a69be42084e3c97eef56c3af7b0262d01&osVersion=13.5.1&partner=apple&rfs=0000&scope=01&screen=828%2A1792&sign=b2a86a0f477e65a5ea40adc4a7a296cb&st=${Date.now()}&sv=101&uts=0f31TVRjBSsqndu4/jgUPz6uymy50MQJOnkRxds9DBcksJKOMWtLozcAH/M69g0LniG6s05YlJ4C6nk%2BI1mo0gto0Kw8pej0%2BiVtbzGBGqYDTEvkT7XS8YjpNXWZmM4gEDOL2mHlGnj251JSm9QUxTwQz0qHIHeQDWSErxbtZIA45XJsDxWqIIClWOUUPgFrbDVA11WciAWXJ1lqN41m7g%3D%3D&uuid=coW0lj7vbXVin6h7ON%2BtMNFQqYBqMahr&wifiBssid=f7754c40c09909dc5fccf03e8d7e39d4`,
- headers: {
- // 'Cookie': cookie,
- "Host": "api.m.jd.com",
- "Content-Type": "application/x-www-form-urlencoded",
- "Accept": "*/*",
- "Connection": "keep-alive",
- "Cookie": "pt_key=AAJfAv31AEBlB0UzN_9K9kXOEs2VvYg5kz8AACQyVpWZs4zInFVXVF01t-a-7ylquYGxUM5DG9F6sSddD4xs_GZV3LYKgX5I;pt_pin=%E8%A2%AB%E6%8A%98%E5%8F%A0%E7%9A%84%E8%AE%B0%E5%BF%8633;",
- "User-Agent": "JD4iPhone/167283 (iPhone; iOS 13.5.1; Scale/2.00)",
- "Accept-Language": "zh-Hans-CN;q=1, en-CN;q=0.9, zh-Hant-CN;q=0.8",
- "Content-Length": "870",
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- $.post(doTaskUrl, (err, resp, data) => {
- try {
- data = JSON.parse(data);
- console.log(`做任务----data${JSON.stringify(data)}`)
- // $.homePage = data;
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve()
- }
- })
- })
-}
-function cash_homePage() {
- const body = {};
- return new Promise((resolve) => {
- const homePageUrl = {
- url: JD_API_HOST + `?functionId=cash_homePage`,
- body: `adid=3B3AD5BC-B5E6-4A08-B32A-030CD805B5DD&area=19_1601_50258_51885&body=${escape(JSON.stringify(body))}&build=167283&client=apple&clientVersion=9.0.4&d_brand=apple&d_model=iPhone11%2C8&eid=eidI42550111OTc2RjFCQzgtMTYxQy00OA%3D%3DrCYdObgFE80GYJdgxMLJ0RlHfdF1uWSVuAwDfNOV%2BH%2BArP2K4Ht7t9Cscz%2B/mkYaC70ypbQutgv8vqJr&isBackground=N&joycious=298&lang=zh_CN&networkType=wifi&networklibtype=JDNetworkBaseAF&openudid=e35caf0a69be42084e3c97eef56c3af7b0262d01&osVersion=13.5.1&partner=apple&rfs=0000&scope=01&screen=828%2A1792&sign=216d0aa860a52ea89420293976d2ee28&st=1595926359893&sv=101&uts=0f31TVRjBSsqndu4/jgUPz6uymy50MQJcPZxWlSpDrAQ8407rzIXjarvshNNSEsnLV0tV3BB9%2B3IWXJgCfYn8yocpXrWCjeJzfA4MHUq%2BjAyQ7ZUc8ZaXvIx2JM4dUlg6P1v6IgCWZJa1u0j1YuA7IUrZzm3E1eYuNoB7UmQTgXV4%2BFyD/FzKY0DqsmdN6Fvo8yZeblZwy8sAEI//MvESQ%3D%3D&uuid=coW0lj7vbXVin6h7ON%2BtMNFQqYBqMahr&wifiBssid=f7754c40c09909dc5fccf03e8d7e39d4`,
- headers: {
- 'Cookie': cookie,
- "Host": "api.m.jd.com",
- "Content-Type": "application/x-www-form-urlencoded",
- "Accept": "*/*",
- "Connection": "keep-alive",
- "User-Agent": "JD4iPhone/167283 (iPhone; iOS 13.5.1; Scale/2.00)",
- "Accept-Language": "zh-Hans-CN;q=1, en-CN;q=0.9, zh-Hant-CN;q=0.8",
- "Content-Length": "870",
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- $.post(homePageUrl, async (err, resp, data) => {
- try {
- data = JSON.parse(data);
- // console.log(`cash_homePage----data${JSON.stringify(data)}`)
- $.homePage = data;
- // var canDoTaskList = [];
- // if (data.code === 0) {
- // if (data.data.result.taskInfos && data.data.result.taskInfos.length > 0) {
- // for (let item of data.data.result.taskInfos) {
- // if ((item.type === 2 || item.type === 3 || item.type === 4 || item.type === 17) && item.finishFlag === 2) {
- // canDoTaskList.push(item);
- // console.log('type', item.type)
- // console.log('type', item.desc)
- // let aa = await cash_doTask(item.type, item.desc);
- // if (aa.code === 0) {
- // console.log('重新请求任务列表')
- // await cash_homePage();
- // }
- // }
- // }
- // }
- // }
- // canDoTaskList
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve()
- }
- })
- })
-}
-
-function msgShow() {
- if ($.data.data.bizCode === 0 && $.data.data.success === 'True' ) {
- $.msg($.name, `今日签到${$.data.data.bizMsg}`, `【签到获得现金】${$.data.data.result.signCash}元\n【现有红包】${$.homePage.data.result.totalMoney},${$.homePage.data.result.cashOutStatusTip}\\n`);
-
- } else {
- $.msg($.name, '今日已签到,请明日再来哦', `【现有红包】${$.homePage.data.result.totalMoney}元,${$.homePage.data.result.cashOutStatusTip}\n`);
- }
-}
-// function request(function_id, body = {}) {
-// return new Promise((resolve) => {
-// $.post(taskurl(function_id, body), (err, resp, data) => {
-// if (err) {
-// console.log("=== request error -s--");
-// console.log("=== request error -e--");
-// } else {
-// try {
-// data = JSON.parse(data);
-// console.log(`data${JSON.stringify(data)}`)
-// $.data = data;
-// } catch (e) {
-// console.log(e);
-// } finally {
-// resolve()
-// }
-// }
-// })
-// })
-// }
-function taskUrl(function_id, body = {}) {
- // console.log(`${JD_API_HOST}?functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=ld&client=apple&clientVersion=&networkType=&osVersion=&uuid=`)
- return {
- // url: `${JD_API_HOST}?functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=ld&client=apple&clientVersion=&networkType=&osVersion=&uuid=`,
- url: JD_API_HOST + `?functionId=${function_id}`,
- // body: `adid=3B3AD5BC-B5E6-4A08-B32A-030CD805B5DD&area=19_1601_50258_51885&body=%7B%22remind%22%3A0%2C%22inviteCode%22%3A%22%22%2C%22type%22%3A0%2C%22breakReward%22%3A0%7D&build=167283&client=apple&clientVersion=9.0.4&d_brand=apple&d_model=iPhone11%2C8&eid=eidI42550111OTc2RjFCQzgtMTYxQy00OA%3D%3DrCYdObgFE80GYJdgxMLJ0RlHfdF1uWSVuAwDfNOV%2BH%2BArP2K4Ht7t9Cscz%2B/mkYaC70ypbQutgv8vqJr&isBackground=N&joycious=298&lang=zh_CN&networkType=wifi&networklibtype=JDNetworkBaseAF&openudid=e35caf0a69be42084e3c97eef56c3af7b0262d01&osVersion=13.5.1&partner=apple&rfs=0000&scope=01&screen=828%2A1792&sign=59c1af6b257421672f1c8f6ab878084d&st=1595926377439&sv=102&uts=0f31TVRjBSsqndu4/jgUPz6uymy50MQJcPZxWlSpDrAQ8407rzIXjarvshNNSEsnLV0tV3BB9%2B3IWXJgCfYn8yocpXrWCjeJzfA4MHUq%2BjAyQ7ZUc8ZaXvIx2JM4dUlg6P1v6IgCWZJa1u0j1YuA7IUrZzm3E1eYuNoB7UmQTgXV4%2BFyD/FzKY0DqsmdN6Fvo8yZeblZwy8sAEI//MvESQ%3D%3D&uuid=coW0lj7vbXVin6h7ON%2BtMNFQqYBqMahr&wifiBssid=f7754c40c09909dc5fccf03e8d7e39d4`,
- body: `adid=3B3AD5BC-B5E6-4A08-B32A-030CD805B5DD&area=19_1601_50258_51885&body=${escape(JSON.stringify(body))}&build=167283&client=apple&clientVersion=9.0.4&d_brand=apple&d_model=iPhone11%2C8&eid=eidI42550111OTc2RjFCQzgtMTYxQy00OA%3D%3DrCYdObgFE80GYJdgxMLJ0RlHfdF1uWSVuAwDfNOV%2BH%2BArP2K4Ht7t9Cscz%2B/mkYaC70ypbQutgv8vqJr&isBackground=N&joycious=298&lang=zh_CN&networkType=wifi&networklibtype=JDNetworkBaseAF&openudid=e35caf0a69be42084e3c97eef56c3af7b0262d01&osVersion=13.5.1&partner=apple&rfs=0000&scope=01&screen=828%2A1792&sign=59c1af6b257421672f1c8f6ab878084d&st=1595926377439&sv=102&uts=0f31TVRjBSsqndu4/jgUPz6uymy50MQJcPZxWlSpDrAQ8407rzIXjarvshNNSEsnLV0tV3BB9%2B3IWXJgCfYn8yocpXrWCjeJzfA4MHUq%2BjAyQ7ZUc8ZaXvIx2JM4dUlg6P1v6IgCWZJa1u0j1YuA7IUrZzm3E1eYuNoB7UmQTgXV4%2BFyD/FzKY0DqsmdN6Fvo8yZeblZwy8sAEI//MvESQ%3D%3D&uuid=coW0lj7vbXVin6h7ON%2BtMNFQqYBqMahr&wifiBssid=f7754c40c09909dc5fccf03e8d7e39d4`,
- headers: {
- 'Cookie': cookie,
- "Host": "api.m.jd.com",
- "Content-Type": "application/x-www-form-urlencoded",
- "Accept": "*/*",
- "Connection": "keep-alive",
- "User-Agent": "JD4iPhone/167283 (iPhone; iOS 13.5.1; Scale/2.00)",
- "Accept-Language": "zh-Hans-CN;q=1, en-CN;q=0.9, zh-Hant-CN;q=0.8",
- "Content-Length": "955",
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
-}
-
-function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{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=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"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 e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)}
\ No newline at end of file
diff --git a/backUp/gitSync.md b/backUp/gitSync.md
deleted file mode 100644
index 132321d..0000000
--- a/backUp/gitSync.md
+++ /dev/null
@@ -1,100 +0,0 @@
-## 保持自己github的forks自动和上游仓库同步的教程
- - 信息来源于 [https://github.com/wei/pull](https://github.com/wei/pull)
- - 以下教程仅是出于个人爱好,不保证本教程的完全正确性,最终请以作者 [https://github.com/wei/pull](https://github.com/wei/pull) 的描述为准。
- - 注:此教程由telegram用户@wukongdada提供
-### 1、只同步默认分支的教程
-
-> 当上游的仓库仅有一个默认分支。或者上游仓库有两个分支,我们仅需要同步他的默认分支,其他分支对内容对我们来说无关紧要。
-
-
-
-
-
-
-
-a) 登录自己的github账号,另开网页打开 [https://github.com/wei/pull](https://github.com/wei/pull)
-
-
-
-b) 点击Pull app进行安装。
-
-
-
-
-
-c) 安装过程中会让你选择要选择那一种方式,All repositories(就是同步已经frok的仓库以及未来fork的仓库),Only select repositories(仅选择要自己需要同步的仓库,其他fork的仓库不会被同步),根据自己需求选择,实在不知道怎么选择,就选All repositories;点击install,完成安装。
-
-
-
-
-
-d) 后续,如果要调整1.c中的选项,打开 [https://github.com/apps/pull](https://github.com/apps/pull) ,点击Configure,输入github密码进入pull的相关设置。
-
-
-
-
-
-e) 进入后,找到Repository access,根据自己的需求,重新选择:All repositories(就是同步已经frok的仓库以及未来fork的仓库),Only select repositories(仅选择要自己需要同步的仓库,其他fork的仓库不会被同步),Save后保存生效。
-
-
-
-
-
-f) Pull app作者虽然在项目中写道keeps your forks up-to-date with upstream via automated pull requests,但当上游仓库有更改时,自己的仓库会在3个小时内完成与上游的同步,3个小时是Pull app作者说的最长时间。当然也可以通过手动触发同步上游仓库,手动触发方式:`https://pull.git.ci/process/你的GitHub名字/你的仓库名字` (例如:`https://pull.git.ci/process/xxxxx/test` ),手动触发可能会进行人机验证,验证通过后会显示Success。
-
-
-
-
-
-### 2、同步其他分支的教程
-
- 
-
-
-
-a) 假设你fork了上游仓库后,你fork后的地址为 `https://github.com/你的仓库名字/test` ,首先设置完成第1部分内容,注意在1.c步骤没有设置全部同步的,要回到1.e步,确认是否设置同步了 `你的仓库名字/test`,如果没有,请添加上。
-
-
-
-
-
-b) 在默认分支下添加一个文件。
-
-
-
-
-
-c) 复制 ``.github/pull.yml`` 粘贴后看到以下页面,注意github前面的那个.别漏掉了。
-
-
-
-
-
-d) 请在https://github.com/wei/pull\#advanced-setup-with-config 页复制代码,
-
-注意:upstream处要修改为上游仓库作者名字。
-
-
-
-
-
-
-
-e) 最终的示例如下,假设上游作者是zhangsan,所有的注意点都用红线圈出来了,保存后生效。
-
-
-
-
-
-f) Pull app作者虽然在项目中写道keeps your forks up-to-date with upstream via automated pull requests,但当上游仓库有更改时,自己的仓库会在3个小时内完成与上游的同步,3个小时是Pull app作者说的最长时间。当然也可以通过手动触发同步上游仓库,手动触发方式:`https://pull.git.ci/process/你的GitHub名字/你的仓库名字` (例如:`https://pull.git.ci/process/xxxxx/test`),手动触发可能会进行人机验证,验证通过后会显示Success。具体见1.f提供的图片。
-
-
-
-g) 本人仅测试过forks一个仓库只有2个分支的项目,如果有多个分支,不能保证是否可行,请自行测试,或者是使用本教程第3部分高级玩法。
-
-### 高级玩法
-
->当然,作者还有其他更好的项目用于同步所有分支,例如使用 GitHub actions 进行同步。请参考原作者的项目
-
-- [https://github.com/wei/git-sync](https://github.com/wei/git-sync)
-- [https://github.com/repo-sync/github-sync](https://github.com/repo-sync/github-sync)
diff --git a/backUp/iepngs.boxjs.json b/backUp/iepngs.boxjs.json
deleted file mode 100644
index 7f07218..0000000
--- a/backUp/iepngs.boxjs.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "id": "iepngs.app.sub",
- "name": "iepngs脚本订阅(自用,非作者本人的订阅)",
- "author": "@iepngs",
- "icon": "https://avatars2.githubusercontent.com/u/10695382?s=460&u=efc97d623c7c21170e6794f367fa80a97253f87b&v=4",
- "repo": "https://github.com/iepngs/Script",
- "apps": [
- {
- "id": "lxhealth",
- "name": "乐心健康",
- "keys": [
- "lxhealthCookie",
- "lxhealthStep"
- ],
- "settings": [
- {
- "id": "lxhealthStep",
- "name": "运动步数",
- "val": "",
- "type": "text",
- "desc": "修改乐心健康运动步数"
- }
- ],
- "author": "@iepngs",
- "repo": "https://github.com/iepngs/Script",
- "script": "https://raw.githubusercontent.com/iepngs/Script/master/lxhealth/index.js",
- "icons": [
- "https://avatars2.githubusercontent.com/u/10695382?s=460&u=efc97d623c7c21170e6794f367fa80a97253f87b&v=4",
- "https://avatars2.githubusercontent.com/u/10695382?s=460&u=efc97d623c7c21170e6794f367fa80a97253f87b&v=4"
- ]
- }
- ]
-}
\ No newline at end of file
diff --git a/backUp/jd_fruit_double.js b/backUp/jd_fruit_double.js
deleted file mode 100644
index 0472184..0000000
--- a/backUp/jd_fruit_double.js
+++ /dev/null
@@ -1,1000 +0,0 @@
-/*
-jd免费水果 搬的https://github.com/liuxiaoyucc/jd-helper/blob/a6f275d9785748014fc6cca821e58427162e9336/fruit/fruit.js
-更新时间:2020-08-25
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-// quantumultx
-[task_local]
-#jd免费水果
-5 6-18/6 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_fruit.js, tag=东东农场, img-url=https://raw.githubusercontent.com/znz1992/Gallery/master/jdsg.png, enabled=true
-// Loon
-[Script]
-cron "5 6-18/6 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_fruit.js,tag=东东农场
-// Surge
-// 宠汪汪偷好友积分与狗粮 = type=cron,cronexp="5 6-18/6 * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_steal.js
-互助码shareCode请先手动运行脚本查看打印可看到
-一天只能帮助4个人。多出的助力码无效
-注:如果使用Node.js, 需自行安装'crypto-js,got,http-server,tough-cookie'模块. 例: npm install crypto-js http-server tough-cookie got --save
-*/
-
-let name = '东东农场';
-const retainWater = 100;//保留水滴大于多少g,默认100g;
-const $ = new Env(name);
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
-//ios等软件用户直接用NobyDa的jd cookie
-const cookie = jdCookieNode.CookieJD ? jdCookieNode.CookieJD : $.getdata('CookieJD');
-
-//京东接口地址
-const JD_API_HOST = 'https://api.m.jd.com/client.action';
-
-let jdNotify = $.getdata('jdFruitNotify');
-//助力好友分享码(最多4个,否则后面的助力失败),原因:京东农场每人每天只有四次助力机会
-let shareCodes = [ // 这个列表填入你要助力的好友的shareCode
- '0a74407df5df4fa99672a037eec61f7e',
- 'dbb21614667246fabcfd9685b6f448f3',
- '6fbd26cc27ac44d6a7fed34092453f77',
- '61ff5c624949454aa88561f2cd721bf6',
-]
-// 添加box功能
-// 【用box订阅的好处】
-// 1️⃣脚本也可以远程挂载了。助力功能只需在box里面设置助力码。
-// 2️⃣所有脚本的cookie都可以备份,方便你迁移到其他支持box的软件。
-let isBox = false //默认没有使用box
-const boxShareCodeArr = ['jd_fruit1', 'jd_fruit2', 'jd_fruit3', 'jd_fruit4'];
-isBox = boxShareCodeArr.some((item) => {
- const boxShareCode = $.getdata(item);
- return (boxShareCode !== undefined && boxShareCode !== null && boxShareCode !== '');
-});
-if (isBox) {
- shareCodes = [];
- for (const item of boxShareCodeArr) {
- if ($.getdata(item)) {
- shareCodes.push($.getdata(item));
- }
- }
-}
-const Task = step()
-Task.next();
-
-let farmTask = null, isFruitFinished = false;
-
-// let farmInfo = null;
-
-function* step() {
- let message = '';
- let subTitle = '', UserName = '';
- let option = {};
- if (!cookie) {
- $.msg(name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- $.done();
- return
- }
- UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- let farmInfo = yield initForFarm();
- if (farmInfo.farmUserPro) {
- option['media-url'] = farmInfo.farmUserPro.goodsImage;
- subTitle = `【${UserName}】${farmInfo.farmUserPro.name}`;
- console.log(`\n【您的互助码shareCode】 ${farmInfo.farmUserPro.shareCode}\n`);
- console.log(`\n【已成功兑换水果】${farmInfo.farmUserPro.winTimes}次\n`)
- if (farmInfo.treeState === 0) {
- //已下单购买, 但未开始种植新的水果
- $.msg(name, `【提醒⏰】请重新种植水果`, `上轮水果${farmInfo.farmUserPro.name}已兑换成功\n请去京东APP或微信小程序选购并种植新的水果\n openApp.jdMobile://`, {"open-url": "openApp.jdMobile://"});
- $.done();
- return;
- } else if (farmInfo.treeState === 1){
- console.log(`\n${farmInfo.farmUserPro.name}种植中...\n`)
- } else if (farmInfo.treeState === 2) {
- option['open-url'] = "openApp.jdMobile://";
- $.msg(name, `【提醒⏰】${farmInfo.farmUserPro.name}已可领取`, '请去京东APP或微信小程序查看', option);
- $.done();
- return;
- } else if (farmInfo.treeState === 3) {
- //已成熟可去兑换,但还没去下单购买
- option['open-url'] = "openApp.jdMobile://";
- $.msg(name, `【提醒⏰】${farmInfo.farmUserPro.name}已可领取`, '请去京东APP或微信小程序查看', option);
- $.done();
- return;
- }
- farmTask = yield taskInitForFarm();
- // console.log(`当前任务详情: ${JSON.stringify(farmTask)}`);
- console.log(`开始签到`);
- if (!farmTask.signInit.todaySigned) {
- let signResult = yield signForFarm(); //签到
- if (signResult.code == "0") {
- message += `【签到成功】获得${signResult.amount}g💧\n`//连续签到${signResult.signDay}天
- // if (signResult.todayGotWaterGoalTask.canPop) {
- // let goalResult = yield gotWaterGoalTaskForFarm();
- // console.log(`被水滴砸中奖励:${JSON.stringify(goalResult)}`);
- // if (goalResult.code === '0') {
- // message += `【被水滴砸中】获取:${goalResult.addEnergy}g\n`
- // }
- // }
- } else {
- message += `签到失败,详询日志\n`
- console.log(`签到结果: ${JSON.stringify(signResult)}`);
- }
- } else {
- console.log(`今天已签到,连续签到${farmTask.signInit.totalSigned},下次签到可得${farmTask.signInit.signEnergyEachAmount}g`);
- // message += `今天已签到,连续签到${farmTask.signInit.totalSigned},下次签到可得${farmTask.signInit.signEnergyEachAmount}g\n`
- }
- // 被水滴砸中
- console.log(`被水滴砸中: ${farmInfo.todayGotWaterGoalTask.canPop ? '是' : '否'}`);
- if (farmInfo.todayGotWaterGoalTask.canPop) {
- let goalResult = yield gotWaterGoalTaskForFarm();
- //console.log(`被水滴砸中奖励:${JSON.stringify(goalResult)}`);
- if (goalResult.code === '0') {
- message += `【被水滴砸中】获得${goalResult.addEnergy}g💧\n`
- }
- }
- console.log(`签到结束,开始广告浏览任务`);
- if (!farmTask.gotBrowseTaskAdInit.f) {
- let adverts = farmTask.gotBrowseTaskAdInit.userBrowseTaskAds
- let browseReward = 0
- let browseSuccess = 0
- let browseFail = 0
- for (let advert of adverts) { //开始浏览广告
- if (advert.limit <= advert.hadFinishedTimes) {
- // browseReward+=advert.reward
- console.log(`${advert.mainTitle}+ ' 已完成`);//,获得${advert.reward}g
- continue;
- }
- console.log('正在进行广告浏览任务: ' + advert.mainTitle);
- let browseResult = yield browseAdTaskForFarm(advert.advertId, 0);
- if (browseResult.code == 0) {
- console.log(`${advert.mainTitle}浏览任务完成`);
- //领取奖励
- let browseRwardResult = yield browseAdTaskForFarm(advert.advertId, 1);
- if (browseRwardResult.code == '0') {
- console.log(`领取浏览${advert.mainTitle}广告奖励成功,获得${browseRwardResult.amount}g`)
- browseReward += browseRwardResult.amount
- browseSuccess++
- } else {
- browseFail++
- console.log(`领取浏览广告奖励结果: ${JSON.stringify(browseRwardResult)}`)
- }
- } else {
- browseFail++
- console.log(`广告浏览任务结果: ${JSON.stringify(browseResult)}`);
- }
- }
- if (browseFail > 0) {
- message += `【广告浏览】完成${browseSuccess}个,失败${browseFail},获得${browseReward}g💧\n`
- } else {
- message += `【广告浏览】完成${browseSuccess}个,获得${browseReward}g💧\n`
- }
- } else {
- console.log(`今天已经做过浏览任务`);
- // message += '今天已经做过浏览任务\n'
- }
- //定时领水
- if (!farmTask.gotThreeMealInit.f) {
- //
- let threeMeal = yield gotThreeMealForFarm();
- if (threeMeal.code == "0") {
- message += `【定时领水】获得${threeMeal.amount}g💧\n`
- } else {
- message += `【定时领水】失败,详询日志\n`
- console.log(`定时领水成功结果: ${JSON.stringify(threeMeal)}`);
- }
- } else {
- // message += '当前不在定时领水时间断或者已经领过\n'
- console.log('当前不在定时领水时间断或者已经领过')
- }
- //打卡领水
- console.log('开始打卡领水活动(签到,关注,领券)')
- let clockInInit = yield clockInInitForFarm();
- // console.log(`clockInInit---${JSON.stringify(clockInInit)}`)
- if (clockInInit.code === '0') {
- // 签到得水滴
- if (!clockInInit.todaySigned) {
- console.log('开始今日签到');
- // request('clockInForFarm', {"type" : 1});
- let clockInForFarmRes = yield clockInForFarm();
- console.log(`打卡结果${JSON.stringify(clockInForFarmRes)}`);
- if (clockInForFarmRes.code === '0') {
- message += `【第${clockInForFarmRes.signDay}天签到】获得${clockInForFarmRes.amount}g💧\n`//连续签到${signResult.signDay}天
- if (clockInForFarmRes.signDay === 7) {
- //可以领取惊喜礼包
- console.log('开始领取--惊喜礼包38g水滴');
- let gotClockInGiftRes = yield gotClockInGift();
- if (gotClockInGiftRes.code === '0') {
- message += `【惊喜礼包】获得${gotClockInGiftRes.amount}g💧\n`
- }
- }
- // if (clockInForFarmRes.todayGotWaterGoalTask.canPop) {
- // let goalResult = yield gotWaterGoalTaskForFarm();
- // console.log(`被水滴砸中奖励:${JSON.stringify(goalResult)}`);
- // if (goalResult.code === '0') {
- // message += `【被水滴砸中】${goalResult.addEnergy}g\n`;
- // }
- // }
- }
- }
- // 连续七天签到-惊喜礼包
- // if (!clockInInit.gotClockInGift && clockInInit.totalSigned === 7) {
- // console.log('开始领取--惊喜礼包38g水滴');
- // let gotClockInGiftRes = yield gotClockInGift();
- // if (gotClockInGiftRes.code === '0') {
- // message += `【惊喜礼包】获得${gotClockInGiftRes.amount}g💧\n`
- // }
- // }
- // 限时关注得水滴
- if (clockInInit.themes && clockInInit.themes.length > 0) {
- for (let item of clockInInit.themes) {
- if (!item.hadGot) {
- console.log(`关注ID${item.id}`);
- let themeStep1 = yield clockInFollowForFarm(item.id, "theme", "1");
- console.log(`themeStep1--结果${JSON.stringify(themeStep1)}`);
- if (themeStep1.code === '0') {
- let themeStep2 = yield clockInFollowForFarm(item.id, "theme", "2");
- console.log(`themeStep2--结果${JSON.stringify(themeStep2)}`);
- if (themeStep2.code === '0') {
- console.log(`关注${item.name},获得水滴${themeStep2.amount}g`);
- }
- }
- }
- }
- }
- // 限时领券得水滴
- if (clockInInit.venderCoupons && clockInInit.venderCoupons.length > 0) {
- for (let item of clockInInit.venderCoupons) {
- if (!item.hadGot) {
- console.log(`领券的ID${item.id}`);
- let venderCouponStep1 = yield clockInFollowForFarm(item.id, "venderCoupon", "1");
- console.log(`venderCouponStep1--结果${JSON.stringify(venderCouponStep1)}`);
- if (venderCouponStep1.code === '0') {
- let venderCouponStep2 = yield clockInFollowForFarm(item.id, "venderCoupon", "2");
- if (venderCouponStep2.code === '0') {
- console.log(`venderCouponStep2--结果${JSON.stringify(venderCouponStep2)}`);
- console.log(`从${item.name}领券,获得水滴${venderCouponStep2.amount}g`);
- }
- }
- }
- }
- }
- }
- console.log('\n开始打卡领水活动(签到,关注,领券)结束\n');
- // 水滴雨
- let executeWaterRain = !farmTask.waterRainInit.f;
- if (executeWaterRain) {
- console.log(`水滴雨任务,每天两次,最多可得10g水滴`);
- console.log(`两次水滴雨任务是否全部完成:${farmTask.waterRainInit.f ? '是' : '否'}`);
- if (farmTask.waterRainInit.lastTime) {
- if (new Date().getTime() < (farmTask.waterRainInit.lastTime + 3 * 60 * 60 * 1000)) {
- executeWaterRain = false;
- message += `【第${farmTask.waterRainInit.winTimes + 1}次水滴雨】未到时间,请稍后再试\n`;
- }
- }
- if (executeWaterRain) {
- console.log(`开始水滴雨任务,这是第${farmTask.waterRainInit.winTimes + 1}次,剩余${2 - (farmTask.waterRainInit.winTimes + 1)}次`);
- let waterRain = yield waterRainForFarm();
- console.log('水滴雨waterRain', waterRain);
- if (waterRain.code === '0') {
- console.log('水滴雨任务执行成功,获得水滴:' + waterRain.addEnergy + 'g');
- message += `【第${farmTask.waterRainInit.winTimes + 1}次水滴雨】获得${waterRain.addEnergy}g水滴\n`
- }
- }
- // if (farmTask.waterRainInit.winTimes === 0) {
- // console.log(`开始水滴雨任务,这是第${farmTask.waterRainInit.winTimes + 1}次,剩余${2 - (farmTask.waterRainInit.winTimes + 1)}次`);
- // let waterRain = yield waterRainForFarm();
- // console.log('水滴雨waterRain', waterRain);
- // if (waterRain.code === '0') {
- // console.log('水滴雨任务执行成功,获得水滴:' + waterRain.addEnergy + 'g');
- // message += `【第${farmTask.waterRainInit.winTimes + 1}次水滴雨】获得${waterRain.addEnergy}g水滴\n`
- // }
- // } else {
- // //执行了第一次水滴雨。需等待3小时候才能再次执行
- // if (new Date().getTime() > (farmTask.waterRainInit.lastTime + 3 * 60 * 60 *1000)) {
- // console.log(`开始水滴雨任务,这是第${farmTask.waterRainInit.winTimes + 1}次,剩余${2 - (farmTask.waterRainInit.winTimes + 1)}次`);
- // let waterRain = yield waterRainForFarm();
- // console.log('水滴雨waterRain', waterRain);
- // if (waterRain.code === '0') {
- // console.log('水滴雨任务执行成功,获得水滴:' + waterRain.addEnergy + 'g');
- // message += `【第${farmTask.waterRainInit.winTimes + 1}次水滴雨】获得${waterRain.addEnergy}g水滴\n`
- // }
- // } else {
- // console.log(`【第${farmTask.waterRainInit.winTimes + 1}次水滴雨】未到时间,请稍后再试\n`)
- // message += `【第${farmTask.waterRainInit.winTimes + 1}次水滴雨】未到时间,请稍后再试\n`
- // }
- // }
- } else {
- message += `【水滴雨】已全部完成,获得20g💧\n`
- }
- const masterHelpResult = yield masterHelpTaskInitForFarm();
- if (masterHelpResult.code === '0') {
- if (masterHelpResult.masterHelpPeoples && masterHelpResult.masterHelpPeoples.length >= 5) {
- // 已有五人助力。领取助力后的奖励
- if (!masterHelpResult.masterGotFinal) {
- const masterGotFinished = yield masterGotFinishedTaskForFarm();
- if (masterGotFinished.code === '0') {
- console.log(`已成功领取好友助力奖励:【${masterGotFinished.amount}】g水`);
- message += `【额外奖励】${masterGotFinished.amount}g水领取成功\n`;
- }
- } else {
- console.log("已经领取过5好友助力额外奖励");
- message += `【额外奖励】已被领取过\n`;
- }
- } else {
- console.log("助力好友未达到5个");
- message += `【额外奖励】领取失败,原因:助力好友未达5个\n`;
- }
- if (masterHelpResult.masterHelpPeoples && masterHelpResult.masterHelpPeoples.length > 0) {
- let str = '';
- masterHelpResult.masterHelpPeoples.map((item, index) => {
- if (index === (masterHelpResult.masterHelpPeoples.length - 1)) {
- str += item.nickName || "匿名用户";
- } else {
- str += (item.nickName || "匿名用户") + ',';
- }
- let date = new Date(item.time);
- let time = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getMinutes();
- console.log(`\n京东昵称【${item.nickName || "匿名用户"}】 在 ${time} 给您助过力\n`);
- })
- message += `【助力您的好友】${str}\n`;
- }
- }
- //助力
- // masterHelpTaskInitForFarm
- console.log('开始助力好友')
- let salveHelpAddWater = 0;
- let remainTimes = 4;//今日剩余助力次数,默认4次(京东农场每人每天4次助力机会)。
- let helpSuccessPeoples = '';//成功助力好友
- for (let code of shareCodes) {
- if (code == farmInfo.farmUserPro.shareCode) {
- console.log('跳过自己的shareCode')
- continue
- }
- console.log(`开始助力好友: ${code}`);
- let helpResult = yield masterHelp(code)
- if (helpResult.code == 0) {
- if (helpResult.helpResult.code === '0') {
- //助力成功
- salveHelpAddWater += helpResult.helpResult.salveHelpAddWater;
- console.log(`【助力好友结果】: 已成功给【${helpResult.helpResult.masterUserInfo.nickName}】助力`);
- console.log(`给好友【${helpResult.helpResult.masterUserInfo.nickName}】助力获得${helpResult.helpResult.salveHelpAddWater}g水滴`)
- helpSuccessPeoples += (helpResult.helpResult.masterUserInfo.nickName || '匿名用户') + ',';
- } else if (helpResult.helpResult.code === '8') {
- console.log(`【助力好友结果】: 助力【${helpResult.helpResult.masterUserInfo.nickName}】失败,您今天助力次数已耗尽`);
- } else if (helpResult.helpResult.code === '9') {
- console.log(`【助力好友结果】: 之前给【${helpResult.helpResult.masterUserInfo.nickName}】助力过了`);
- } else if (helpResult.helpResult.code === '10') {
- console.log(`【助力好友结果】: 好友【${helpResult.helpResult.masterUserInfo.nickName}】已满五人助力`);
- }
- console.log(`【今日助力次数还剩】${helpResult.helpResult.remainTimes}次`);
- remainTimes = helpResult.helpResult.remainTimes;
- if (helpResult.helpResult.remainTimes === 0) {
- console.log(`您当前助力次数已耗尽,跳出助力`);
- break
- }
- }
- }
- let helpSuccessPeoplesKey = timeFormat() + farmInfo.farmUserPro.shareCode;
- if (!$.getdata(helpSuccessPeoplesKey)) {
- //把前一天的清除
- $.setdata('', timeFormat(Date.now() - 24 * 60 * 60 * 1000) + farmInfo.farmUserPro.shareCode);
- $.setdata('', helpSuccessPeoplesKey);
- }
- if (helpSuccessPeoples) {
- if ($.getdata(helpSuccessPeoplesKey)) {
- $.setdata($.getdata(helpSuccessPeoplesKey) + ',' + helpSuccessPeoples, helpSuccessPeoplesKey);
- } else {
- $.setdata(helpSuccessPeoples, helpSuccessPeoplesKey);
- }
- }
- helpSuccessPeoples = $.getdata(helpSuccessPeoplesKey);
- if (helpSuccessPeoples && helpSuccessPeoples.length > 0) {
- message += `【您助力的好友👬】${helpSuccessPeoples.substr(0, helpSuccessPeoples.length - 1)}\n`;
- }
- if (salveHelpAddWater > 0) {
- message += `【助力好友👬】获得${salveHelpAddWater}g💧\n`
- }
- message += `【今日剩余助力👬】${remainTimes}次\n`;
- console.log('助力好友结束,即将开始每日浇水任务');
- // console.log('当前水滴剩余: ' + farmInfo.farmUserPro.totalEnergy);
- // farmTask = yield taskInitForFarm();
- //天天抽奖得好礼
- let initForTurntableFarmRes = yield initForTurntableFarm();
- if (initForTurntableFarmRes.code === '0') {
- //领取定时奖励 //4小时一次
- let {timingIntervalHours, timingLastSysTime, sysTime, timingGotStatus, remainLotteryTimes, turntableInfos} = initForTurntableFarmRes;
-
- if (!timingGotStatus) {
- console.log(`是否到了领取免费赠送的抽奖机会----${sysTime > (timingLastSysTime + 60*60*timingIntervalHours*1000)}`)
- if (sysTime > (timingLastSysTime + 60*60*timingIntervalHours*1000)) {
- let timingAwardRes = yield timingAwardForTurntableFarm();
- console.log(`领取定时奖励结果${JSON.stringify(timingAwardRes)}`);
- initForTurntableFarmRes = yield initForTurntableFarm();
- remainLotteryTimes = initForTurntableFarmRes.remainLotteryTimes;
- } else {
- console.log(`免费赠送的抽奖机会未到时间`)
- }
- } else {
- console.log('4小时候免费赠送的抽奖机会已领取')
- }
- if (initForTurntableFarmRes.turntableBrowserAds && initForTurntableFarmRes.turntableBrowserAds.length > 0) {
- console.log('开始浏览天天抽奖的逛会场任务')
- if (!initForTurntableFarmRes.turntableBrowserAds[0].status) {
- const browserForTurntableFarmRes = yield browserForTurntableFarm(initForTurntableFarmRes.turntableBrowserAds[0].adId);
- if (browserForTurntableFarmRes.code === '0' && browserForTurntableFarmRes.status) {
- const browserForTurntableFarm2Res = yield browserForTurntableFarm2(initForTurntableFarmRes.turntableBrowserAds[0].adId);
- if (browserForTurntableFarm2Res.code === '0') {
- initForTurntableFarmRes = yield initForTurntableFarm();
- remainLotteryTimes = initForTurntableFarmRes.remainLotteryTimes;
- }
- }
- } else {
- console.log('天天抽奖浏览任务已经做完')
- }
- }
- //天天抽奖助力
- console.log('开始天天抽奖--好友助力--每人每天只有三次助力机会.')
- for (let code of shareCodes) {
- if (code === farmInfo.farmUserPro.shareCode) {
- console.log('天天抽奖-不能自己给自己助力\n')
- continue
- }
- let lotteryMasterHelpRes = yield lotteryMasterHelp(code);
- // console.log('天天抽奖助力结果',lotteryMasterHelpRes.helpResult)
- if (lotteryMasterHelpRes.helpResult.code === '0') {
- console.log(`天天抽奖-助力${lotteryMasterHelpRes.helpResult.masterUserInfo.nickName}成功\n`)
- } else if (lotteryMasterHelpRes.helpResult.code === '11') {
- console.log(`天天抽奖-不要重复助力${lotteryMasterHelpRes.helpResult.masterUserInfo.nickName}\n`)
- } else if (lotteryMasterHelpRes.helpResult.code === '13') {
- console.log(`天天抽奖-助力${lotteryMasterHelpRes.helpResult.masterUserInfo.nickName}失败,助力次数耗尽\n`);
- break;
- }
- //lotteryMasterHelp
- }
- console.log(`---天天抽奖次数remainLotteryTimes----${remainLotteryTimes}次`)
- //抽奖
- if (remainLotteryTimes > 0) {
- console.log('开始抽奖')
- let lotteryResult = '';
- for (let i = 0; i < new Array(remainLotteryTimes).fill('').length; i++) {
- let lotteryRes = yield lotteryForTurntableFarm()
- console.log(`第${i + 1}次抽奖结果${JSON.stringify(lotteryRes)}`);
- if (lotteryRes.code === '0') {
- turntableInfos.map((item) => {
- if (item.type === lotteryRes.type) {
- console.log(`lotteryRes.type${lotteryRes.type}`);
- if (lotteryRes.type.match(/bean/g) && lotteryRes.type.match(/bean/g)[0] === 'bean') {
- lotteryResult += `${item.name}个,`;
- } else if (lotteryRes.type.match(/water/g) && lotteryRes.type.match(/water/g)[0] === 'water') {
- lotteryResult += `${item.name}g,`;
- } else {
- lotteryResult += `${item.name},`;
- }
- }
- })
- //没有次数了
- if (lotteryRes.remainLotteryTimes === 0) {
- break
- }
- }
- }
- if (lotteryResult) {
- console.log(`【天天抽奖】${lotteryResult.substr(0, lotteryResult.length - 1)}\n`)
- message += `【天天抽奖】${lotteryResult.substr(0, lotteryResult.length - 1)}\n`;
- }
- } else {
- console.log('天天抽奖--抽奖机会为0次')
- }
- } else {
- console.log('初始化天天抽奖得好礼失败')
- }
- //浇水10次
- if (farmTask.totalWaterTaskInit.totalWaterTaskTimes < farmTask.totalWaterTaskInit.totalWaterTaskLimit) {
- let waterCount = 0;
- isFruitFinished = false;
- for (; waterCount < farmTask.totalWaterTaskInit.totalWaterTaskLimit - farmTask.totalWaterTaskInit.totalWaterTaskTimes; waterCount++) {
- console.log(`第${waterCount + 1}次浇水`);
- let waterResult = yield waterGoodForFarm();
- console.log(`本次浇水结果: ${JSON.stringify(waterResult)}`);
- if (waterResult.code === '0') {
- console.log(`剩余水滴${waterResult.totalEnergy}g`);
- if (waterResult.finished) {
- // 已证实,waterResult.finished为true,表示水果可以去领取兑换了
- isFruitFinished = true;
- break
- } else {
- if (waterResult.waterStatus === 0 && waterResult.treeEnergy === 10) {
- console.log('果树发芽了,奖励30g水滴');
- let gotStageAwardForFarmRes1 = yield gotStageAwardForFarm('1');
- console.log(`浇水阶段奖励1领取结果 ${JSON.stringify(gotStageAwardForFarmRes1)}`);
- if (gotStageAwardForFarmRes1.code === '0') {
- message += `【果树发芽了】奖励${gotStageAwardForFarmRes1.addEnergy}`
- }
- } else if (waterResult.waterStatus === 1) {
- console.log('果树开花了,奖励40g水滴');
- let gotStageAwardForFarmRes2 = yield gotStageAwardForFarm('2');
- console.log(`浇水阶段奖励2领取结果 ${JSON.stringify(gotStageAwardForFarmRes2)}`);
- if (gotStageAwardForFarmRes2.code === '0') {
- message += `【果树开花了】奖励${gotStageAwardForFarmRes2.addEnergy}g💧\n`
- }
- } else if (waterResult.waterStatus === 2) {
- console.log('果树长出小果子啦, 奖励50g水滴');
- let gotStageAwardForFarmRes3 = yield gotStageAwardForFarm('3');
- console.log(`浇水阶段奖励3领取结果 ${JSON.stringify(gotStageAwardForFarmRes3)}`)
- if (gotStageAwardForFarmRes3.code === '0') {
- message += `【果树结果了】奖励${gotStageAwardForFarmRes3.addEnergy}g💧\n`
- }
- }
- if (waterResult.totalEnergy < 10) {
- console.log(`水滴不够,结束浇水`)
- break
- }
- }
- } else {
- console.log('浇水出现失败异常,跳出不在继续浇水')
- break;
- }
- }
- if (isFruitFinished) {
- option['open-url'] = "openApp.jdMobile://";
- $.msg(name, `【提醒⏰】${farmInfo.farmUserPro.name}已可领取`, '请去京东APP或微信小程序查看', option);
- $.done();
- return;
- }
- farmTask = yield taskInitForFarm();
- // message += `【自动浇水】浇水${waterCount}次,今日浇水${farmTask.totalWaterTaskInit.totalWaterTaskTimes}次\n`
- } else {
- console.log('今日已完成10次浇水任务');
- }
- //领取首次浇水奖励
- if (!farmTask.firstWaterInit.f && farmTask.firstWaterInit.totalWaterTimes > 0) {
- let firstWaterReward = yield firstWaterTaskForFarm();
- if (firstWaterReward.code === '0') {
- message += `【首次浇水奖励】获得${firstWaterReward.amount}g💧\n`
- } else {
- message += '【首次浇水奖励】领取奖励失败,详询日志\n'
- console.log(`领取首次浇水奖励结果: ${JSON.stringify(firstWaterReward)}`);
- }
- }
- //领取10次浇水奖励
- if (!farmTask.totalWaterTaskInit.f && farmTask.totalWaterTaskInit.totalWaterTaskTimes >= farmTask.totalWaterTaskInit.totalWaterTaskLimit) {
- let totalWaterReward = yield totalWaterTaskForFarm();
- if (totalWaterReward.code === '0') {
- // console.log(`领取10次浇水奖励结果: ${JSON.stringify(totalWaterReward)}`);
- message += `【十次浇水奖励】获得${totalWaterReward.totalWaterTaskEnergy}g💧\n`//,
- } else {
- message += '【十次浇水奖励】领取奖励失败,详询日志\n'
- console.log(`领取10次浇水奖励结果: ${JSON.stringify(totalWaterReward)}`);
- }
- } else if (farmTask.totalWaterTaskInit.totalWaterTaskTimes < farmTask.totalWaterTaskInit.totalWaterTaskLimit) {
- message += `【十次浇水奖励】任务未完成,今日浇水${farmTask.totalWaterTaskInit.totalWaterTaskTimes}次\n`
- }
- console.log('finished 水果任务完成!');
-
- farmInfo = yield initForFarm();
- // 所有的浇水(10次浇水)任务,获取水滴任务完成后,如果剩余水滴大于等于60g,则继续浇水(保留部分水滴是用于完成第二天的浇水10次的任务)
- let overageEnergy = farmInfo.farmUserPro.totalEnergy - retainWater;
- if (farmInfo.farmUserPro.totalEnergy >= (farmInfo.farmUserPro.treeTotalEnergy - farmInfo.farmUserPro.treeEnergy)) {
- //如果现有的水滴,大于水果可兑换所需的对滴(也就是把水滴浇完,水果就能兑换了)
- isFruitFinished = false;
- for (let i = 0; i < (farmInfo.farmUserPro.treeTotalEnergy - farmInfo.farmUserPro.treeEnergy) / 10; i++) {
- let resp = yield waterGoodForFarm();
- console.log(`本次浇水结果(水果马上就可兑换了): ${JSON.stringify(resp)}`);
- if (resp.code === '0') {
- console.log('\n浇水10g成功\n');
- if (resp.finished) {
- // 已证实,waterResult.finished为true,表示水果可以去领取兑换了
- isFruitFinished = true;
- break
- } else {
- console.log(`目前水滴【${resp.totalEnergy}】g,继续浇水,水果马上就可以兑换了`)
- }
- } else {
- console.log('浇水出现失败异常,跳出不在继续浇水')
- break;
- }
- }
- if (isFruitFinished) {
- option['open-url'] = "openApp.jdMobile://";
- $.msg(name, `【提醒⏰】${farmInfo.farmUserPro.name}已可领取`, '请去京东APP或微信小程序查看', option);
- $.done();
- return;
- }
- } else if (overageEnergy >= 10) {
- console.log("目前剩余水滴:【" + farmInfo.farmUserPro.totalEnergy + "】g,可继续浇水");
- isFruitFinished = false;
- for (let i = 0; i < parseInt(overageEnergy / 10); i++) {
- let res = yield waterGoodForFarm();
- if (res.code === '0') {
- console.log('\n浇水10g成功\n')
- if (res.finished) {
- // 已证实,waterResult.finished为true,表示水果可以去领取兑换了
- isFruitFinished = true;
- break
- } else {
- if (res.waterStatus === 0 && res.treeEnergy === 10) {
- console.log('果树发芽了,奖励30g水滴');
- let gotStageAwardForFarmRes1 = yield gotStageAwardForFarm('1');
- console.log(`浇水阶段奖励1领取结果 ${JSON.stringify(gotStageAwardForFarmRes1)}`);
- if (gotStageAwardForFarmRes1.code === '0') {
- message += `【果树发芽了】奖励${gotStageAwardForFarmRes1.addEnergy}g💧\n`
- }
- } else if (res.waterStatus === 1) {
- console.log('果树开花了,奖励40g水滴');
- let gotStageAwardForFarmRes2 = yield gotStageAwardForFarm('2');
- console.log(`浇水阶段奖励2领取结果 ${JSON.stringify(gotStageAwardForFarmRes2)}`);
- if (gotStageAwardForFarmRes2.code === '0') {
- message += `【果树开花了】奖励${gotStageAwardForFarmRes2.addEnergy}g💧\n`
- }
- } else if (res.waterStatus === 2) {
- console.log('果树长出小果子啦, 奖励50g水滴');
- let gotStageAwardForFarmRes3 = yield gotStageAwardForFarm('3');
- console.log(`浇水阶段奖励3领取结果 ${JSON.stringify(gotStageAwardForFarmRes3)}`)
- if (gotStageAwardForFarmRes3.code === '0') {
- message += `【果树结果了】奖励${gotStageAwardForFarmRes3.addEnergy}g💧\n`
- }
- }
- }
- } else {
- console.log('浇水出现失败异常,跳出不在继续浇水')
- break;
- }
- }
- if (isFruitFinished) {
- option['open-url'] = "openApp.jdMobile://";
- $.msg(name, `【提醒⏰】${farmInfo.farmUserPro.name}已可领取`, '请去京东APP或微信小程序查看', option);
- $.done();
- return;
- }
- } else {
- console.log("目前剩余水滴:【" + farmInfo.farmUserPro.totalEnergy + "】g,不再继续浇水,保留部分水滴用于完成第二天【十次浇水得水滴】任务")
- }
-
- farmInfo = yield initForFarm();
- message += `【水果🍉进度】${((farmInfo.farmUserPro.treeEnergy / farmInfo.farmUserPro.treeTotalEnergy) * 100).toFixed(2)}%,已浇水${farmInfo.farmUserPro.treeEnergy / 10}次,还需${(farmInfo.farmUserPro.treeTotalEnergy - farmInfo.farmUserPro.treeEnergy) / 10}次\n`
- if (farmInfo.toFlowTimes > (farmInfo.farmUserPro.treeEnergy / 10)) {
- message += `【开花进度】再浇水${farmInfo.toFlowTimes - farmInfo.farmUserPro.treeEnergy / 10}次开花\n`
- } else if (farmInfo.toFruitTimes > (farmInfo.farmUserPro.treeEnergy / 10)) {
- message += `【结果进度】再浇水${farmInfo.toFruitTimes - farmInfo.farmUserPro.treeEnergy / 10}次结果\n`
- }
- // 预测n天后水果课可兑换功能
- let waterTotalT = (farmInfo.farmUserPro.treeTotalEnergy - farmInfo.farmUserPro.treeEnergy - farmInfo.farmUserPro.totalEnergy) / 10;//一共还需浇多少次水
- farmTask = yield taskInitForFarm();
- let waterEveryDayT = farmTask.totalWaterTaskInit.totalWaterTaskTimes;//今天到到目前为止,浇了多少次水
- message += `【今日共浇水】${waterEveryDayT}次\n`;
- let waterD = Math.ceil(waterTotalT / waterEveryDayT);
- // name += `——预测在${timeFormat(24 * 60 * 60 * 1000 * waterD + Date.now())}日可兑换🍉`;
- // if (waterEveryDayT !== 0) {
- // subTitle += `,预计需${waterD}天可兑换`
- // } else {
- // subTitle += `,预计需${Math.ceil(waterTotalT / 10)}天可兑换`
- // }
- message += `【剩余水滴】${farmInfo.farmUserPro.totalEnergy}g💧\n`;
- message += `【预测】${waterD === 1 ? '明天' : waterD === 2 ? '后天' : waterD + '天之后'}(${timeFormat(24 * 60 * 60 * 1000 * waterD + Date.now())}日)可兑换水果🍉`
-// //集卡抽奖活动
-// console.log('开始集卡活动')
-//
-// //初始化集卡抽奖活动数据
-// let turntableFarm = yield initForTurntableFarm()
-// if (turntableFarm.code == 0) {
-// //浏览爆品任务
-// if (!turntableFarm.turntableBrowserAdsStatus) {
-// let browserResult1 = yield browserForTurntableFarm(1);
-// console.log(`浏览爆品任务结果${JSON.stringify(browserResult1)}`)
-// if (browserResult1.code == 0) {
-// let browserResult2 = yield browserForTurntableFarm(2);
-// console.log(`领取爆品任务奖励结果${JSON.stringify(browserResult2)}`)
-// }
-// }
-// //领取定时奖励 //4小时一次 没判断时间
-// if (!turntableFarm.timingGotStatus) {
-// let timingAward = yield timingAwardForTurntableFarm();
-// console.log(`领取定时奖励结果${JSON.stringify(timingAward)}`)
-// }
-// turntableFarm = yield initForTurntableFarm()
-// console.log('开始抽奖')
-// //抽奖
-// if (turntableFarm.remainLotteryTimes > 0) {
-// let lotteryResult = "【集卡抽奖】获得"
-// for (let i = 0; i < turntableFarm.remainLotteryTimes; i++) {
-// let lottery = yield lotteryForTurntableFarm()
-// console.log(`第${i + 1}次抽奖结果${JSON.stringify(lottery)}`)
-//
-// if (lottery.code == 0) {
-// if (lottery.type == "water") {
-// lotteryResult += `水滴${lottery.addWater}g `
-// } else if (lottery.type == "pingguo") {
-// lotteryResult += "苹果卡 "
-// } else if (lottery.type == "baixiangguo") {
-// lotteryResult += "百香果卡 "
-// } else if (lottery.type == "mangguo") {
-// lotteryResult += "芒果卡 "
-// } else if (lottery.type == "taozi") {
-// lotteryResult += "桃子卡 "
-// } else if (lottery.type == "mihoutao") {
-// lotteryResult += "猕猴桃卡 "
-// } else if (lottery.type == "pingguo") {
-// lotteryResult += "苹果卡 "
-// } else if (lottery.type == "coupon") {
-// lotteryResult += "优惠券 "
-// } else if (lottery.type == "coupon3") {
-// lotteryResult += "8斤金枕榴莲 "
-// } else if (lottery.type == "bean") {
-// lotteryResult += `京豆${lottery.beanCount}个 `
-// } else if (lottery.type == "hongbao1") {
-// lotteryResult += `${lottery.hongBao.balance}元无门槛红包 `
-// } else {
-// lotteryResult += `未知奖品${lottery.type} `
-// }
-// //没有次数了
-// if (lottery.remainLotteryTimes == 0) {
-// break
-// }
-// }
-//
-// }
-// message += lotteryResult
-// }
-// console.log('抽奖结束')
-//
-// } else {
-// console.log(`初始化集卡抽奖活动数据异常, 数据: ${JSON.stringify(farmInfo)}`);
-// message += '【集卡抽奖】初始化集卡抽奖数据异常'
-// }
-// console.log('集卡活动抽奖结束')
-
- console.log('全部任务结束');
- } else {
- if (farmInfo.code === '3') {
- $.msg(name, '【提示】京东cookie已失效,请重新登录获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- $.setdata('', 'CookieJD');//cookie失效,故清空cookie。
- $.done();
- return
- } else {
- console.log(`初始化农场数据异常, 请登录京东 app查看农场0元水果功能是否正常,农场初始化数据: ${JSON.stringify(farmInfo)}`);
- message = '初始化农场数据异常, 请登录京东 app查看农场0元水果功能是否正常'
- }
- }
- if (!jdNotify || jdNotify === 'false') {
- $.msg(name, subTitle, message, option);
- }
- $.done();
-}
-
-/**
- * 天天抽奖拿好礼-助力(每人每天三次助力机会)
- */
-function lotteryMasterHelp() {
- request(`initForFarm`, {
- imageUrl: "",
- nickName: "",
- shareCode: arguments[0] + '-3',
- babelChannel: "3",
- version: 4,
- channel: 1
- });
-}
-/**
- * 集卡抽奖
- */
-async function lotteryForTurntableFarm() {
- await $.wait(2000);
- console.log('等待了5秒')
- request(arguments.callee.name.toString(), {type: 1, version: 4, channel: 1});
-}
-
-function timingAwardForTurntableFarm() {
- request(arguments.callee.name.toString(), {version: 4, channel: 1});
-}
-
-// 初始化集卡抽奖活动数据
-function initForTurntableFarm() {
- request(arguments.callee.name.toString(), {version: 4, channel: 1});
-}
-
-function browserForTurntableFarm(type) {
- if (type === 1) {
- console.log('浏览爆品会场');
- }
- if (type === 2) {
- console.log('领取浏览爆品会场奖励');
- }
- const body = {"type":1,"adId": type,"version":4,"channel":1};
- console.log('type', type + "");
- console.log(body)
- // request(arguments.callee.name.toString(), {type: type});
- request(arguments.callee.name.toString(), body);
- // 浏览爆品会场8秒
-}
-function browserForTurntableFarm2(type) {
- const body = {"type":2,"adId": type,"version":4,"channel":1};
- request('browserForTurntableFarm', body);
-}
-/**
- * 领取浇水过程中的阶段性奖励
- */
-function gotStageAwardForFarm(type) {
- request(arguments.callee.name.toString(), {'type': type});
-}
-
-/**
- * 被水滴砸中
- * 要弹出来窗口后调用才有效, 暂时不知道如何控制
- */
-function gotWaterGoalTaskForFarm() {
- request(arguments.callee.name.toString(), {type: 3});
-}
-
-//助力好友信息
-function masterHelpTaskInitForFarm() {
- let functionId = arguments.callee.name.toString();
- request(functionId);
-}
-
-//领取5人助力后的额外奖励
-function masterGotFinishedTaskForFarm() {
- console.log("领取助力完成后的水滴")
- let functionId = arguments.callee.name.toString();
- request(functionId);
-}
-
-function masterHelp() {
- request(`initForFarm`, {
- imageUrl: "",
- nickName: "",
- shareCode: arguments[0],
- babelChannel: "3",
- version: 2,
- channel: 1
- });
-}
-
-/**
- * 10次浇水
- */
-function totalWaterTaskForFarm() {
- let functionId = arguments.callee.name.toString();
- request(functionId);
-}
-
-function firstWaterTaskForFarm() {
- let functionId = arguments.callee.name.toString();
- request(functionId);
-}
-
-// 浇水动作
-function waterGoodForFarm() {
- let functionId = arguments.callee.name.toString();
- request(functionId);
-}
-
-/**
- * 浏览广告任务
- * type为0时, 完成浏览任务
- * type为1时, 领取浏览任务奖励
- */
-function browseAdTaskForFarm(advertId, type) {
- let functionId = arguments.callee.name.toString();
- request(functionId, {advertId, type});
-}
-
-//签到
-function signForFarm() {
- let functionId = arguments.callee.name.toString();
- request(functionId);
-}
-
-//定时领水
-function gotThreeMealForFarm() {
- let functionId = arguments.callee.name.toString();
- request(functionId);
-}
-
-// 初始化任务列表
-function taskInitForFarm() {
- let functionId = arguments.callee.name.toString();
- request(functionId);
-}
-
-/**
- * 初始化农场, 可获取果树及用户信息
- */
-function initForFarm() {
- let functionId = arguments.callee.name.toString();
- request(functionId);
-}
-
-/**
- * 水滴雨
- * @param function_id
- * @param body
- */
-function waterRainForFarm() {
- let functionId = arguments.callee.name.toString();
- let body = {"type": 1, "hongBaoTimes": 100, "version": 3};
- request(functionId, body);
-}
-
-/**
- * 打卡领水
- */
-function clockInInitForFarm() {
- let functionId = arguments.callee.name.toString();
- request(functionId);
-}
-
-// 连续签到
-function clockInForFarm() {
- let functionId = arguments.callee.name.toString();
- request(functionId, {"type": 1});
-}
-
-//关注,领券等
-function clockInFollowForFarm(id, type, step) {
- let functionId = arguments.callee.name.toString();
- let body = {
- id,
- type,
- step
- }
- request(functionId, body);
-}
-
-// 领取连续签到7天的惊喜礼包
-function gotClockInGift() {
- request('clockInForFarm', {"type": 2})
-}
-//获取好友列表
-function friendListInitForFarm() {
- request('friendListInitForFarm')
-}
-function request(function_id, body = {}) {
- $.get(taskurl(function_id, body), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n东东农场: API查询请求失败 ‼️‼️')
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- console.log(e);
- } finally {
- sleep(data);
- }
- })
-}
-
-function sleep(response) {
- console.log('休息一下');
- setTimeout(() => {
- console.log('休息结束');
- Task.next(response)
- }, 1000);
-}
-
-function taskurl(function_id, body = {}) {
- return {
- url: `${JD_API_HOST}?functionId=${function_id}&appid=wh5&body=${escape(JSON.stringify(body))}`,
- headers: {
- Cookie: cookie,
- UserAgent: `Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1`,
- }
- }
-}
-
-function taskPostUrl(function_id, body = {}) {
- return {
- url: JD_API_HOST,
- body: `functionId=${function_id}&body=${JSON.stringify(body)}&appid=wh5`,
- headers: {
- Cookie: cookie,
- }
- }
-}
-
-function timeFormat(time) {
- let date;
- if (time) {
- date = new Date(time)
- } else {
- date = new Date();
- }
- return date.getFullYear() + '-' + ((date.getMonth() + 1) >= 10 ? (date.getMonth() + 1) : '0' + (date.getMonth() + 1)) + '-' + (date.getDate() >= 10 ? date.getDate() : '0' + date.getDate());
-}
-// prettier-ignore
-function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{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=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"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 e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)}
\ No newline at end of file
diff --git a/backUp/jd_joy2.js b/backUp/jd_joy2.js
deleted file mode 100644
index de114a4..0000000
--- a/backUp/jd_joy2.js
+++ /dev/null
@@ -1,510 +0,0 @@
-/*
-jd宠汪汪 搬的https://github.com/uniqueque/QuantumultX/blob/4c1572d93d4d4f883f483f907120a75d925a693e/Script/jd_joy.js
-feedCount:自定义 每次喂养数量; 等级只和喂养次数有关,与数量无关
-推荐每次投喂10个,积累狗粮,然后去聚宝盆赌每小时的幸运奖,据观察,投入3000-6000中奖概率大,超过7000基本上注定亏本,即使是第一名
-Combine from Zero-S1/JD_tools(https://github.com/Zero-S1/JD_tools)
-更新时间:2020-08-15
-注:如果使用Node.js, 需自行安装'crypto-js,got,http-server,tough-cookie'模块. 例: npm install crypto-js http-server tough-cookie got --save
-*/
-// quantumultx
-// [task_local]
-// #京东宠汪汪
-// 15 1,2 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy.js, tag=京东宠汪汪, img-url=https://raw.githubusercontent.com/znz1992/Gallery/master/jdww.png, enabled=true
-// Loon
-// [Script]
-// cron "15 1,2 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy.js,tag=京东宠汪汪
-const name = '京东宠汪汪';
-const $ = new Env(name);
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
-//直接用NobyDa的jd cookie
-let cookie = jdCookieNode.CookieJD ? jdCookieNode.CookieJD : $.getdata('CookieJD');
-const cookie2 = jdCookieNode.CookieJD2 ? jdCookieNode.CookieJD2 : $.getdata('CookieJD2');
-
-const FEED_NUM = ($.getdata('joyFeedCount') * 1) || 10 //每次喂养数量 [10,20,40,80]
-
-let jdNotify = $.getdata('jdJoyNotify');
-var Task = step();
-Task.next();
-
-function* step() {
- let message = '';
- let subTitle = '';
- if (cookie) {
- //获取任务信息
- let petTaskConfig = yield getPetTaskConfig()
- if (petTaskConfig.success) {
- //每日签到
- let signEveryDayTask = petTaskConfig.datas.find(item => item.taskType === 'SignEveryDay')
- if (signEveryDayTask && signEveryDayTask.taskStatus == 'processing' && signEveryDayTask.joinedCount == 0) {
- let signResult = yield SignEveryDay()
- console.log(`签到结果${JSON.stringify(signResult)}`)
- } else {
- console.log(`今天已签到或任务不存在`)
- }
- //关注店铺
- let followShopTask = petTaskConfig.datas.find(item => item.taskType === 'FollowShop')
- if (followShopTask && followShopTask.taskStatus == 'processing' && followShopTask.taskChance > followShopTask.joinedCount) {
- for (let shop of followShopTask.followShops) {
- if (!shop.status) {
- let followShopResult = yield followShop(shop.shopId)
- console.log(`关注店铺${shop.name}结果${JSON.stringify(followShopResult)}`)
- }
- }
- } else {
- console.log(`关注店铺今天已完成或任务不存在`)
- }
- //三餐
- let threeMeals = petTaskConfig.datas.find(item => item.taskType === 'ThreeMeals')
- if (threeMeals && threeMeals.taskStatus == 'processing') {
- let threeMealsResult = yield ThreeMeals()
- console.log(`三餐结果${JSON.stringify(threeMealsResult)}`)
- } else {
- // console.log(`今天已关注或任务不存在`)
- }
- //逛会场
- let scanMarketTask = petTaskConfig.datas.find(item => item.taskType === 'ScanMarket')
- if (scanMarketTask && scanMarketTask.taskStatus == 'processing' && scanMarketTask.taskChance > scanMarketTask.joinedCount) {
- for (let market of scanMarketTask.scanMarketList) {
- if (!market.status) {
- // 解决部分商品market.marketLink为空的时候,浏览不到的bug
- let clickResult = yield click(market.marketLinkH5)
- console.log(`逛会场点击${market.marketName}结果${JSON.stringify(clickResult)}`)
-
- let scanMarketResult = yield ScanMarket(market.marketLinkH5)
- console.log(`逛会场${market.marketName}结果${JSON.stringify(scanMarketResult)}`)
- }
- }
- } else {
- console.log(`逛会场今天已完成或任务不存在`)
- }
- //关注商品
- let followGoodTask = petTaskConfig.datas.find(item => item.taskType === 'FollowGood')
- if (followGoodTask && followGoodTask.taskStatus == 'processing' && followGoodTask.taskChance > followGoodTask.joinedCount) {
- for (let good of followGoodTask.followGoodList) {
- if (!good.status) {
- let followGoodResult = yield followGood(good.sku)
- console.log(`关注商品${good.skuName}结果${JSON.stringify(followGoodResult)}`)
- }
- }
- } else {
- console.log(`关注商品今天已完成或任务不存在`)
- }
- //浏览频道
- let followChannelTask = petTaskConfig.datas.find(item => item.taskType === 'FollowChannel')
- if (followChannelTask && followChannelTask.taskStatus == 'processing' && followChannelTask.taskChance > followChannelTask.joinedCount) {
- for (let channel of followChannelTask.followChannelList) {
- if (!channel.status) {
- let followChannelResult = yield FollowChannel(channel.channelId)
- console.log(`浏览频道${channel.channelName}结果${JSON.stringify(followChannelResult)}`)
- }
- }
- } else {
- console.log(`浏览商品今天已完成或任务不存在`)
- }
- //浏览商品奖励积分
- let deskGoodDetails = yield getDeskGoodDetails()
- if (deskGoodDetails.success) {
- if (deskGoodDetails.data.deskGoods && deskGoodDetails.data.deskGoods.length > 0) {
- for (let deskGood of deskGoodDetails.data.deskGoods) {
- if (!deskGood.status) {
- let scanDeskGoodResult = yield ScanDeskGood(deskGood.sku)
- console.log(`浏览频道${deskGood.skuName}结果${JSON.stringify(scanDeskGoodResult)}`)
- }
- }
- }
- } else {
- console.log(`浏览商品奖励积分返回结果${JSON.stringify(deskGoodDetails)}`)
- }
- // 看激励视频得狗粮
- let taskVideoRes = yield taskVideo();
- // console.log(`视频激--任务列表--${JSON.stringify(taskVideoRes)}`);
- // let sanVideoRes = yield sanVideo();
- // console.log(`看视频激励结果--${JSON.stringify(sanVideoRes)}`);
- if (taskVideoRes.success) {
- let taskArr = {};
- for (let item of taskVideoRes.datas) {
- if (item.taskType === 'ViewVideo') {
- taskArr = item;
- }
- }
- let joinedCount = taskArr.joinedCount || 0;
- if (taskArr.taskChance === joinedCount) {
- console.log('今日激励视频已看完')
- } else {
- for (let i = 0; i < new Array(taskArr.taskChance - joinedCount).fill('').length; i++) {
- console.log(`开始第${i+1}次看激励视频`);
- let sanVideoRes = yield sanVideo();
- console.log(`看视频激励结果--${JSON.stringify(sanVideoRes)}`);
- }
- }
- }
- // 好友列表
- let currentPage = 1;
- let getFriendsResult = yield getFriends(currentPage);
- if (getFriendsResult.page && getFriendsResult.datas) {
- const { pages } = getFriendsResult.page && getFriendsResult.page;
- for (var i = getFriendsResult.datas.length - 1; i >= 1; i--) {
- let friendPin = getFriendsResult.datas[i]["friendPin"]
- console.log(friendPin)
- // 进入好友房间
- let enterFriendRoomResult = yield enterFriendRoom(friendPin)
- let friendHomeCoin = enterFriendRoomResult.data["friendHomeCoin"]
- console.log('friendHomeCoin = ' + friendHomeCoin)
- if (enterFriendRoomResult.data["friendHomeCoin"] > 0) {
- let getFriendCoinResult = yield getFriendCoin(friendPin)
- console.log(`收取好友金币结果${JSON.stringify(getFriendCoinResult)}`)
- }
- let stealStatus = getFriendsResult.datas[i]["stealStatus"]
- console.log('stealStatus = ' + stealStatus)
- if (getFriendsResult.datas[i]["stealStatus"] == "can_steal") {
- let getRandomFoodResult = yield getRandomFood(friendPin)
- console.log(`收取好友狗粮结果${JSON.stringify(getRandomFoodResult)}`)
- }
- let status = getFriendsResult.datas[i]["status"]
- console.log('status = ' + status)
- if (getFriendsResult.datas[i]["status"] == "not_feed") {
- let helpFeedResult = yield helpFeed(friendPin)
- console.log(`帮忙喂食结果${JSON.stringify(helpFeedResult)}`)
- }
- // if (friendPin != "jd_6162cd8a30268") {
-
- // }
- }
- if (pages > 1) {
- currentPage ++;
- getFriendsResult = yield getFriends(currentPage);
- for (var i = getFriendsResult.datas.length - 1; i >= 1; i--) {
- let friendPin = getFriendsResult.datas[i]["friendPin"]
- console.log(friendPin)
- // 进入好友房间
- let enterFriendRoomResult = yield enterFriendRoom(friendPin)
- let friendHomeCoin = enterFriendRoomResult.data["friendHomeCoin"]
- console.log('friendHomeCoin = ' + friendHomeCoin)
- if (enterFriendRoomResult.data["friendHomeCoin"] > 0) {
- let getFriendCoinResult = yield getFriendCoin(friendPin)
- console.log(`收取好友金币结果${JSON.stringify(getFriendCoinResult)}`)
- }
- let stealStatus = getFriendsResult.datas[i]["stealStatus"]
- console.log('stealStatus = ' + stealStatus)
- if (getFriendsResult.datas[i]["stealStatus"] == "can_steal") {
- let getRandomFoodResult = yield getRandomFood(friendPin)
- console.log(`收取好友狗粮结果${JSON.stringify(getRandomFoodResult)}`)
- }
- let status = getFriendsResult.datas[i]["status"]
- console.log('status = ' + status)
- if (getFriendsResult.datas[i]["status"] == "not_feed") {
- let helpFeedResult = yield helpFeed(friendPin)
- console.log(`帮忙喂食结果${JSON.stringify(helpFeedResult)}`)
- }
- // if (friendPin != "jd_6162cd8a30268") {
-
- // }
- }
- }
- }
-
- // 领取好友助力后的狗粮
- let getFoodRes = yield getFood();
- console.log(`领取好友助力后的狗粮结果${JSON.stringify(getFoodRes)}`)
- // 喂食
- let feedPetsResult = yield feedPets()
- console.log(`喂食结果${JSON.stringify(feedPetsResult)}`)
- if (feedPetsResult.success) {
- if (feedPetsResult.errorCode === 'feed_ok') {
- console.log('喂食成功')
- } else if (feedPetsResult.errorCode === 'time_error') {
- console.log('喂食失败:正在食用')
- }
- }
- // 喂养状态
- let enterRoomResult = yield enterRoom()
- console.log(`喂养状态${JSON.stringify(enterRoomResult)}`)
- message = `现有积分: ${enterRoomResult.data.petCoin}\n现有狗粮: ${enterRoomResult.data.petFood}\n喂养次数: ${enterRoomResult.data.feedCount}\n宠物等级: ${enterRoomResult.data.petLevel}`
- subTitle = `【用户名】${enterRoomResult.data.pin}`
- } else {
- console.log(`任务信息${JSON.stringify(petTaskConfig)}`)
- if (petTaskConfig.errorCode === 'B0001') {
- $.setdata('', 'CookieJD');//cookie失效,故清空cookie。
- $.msg(name, '【提示】京东cookie已失效,请重新登录获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- if ($.isNode() && notify.SCKEY) {
- notify.sendNotify(`京东账号${UserName}cookie已失效`, '请重新登录获取cookie');
- }
- $.done();
- return
- } else {
- message += `${petTaskConfig.errorMessage}`;
- }
- }
- } else {
- $.msg(name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', { "open-url": "https://bean.m.jd.com/" });
- $.done();
- return
- }
- console.log(`jdNotify${jdNotify}`)
- console.log(`jdNotify${jdNotify === 'false'}`)
- if (!jdNotify || jdNotify === 'false') {
- $.msg(name, subTitle, message);
- }
- $.done();
-}
-
-function click(marketLink) {
- request(`https://jdjoy.jd.com/pet/icon/click?reqSource=h5&iconCode=scan_market&linkAddr=${marketLink}`)
-}
-
-//浏览商品
-function ScanDeskGood(sku) {
- requestPost(`https://jdjoy.jd.com/pet/scan`, JSON.stringify({ sku: sku, taskType: 'ScanDeskGood', reqSource: 'h5' }), 'application/json')
-}
-
-//浏览商品奖励积分任务
-function getDeskGoodDetails() {
- request(`https://jdjoy.jd.com/pet/getDeskGoodDetails?reqSource=h5`)
-}
-
-//浏览频道
-function FollowChannel(channelId) {
- requestPost(`https://jdjoy.jd.com/pet/scan`, JSON.stringify({ channelId: channelId, taskType: 'FollowChannel', reqSource: 'h5' }), 'application/json')
-}
-
-//关注商品
-function followGood(sku) {
- requestPost(`https://jdjoy.jd.com/pet/followGood`, `sku=${sku}&reqSource=h5`)
-}
-
-//逛会场
-function ScanMarket(marketLink,) {
- requestPost(`https://jdjoy.jd.com/pet/scan`, JSON.stringify({ marketLink: marketLink, taskType: 'ScanMarket', reqSource: 'h5' }), 'application/json')
-}
-//关注店铺
-function followShop(shopId) {
- requestPost(`https://jdjoy.jd.com/pet/followShop`, `shopId=${shopId}&reqSource=h5`)
-}
-
-//每日签到
-function SignEveryDay() {
- request(`https://jdjoy.jd.com/pet/sign?taskType=SignEveryDay`)
-}
-//获取任务
-function getPetTaskConfig() {
- request(`https://jdjoy.jd.com/pet/getPetTaskConfig?reqSource=h5`)
-}
-//三餐奖励
-function ThreeMeals() {
- request(`https://jdjoy.jd.com/pet/getFood?taskType=ThreeMeals`)
-}
-
-//喂食
-function feedPets() {
- request(`https://jdjoy.jd.com/pet/feed?feedCount=${FEED_NUM}`)
-}
-
-//喂养状态
-function enterRoom() {
- request(`https://jdjoy.jd.com/pet/enterRoom?reqSource=h5`)
-}
-//看激励视频
-function taskVideo() {
- const option = {
- url: 'https://draw.jdfcloud.com//pet/getPetTaskConfig?reqSource=weapp',
- headers: {
- 'Cookie': cookie,
- "Host": "draw.jdfcloud.com",
- "Content-Type": "application/json",
- "reqSource": "h5",
- "Connection": "keep-alive",
- "Accept": "*/*",
- "User-Agent": "jdapp;iPhone;9.0.4;13.5.1;e35caf0a69be42084e3c97eef56c3af7b0262d01;network/4g;ADID/3B3AD5BC-B5E6-4A08-B32A-030CD805B5DD;supportApplePay/3;hasUPPay/0;pushNoticeIsOpen/1;model/iPhone11,8;addressid/2005183373;hasOCPay/0;appBuild/167283;supportBestPay/0;jdSupportDarkMode/0;pv/206.5;apprpd/MyJD_Main;ref/https%3A%2F%2Fjdjoy.jd.com%2Fpet%2Findex%3Fun_area%3D19_1601_50258_51885%26lng%3D113.3259241595859%26lat%3D23.20459586587208;psq/4;ads/;psn/e35caf0a69be42084e3c97eef56c3af7b0262d01|831;jdv/0|kong|t_1001777500_|jingfen|ca196c5ef31b4f7680c45e9334f94ba2|1596887714965|1596887717;adk/;app_device/IOS;pap/JA2015_311210|9.0.4|IOS 13.5.1;Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
- "Referer": "https://jdjoy.jd.com/pet/index?un_area=19_1601_50258_51885&lng=113.3259241595859&lat=23.20459586587208",
- "Accept-Language": "zh-cn",
- "Accept-Encoding": "gzip, deflate, br"
- }
- };
- $.get(option, (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- sleep(data);
- }
- })
-}
-
-//好友列表
-function getFriends(currentPage) {
- request(`https://jdjoy.jd.com/pet/getFriends?itemsPerPage=20¤tPage=${currentPage}`)
-}
-
-//进入好友房间
-function enterFriendRoom(friendPin) {
- let url = "https://jdjoy.jd.com/pet/enterFriendRoom?friendPin="+friendPin
- let encodeURI_url = encodeURI(url)
- request(encodeURI_url)
-}
-
-//收集好友金币
-function getFriendCoin(friendPin) {
- let url = "https://jdjoy.jd.com/pet/getFriendCoin?friendPin="+friendPin
- let encodeURI_url = encodeURI(url)
- request(encodeURI_url)
-}
-
-//收集好友狗粮
-function getRandomFood(friendPin) {
- let url = "https://jdjoy.jd.com/pet/getRandomFood?friendPin="+friendPin
- let encodeURI_url = encodeURI(url)
- request(encodeURI_url)
-}
-
-//帮忙喂食
-function helpFeed(friendPin) {
- let url = "https://jdjoy.jd.com/pet/helpFeed?friendPin="+friendPin
- let encodeURI_url = encodeURI(url)
- request(encodeURI_url)
-}
-
-function sanVideo() {
- const body = JSON.stringify({"taskType":"ViewVideo","reqSource":"weapp"});
- const option = {
- url: 'https://draw.jdfcloud.com//pet/scan',
- body: body,
- headers: {
- 'Cookie': cookie,
- "Host": "draw.jdfcloud.com",
- "Connection": "keep-alive",
- "Content-Length": "44",
- "Content-Type": "application/json",
- "reqSource": "weapp",
- "Accept-Encoding": "gzip,compress,br,deflate",
- "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.14(0x17000e2b) NetType/4G Language/zh_CN",
- "Referer": "https://servicewechat.com/wxccb5c536b0ecd1bf/617/page-frame.html"
- }
- };
- $.post(option, (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- sleep(data);
- }
- })
-}
-// 领取好友助力后的狗粮
-function getFood() {
- let url = "https://jdjoy.jd.com/pet/getFood?taskType=InviteUser";
- request(url)
-}
-function request(url) {
- console.log(`\n request url:::${url}\n`);
- const option = {
- url: url,
- headers: {
- 'Cookie': cookie,
- 'reqSource': 'h5',
- 'Host': 'jdjoy.jd.com',
- 'Connection': 'keep-alive',
- 'Content-Type': 'application/json',
- 'Referer': 'https://jdjoy.jd.com/pet/index',
- 'User-Agent': 'jdapp;iPhone;8.5.8;13.4.1;9b812b59e055cd226fd60ebb5fd0981c4d0d235d;network/wifi;supportApplePay/3;hasUPPay/0;pushNoticeIsOpen/0;model/iPhone9,2;addressid/138109592;hasOCPay/0;appBuild/167169;supportBestPay/0;jdSupportDarkMode/0;pv/200.75;apprpd/MyJD_Main;ref/MyJdMTAManager;psq/29;ads/;psn/9b812b59e055cd226fd60ebb5fd0981c4d0d235d|608;jdv/0|direct|-|none|-|1587263154256|1587263330;adk/;app_device/IOS;pap/JA2015_311210|8.5.8|IOS 13.4.1;Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
- 'Accept-Language': 'zh-cn',
- 'Accept-Encoding': 'gzip, deflate, br',
- }
- };
- $.get(option, (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- sleep(data);
- }
- // if (err) {
- // console.log("\n京东宠汪汪: API查询请求失败 ‼️‼️")
- // $.msg('京东宠汪汪', `脚本执行中断`, `京东宠汪汪: API查询请求失败 ‼️‼️`);
- // $.done();
- // } else {
- // try {
- // data = JSON.parse(data);
- // } catch (e) {
- // console.log(e);
- // } finally {
- // sleep(data);
- // }
- // }
- })
-}
-
-function requestPost(url, body, ContentType) {
- console.log(`\n request url:::${url}\n`);
- console.log(`request body:${body}\n`);
- console.log(`request ContentType:${ContentType}\n`);
- const options = {
- url: url,
- body: body,
- headers: {
- Cookie: cookie,
- UserAgent: `Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1`,
- reqSource: 'h5',
- 'Content-Type': ContentType,
- 'Host': 'jdjoy.jd.com',
- 'Referer': 'https://jdjoy.jd.com/pet/index?un_area=5_274_49707_49973&lng=116.8439659502069&lat=39.95722551778479',
- 'Accept-Language': 'zh-cn',
- 'Accept-Encoding': 'gzip, deflate, br',
- }
- };
- $.post(options, (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- sleep(data);
- }
- // if (err) {
- // console.log("\n京东宠汪汪: API查询请求失败 ‼️‼️")
- // $.msg('京东宠汪汪', `${err.name}`, `京东宠汪汪: API查询请求失败 ‼️‼️`);
- // $.done();
- // } else {
- // try {
- // data = JSON.parse(data);
- // } catch (e) {
- // console.log(e);
- // } finally {
- // sleep(data);
- // }
- // }
- })
-}
-
-function sleep(response) {
- console.log('休息一下');
- setTimeout(() => {
- console.log('休息结束');
- Task.next(response)
- }, 1000);
-}
-
-// https://jdjoy.jd.com/pet/getPetTaskConfig?reqSource=h5
-// prettier-ignore
-function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{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=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"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 e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;$.isMute||(this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o))),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)}
\ No newline at end of file
diff --git a/backUp/jd_joy_help2.js b/backUp/jd_joy_help2.js
deleted file mode 100644
index 67f67bc..0000000
--- a/backUp/jd_joy_help2.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
-宠汪汪强制为别人助力(助力一个好友你自己可以获得30积分,一天上限是帮助3个好友,自己获得90积分,不管助力是否成功,对方都会成为你的好友)
-自用
-**/
-let url = $request.url
-const friendsArr = ["jd_136833sjn","jd_131335rbv","jd_4f044bdd67a3f","jd_176968gwf","jd_136744uks","jd_139559isq","jd_151698nhe","jd_182775ekl","jd_139643ldl","jd_159166edm","jd_157100apb","jd_131843tvo","jd_152554vhs","jd_134283prpb","jd_139988mgfo","jd_133590dtg","jd_63636969e55cb","jd_135565fsg","jd_189071npd","jd_138430zvw","jd_139582hlp","jd_815411720","jd_157642zjc","jd_177753pzb","jd_137918wwl","jd_188675alaf","jd_186718otu","jd_139139bew","jd_180436ggd","jd_52315d900a88a","jd_137689rjx","jd_151106nxb","jd_153879dzp","jd_185840vwq","jd_6194e9ae2cebf","jd_186221rph","jd_153810ylu","jd_189288egp","jd_158791okv","jd_139132erd","jd_159304acn","jd_138899zum","jd_187182akf","jd_136324bjqi","jd_131616wdo","jd_155384iof","jd_186326vtm","jd_zoezhu","jd_135075ahc","jd_138141ill","jd_139773zbm","jd_158416jwas","jd_182328ujc","jd_135999wrw","jd_181325tmk","jd_188254zgv","jd_3712425","jd_153711hhx","jd_176020ylg","jd_136436iuk","jd_180430yxp","jd_159958jmr","jd_155382wjy","jd_135819ueh","jd_132125ish","jd_181196mrhz","jd_138403wnm","jd_181568lrk","jd_155785zic","jd_150712koi","jd_137012gwu","jd_137638siy","jd_183011sph","jd_158224asm","jd_1652541161","jd_137332lgt","jd_181991fgs","jd_189347opuc","jd_181898rlw","jd_136526chs","jd_152616rsg","jd_151410rti","jd_139657jxa","jd_187978fdq","jd_136039csx","jd_186029urn","jd_138681pjy","jd_138204hpd","jd_138246wgz","jd_131177aol","jd_182100ofj","jd_282335851","jd_180210xwj","jd_139400bou","jd_189751xfv","jd_133781olg","jd_155229qbl","jd_dady_a","jd_183890opj","jd_136830xsh","jd_138731rkth","jd_135476kin","jd_3302023","jd_suns932","jd_158958xju","jd_688050784","jd_177467uaf","jd_138950cao","jd_181726mer","jd_138194nvx","jd_2010wwk","jd_139295gxw","jd_173931eeb","jd_189713iss","jd_139894msf","jd_158767vct","jd_159210nml","jd_133230bpy","jd_150771igh","jd_4c9dced2ff301","jd_133025pjb","jd_184751jlf","jd_139379bhj","jd_4900071","jd_137188nnv","jd_153678kxr","jd_6b04334c27336","jd_185217cfd","jd_155892hhe","jd_gxq721","jd_duqing821","jd_185087idh","jd_181528ojs","jd_136778wigm","jd_137903zfgq","jd_134785qjj","jd_159536nii","jd_188492aqx","jd_152226ypk","jd_183815eio","jd_139250pva","jd_151739nli","jd_135202pbl","jd_138201yhi","jd_137642nzw","jd_136600ysr","jd_138220eom","jd_178595cqf","jd_186682kjk","jd_136205srq","jd_138820xtj","jd_152322tkj","jd_150225ipi","jd_133287tje","jd_guba01","jd_187568qui","jd_158753hfl","jd_159816boe","jd_139297psw","jd_138564ibo","jd_188105wjm","jd_180199ekd","jd_134164zgp","jd_181547miy","jd_137030gdm","jd_183197ekf","jd_155187jhm","jd_158363nbzh","jd_151335bxo","jd_139616ywb","jd_156600kfm","jd_352215391","jd_620475312","jd_137997ole","jd_186060jol","jd_7824770b3d748","jd_6b8ba51989353","jd_152712oax","jd_177413lgq","jd_134172lqw","jd_135035dya","jd_135388arv","jd_135013mbs","jd_150897xln","jd_133827ois","jd_133307ffi","jd_138326tzrx","jd_186639utz","jd_Thin779","jd_137173yni","jd_159843fjq","jd_152590bui","jd_180225wpx","jd_187579piq","jd_156758shb","jd_139960nex","jd_138817fsp","jd_181696mtg","jd_137911aamo","jd_135891nxk","jd_177761izc","jd_153337fyq","jd_114559761","jd_Xsgfsj","jd_139965zpe","jd_185459vvx","jd_189214its","jd_151615dmb","jd_138460bsc","jd_138618yqc","jd_187290mur","jd_151318bht","jd_155344pmg","jd_137302fjz","jd_182505eyw","jd_136416nan","jd_151651ncw","jd_137131dya","jd_133471mru","jd_181116wrh","jd_139819ahg","jd_138219eja","jd_136695iqb","jd_158215wjb","jd_107071797","jd_155664eni","jd_182384yok","jd_139611sco","jd_157652hlh","jd_137036vhs","jd_188476ctf","jd_178651ldby","jd_158107bvn","jd_150342aox","jd_150283rncu","jd_131367qhs","jd_133052bem","jd_189317gau","jd_134186sbh","jd_138637pbp","jd_glwang2","jd_189557iiq","jd_138906xlbm","jd_152360yuk","jd_134551yla","jd_135832apl","jd_155448yab","jd_138388paz","jd_1352513187","jd_135464sqz","jd_153298yxo","jd_139208nicz","jd_136608wyr","jd_133053kbn","jd_135034bbx","jd_2133952","jd_187382exm","jd_135063kvb","jd_130844lme","jd_137295ajrg","jd_136810xds","jd_182771zcmi","jd_qwertag13568370gf","jd_189200fiu","jd_159871grf","jd_q105946","jd_182028tnj","jd_153718opj","jd_136850dhv","jd_159162dxb","jd_155267dkh","jd_152763ghe","jd_137104jyuf","jd_136426poa","jd_153920qlg","jd_159715spj","jd_135772nxy","jd_321051","jd_fanm537","jd_137104vuum","jd_177212uid","jd_150312pgc","jd_152569xgz","jd_136994ddl","jd_186223kew","jd_139779ovt","jd_181193dok","jd_189461sem","jd_138245yum","jd_134136kgip","jd_189543hpt","jd_132180xif","jd_182857oox","jd_186245aal","jd_3555750","jd_188502cqy","jd_186910cwu","jd_182829qbch","jd_182297xcme","jd_159708cng","jd_133330ift","jd_131904zwu","jd_182801xpy","jd_150075wud","jd_156874jup","jd_189964qzl","jd_158132cle","jd_sun723","jd_182176mee","jd_188503acjo","jd_158537jdm","jd_159485zvu","jd_180011ejj","jd_135829xzp","jd_136921jpe","jd_152629pmx","jd_189710eck","jd_189397oeo","jd_189592sul","jd_150576adh","jd_159411rzd","jd_134601izn","jd_180053tsa","jd_138226cmgb","jd_183757gbgp","jd_139289bij","jd_lx_a","jd_138562oek","jd_183691xyg","jd_151429qhv","jd_139804lhb","jd_136042bzg","jd_138102ldq","jd_135986nkf","jd_truman","jd_181700kju","jd_151064dhx","jd_150907ahj","jd_186652jxh","jd_418fef3fab12f","jd_159527gqz","jd_138237dcn","jd_134119thub","jd_wrrr0","jd_180498ozp","jd_138531irs","jd_131136fru","jd_185228tkh","jd_131910jzm","jd_151063mhz","jd_58096918e5234","jd_187187rvl","jd_157537jpe","jd_6cebe25400109","jd_1175189","jd_42a743e0b8651","jd_153063yds","jd_177692lwq","jd_152020gzy","jd_138898puv","jd_155525lpff","jd_151123xea","jd_2672389178","jd_178258cff","jd_158191ansh","jd_153280zoy","jd_hl31450","jd_150416qyl","jd_152315mcm","jd_135648axo","jd_4cfd4439d158f","jd_134815cgd","jd_135087ela","jd_180921pam","jd_135610gth","jd_156973ipc","jd_188112gxw","jd_188110wps","jd_173589vmd","jd_135604ngz","jd_158219erd","jd_158449aru","jd_166312hcv","jd_151360sty","jd_183282vqt","jd_139208bac","jd_139276cex","jd_626010305","jd_158181bbe","jd_134339ytdb","jd_139206mkrh","jd_181579uxd","jd_137015nmi","jd_511064173","jd_182924yvbk","jd_137378axvd","jd_157351ype","jd_135161rmsc","jd_188425wum","jd_135315ofn","jd_131160xix","jd_186339gil","jd_150862gpa","jd_132385iqb","jd_138132znr","jd_384180113","jd_1362103","jd_139409xbn","jd_133146qwv","jd_132661jmj","jd_158676edk","jd_133316lld","jd_188714irz","jd_159103vma","jd_131148pkg","jd_152769boe","jd_138846yad","jd_132036kqj","jd_183813dsf","jd_189617vkq","jd_185715pgz","jd_159905euu","jd_134631ehy","jd_176278mmr","jd_5161d94861016","jd_135466mil","jd_177287yyr","jd_139720epl","jd_132037mat","jd_139830uaz","jd_138988jgl","jd_137222hds","jd_177038fca","jd_137096jyx","jd_189081vhx","jd_189985hzh","jd_151927ufa","jd_135145znf","jd_139306rrn","jd_130650d","jd_134321vtn","jd_151515epa","jd_135137jaia","jd_137164augj","jd_130024lmi","jd_139602byf","jd_183766qfi","jd_139705lek","jd_133834qau","jd_180157euk","jd_139111kud","jd_155116pea","jd_159626fgnc","jd_185154lww","jd_177435tuc","jd_137292pwe","jd_177395xqs","jd_133053jus","jd_151339jhx","jd_135087ljd","jd_53b1c5c35ac9a","jd_qiuche549","jd_158164uel","jd_138107wud","jd_199771clu","jd_186753jcs","jd_187150ylk","jd_138974rxt","jd_103433211","jd_185821hfr","jd_139502ycf","jd_137713uyd","jd_187698feo","jd_136089okg","jd_4352325","jd_139639yoj","jd_979798715","jd_131321aoc","jd_185224kzc","jd_151639rszh","jd_185669lfi","jd_lideguang_2011","jd_138725hyc","jd_qaa011","jd_135928ucx","jd_649f9eae0be6c","jd_155229vlt","jd_139885sgt","jd_136220wqh","jd_130741cki","jd_151611ebv","jd_189756rue","jd_5e95dcfd762f4","jd_6261731","jd_135495gbf","jd_150042iil","jd_137894frb","jd_135873xqmi","jd_138593nkp","jd_175412852","jd_139690dad","jd_43a2e9c6537f8","jd_138175wuk","jd_131716dfh","jd_138556pnn","jd_5020276315","jd_177316iqo","jd_181375rvj","jd_229003983","jd_180789bug","jd_150682yxz","jd_152181wlw","jd_224275759","jd_136102svi","jd_9929897714","jd_139691wvgh","jd_189305xgc","jd_133211nev","jd_138697wdw","jd_189314rid","jd_182520tcmf","jd_184399ypg","jd_156312gqm","jd_183257kbc","jd_8745170","jd_151758sra","jd_136000dfw","jd_138337tbg","jd_xishuwulu","jd_189shijz","jd_182257jvd","jd_156983msp","jd_316882724","jd_135808jxz","jd_135557shtf","jd_233102237","jd_186099qlx","jd_185263tir","jd_406bfe50a3525","jd_180669zge","jd_6402aba2128d9","jd_181335kmh","jd_137378ult","jd_150022yxf","jd_188540les","jd_133774erh","jd_138784rjl","jd_182817gcd","jd_134724ief","jd_132536dsy","jd_136604veq","jd_189715ich","jd_182876ynp","jd_177737trf","jd_186552tmg","jd_152104bbn","jd_136219qpt","jd_138262kmx","jd_176204injl","jd_183772tnk","jd_152150ixc","jd_139291nono","jd_186430qkb","jd_183182ynu","jd_135980gkl","jd_158520qfph","jd_135592ugy","jd_139445whz","jd_151308una","jd_150849jbh","jd_655789303","jd_136906lqt","jd_156206yfx","jd_137619mem","jd_152667dao","jd_138597bto","jd_189315etn","jd_151132kre","jd_239626183","jd_sdwh1","jd_136817uwz","jd_187119rqc","jd_yzztt","jd_157563ywzn","jd_zran012","jd_178280jig","jd_070889622","jd_132865tfs","jd_137098qlp","jd_159314ahj","jd_135530jsi","jd_156985tlp","jd_182109kiy","jd_183501fyv","jd_151668vpv","jd_138155ahi","jd_zwh082","jd_135647kui","jd_139149ipt","jd_186993pyi","jd_159524eku","jd_135392iff","jd_177019dfk","jd_185008kmg","jd_18259236618","jd_151227rgpa","jd_4b3c0be45543e","jd_158968lou","jd_150389hzqg","jd_136861rdw","jd_155046rli","jd_136773sqft","jd_zgybon","jd_131035lcq","jd_150342zqz","jd_2402232","jd_136718hfu","jd_176455kih","jd_188621xuu","jd_138719eld","jd_150670lziv","jd_135854sbe","jd_135262oos","jd_188161shx","jd_180136kfc","jd_189843kbz","jd_186041eon","jd_134570eqc","jd_180796xlc","jd_136923ucb","jd_182633vxt","jd_nmge","jd_183208ouaf","jd_155310zrn","jd_157188fmac","jd_158257chj","jd_177727lrh","jd_135397spe","jd_185124djb","jd_183860rvq","jd_157059kmd","jd_180922bpt","jd_183309nqe","jd_188510uou","jd_135909yhz","jd_138438ems","jd_136111kka","jd_138178ifs","jd_137646lxd","jd_188091hsj","jd_138226rqe","jd_159780lcxu","jd_139609eib","jd_135855xcw","jd_138531zvu","jd_186653hgl","jd_187269vtx","jd_138651nbt","jd_jwh788","jd_133387vpc","jd_188293qlb","jd_150403hbmm","jd_Yuton","jd_184wdz","jd_wyxgz","jd_186372kcz","jd_151600bmg","jd_151121uvgb","jd_137789qwb","jd_837751791","jd_153201xmi","jd_189562krx","jd_182519hniq","jd_188254mlj","jd_136893llq","jd_181322mkf","jd_132625cpe","jd_139609gwt","jd_188967afm","jd_136128fuyn","jd_153732jlpo","jd_221890978","jd_183184wfpz","jd_158304rms","jd_133010ltt","jd_135162chg","jd_158170msu","jd_135101jzrs","jd_155335qzm","jd_5701f57639cfe","jd_139502lkx","jd_cloi","jd_151948etv","jd_185502ypm","jd_186915dcn","jd_133672hlv"];
-//随机生成m(小)到n(大)的数,包含m和n
-function randomFriendPin(m,n) {
- return Math.round(Math.random()*(n - m) + m);
-}
-let friendPin = friendsArr[randomFriendPin(0, friendsArr.length - 1)] //强制为对方助力,可成为好友关系
-friendPin = encodeURI(friendPin);
-const timestamp = new Date().getTime()
-newUrl = url.replace(/friendPin=.*?$/i, "friendPin=" + friendPin).replace(/invitePin=.*?$/i, "invitePin=" + friendPin).replace(/inviteTimeStamp=.*?$/i, "inviteTimeStamp=" + timestamp + "&")
-console.log(newUrl)
-$done({ url: newUrl })
diff --git a/backUp/jd_moneyTree2.js b/backUp/jd_moneyTree2.js
deleted file mode 100644
index 236beee..0000000
--- a/backUp/jd_moneyTree2.js
+++ /dev/null
@@ -1,452 +0,0 @@
-/*
-京东摇钱树 :https://gitee.com/lxk0301/jd_scripts/raw/master/jd_moneyTree.js
-更新时间:2020-07-22
-注:如果使用Node.js, 需自行安装'crypto-js,got,http-server,tough-cookie'模块. 例: npm install crypto-js http-server tough-cookie got --save
-*/
-// quantumultx
-// [task_local]
-// #京东摇钱树
-// 3 */2 * * * https://gitee.com/lxk0301/jd_scripts/raw/master/jd_moneyTree.js, tag=京东摇钱树, img-url=https://raw.githubusercontent.com/znz1992/Gallery/master/moneyTree.png, enabled=true
-// Loon
-// [Script]
-// cron "3 */2 * * *" script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_moneyTree.js,tag=京东摇钱树
-const Notice = 2;//设置运行多少次才通知。
-const name = '京东摇钱树';
-const $ = new Env(name);
-const Key = '';//单引号内自行填写您抓取的京东Cookie
-//直接用NobyDa的jd cookie
-const cookie = Key ? Key : $.getdata('CookieJD');
-let jdNotify = $.getdata('jdMoneyTreeNotify');
-let treeMsgTime = $.getdata('treeMsgTime') >= Notice ? 0 : $.getdata('treeMsgTime') || 0;
-
-const JD_API_HOST = 'https://ms.jr.jd.com/gw/generic/uc/h5/m';
-let userInfo = null, taskInfo = [], message = '', subTitle = '', fruitTotal = 0;
-let gen = entrance();
-gen.next();
-function* entrance() {
- if (!cookie) {
- $.msg(name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', { "open-url": "https://bean.m.jd.com/" });
- $.done();
- return
- }
- yield user_info();
- yield signEveryDay();//每日签到
- yield dayWork();//做任务
- console.log('开始做浏览任务了')
- console.log(`浏览任务列表::${JSON.stringify(taskInfo)}`);
- // for (let task of taskInfo) {
- // if (task.mid && task.workStatus === 0) {
- // console.log('开始做浏览任务');
- // yield setUserLinkStatus(task.mid);
- // } else if (task.mid && task.workStatus === 1){
- // console.log(`开始领取浏览后的奖励:mid:${task.mid}`);
- // let receiveAwardRes = await receiveAward(task.mid);
- // console.log(`领取浏览任务奖励成功:${JSON.stringify(receiveAwardRes)}`)
- // } else if (task.mid && task.workStatus === 2) {
- // console.log('所有的浏览任务都做完了')
- // }
- // }
- yield harvest(userInfo);//收获
-
- if (fruitTotal > 380) {
- //金果数量大于380,才可以卖出
- yield sell();
- }
- yield myWealth();
- // console.log(`----${treeMsgTime}`)
- msgControl();
- console.log('任务做完了');
- console.log(`运行脚本次数和设置的次数是否相等::${($.getdata('treeMsgTime') * 1) === Notice}`);
- console.log(`box订阅静默运行-是否打开::${jdNotify || jdNotify === 'true'}`);
- console.log(`是否弹窗::${(($.getdata('treeMsgTime') * 1) === Notice) && (!jdNotify || jdNotify === 'false')}`);
- if (!jdNotify || jdNotify === 'false') {
- // $.msg(name, subTitle, message);
- if (($.getdata('treeMsgTime') * 1) === Notice) {
- $.msg(name, subTitle, message);
- $.setdata('0', 'treeMsgTime');
- }
- }
- $.done();
-}
-
-function user_info() {
- console.log('初始化摇钱树个人信息');
- const params = {
- "sharePin":"",
- "shareType":1,
- "channelLV":"",
- "source":0,
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- }
- params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);
- request('login', params).then((res) => {
- console.log(`登录信息:${JSON.stringify(res)}\n`);
- if (res && res.resultCode === 0) {
- console.log('resultCode为0')
- if (res.resultData.data) {
- console.log('res.resultData.data有值')
- userInfo = res.resultData.data;
- if (userInfo.realName) {
- console.log(`助力码sharePin为::${userInfo.sharePin}`);
- subTitle = `${userInfo.nick}的${userInfo.treeInfo.treeName}`;
- // message += `【我的金果数量】${userInfo.treeInfo.fruit}\n`;
- // message += `【我的金币数量】${userInfo.treeInfo.coin}\n`;
- // message += `【距离${userInfo.treeInfo.level + 1}级摇钱树还差】${userInfo.treeInfo.progressLeft}\n`;
- gen.next();
- } else {
- $.msg(name, `【提示】请先去京东app参加摇钱树活动\n入口:我的->游戏与互动->查看更多`, '', {"open-url": "openApp.jdMobile://"});
- $.done();
- return
- gen.return();
- }
- }
- } else {
- console.log('走了else');
- if (res.resultCode === 3) {
- $.setdata('', 'CookieJD');//cookie失效,故清空cookie。
- $.msg(name, '【提示】京东cookie已失效,请重新登录获取', 'https://bean.m.jd.com/', { "open-url": "https://bean.m.jd.com/" });
- $.done();
- return
- }
- gen.return();
- }
- });
-}
-
-async function dayWork() {
- console.log(`开始做任务userInfo了\n`)
- const data = {
- "source":0,
- "linkMissionIds":["666","667"],
- "LinkMissionIdValues":[7,7],
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- };
- let response = await request('dayWork', data);
- console.log(`获取任务的信息:${JSON.stringify(response)}\n`)
- let canTask = [];
- taskInfo = [];
- if (response.resultCode === 0) {
- if (response.resultData.code === '200') {
- response.resultData.data.map((item) => {
- if (item.prizeType === 2) {
- canTask.push(item);
- }
- if (item.workType === 7 && item.prizeType === 0) {
- // missionId.push(item.mid);
- taskInfo.push(item);
- }
- // if (item.workType === 7 && item.prizeType === 0) {
- // missionId2 = item.mid;
- // }
- })
- }
- }
- console.log(`canTask::${JSON.stringify(canTask)}\n`)
- console.log(`浏览任务列表taskInfo::${JSON.stringify(taskInfo)}\n`)
- for (let item of canTask) {
- if (item.workType === 1) {
- // 签到任务
- // let signRes = await sign();
- // console.log(`签到结果:${JSON.stringify(signRes)}`);
- if (item.workStatus === 0) {
- // const data = {"source":2,"workType":1,"opType":2};
- // let signRes = await request('doWork', data);
- let signRes = await sign();
- console.log(`三餐签到结果:${JSON.stringify(signRes)}`);
- } else if (item.workStatus === 2) {
- console.log(`三餐签到任务已经做过`)
- }
- } else if (item.workType === 2) {
- // 分享任务
- if (item.workStatus === 0) {
- // share();
- const data = {"source":0,"workType":2,"opType":1};
- //开始分享
- // let shareRes = await request('doWork', data);
- let shareRes = await share(data);
- console.log(`开始分享的动作:${JSON.stringify(shareRes)}`);
- const b = {"source":0,"workType":2,"opType":2};
- // let shareResJL = await request('doWork', b);
- let shareResJL = await share(b);
- console.log(`领取分享后的奖励:${JSON.stringify(shareResJL)}`)
- } else if (item.workStatus === 2) {
- console.log(`分享任务已经做过`)
- }
- }
- }
- for (let task of taskInfo) {
- if (task.mid && task.workStatus === 0) {
- console.log('开始做浏览任务');
- // yield setUserLinkStatus(task.mid);
- let aa = await setUserLinkStatus(task.mid);
- console.log(`aaa${JSON.stringify(aa)}`);
- } else if (task.mid && task.workStatus === 1){
- console.log(`workStatus === 1开始领取浏览后的奖励:mid:${task.mid}`);
- let receiveAwardRes = await receiveAward(task.mid);
- console.log(`领取浏览任务奖励成功:${JSON.stringify(receiveAwardRes)}`)
- } else if (task.mid && task.workStatus === 2) {
- console.log('所有的浏览任务都做完了')
- }
- }
- // console.log(`浏览任务列表::${JSON.stringify(taskInfo)}`);
- // for (let task of taskInfo) {
- // if (task.mid && task.workStatus === 0) {
- // await setUserLinkStatus(task.mid);
- // } else {
- // console.log('所有的浏览任务都做完了')
- // }
- // }
- gen.next();
-}
-
-function harvest(userInfo) {
- // console.log(`收获的操作:${JSON.stringify(userInfo)}\n`)
- if (!userInfo.userInfo && !userInfo.userToken) return
- const data = {
- "source": 2,
- "sharePin": "",
- "userId": userInfo.userInfo,
- "userToken": userInfo.userToken
- }
- // return new Promise((rs, rj) => {
- // request('harvest', data).then((response) => {
- // console.log(`收获金果结果:${JSON.stringify(response)}`);
- // rs(response)
- // // gen.next();
- // })
- // })
- request('harvest', data).then((harvestRes) => {
- if (harvestRes.resultCode === 0 && harvestRes.resultData.code === '200') {
- let data = harvestRes.resultData.data;
- message += `【距离${data.treeInfo.level + 1}级摇钱树还差】${data.treeInfo.progressLeft}\n`;
- fruitTotal = data.treeInfo.fruit;
- gen.next();
- }
- })
-}
-//卖出金果,得到金币
-function sell() {
- const params = {
- "source": 2,
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- }
- params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);//这一步,不可省略,否则提交会报错(和login接口一样)
- // return new Promise((rs, rj) => {
- // request('sell', params).then(response => {
- // rs(response);
- // })
- // })
- request('sell', params).then((sellRes) => {
- console.log(`卖出金果结果:${JSON.stringify(sellRes)}\n`)
- gen.next();
- })
-}
-//获取金币和金果数量
-function myWealth() {
- const params = {
- "source": 2,
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- }
- params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);//这一步,不可省略,否则提交会报错(和login接口一样)
- request('myWealth', params).then(res=> {
- if (res.resultCode === 0 && res.resultData.code === '200') {
- console.log(`金币数量和金果::${JSON.stringify(res)}`);
- message += `【我的金果数量】${res.resultData.data.gaAmount}\n`;
- message += `【我的金币数量】${res.resultData.data.gcAmount}\n`;
- gen.next();
- }
- })
-}
-function sign() {
- console.log('开始三餐签到')
- const data = {"source":2,"workType":1,"opType":2};
- return new Promise((rs, rj) => {
- request('doWork', data).then(response => {
- rs(response);
- })
- })
-}
-function signIndex() {
- const params = {
- "source":0,
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- }
- return new Promise((rs, rj) => {
- request('signIndex', params).then(response => {
- rs(response);
- })
- })
-}
-async function signEveryDay() {
- let signIndexRes = await signIndex();
- console.log(`每日签到条件查询:${JSON.stringify(signIndexRes)}`);
- if (signIndexRes.resultCode === 0) {
- if (signIndexRes.resultData && signIndexRes.resultData.data.canSign == 2) {
- console.log('准备每日签到')
- let signOneRes = await signOne(signIndexRes.resultData.data.signDay);
- console.log(`第${signIndexRes.resultData.data.signDay}日签到结果:${JSON.stringify(signOneRes)}`);
- if (signIndexRes.resultData.data.signDay === 7) {
- let getSignAwardRes = await getSignAward();
- console.log(`店铺券(49-10)领取结果:${JSON.stringify(getSignAwardRes)}`)
- if (getSignAwardRes.resultCode === 0 && getSignAwardRes.data.code === 0) {
- message += `【7日签到奖励领取】${getSignAwardRes.datamessage}\n`
- }
- }
- } else {
- console.log('走了signOne的else')
- }
- }
- gen.next();
-}
-function signOne(signDay) {
- const params = {
- "source":0,
- "signDay": signDay,
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- }
- return new Promise((rs, rj) => {
- request('signOne', params).then(response => {
- rs(response);
- })
- })
-}
-// 领取七日签到后的奖励(店铺优惠券)
-function getSignAward() {
- const params = {
- "source":2,
- "awardType": 2,
- "deviceRiskParam": 1,
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- }
- return new Promise((rs, rj) => {
- request('getSignAward', params).then(response => {
- rs(response);
- })
- })
-}
-// 浏览任务
-async function setUserLinkStatus(missionId) {
- let resultCode = 0, code = 200, index = 0;
- do {
- const params = {
- "missionId": missionId,
- "pushStatus": 1,
- "keyValue": index,
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- }
- let response = await request('setUserLinkStatus', params)
- console.log(`missionId为${missionId}::第${index + 1}次浏览活动完成: ${JSON.stringify(response)}`);
- resultCode = response.resultCode;
- code = response.resultData.code;
- // if (resultCode === 0) {
- // let sportRevardResult = await getSportReward();
- // console.log(`领取遛狗奖励完成: ${JSON.stringify(sportRevardResult)}`);
- // }
- index++;
- } while (index < 7) //不知道结束的条件,目前写死循环7次吧
- console.log('浏览店铺任务结束');
- console.log('开始领取浏览后的奖励');
- let receiveAwardRes = await receiveAward(missionId);
- console.log(`领取浏览任务奖励成功:${JSON.stringify(receiveAwardRes)}`)
- return new Promise((resolve, reject) => {
- resolve(receiveAwardRes);
- })
- // gen.next();
-}
-// 领取浏览后的奖励
-function receiveAward(mid) {
- if (!mid) return
- mid = mid + "";
- const params = {
- "source":0,
- "workType": 7,
- "opType": 2,
- "mid": mid,
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- }
- return new Promise((rs, rj) => {
- request('doWork', params).then(response => {
- rs(response);
- })
- })
-}
-function share(data) {
- if (data.opType === 1) {
- console.log(`开始做分享任务\n`)
- } else {
- console.log(`开始做领取分享后的奖励\n`)
- }
- return new Promise((rs, rj) => {
- request('doWork', data).then(response => {
- rs(response);
- })
- })
- // const data = 'reqData={"source":0,"workType":2,"opType":1}';
- // request('doWork', data).then(res => {
- // console.log(`分享111:${JSON.stringify(res)}`)
- // setTimeout(() => {
- // const data2 = 'reqData={"source":0,"workType":2,"opType":2}';
- // request('doWork', data2).then(res => {
- // console.log(`分享222:${JSON.stringify(res)}`)
- // })
- // }, 2000)
- // })
- // await sleep(3);
-}
-function msgControl() {
- console.log('控制弹窗');
- console.log(treeMsgTime);
- // console.log(typeof (treeMsgTime));
- treeMsgTime++;
- // console.log(treeMsgTime);
- $.setdata(`${treeMsgTime}`, 'treeMsgTime');
- console.log(`${$.getdata('treeMsgTime')}`);
- // console.log(`${typeof (Number($hammer.read('treeMsgTime')))}`)
- // console.log(`${($hammer.read('treeMsgTime') * 1) === Notice}`)
- // if (($.getdata('treeMsgTime') * 1) === Notice) {
- // $.msg(name, subTitle, message);
- // $.setdata('0', 'treeMsgTime');
- // }
- // gen.next()
-}
-
-async function request(function_id, body = {}) {
- await $.wait(1000); //歇口气儿, 不然会报操作频繁
- return new Promise((resolve, reject) => {
- $.post(taskurl(function_id,body), (err, resp, data) => {
- if (err) {
- console.log("=== request error -s--");
- console.log("=== request error -e--");
- } else {
- try {
- data = JSON.parse(data);
- } catch (e) {
- console.log(e)
- } finally {
- resolve(data)
- }
- }
- })
- })
-}
-
-function taskurl(function_id, body) {
- return {
- url: JD_API_HOST + '/' + function_id + '?_=' + new Date().getTime()*1000,
- body: `reqData=${function_id === 'harvest' || function_id === 'login' || function_id === 'signIndex' || function_id === 'signOne' || function_id === 'setUserLinkStatus' || function_id === 'dayWork' || function_id === 'getSignAward' || function_id === 'sell' ? encodeURIComponent(JSON.stringify(body)) : JSON.stringify(body)}`,
- headers: {
- 'Accept' : `application/json`,
- 'Origin' : `https://uua.jr.jd.com`,
- 'Accept-Encoding' : `gzip, deflate, br`,
- 'Cookie' : cookie,
- 'Content-Type' : `application/x-www-form-urlencoded;charset=UTF-8`,
- 'Host' : `ms.jr.jd.com`,
- 'Connection' : `keep-alive`,
- 'User-Agent' : `jdapp;iPhone;9.0.0;13.4.1;e35caf0a69be42084e3c97eef56c3af7b0262d01;network/4g;ADID/F75E8AED-CB48-4EAC-A213-E8CE4018F214;supportApplePay/3;hasUPPay/0;pushNoticeIsOpen/1;model/iPhone11,8;addressid/2005183373;hasOCPay/0;appBuild/167237;supportBestPay/0;jdSupportDarkMode/0;pv/1287.19;apprpd/MyJD_GameMain;ref/https%3A%2F%2Fuua.jr.jd.com%2Fuc-fe-wxgrowing%2Fmoneytree%2Findex%2F%3Fchannel%3Dyxhd%26lng%3D113.325843%26lat%3D23.204628%26sid%3D2d98e88cf7d182f60d533476c2ce777w%26un_area%3D19_1601_50258_51885;psq/1;ads/;psn/e35caf0a69be42084e3c97eef56c3af7b0262d01|3485;jdv/0|kong|t_1000170135|tuiguang|notset|1593059927172|1593059927;adk/;app_device/IOS;pap/JA2015_311210|9.0.0|IOS 13.4.1;Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1`,
- 'Referer' : `https://uua.jr.jd.com/uc-fe-wxgrowing/moneytree/index/?channel=yxhd&lng=113.325896&lat=23.204600&sid=2d98e88cf7d182f60d533476c2ce777w&un_area=19_1601_50258_51885`,
- 'Accept-Language' : `zh-cn`
- }
- }
-}
-// prettier-ignore
-function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{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=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"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 e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)}
\ No newline at end of file
diff --git a/backUp/jd_pet_double.js b/backUp/jd_pet_double.js
deleted file mode 100644
index a9f11db..0000000
--- a/backUp/jd_pet_double.js
+++ /dev/null
@@ -1,530 +0,0 @@
-//备份之前单账号的萌宠脚本
-const name = '东东萌宠';
-const $ = new Env(name);
-
-// =======node.js使用说明======
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
-//ios等软件用户直接用NobyDa的jd cookie
-const cookie = jdCookieNode.CookieJD ? jdCookieNode.CookieJD : $.getdata('CookieJD');
-//京东接口地址
-const JD_API_HOST = 'https://api.m.jd.com/client.action';
-let jdNotify = $.getdata('jdPetNotify');
-let shareCodes = [ // 这个列表填入你要助力的好友的shareCode, 最多可能是5个
- 'MTAxODc2NTEzMjAwMDAwMDAzMDI3MTMyOQ==',
- 'MTAxODcxOTI2NTAwMDAwMDAyNjA4ODQyMQ==',
- 'MTAxODc2NTEzMDAwMDAwMDAwNTUwNDUxMw==',
- 'MTAxODc2NTEzOTAwMDAwMDAxODQ5MDg5NQ==',
- 'MTAxODcxOTI2NTAwMDAwMDAxOTQ3MjkzMw=='
-]
-// 添加box功能
-// 【用box订阅的好处】
-// 1️⃣脚本也可以远程挂载了。助力功能只需在box里面设置助力码。
-// 2️⃣所有脚本的cookie都可以备份,方便你迁移到其他支持box的软件。
-let isBox = false //默认没有使用box
-const boxShareCodeArr = ['jd_pet1', 'jd_pet2', 'jd_pet3', 'jd_pet4', 'jd_pet5'];
-isBox = boxShareCodeArr.some((item) => {
- const boxShareCode = $.getdata(item);
- return (boxShareCode !== undefined && boxShareCode !== null && boxShareCode !== '');
-});
-if (isBox) {
- shareCodes = [];
- for (const item of boxShareCodeArr) {
- if ($.getdata(item)) {
- shareCodes.push($.getdata(item));
- }
- }
-}
-let petInfo = null, taskInfo = null, message = '', subTitle = '', goodsUrl = '', taskInfoKey = [], option = {};
-
-//按顺序执行, 尽量先执行不消耗狗粮的任务, 避免中途狗粮不够, 而任务还没做完
-let function_map = {
- signInit: signInit, //每日签到
- threeMealInit: threeMealInit, //三餐
- browseSingleShopInit: browseSingleShopInit, //浏览店铺1
- browseSingleShopInit2: browseSingleShopInit2, //浏览店铺2
- browseSingleShopInit3: browseSingleShopInit3, //浏览店铺3
- browseShopsInit: browseShopsInit, //浏览店铺s, 目前只有一个店铺
- firstFeedInit: firstFeedInit, //首次喂食
- inviteFriendsInit: inviteFriendsInit, //邀请好友, 暂未处理
- feedReachInit: feedReachInit, //喂食10次任务 最后执行投食10次任务, 提示剩余狗粮是否够投食10次完成任务, 并询问要不要继续执行
-}
-
-let gen = entrance();
-gen.next();
-/**
- * 入口函数
- */
-function* entrance() {
- if (!cookie) {
- $.msg(name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', { "open-url": "https://bean.m.jd.com/" });
- $.done();
- return
- }
- console.log('任务开始');
- yield initPetTown(); //初始化萌宠
- yield taskInit(); // 初始化任务
-
- yield petSport(); // 遛弯
- yield slaveHelp(); // 助力, 在顶部shareCodes中填写需要助力的shareCode
- yield masterHelpInit();//获取助力信息
- taskInfo['taskList'].forEach((val) => {
- taskInfoKey.push(val);
- })
- // 任务开始
- for (let task_name in function_map) {
- if (taskInfoKey.indexOf(task_name) !== -1) {
- taskInfoKey.splice(taskInfoKey.indexOf(task_name), 1);
- }
- if (taskInfo[task_name] && !taskInfo[task_name].finished) {
- console.log('任务' + task_name + '开始');
- // yield eval(task_name + '()');
- yield function_map[task_name]();
- } else {
- console.log('任务' + task_name + '已完成');
- }
- }
- for (let item of taskInfoKey) {
- console.log(`新任务 【${taskInfo[item].title}】 功能未开发,请反馈给脚本维护者@lxk0301\n`);
- $.msg($.name, subTitle, `新的任务 【${taskInfo[item].title}】 功能未开发,请反馈给脚本维护者@lxk0301\n`, {"open-url": "https://t.me/JD_fruit_pet"})
- }
- yield feedPetsAgain();//所有任务做完后,检测剩余狗粮是否大于110g,大于就继续投食
- yield energyCollect();
- option['media-url'] = goodsUrl;
- if (!jdNotify || jdNotify === 'false') {
- $.msg(name, subTitle, message, option);
- }
- // $notify(name, subTitle, message);
- console.log('全部任务完成, 如果帮助到您可以点下🌟STAR鼓励我一下, 明天见~');
- $.done();
-}
-
-
-// 收取所有好感度
-function energyCollect() {
- console.log('开始收取任务奖励好感度');
-
- let function_id = arguments.callee.name.toString();
- request(function_id).then(response => {
- console.log(`收取任务奖励好感度完成:${JSON.stringify(response)}`);
- if (response.code === '0') {
- // message += `【第${petInfo.medalNum + 2}块勋章完成进度】:${response.result.medalPercent}%,还需投食${response.result.needCollectEnergy}g狗粮\n`;
- // message += `【已获得勋章】${petInfo.medalNum + 1}块,还需收集${petInfo.goodsInfo.exchangeMedalNum - petInfo.medalNum - 1}块即可兑换奖品“${petInfo.goodsInfo.goodsName}”\n`;
- message += `【第${response.result.medalNum + 1}块勋章完成进度】${response.result.medalPercent}%,还需收集${response.result.needCollectEnergy}好感\n`;
- message += `【已获得勋章】${response.result.medalNum}块,还需收集${response.result.needCollectMedalNum}块即可兑换奖品“${petInfo.goodsInfo.goodsName}”\n`;
- }
- gen.next();
- })
-}
-
-// 首次投食 任务
-function firstFeedInit() {
- console.log('首次投食任务合并到10次喂食任务中');
- setTimeout(() => {
- gen.next();
- }, 2000);
-}
-
-/**
- * 投食10次 任务
- */
-async function feedReachInit() {
- console.log('投食任务开始...');
-
- // let foodAmount = petInfo.foodAmount; //剩余狗粮
- let finishedTimes = taskInfo.feedReachInit.hadFeedAmount / 10; //已经喂养了几次
- let needFeedTimes = 10 - finishedTimes; //还需要几次
- // let canFeedTimes = foodAmount / 10;
- // if (canFeedTimes < needFeedTimes) {
- // if (confirm('当前剩余狗粮' + foodAmount + 'g, 已不足投食' + needFeedTimes + '次, 确定要继续吗?') === false) {
- // console.log('你拒绝了执行喂养十次任务');
- // gen.next();
- // }
- // }
-
- let tryTimes = 20; //尝试次数
- do {
- console.log(`还需要投食${needFeedTimes}次`);
- let response = await feedPets();
- console.log(`本次投食结果: ${JSON.stringify(response)}`);
- if (response.resultCode == 0 && response.code == 0) {
- needFeedTimes--;
- }
- if (response.resultCode == 3003 && response.code == 0) {
- console.log('剩余狗粮不足, 投食结束');
- needFeedTimes = 0;
- }
-
- tryTimes--;
- } while (needFeedTimes > 0 && tryTimes > 0)
-
- console.log('投食任务结束...');
- gen.next();
-
-}
-
-// 遛狗, 每天次数上限10次, 随机给狗粮, 每次遛狗结束需调用getSportReward领取奖励, 才能进行下一次遛狗
-async function petSport() {
- console.log('开始遛弯');
-
- var times = 1;
- var code = 0;
- var resultCode = 0;
-
- do {
- let response = await request(arguments.callee.name.toString())
- console.log(`第${times}次遛狗完成: ${JSON.stringify(response)}`);
- resultCode = response.resultCode;
-
- if (resultCode == 0) {
- let sportRevardResult = await getSportReward();
- console.log(`领取遛狗奖励完成: ${JSON.stringify(sportRevardResult)}`);
- }
-
- times++;
- } while (resultCode == 0 && code == 0)
- if (times > 1) {
- message += '【十次遛狗】已完成\n';
- }
- gen.next();
-
-}
-
-/**
- * 助力好友, 暂时支持一个好友, 需要拿到shareCode
- * shareCode为你要助力的好友的
- * 运行脚本时你自己的shareCode会在控制台输出, 可以将其分享给他人
- */
-async function slaveHelp() {
- let functionId = arguments.callee.name.toString();
- let helpPeoples = '';
- for (let code of shareCodes) {
- console.log(`开始助力好友: ${code}`);
- let response = await request(functionId, {
- shareCode: code
- });
- if (response.code === '0' && response.resultCode === '0') {
- if (response.result.helpStatus === 0) {
- console.log('已给好友: 【' + response.result.masterNickName + '】助力');
- helpPeoples += response.result.masterNickName + ',';
- } else if (response.result.helpStatus === 1) {
- // 您今日已无助力机会
- console.log(`助力好友${response.result.masterNickName}失败,您今日已无助力机会`);
- break;
- } else if (response.result.helpStatus === 2) {
- //该好友已满5人助力,无需您再次助力
- console.log(`该好友${response.result.masterNickName}已满5人助力,无需您再次助力`);
- }
- } else {
- console.log(`助理好友结果: ${response.message}`);
- }
- }
- if (helpPeoples && helpPeoples.length > 0) {
- message += `【您助力的好友】${helpPeoples.substr(0, helpPeoples.length - 1)}\n`;
- }
-
- gen.next();
-}
-
-
-// 领取遛狗奖励
-function getSportReward() {
- return new Promise((rs, rj) => {
- request(arguments.callee.name.toString()).then(response => {
- rs(response);
- })
- })
-}
-
-// 浏览店铺任务, 任务可能为多个? 目前只有一个
-async function browseShopsInit() {
- console.log('开始浏览店铺任务');
- let times = 0;
- let resultCode = 0;
- let code = 0;
-
- do {
- let response = await request("getBrowseShopsReward");
- console.log(`第${times}次浏览店铺结果: ${JSON.stringify(response)}`);
- code = response.code;
- resultCode = response.resultCode;
- times++;
- } while (resultCode == 0 && code == 0 && times < 5)
-
- console.log('浏览店铺任务结束');
- gen.next();
-}
-
-// 浏览指定店铺 任务
-function browseSingleShopInit() {
- console.log('准备浏览指定店铺');
- const body = {"index":0,"version":1,"type":1};
- request("getSingleShopReward", body).then(response => {
- console.log(`response::${JSON.stringify(response)}`);
- if (response.code === '0' && response.resultCode === '0') {
- const body2 = {"index":0,"version":1,"type":2};
- request("getSingleShopReward", body2).then(response2 => {
- console.log(`response2::${JSON.stringify(response)}`);
- if (response2.code === '0' && response2.resultCode === '0') {
- message += `【浏览指定店铺】获取${response2.result.reward}g\n`;
- }
- gen.next();
- })
- }
- })
-}
-// 临时新增任务--冰淇淋会场
-function browseSingleShopInit2() {
- console.log('准备浏览指定店铺--冰淇淋会场');
- const body = {"index":1,"version":1,"type":1};
- const body2 = {"index":1,"version":1,"type":2}
- request("getSingleShopReward", body).then(response => {
- console.log(`①点击浏览指定店铺结果: ${JSON.stringify(response)}`);
- if (response.code === '0' && response.resultCode === '0') {
- request("getSingleShopReward", body2).then(response2 => {
- console.log(`②浏览指定店铺结果: ${JSON.stringify(response2)}`);
- if (response2.code === '0' && response2.resultCode === '0') {
- message += `【冰淇淋会场】获取狗粮${response2.result.reward}g\n`;
- }
- })
- }
- gen.next();
- })
-}
-function browseSingleShopInit3() {
- console.log('准备完成 去参与星品解锁计划');
- const body = {"index":2,"version":1,"type":1};
- const body2 = {"index":2,"version":1,"type":2}
- request("getSingleShopReward", body).then(response => {
- console.log(`①点击浏览指定店铺结果: ${JSON.stringify(response)}`);
- if (response.code === '0' && response.resultCode === '0') {
- request("getSingleShopReward", body2).then(response2 => {
- console.log(`②浏览指定店铺结果: ${JSON.stringify(response2)}`);
- if (response2.code === '0' && response2.resultCode === '0') {
- message += `【去参与星品解锁计划】获取狗粮${response2.result.reward}g\n`;
- }
- })
- }
- gen.next();
- })
-}
-// 三餐签到, 每天三段签到时间
-function threeMealInit() {
- console.log('准备三餐签到');
- request("getThreeMealReward").then(response => {
- console.log(`三餐签到结果: ${JSON.stringify(response)}`);
- if (response.code === '0' && response.resultCode === '0') {
- message += `【定时领狗粮】获得${response.result.threeMealReward}g\n`;
- } else {
- message += `【定时领狗粮】${response.message}\n`;
- }
- gen.next();
- })
-}
-
-// 每日签到, 每天一次
-function signInit() {
- console.log('准备每日签到');
- request("getSignReward").then(response => {
- console.log(`每日签到结果: ${JSON.stringify(response)}`);
- message += `【每日签到成功】奖励${response.result.signReward}g狗粮\n`;
- gen.next();
- })
-
-}
-
-// 投食
-function feedPets() {
- console.log('开始投食');
- return new Promise((rs, rj) => {
- request(arguments.callee.name.toString()).then(response => {
- rs(response);
- })
- })
-}
-
-//查询jd宠物信息
-function initPetTown() {
- request(arguments.callee.name.toString()).then((response) => {
- // console.log(`初始化萌宠信息${JSON.stringify(response)}`)
- if (response.code === '0' && response.resultCode === '0' && response.message === 'success') {
- petInfo = response.result;
- if (petInfo.userStatus === 0) {
- $.msg(name, '【提示】此账号萌宠活动未开始,请手动去京东APP开启活动\n入口:我的->游戏与互动->查看更多', '', { "open-url": "openapp.jdmoble://" });
- $.done();
- return
- }
- goodsUrl = petInfo.goodsInfo && petInfo.goodsInfo.goodsUrl;
- // console.log(`初始化萌宠信息完成: ${JSON.stringify(petInfo)}`);
- if (petInfo.petStatus === 5 && petInfo.showHongBaoExchangePop) {
- option['open-url'] = "openApp.jdMobile://";
- option['media-url'] = goodsUrl;
- $.msg($.name, `【提醒⏰】${petInfo.goodsInfo.goodsName}已可领取`, '请去京东APP或微信小程序查看', option);
- $.done();
- return
- }
- console.log(`\n【您的互助码shareCode】 ${petInfo.shareCode}\n`);
- gen.next();
- } else if (response.code === '0' && response.resultCode === '2001'){
- console.log(`初始化萌宠失败: ${response.message}`);
- $.setdata('', 'CookieJD');//cookie失效,故清空cookie。
- $.msg(name, '【提示】京东cookie已失效,请重新登录获取', 'https://bean.m.jd.com/', { "open-url": "https://bean.m.jd.com/" });
- $.done();
- }
- })
-
-}
-//再次投食
-async function feedPetsAgain() {
- const response = await secondInitPetTown(); //再次初始化萌宠
- if (response.code === '0' && response.resultCode === '0' && response.message === 'success') {
- let secondPetInfo = response.result;
- let foodAmount = secondPetInfo.foodAmount; //剩余狗粮
- if (foodAmount - 100 >= 10) {
- for (let i = 0; i < parseInt((foodAmount - 100) / 10); i++) {
- const feedPetRes = await feedPets();
- console.log(`投食feedPetRes`);
- if (feedPetRes.resultCode == 0 && feedPetRes.code == 0) {
- console.log('投食成功')
- }
- }
- const response2 = await secondInitPetTown();
- subTitle = response2.result.goodsInfo.goodsName;
- message += `【与爱宠相识】${response2.result.meetDays}天\n`;
- message += `【剩余狗粮】${response2.result.foodAmount}g\n`;
- } else {
- console.log("目前剩余狗粮:【" + foodAmount + "】g,不再继续投食,保留100g用于完成第二天任务");
- subTitle = secondPetInfo.goodsInfo.goodsName;
- message += `【与爱宠相识】${secondPetInfo.meetDays}天\n`;
- message += `【剩余狗粮】${secondPetInfo.foodAmount}g\n`;
- }
- } else {
- console.log(`初始化萌宠失败: ${JSON.stringify(petInfo)}`);
- }
- gen.next();
-}
-// 再次查询萌宠信息
-function secondInitPetTown() {
- console.log('开始再次初始化萌宠信息');
- return new Promise((rs, rj) => {
- request("initPetTown").then(response => {
- rs(response);
- })
- })
-}
-// 邀请新用户
-function inviteFriendsInit() {
- console.log('邀请新用户功能未实现');
- if (taskInfo.inviteFriendsInit.status == 1 && taskInfo.inviteFriendsInit.inviteFriendsNum > 0) {
- // 如果有邀请过新用户,自动领取60gg奖励
- request('getInviteFriendsReward').then((res) => {
- try {
- if (res.code == 0 && res.resultCode == 0) {
- console.log(`领取邀请新用户奖励成功,获得狗粮现有狗粮${taskInfo.inviteFriendsInit.reward}g,${res.result.foodAmount}g`);
- message += `【邀请新用户】获取${taskInfo.inviteFriendsInit.reward}g\n`;
- }
- gen.next();
- } catch (e) {
- console.log('领取邀请新用户奖励失败')
- }
- });
- } else {
- setTimeout(() => {
- gen.next();
- }, 2000);
- }
-}
-
-// 好友助力信息
-async function masterHelpInit() {
- let res = await request(arguments.callee.name.toString());
- console.log('助力信息: ' , res);
- if (res.code === '0' && res.resultCode === '0') {
- if (res.result.masterHelpPeoples && res.result.masterHelpPeoples.length >= 5) {
- if(!res.result.addedBonusFlag) {
- console.log("开始领取额外奖励");
- let getHelpAddedBonusResult = await getHelpAddedBonus();
- console.log(`领取30g额外奖励结果:【${getHelpAddedBonusResult.message}】`);
- message += `【额外奖励${getHelpAddedBonusResult.result.reward}领取】${getHelpAddedBonusResult.message}\n`;
- } else {
- console.log("已经领取过5好友助力额外奖励");
- message += `【额外奖励】已领取\n`;
- }
- } else {
- console.log("助力好友未达到5个")
- message += `【额外奖励】领取失败,原因:助力好友未达5个\n`;
- }
- if (res.result.masterHelpPeoples && res.result.masterHelpPeoples.length > 0) {
- console.log('帮您助力的好友的名单开始')
- let str = '';
- res.result.masterHelpPeoples.map((item, index) => {
- if (index === (res.result.masterHelpPeoples.length - 1)) {
- str += item.nickName || "匿名用户";
- } else {
- str += (item.nickName || "匿名用户") + ',';
- }
- })
- message += `【助力您的好友】${str}\n`;
- }
- }
- gen.next();
-}
-// 领取5好友助力后的奖励
-function getHelpAddedBonus() {
- return new Promise((rs, rj)=> {
- request(arguments.callee.name.toString()).then(response=> {
- rs(response);
- })
- })
-}
-
-// 初始化任务, 可查询任务完成情况
-function taskInit() {
- console.log('开始任务初始化');
- const body = {"version":1};
- request(arguments.callee.name.toString(), body).then(response => {
- if (response.resultCode === '9999' || !response.result) {
- console.log('初始化任务异常, 请稍后再试');
- gen.return();
- }
- taskInfo = response.result;
- // function_map = taskInfo.taskList;
- // console.log(`任务初始化完成: ${JSON.stringify(taskInfo)}`);
- gen.next();
- })
-
-}
-
-// 请求
-async function request(function_id, body = {}) {
- await $.wait(3000); //歇口气儿, 不然会报操作频繁
- return new Promise((resolve, reject) => {
- $.get(taskurl(function_id, body), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n东东萌宠: API查询请求失败 ‼️‼️')
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- console.log(e)
- } finally {
- resolve(data)
- }
- })
- })
-}
-
-function taskurl(function_id, body = {}) {
- return {
- url: `${JD_API_HOST}?functionId=${function_id}&appid=wh5&loginWQBiz=pet-town&body=${escape(JSON.stringify(body))}`,
- headers: {
- Cookie: cookie,
- UserAgent: `Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1`,
- }
- };
-}
-
-// prettier-ignore
-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
diff --git a/backUp/jd_plantBean_double.js b/backUp/jd_plantBean_double.js
deleted file mode 100644
index 892a4b5..0000000
--- a/backUp/jd_plantBean_double.js
+++ /dev/null
@@ -1,595 +0,0 @@
-
-/*
-种豆得豆 搬的https://github.com/uniqueque/QuantumultX/blob/4c1572d93d4d4f883f483f907120a75d925a693e/Script/jd_joy.js
-更新时间:2020-08-25
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-会自动关注任务中的店铺跟商品
-互助码shareCode请先手动运行脚本查看打印可看到
-// quantumultx
-[task_local]
-1 7-21/2 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_plantBean.js, tag=种豆得豆, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdzd.png, enabled=true
-// Loon
-[Script]
-cron "1 7-21/2 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_plantBean.js,tag=京东种豆得豆
-// Surge
-// 京东种豆得豆 = type=cron,cronexp="1 7-21/2 * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_steal.js
-一天只能帮助3个人。多出的助力码无效
-注:如果使用Node.js, 需自行安装'crypto-js,got,http-server,tough-cookie'模块. 例: npm install crypto-js http-server tough-cookie got --save
-*/
-
-const name = '京东种豆得豆';
-const $ = new Env(name);
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
-//ios等软件用户直接用NobyDa的jd cookie
-const cookie = jdCookieNode.CookieJD ? jdCookieNode.CookieJD : $.getdata('CookieJD');
-let jdNotify = $.getdata('jdPlantBeanNotify');
-
-//京东接口地址
-const JD_API_HOST = 'https://api.m.jd.com/client.action';
-
-let plantUuids = [ // 这个列表填入你要助力的好友的plantUuid
- '66j4yt3ebl5ierjljoszp7e4izzbzaqhi5k2unz2afwlyqsgnasq',
- 'olmijoxgmjutyrsovl2xalt2tbtfmg6sqldcb3q',
- 'qawf5ls3ucw25yhfulu32xekqy3h7wlwy7o5jii'
-]
-let currentRoundId = null;//本期活动id
-let lastRoundId = null;//上期id
-let roundList = [];
-let awardState = '';//上期活动的京豆是否收取
-// 添加box功能
-// 【用box订阅的好处】
-// 1️⃣脚本也可以远程挂载了。助力功能只需在box里面设置助力码。
-// 2️⃣所有脚本的cookie都可以备份,方便你迁移到其他支持box的软件。
-let isBox = false //默认没有使用box
-const boxShareCodeArr = ['jd_plantBean1', 'jd_plantBean2', 'jd_plantBean3'];
-isBox = boxShareCodeArr.some((item) => {
- const boxShareCode = $.getdata(item);
- return (boxShareCode !== undefined && boxShareCode !== null && boxShareCode !== '');
-});
-if (isBox) {
- plantUuids = [];
- for (const item of boxShareCodeArr) {
- if ($.getdata(item)) {
- plantUuids.push($.getdata(item));
- }
- }
-}
-
-var Task = step();
-Task.next();
-
-function* step() {
- let message = '', subTitle = '';
- if (cookie) {
- console.log(`获取任务及基本信息`)
- let plantBeanIndexResult = yield plantBeanIndex()
- if (plantBeanIndexResult.code != "0") {
- console.log(`plantBeanIndexResult:${JSON.stringify(plantBeanIndexResult)}`)
- if (plantBeanIndexResult.code === '3') {
- $.setdata('', 'CookieJD');//cookie失效,故清空cookie。
- $.msg(name, '【提示】京东cookie已失效,请重新登录获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- $.done();
- return
- }
- //todo
- return
- }
- roundList = plantBeanIndexResult.data.roundList;
- currentRoundId = roundList[1].roundId;
- lastRoundId = roundList[0].roundId;
- awardState = roundList[0].awardState;
- subTitle = `【京东昵称】${plantBeanIndexResult.data.plantUserInfo.plantNickName}`;
- message += `【上期时间】${roundList[0].dateDesc}\n`;
- message += `【上期成长值】${roundList[0].growth}\n`;
- //定时领取--放到前面执行收取自动生产的营养液
- if (plantBeanIndexResult.data.timeNutrientsRes.state == 1 && plantBeanIndexResult.data.timeNutrientsRes.nutrCount > 0) {
- console.log(`开始领取定时产生的营养液`)
- let receiveNutrientsResult = yield receiveNutrients(currentRoundId)
- console.log(`receiveNutrientsResult:${JSON.stringify(receiveNutrientsResult)}`)
- }
- console.log(`【上轮京豆】${awardState === '4' ? '采摘中' : awardState === '5' ? '可收获了' : '已领取'}`);
- if (awardState === '4') {
- //京豆采摘中...
- message += `【上期状态】${roundList[0].tipBeanEndTitle}\n`;
- } else if (awardState === '5') {
- //收获
- let res = yield getReward();
- // console.log(`种豆得豆收获的京豆情况---res,${JSON.stringify(res)}`);
- console.log('开始领取京豆');
- if (res.code === '0') {
- console.log('京豆领取成功');
- message += `【上期兑换京豆】${res.data.awardBean}个\n`;
- $.msg(name, subTitle, message);
- }
- } else if (awardState === '6') {
- //京豆已领取
- message += `【上期兑换京豆】${roundList[0].awardBeans}个\n`;
- }
- if (roundList[1].dateDesc.indexOf('本期 ') > -1) {
- roundList[1].dateDesc = roundList[1].dateDesc.substr(roundList[1].dateDesc.indexOf('本期 ') + 3, roundList[1].dateDesc.length);
- }
- message += `【本期时间】${roundList[1].dateDesc}\n`;
- message += `【本期成长值】${roundList[1].growth}\n`;
- let shareUrl = plantBeanIndexResult.data.jwordShareInfo.shareUrl
- let myPlantUuid = getParam(shareUrl, 'plantUuid')
- // console.log(`你的plantUuid为${myPlantUuid}`)
- console.log(`\n【您的互助码plantUuid】 ${myPlantUuid}\n`);
- for (let task of plantBeanIndexResult.data.taskList) {
- console.log(`开始【${task.taskName}】任务`)
- if (task.taskType == 7 || task.taskType == 17 || task.taskType == 18) {
- //具体每个人可能不一样
- //7金融双签,18疯抢爆品,17叠蛋糕
- if (task.isFinished != 1) {
- console.log(task.taskName)
- let receiveNutrientsTaskResult = yield receiveNutrientsTask(task.taskType)
- console.log(`receiveNutrientsTaskResult:${JSON.stringify(receiveNutrientsTaskResult)}`)
- }
- } else if (task.awardType == 3) {
- //浏览店铺
- if (task.isFinished != 1) {
- let shopTaskListResult = yield shopTaskList()
- if (shopTaskListResult.code == '0') {
- let shops = shopTaskListResult.data.goodShopList.concat(shopTaskListResult.data.moreShopList)
- let nutrCount = 0
- for (let shop of shops) {
- console.log(shop.shopName)
- if (shop.taskState == '2') {
- let shopNutrientsTaskResult = yield shopNutrientsTask(shop.shopTaskId, shop.shopId)
- if (shopNutrientsTaskResult.code == 0) {
- if (shopNutrientsTaskResult.data.nutrState && shopNutrientsTaskResult.data.nutrState == '1' && shopNutrientsTaskResult.data.nutrCount > 0) {
- console.log(`关注店铺${shop.shopName}获得${shopNutrientsTaskResult.data.nutrCount}营养液`)
- nutrCount += shopNutrientsTaskResult.data.nutrCount
- if (nutrCount >= task.totalNum - task.gainedNum) {
- break
- }
- } else {
- console.log(`关注店铺${shop.shopName}未获得营养液`)
- }
- } else {
- console.log(`${shop.shopName},shopNutrientsTaskResult:${JSON.stringify(shopNutrientsTaskResult)}`)
- }
- }
- }
- } else {
- console.log(`shopTaskListResult:${JSON.stringify(shopTaskListResult)}`)
- }
- }
- } else if (task.awardType == 10) {
- //浏览频道
- if (task.isFinished != 1) {
- let plantChannelTaskListResult = yield plantChannelTaskList()
- if (plantChannelTaskListResult.code == '0') {
- let channelList = plantChannelTaskListResult.data.goodChannelList.concat(plantChannelTaskListResult.data.normalChannelList)
- let nutrCount = 0
- for (let channel of channelList) {
- // console.log(channel.channelName)
- if (channel.taskState == '2') {
- let plantChannelNutrientsTaskResult = yield plantChannelNutrientsTask(channel.channelTaskId, channel.channelId)
- if (plantChannelNutrientsTaskResult.code == '0') {
- if (plantChannelNutrientsTaskResult.data.nutrState && plantChannelNutrientsTaskResult.data.nutrState == '1' && plantChannelNutrientsTaskResult.data.nutrNum > 0) {
- console.log(`浏览频道${channel.channelName}获得${plantChannelNutrientsTaskResult.data.nutrNum}营养液`)
- nutrCount += plantChannelNutrientsTaskResult.data.nutrNum
- if (nutrCount >= task.totalNum - task.gainedNum) {
- break
- }
- } else {
- console.log(`浏览频道${channel.channelName}未获得营养液`)
- }
- } else {
- console.log(`${channel.channelName},plantChannelNutrientsTaskResult:${JSON.stringify(plantChannelNutrientsTaskResult)}`)
-
- }
- }
- }
- } else {
- console.log(`plantChannelTaskListResult:${JSON.stringify(plantChannelTaskListResult)}`)
- }
- }
- } else if (task.awardType == 5) {
- //关注商品
- if (task.isFinished != 1) {
- let productTaskListResult = yield productTaskList()
- if (productTaskListResult.code == '0') {
- let productInfoList = productTaskListResult.data.productInfoList.map(([item]) => item)
- let nutrCount = 0
- for (let productInfo of productInfoList) {
- console.log(productInfo.productName)
- if (productInfo.taskState == '2') {
- let productNutrientsTaskResult = yield productNutrientsTask(productInfo.productTaskId, productInfo.skuId)
- if (productNutrientsTaskResult.code == '0') {
- if (productNutrientsTaskResult.data.nutrState && productNutrientsTaskResult.data.nutrState == '1' && productNutrientsTaskResult.data.nutrCount > 0) {
- console.log(`关注商品${productInfo.productName}获得${productNutrientsTaskResult.data.nutrCount}营养液`)
- nutrCount += productNutrientsTaskResult.data.nutrCount
- if (nutrCount >= task.totalNum - task.gainedNum) {
- break
- }
- } else {
- console.log(`关注商品${productInfo.productName}未获得营养液`)
- }
- } else {
- console.log(`productNutrientsTaskResult:${JSON.stringify(productNutrientsTaskResult)}`)
- }
- }
- }
- } else {
- console.log(`productTaskListResult:${JSON.stringify(productTaskListResult)}`)
- }
- }
- } else if (task.taskType == 4) {
- //逛逛会场
- if (task.isFinished != 1 && task.gainedNum == '0') {
- if (plantBeanIndexResult.data.roundList[1].roundState == 2) {
- let purchaseRewardTaskResult = yield purchaseRewardTask(plantBeanIndexResult.data.roundList[1].roundId)
- console.log(`purchaseRewardTaskResult:${JSON.stringify(purchaseRewardTaskResult)}`)
- }
- }
- } else if (task.taskType == 19) {
- // 低价包邮
- if (task.isFinished !== 1) {
- let plantReceiveNutrientsTaskRes = yield plantReceiveNutrientsTask();
- console.log(`${task.taskName}获取营养液::${plantReceiveNutrientsTaskRes.data && plantReceiveNutrientsTaskRes.data.nutrNum}`)
- }
- } else if (task.taskType == 20) {
- // 助力高考
- if (task.isFinished !== 1) {
- let plantReceiveNutrientsTaskRes = yield receiveNutrientsTask(task.taskType);
- console.log(`${task.taskName}获取营养液::${plantReceiveNutrientsTaskRes.data && plantReceiveNutrientsTaskRes.data.nutrNum}`)
- }
- } else if (task.taskType == 1) {
- console.log('跳过签到,NobyDa的会签')
- // console.log(`【${task.taskName}】未开发${task.awardType},${task.taskType}`)
- } else {
- console.log(`【${task.taskName}】未开发${task.awardType},${task.taskType}`)
- }
- console.log(`【${task.taskName}】任务结束`)
- }
-
- //任务列表少了金融双签,拉出来执行下
- console.log(`金融双签`)
- let receiveNutrientsTaskResult = yield receiveNutrientsTask(7)
- console.log(`receiveNutrientsTaskResult:${JSON.stringify(receiveNutrientsTaskResult)}`)
-
- //助力好友
- console.log('开始助力好友')
- for (let plantUuid of plantUuids) {
- if (plantUuid == myPlantUuid) {
- console.log('跳过自己的plantUuid')
- continue
- }
- console.log(`开始助力好友: ${plantUuid}`);
- let helpResult = yield helpShare(plantUuid)
- if (helpResult.code === '0') {
- console.log(`助力好友结果: ${JSON.stringify(helpResult.data.helpShareRes)}`);
- if (helpResult.data.helpShareRes && helpResult.data.helpShareRes.state === '2') {
- console.log('今日助力机会已耗尽,跳出助力');
- break;
- }
- } else {
- console.log(`助力好友失败: ${JSON.stringify(helpResult)}`);
- }
- }
-
- //天天扭蛋功能
- let eggChance = yield egg();
- if (eggChance.code == 0) {
- if (eggChance.data.restLotteryNum > 0) {
- const eggL = new Array(eggChance.data.restLotteryNum).fill('');
- for (let i = 0; i < eggL.length; i++) {
- console.log(`开始第${i + 1}次扭蛋`);
- let plantEggDoLotteryRes = yield plantEggDoLottery();
- console.log(`天天扭蛋成功:${JSON.stringify(plantEggDoLotteryRes)}`);
- }
- } else {
- console.log('暂无扭蛋机会')
- }
- } else {
- console.log('查询天天扭蛋的机会失败')
- }
- plantBeanIndexResult = yield plantBeanIndex()
- if (plantBeanIndexResult.code == '0') {
- let plantBeanRound = plantBeanIndexResult.data.roundList[1]
- if (plantBeanRound.roundState == 2) {
- //收取营养液
- console.log(`开始收取营养液`)
- for (let bubbleInfo of plantBeanRound.bubbleInfos) {
- console.log(`收取营养液${bubbleInfo.name}`)
- let cultureBeanResult = yield cultureBean(plantBeanRound.roundId, bubbleInfo.nutrientsType)
- console.log(`cultureBeanResult:${JSON.stringify(cultureBeanResult)}`)
- }
- }
- } else {
- console.log(`plantBeanIndexResult:${JSON.stringify(plantBeanIndexResult)}`)
- }
- // 偷大于等于3瓶好友的营养液
- let stealRes = yield steal();
- if (stealRes.code == 0) {
- if (stealRes.data.tips) {
- console.log('今日已达上限');
- }
- if (stealRes.data && stealRes.data.friendInfoList && stealRes.data.friendInfoList.length > 0) {
- for (let item of stealRes.data.friendInfoList) {
- if (item.nutrCount >= 3) {
- console.log(`可以偷的好友的信息::${JSON.stringify(item)}`);
- console.log(`可以偷的好友的信息paradiseUuid::${JSON.stringify(item.paradiseUuid)}`);
- let stealFriendRes = yield collectUserNutr(item.paradiseUuid);
- console.log(`偷取好友营养液情况:${JSON.stringify(stealFriendRes)}`)
- if (stealFriendRes.code == '0') {
- console.log(`偷取好友营养液成功`)
- }
- }
- }
- }
- }
- console.log('结束')
- } else {
- $.msg(name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- $.done();
- return
- }
- if (!jdNotify || jdNotify === 'false') {
- $.msg(name, subTitle, message);
- }
- $.done();
-}
-
-function purchaseRewardTask(roundId) {
- let functionId = arguments.callee.name.toString();
- let body = {
- "monitor_refer": "plant_receiveNutrients",
- "monitor_source": "plant_app_plant_index",
- "roundId": roundId,
- "version": "9.0.0.1"
- }
- request(functionId, body);// `body=${escape(JSON.stringify(body))}&uuid=&appid=ld`
-}
-
-//低价包邮
-function plantReceiveNutrientsTask() {
- const body = {
- "monitor_refer": "plant_receiveNutrientsTask",
- "monitor_source": "plant_app_plant_index",
- "awardType": "19",
- "version": "9.0.0.1"
- };
- request('receiveNutrientsTask', body);
-}
-
-function receiveNutrientsTask(awardType) {
- // let functionId = arguments.callee.name.toString();
- // let body = {
- // "monitor_refer": "plant_receiveNutrientsTask",
- // "monitor_source": "plant_m_plant_index",//plant_app_plant_index,plant_m_plant_index
- // "awardType": `"${awardType}"`,
- // "version": "9.0.0.1"// "9.0.0.1", "8.4.0.0"
- // }
- //这里很奇怪,试了很多情况都不行,直接这样了
- requestGet(`https://api.m.jd.com/client.action?functionId=receiveNutrientsTask&body=%7B%22awardType%22%3A%22${awardType}%22%2C%22monitor_source%22%3A%22plant_m_plant_index%22%2C%22monitor_refer%22%3A%22plant_receiveNutrientsTask%22%2C%22version%22%3A%228.4.0.0%22%7D&appid=ld&client=apple&clientVersion=&networkType=&osVersion=&uuid=`)
- // request(functionId, body);// `body=${escape(JSON.stringify(body))}&client=apple&appid=ld`
-}
-
-//https://api.m.jd.com/client.action?functionId=receiveNutrients
-function receiveNutrients(roundId) {
-
- let functionId = arguments.callee.name.toString();
- let body = {
- "monitor_refer": "plant_receiveNutrients",
- "monitor_source": "plant_app_plant_index",
- "roundId": roundId,
- "version": "9.0.0.1"
- }
-
- request(functionId, body);//`body=${escape(JSON.stringify(body))}&uuid=&appid=ld`
-
-}
-
-// https://api.m.jd.com/client.action?functionId=cultureBean
-//收取营养液
-function cultureBean(roundId, nutrientsType) {
- let functionId = arguments.callee.name.toString();
- let body = {
- "monitor_refer": "plant_index",
- "monitor_source": "plant_app_plant_index",
- "roundId": roundId,
- "nutrientsType": nutrientsType,
- "version": "9.0.0.1"
- }
- request(functionId, body);//`body=${escape(JSON.stringify(body))}&uuid=&appid=ld`
-}
-
-function productNutrientsTask(productTaskId, skuId) {
- let functionId = arguments.callee.name.toString();
- let body = {
- "monitor_refer": "plant_productNutrientsTask",
- "monitor_source": "plant_app_plant_index",
- "productTaskId": productTaskId,
- "skuId": skuId,
- "version": "9.0.0.1"
- }
- request(functionId, body);//`body=${escape(JSON.stringify(body))}&uuid=&appid=ld`
-}
-
-function productTaskList() {
- //https://api.m.jd.com/client.action?functionId=productTaskList&body=%7B%7D&uuid=&appid=ld
- let functionId = arguments.callee.name.toString();
- request(functionId);// `body=%7B%7D&uuid=&appid=ld`
-}
-
-function plantChannelNutrientsTask(channelTaskId, channelId) {
- let functionId = arguments.callee.name.toString();
- let body = {"channelTaskId": channelTaskId, "channelId": channelId}
- request(functionId, body);//`body=${escape(JSON.stringify(body))}&uuid=&appid=ld`
-}
-
-function plantChannelTaskList() {
- let functionId = arguments.callee.name.toString();
- request(functionId);// `body=%7B%7D&uuid=&appid=ld`
-}
-
-function shopNutrientsTask(shopTaskId, shopId) {
- let functionId = arguments.callee.name.toString();
- let body = {
- "version": "9.0.0.1",
- "monitor_refer": "plant_shopNutrientsTask",
- "monitor_source": "plant_app_plant_index",
- "shopId": shopId,
- "shopTaskId": shopTaskId
- }
-
- request(functionId, body);// `body=${escape(JSON.stringify(body))}&uuid=&appid=ld`
-}
-
-function shopTaskList() {
- let functionId = arguments.callee.name.toString();
- request(functionId);//`body=%7B%7D&uuid=&appid=ld`
-}
-
-function helpShare(plantUuid) {
- let body = {
- "plantUuid": plantUuid,
- "monitor_refer": "",
- "wxHeadImgUrl": "",
- "shareUuid": "",
- "followType": "0",
- "monitor_source": "plant_m_plant_index",
- "version": "9.0.0.1"
- }
- request(`plantBeanIndex`, body);
-}
-
-//查询天天扭蛋的机会
-function egg() {
- request('plantEggLotteryIndex');
-}
-
-// 调用扭蛋api
-function plantEggDoLottery() {
- request('plantEggDoLottery');
-}
-
-function plantBeanIndex() {
- // https://api.m.jd.com/client.action?functionId=plantBeanIndex
- let functionId = arguments.callee.name.toString();
- let body = {"monitor_source": "plant_app_plant_index", "monitor_refer": "", "version": "9.0.0.1"}
- request(functionId, body);//plantBeanIndexBody
-}
-
-//偷营养液大于等于3瓶的好友
-//①查询好友列表
-function steal() {
- const body = {
- pageNum: '1'
- }
- request('plantFriendList', body);
-}
-
-//②执行偷好友营养液的动作
-function collectUserNutr(paradiseUuid) {
- console.log('开始偷好友');
- console.log(paradiseUuid);
- let functionId = arguments.callee.name.toString();
- const body = {
- "paradiseUuid": paradiseUuid,
- "roundId": currentRoundId
- }
- request(functionId, body);
-}
-
-//每轮种豆活动获取结束后,自动收取京豆
-function getReward() {
- const body = {
- "roundId": lastRoundId
- }
- request('receivedBean', body);
-}
-
-function requestGet(url) {
- const option = {
- url: url,
- headers: {
- Cookie: cookie,
- }
- };
- $.get(option, (err, resp, data) => {
- try {
- if (err) {
- console.log('\n种豆得豆: API查询请求失败 ‼️‼️')
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- sleep(data);
- }
- // try {
- // sleep(JSON.parse(data))
- // } catch (e) {
- // $.logErr(e, resp)
- // }
- })
-}
-
-function request(function_id, body = {}) {
- $.post(taskurl(function_id, body), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n种豆得豆: API查询请求失败 ‼️‼️')
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- sleep(data);
- }
- })
-}
-
-function taskurl(function_id, body) {
- // console.log(`${JD_API_HOST}?functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=ld&client=apple&clientVersion=&networkType=&osVersion=&uuid=`)
- return {
- // url: `${JD_API_HOST}?functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=ld&client=apple&clientVersion=&networkType=&osVersion=&uuid=`,
- url: JD_API_HOST,
- body: `functionId=${function_id}&body=${JSON.stringify(body)}&appid=ld&client=apple&clientVersion=&networkType=&osVersion=&uuid=`,
- headers: {
- 'Cookie': cookie,
- 'Host': 'api.m.jd.com',
- 'Accept': '*/*',
- 'Connection': 'keep-alive',
- 'User-Agent': 'JD4iPhone/167249 (iPhone;iOS 13.5.1;Scale/3.00)',
- 'Accept-Language': 'zh-Hans-CN;q=1,en-CN;q=0.9',
- 'Accept-Encoding': 'gzip, deflate, br',
- 'Content-Type': "application/x-www-form-urlencoded"
- }
- }
-}
-
-// function taskurl(function_id, body) {
-// return {
-// url: `${JD_API_HOST}?functionId=${function_id}`,
-// body: body, //escape`functionId=${function_id}&body=${JSON.stringify(body)}&appid=wh5`
-// headers: {
-// Cookie: cookie,
-// },
-// method: "POST",
-// }
-// }
-
-function sleep(response) {
- console.log('休息一下');
- setTimeout(() => {
- console.log('休息结束');
- Task.next(response)
- }, 2000);
-}
-
-function getParam(url, name) {
- var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
- var r = url.match(reg);
- if (r != null) return unescape(r[2]);
- return null;
-}
-// prettier-ignore
-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
diff --git a/backUp/jd_speed2.js b/backUp/jd_speed2.js
deleted file mode 100644
index f79783c..0000000
--- a/backUp/jd_speed2.js
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
-京东天天加速活动 国内gitee链接:https://gitee.com/lxk0301/jd_scripts/raw/master/jd_speed.js
-更新时间:2020-08-15
-每天4京豆,再小的苍蝇也是肉
-从 https://github.com/Zero-S1/JD_tools/blob/master/JD_speed.py 改写来的
-建议3小时运行一次,打卡时间间隔是6小时
-注:如果使用Node.js, 需自行安装'crypto-js,got,http-server,tough-cookie'模块. 例: npm install crypto-js http-server tough-cookie got --save
-*/
-// quantumultx
-// [task_local]
-// #天天加速
-// 8 */3 * * * https://gitee.com/lxk0301/jd_scripts/raw/master/jd_speed.js, tag=京东天天加速, img-url=https://raw.githubusercontent.com/znz1992/Gallery/master/jdttjs.png, enabled=true
-// Loon
-// [Script]
-// cron "8 */3 * * *" script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_speed.js,tag=京东天天加速
-const name = '天天加速';
-const $ = new Env(name);
-const Key = '';//单引号内自行填写您抓取的京东Cookie
-//直接用NobyDa的jd cookie
-const cookie = Key ? Key : $.getdata('CookieJD');
-let jdNotify = $.getdata('jdSpeedNotify');
-const JD_API_HOST = 'https://api.m.jd.com/';
-let gen = entrance();
-gen.next();
-
-let indexState = 0;
-let message = '', subTitle = '';
-let beans_num = null;
-let distance = null;
-let destination = null;
-let source_id = null;
-let done_distance = null;
-let task_status = null, able_energeProp_list = [], spaceEvents = [], energePropUsale = [];
-function* entrance() {
- if (!cookie) {
- $.msg(name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', { "open-url": "https://bean.m.jd.com/" });
- $.done();
- return
- }
- console.log(`start...`);
- yield flyTask_state();
- console.log(`task_status::${task_status}`)
- if (task_status === 0) {
- console.log(`开启新任务:${JSON.stringify(destination)}`);
- yield flyTask_start(source_id)
- } else if (task_status === 1) {
- console.log(`任务进行中:${JSON.stringify(destination)}`);
- } else if (task_status === 2) {
- $.msg(name, subTitle, '天天加速2个京豆已到账');
- yield flyTask_state();
- console.log(`task_status::${task_status}`)
- console.log(`开启新任务:${JSON.stringify(destination)}`);
- yield flyTask_start(source_id);
- }
-
- yield spaceEvent_list();//检查太空特殊事件
- console.log(`可处理的太空特殊事件信息:${spaceEvents.length}个`);
- if (spaceEvents && spaceEvents.length > 0) {
- yield spaceEvent();//处理太空特殊事件
- }
- console.log('开始检查可领取燃料')
- yield energyPropList();
- console.log(`可领取燃料::${able_energeProp_list.length}个`)
- if (able_energeProp_list && able_energeProp_list.length > 0) {
- yield receiveeEergyProp();
- }
- yield energePropUsaleList();//检查剩余可用的燃料
- console.log(`可使用燃料${energePropUsale.length}个`)
- if (energePropUsale && energePropUsale.length > 0) {
- yield useEnergy();
- }
- //执行上面操作后,再进行一次检测
- yield flyTask_state();
- if (task_status === 0) {
- console.log(`开启新任务:${JSON.stringify(destination)}`);
- yield flyTask_start(source_id);
- // fix bug ,开启新任务后,再次检查可用的燃料,如果有可用的,继续使用
- yield energePropUsaleList();//检查剩余可用的燃料
- console.log(`可使用燃料${energePropUsale.length}个`)
- if (energePropUsale && energePropUsale.length > 0) {
- yield useEnergy();
- }
- } else if (task_status === 1) {
- console.log(`任务进行中:${JSON.stringify(destination)}`);
- } else if (task_status === 2) {
- $.msg(name, subTitle, '天天加速2个京豆已到账');
- yield flyTask_state();
- console.log(`task_status::${task_status}`)
- console.log(`开启新任务:${JSON.stringify(destination)}`);
- yield flyTask_start(source_id);
- }
- if (!jdNotify || jdNotify === 'false') {
- $.msg(name, subTitle, message);
- }
- $.done();
-}
-//检查燃料
-function energyPropList() {
- const body = {
- "source":"game",
- }
- request('energyProp_list', body).then(response => {
- // console.log(`检查燃料列表:${JSON.stringify(response)}`);
- if (response.code === 0 && response.data && response.data.length > 0) {
- for (let item of response.data) {
- if (item.thaw_time === 0) {
- able_energeProp_list.push(item);
- }
- }
- }
- gen.next();
- })
-}
-
-async function receiveeEergyProp() {
- //开始领取燃料
- for (let i of able_energeProp_list) {
- let memberTaskCenterRes = await _energyProp_gain(i.id);
- console.log(`领取燃料结果:::${memberTaskCenterRes.message}`)
- }
- gen.next();
-}
-// 领取燃料调用的api
-function _energyProp_gain(energy_id) {
- console.log('energy_id', energy_id)
- if (!energy_id) return;
- const body = {
- "source":"game",
- "energy_id": energy_id
- }
- return new Promise((res, rej) => {
- request('energyProp_gain', body).then((response) => {
- res(response);
- })
- })
-}
-//检查特殊事件
-function spaceEvent_list() {
- const body = {
- "source":"game",
- }
- request('spaceEvent_list', body).then(response => {
- console.log(`开始检查特殊事件`);
- if (response.code === 0 && response.data && response.data.length > 0) {
- for (let item of response.data) {
- if (item.status === 1) {
- for (let j of item.options) {
- if(j.type === 1) {
- spaceEvents.push({
- "id": item.id,
- "value": j.value
- })
- }
- }
- }
- }
- }
- gen.next();
- })
-}
-// 处理太空特殊事件
-async function spaceEvent() {
- for (let item of spaceEvents) {
- let spaceEventRes = await spaceEventHandleEvent(item.id, item.value);
- console.log(`处理特殊事件的结果::${JSON.stringify(spaceEventRes)}`)
- }
- gen.next();
-}
-//处理太空特殊事件调用的api
-function spaceEventHandleEvent(id, value) {
- if (!id && !value) return;
- const body = {
- "source":"game",
- "eventId": id,
- "option": value
- }
- return new Promise((res, rej) => {
- request('spaceEvent_handleEvent', body).then((response) => {
- res(response);
- })
- })
-}
-function energePropUsaleList() {
- const body = {
- "source":"game"
- };
- request('energyProp_usalbeList', body).then(res => {
- console.log(`检查剩余燃料`);
- energePropUsale = [];
- if (res.code === 0 && res.data && res.data.length > 0) {
- res.data.map(item => {
- energePropUsale.push(item)
- })
- }
- gen.next();
- });
-}
-
-//使用能源
-async function useEnergy() {
- for (let i of energePropUsale) {
- let _energyProp_use = await energyPropUse(i.id);
- console.log(`使用燃料的结果::${_energyProp_use.message}`)
- if (_energyProp_use.code !== 0) {
- console.log(`${_energyProp_use.message},跳出循环`);
- $.msg($.name, '', "【上轮太空旅行】2 🐶京豆已到账");
- break
- }
- }
- gen.next();
-}
-//使用能源调用的api
-function energyPropUse(id) {
- if (!id) return
- const body = {
- "source":"game",
- "energy_id": id
- }
- return new Promise((res, rej) => {
- request('energyProp_use', body).then((response) => {
- res(response);
- })
- })
-}
-//开始新的任务
-function flyTask_start(source_id) {
- if (!source_id) return;
- const functionId = arguments.callee.name.toString();
- const body = {
- "source":"game",
- "source_id": source_id
- }
- request(functionId, body).then(res => {
- console.log(`新的任务结束时间:${res.data.end_time}`);
- gen.next();
- })
-}
-function flyTask_state() {
- const functionId = arguments.callee.name.toString();
- const body = {
- "source":"game"
- }
- request(functionId, body).then((res) => {
- // console.log(`初始化信息flyTask_state:${JSON.stringify(res)}`)
- if (res.code === 0) {
- if (res.info.isLogin === 0) {
- $.setdata('', 'CookieJD');//cookie失效,故清空cookie。
- $.msg(name, '【提示】京东cookie已失效,请重新登录获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- $.done();
- return
- }
- let data = res.data;
- if (data.beans_num) {
- beans_num = data.beans_num
- distance = data.distance
- destination = data.destination
- done_distance = data.done_distance
- source_id = data.source_id//根据source_id 启动flyTask_start()
- task_status = data.task_status //0,没开始;1,已开始
- subTitle = `【奖励】${beans_num}京豆`
- if (indexState === 1) {
- message += `【空间站】 ${destination}\n`;
- message += `【结束时间】 ${data['end_time']}\n`;
- message += `【进度】 ${((res.data.done_distance / res.data.distance) * 100).toFixed(2)}%\n`;
- }
- indexState++;
- }
- gen.next();
- } else {
- gen.return()
- }
- })
-}
-
-async function request(function_id, body = {}) {
- await $.wait(300);//延迟两秒
- return new Promise((resolve, reject) => {
- $.get(taskurl(function_id, body), (err, resp, data) => {
- try {
- if (err) {
- console.log("=== request error -s--");
- console.log("=== request error -e--");
- } else {
- data = JSON.parse(_jsonpToJson(data))
- }
- } catch (e) {
- console.log(e)
- } finally {
- resolve(data)
- }
- })
- })
-}
-
-function _jsonpToJson(v) {
- return v.match(/{.*}/)[0]
-}
-function taskurl(function_id, body) {
- let url = '';
- if (function_id === 'spaceEvent_handleEvent') {
- url = `${JD_API_HOST}?appid=memberTaskCenter&functionId=${function_id}&body=${escape(JSON.stringify(body))}&jsonp=__jsonp1593330783690&_=${new Date().getTime()}&t=${new Date().getTime()}`
- } else {
- url = `${JD_API_HOST}?appid=memberTaskCenter&functionId=${function_id}&body=${escape(JSON.stringify(body))}&jsonp=__jsonp1593330783690&_=${new Date().getTime()}`;
- }
- return {
- url,
- headers: {
- 'Cookie': cookie,
- 'Host': 'api.m.jd.com',
- 'Accept': '*/*',
- 'Connection': 'keep-alive',
- 'User-Agent': 'jdapp;iPhone;8.5.5;13.4;9b812b59e055cd226fd60ebb5fd0981c4d0d235d;network/wifi;supportApplePay/3;hasUPPay/0;pushNoticeIsOpen/0;model/iPhone9,2;addressid/138109592;hasOCPay/0;appBuild/167121;supportBestPay/0;jdSupportDarkMode/0;pv/104.43;apprpd/MyJD_GameMain;ref/MyJdGameEnterPageController;psq/9;ads/;psn/9b812b59e055cd226fd60ebb5fd0981c4d0d235d|272;jdv/0|direct|-|none|-|1583449735697|1583796810;adk/;app_device/IOS;pap/JA2015_311210|8.5.5|IOS 13.4;Mozilla/5.0 (iPhone; CPU iPhone OS 13_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
- 'Accept-Language': 'zh-cn',
- 'Referer': 'https://h5.m.jd.com/babelDiy/Zeus/6yCQo2eDJPbyPXrC3eMCtMWZ9ey/index.html?lng=116.845095&lat=39.957701&sid=ea687233c5e7d226b30940ed7382c5cw&un_area=5_274_49707_49973',
- 'Accept-Encoding': 'gzip, deflate, br'
- }
- }
-}
-
-// prettier-ignore
-function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{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=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"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 e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)}
\ No newline at end of file
diff --git a/backUp/webhook.js b/backUp/webhook.js
deleted file mode 100644
index 18e1229..0000000
--- a/backUp/webhook.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * @Author: lxk0301 https://github.com/lxk0301
- * @Date: 2020-10-24 18:53:29
- * @Last Modified by: lxk0301
- * @Last Modified time: 2020-11-05 18:54:13
- */
-
-const $ = new Env('Webhook触发Action');
-let ACTIONS_TRIGGER_TOKEN = '';//Personal access tokens,申请教程:https://www.jianshu.com/p/bb82b3ad1d11 记得勾选repo权限就行
-let TRIGGER_KEYWORDS = '';//.github/workflows/路径里面yml文件里面repository_dispatch项目的types值,例如jd_fruit.yml里面的值为fruit
-let githubUser = '';//github用户名,例:lxk0301
-let repo = '';//需要触发的 Github Action 所在的仓库名称 例:scripts
-
-!(async () => {
- ACTIONS_TRIGGER_TOKEN = $.getdata('ACTIONS_TRIGGER_TOKEN') ? $.getdata('ACTIONS_TRIGGER_TOKEN') : ACTIONS_TRIGGER_TOKEN;
- githubUser = $.getdata('githubUser') ? $.getdata('githubUser') : githubUser;
- repo = $.getdata('repo') ? $.getdata('repo') : repo;
- TRIGGER_KEYWORDS = $.getdata('TRIGGER_KEYWORDS') ? $.getdata('TRIGGER_KEYWORDS') : TRIGGER_KEYWORDS;
- TRIGGER_KEYWORDS = TRIGGER_KEYWORDS.split(',');
- for (let item of TRIGGER_KEYWORDS) {
- if (!item) {
- $.msg($.name, `失败`, `触发关键词未提供`)
- return
- }
- if (!ACTIONS_TRIGGER_TOKEN) {
- $.msg($.name, `失败`, `github token未提供`)
- return
- }
- if (!githubUser) {
- $.msg($.name, `失败`, `github 用户名未提供`)
- return
- }
- if (!repo) {
- $.msg($.name, `失败`, `需触发的github仓库名未提供`)
- return
- }
- if (ACTIONS_TRIGGER_TOKEN && githubUser && repo && item) {
- await hook(item);
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-
-function hook(key) {
- const options = {
- 'url': `https://api.github.com/repos/${githubUser}/${repo}/dispatches`,
- 'body': `${JSON.stringify({"event_type": key})}`,
- 'headers': {
- 'Accept': 'application/vnd.github.everest-preview+json',
- 'Authorization': `token ${ACTIONS_TRIGGER_TOKEN}`
- }
- }
- return new Promise((resolve) => {
- $.post(options, (err, resp, data) => {
- try {
- if (err) {
- if (data && data.match('404')) {
- $.msg($.name, ``, `触发[${key}]失败,请仔细检查提供的参数`, {"open-url": `https://github.com/${githubUser}/${repo}`})
- } else if (data && data.match('401')) {
- $.msg($.name, ``, `触发[${key}]失败,github token权限不足`, {"open-url": `https://github.com/settings/tokens`})
- } else {
- console.log(`${JSON.stringify(err)}`)
- }
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- $.msg($.name, ``, `触发[${key}]成功`, {"open-url": `https://github.com/${githubUser}/${repo}/actions`})
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-// prettier-ignore
-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,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("",`\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 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();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){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="",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}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));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
diff --git a/backUp/xmSports.js b/backUp/xmSports.js
deleted file mode 100644
index 16ffd1b..0000000
--- a/backUp/xmSports.js
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * @Author: lxk0301 https://github.com/lxk0301
- * @Date: 2020-11-01 13:43:28
- * @Last Modified by: lxk0301
- * @Last Modified time: 2020-11-03 13:43:28
- */
-/*
-小米运动修改微信支付宝运动步数
-APP Store下载小米运动APP
-登入小米运动(登录方式必须是手机号码+密码(没有就用手机号码注册),下面的第三方账号(小米账号,Apple,微信)授权登录不行)
-登录成功后在 我的->第三方接入->绑定支付宝,微信
-小米运动只要不退出登录,就会自动获取新的token,即永久有效
-[MITM]
-hostname = account.huami.com
-Surge
-[Script]
-小米运动 = type=cron,cronexp="15 17 * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/backUp/xmSports.js
-小米运动获取Token = type=http-response,pattern=^https:\/\/account\.huami\.com\/v2\/client\/login, requires-body=1, max-size=0, script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/backUp/xmSports.js
-圈X
-[task_local]
-# 小米运动
-15 17 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/backUp/xmSports.js, tag=小米运动, enabled=true
-[rewrite_local]
-# 小米运动获取Token
-^https:\/\/account\.huami\.com\/v2\/client\/login url script-response-body https://raw.githubusercontent.com/lxk0301/jd_scripts/master/backUp/xmSports.js
-Loon
-[Script]
-cron "15 17 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/backUp/xmSports.js, tag=小米运动
-http-response ^https:\/\/account\.huami\.com\/v2\/client\/login script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/backUp/xmSports.js, requires-body=true, timeout=10, tag=小米运动获取Token
- */
-
-const $ = new Env('小米运动');
-const isRequest = typeof $request != "undefined"
-let dataJSON = "%5B%7B%22data_hr%22%3A%22%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F9L%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2FVv%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F0v%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F9e%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F0n%5C%2Fa%5C%2F%5C%2F%5C%2FS%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F0b%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F1FK%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2FR%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F9PTFFpaf9L%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2FR%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F0j%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F9K%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2FOv%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2Fzf%5C%2F%5C%2F%5C%2F86%5C%2Fzr%5C%2FOv88%5C%2Fzf%5C%2FPf%5C%2F%5C%2F%5C%2F0v%5C%2FS%5C%2F8%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2FSf%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2Fz3%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F0r%5C%2FOv%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2FS%5C%2F9L%5C%2Fzb%5C%2FSf9K%5C%2F0v%5C%2FRf9H%5C%2Fzj%5C%2FSf9K%5C%2F0%5C%2F%5C%2FN%5C%2F%5C%2F%5C%2F%5C%2F0D%5C%2FSf83%5C%2Fzr%5C%2FPf9M%5C%2F0v%5C%2FOv9e%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2FS%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2Fzv%5C%2F%5C%2Fz7%5C%2FO%5C%2F83%5C%2Fzv%5C%2FN%5C%2F83%5C%2Fzr%5C%2FN%5C%2F86%5C%2Fz%5C%2F%5C%2FNv83%5C%2Fzn%5C%2FXv84%5C%2Fzr%5C%2FPP84%5C%2Fzj%5C%2FN%5C%2F9e%5C%2Fzr%5C%2FN%5C%2F89%5C%2F03%5C%2FP%5C%2F89%5C%2Fz3%5C%2FQ%5C%2F9N%5C%2F0v%5C%2FTv9C%5C%2F0H%5C%2FOf9D%5C%2Fzz%5C%2FOf88%5C%2Fz%5C%2F%5C%2FPP9A%5C%2Fzr%5C%2FN%5C%2F86%5C%2Fzz%5C%2FNv87%5C%2F0D%5C%2FOv84%5C%2F0v%5C%2FO%5C%2F84%5C%2Fzf%5C%2FMP83%5C%2FzH%5C%2FNv83%5C%2Fzf%5C%2FN%5C%2F84%5C%2Fzf%5C%2FOf82%5C%2Fzf%5C%2FOP83%5C%2Fzb%5C%2FMv81%5C%2FzX%5C%2FR%5C%2F9L%5C%2F0v%5C%2FO%5C%2F9I%5C%2F0T%5C%2FS%5C%2F9A%5C%2Fzn%5C%2FPf89%5C%2Fzn%5C%2FNf9K%5C%2F07%5C%2FN%5C%2F83%5C%2Fzn%5C%2FNv83%5C%2Fzv%5C%2FO%5C%2F9A%5C%2F0H%5C%2FOf8%5C%2F%5C%2Fzj%5C%2FPP83%5C%2Fzj%5C%2FS%5C%2F87%5C%2Fzj%5C%2FNv84%5C%2Fzf%5C%2FOf83%5C%2Fzf%5C%2FOf83%5C%2Fzb%5C%2FNv9L%5C%2Fzj%5C%2FNv82%5C%2Fzb%5C%2FN%5C%2F85%5C%2Fzf%5C%2FN%5C%2F9J%5C%2Fzf%5C%2FNv83%5C%2Fzj%5C%2FNv84%5C%2F0r%5C%2FSv83%5C%2Fzf%5C%2FMP%5C%2F%5C%2F%5C%2Fzb%5C%2FMv82%5C%2Fzb%5C%2FOf85%5C%2Fz7%5C%2FNv8%5C%2F%5C%2F0r%5C%2FS%5C%2F85%5C%2F0H%5C%2FQP9B%5C%2F0D%5C%2FNf89%5C%2Fzj%5C%2FOv83%5C%2Fzv%5C%2FNv8%5C%2F%5C%2F0f%5C%2FSv9O%5C%2F0ZeXv%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F1X%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F9B%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2FTP%5C%2F%5C%2F%5C%2F1b%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F0%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F9N%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2F%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%5C%2Fv7%2B%22%2C%22date%22%3A%222020-08-14%22%2C%22data%22%3A%5B%7B%22start%22%3A0%2C%22stop%22%3A1439%2C%22value%22%3A%22UA8AUBQAUAwAUBoAUAEAYCcAUBkAUB4AUBgAUCAAUAEAUBkAUAwAYAsAYB8AYB0AYBgAYCoAYBgAYB4AUCcAUBsAUB8AUBwAUBIAYBkAYB8AUBoAUBMAUCEAUCIAYBYAUBwAUCAAUBgAUCAAUBcAYBsAYCUAATIPYD0KECQAYDMAYB0AYAsAYCAAYDwAYCIAYB0AYBcAYCQAYB0AYBAAYCMAYAoAYCIAYCEAYCYAYBsAYBUAYAYAYCIAYCMAUB0AUCAAUBYAUCoAUBEAUC8AUB0AUBYAUDMAUDoAUBkAUC0AUBQAUBwAUA0AUBsAUAoAUCEAUBYAUAwAUB4AUAwAUCcAUCYAUCwKYDUAAUUlEC8IYEMAYEgAYDoAYBAAUAMAUBkAWgAAWgAAWgAAWgAAWgAAUAgAWgAAUBAAUAQAUA4AUA8AUAkAUAIAUAYAUAcAUAIAWgAAUAQAUAkAUAEAUBkAUCUAWgAAUAYAUBEAWgAAUBYAWgAAUAYAWgAAWgAAWgAAWgAAUBcAUAcAWgAAUBUAUAoAUAIAWgAAUAQAUAYAUCgAWgAAUAgAWgAAWgAAUAwAWwAAXCMAUBQAWwAAUAIAWgAAWgAAWgAAWgAAWgAAWgAAWgAAWgAAWREAWQIAUAMAWSEAUDoAUDIAUB8AUCEAUC4AXB4AUA4AWgAAUBIAUA8AUBAAUCUAUCIAUAMAUAEAUAsAUAMAUCwAUBYAWgAAWgAAWgAAWgAAWgAAWgAAUAYAWgAAWgAAWgAAUAYAWwAAWgAAUAYAXAQAUAMAUBsAUBcAUCAAWwAAWgAAWgAAWgAAWgAAUBgAUB4AWgAAUAcAUAwAWQIAWQkAUAEAUAIAWgAAUAoAWgAAUAYAUB0AWgAAWgAAUAkAWgAAWSwAUBIAWgAAUC4AWSYAWgAAUAYAUAoAUAkAUAIAUAcAWgAAUAEAUBEAUBgAUBcAWRYAUA0AWSgAUB4AUDQAUBoAXA4AUA8AUBwAUA8AUA4AUA4AWgAAUAIAUCMAWgAAUCwAUBgAUAYAUAAAUAAAUAAAUAAAUAAAUAAAUAAAUAAAUAAAWwAAUAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAeSEAeQ8AcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcBcAcAAAcAAAcCYOcBUAUAAAUAAAUAAAUAAAUAUAUAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcCgAeQAAcAAAcAAAcAAAcAAAcAAAcAYAcAAAcBgAeQAAcAAAcAAAegAAegAAcAAAcAcAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcCkAeQAAcAcAcAAAcAAAcAwAcAAAcAAAcAIAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcCIAeQAAcAAAcAAAcAAAcAAAcAAAeRwAeQAAWgAAUAAAUAAAUAAAUAAAUAAAcAAAcAAAcBoAeScAeQAAegAAcBkAeQAAUAAAUAAAUAAAUAAAUAAAUAAAcAAAcAAAcAAAcAAAcAAAcAAAegAAegAAcAAAcAAAcBgAeQAAcAAAcAAAcAAAcAAAcAAAcAkAegAAegAAcAcAcAAAcAcAcAAAcAAAcAAAcAAAcA8AeQAAcAAAcAAAeRQAcAwAUAAAUAAAUAAAUAAAUAAAUAAAcAAAcBEAcA0AcAAAWQsAUAAAUAAAUAAAUAAAUAAAcAAAcAoAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAYAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcBYAegAAcAAAcAAAegAAcAcAcAAAcAAAcAAAcAAAcAAAeRkAegAAegAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAEAcAAAcAAAcAAAcAUAcAQAcAAAcBIAeQAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcBsAcAAAcAAAcBcAeQAAUAAAUAAAUAAAUAAAUAAAUBQAcBYAUAAAUAAAUAoAWRYAWTQAWQAAUAAAUAAAUAAAcAAAcAAAcAAAcAAAcAAAcAMAcAAAcAQAcAAAcAAAcAAAcDMAeSIAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcAAAcBQAeQwAcAAAcAAAcAAAcAMAcAAAeSoAcA8AcDMAcAYAeQoAcAwAcFQAcEMAeVIAaTYAbBcNYAsAYBIAYAIAYAIAYBUAYCwAYBMAYDYAYCkAYDcAUCoAUCcAUAUAUBAAWgAAYBoAYBcAYCgAUAMAUAYAUBYAUA4AUBgAUAgAUAgAUAsAUAsAUA4AUAMAUAYAUAQAUBIAASsSUDAAUDAAUBAAYAYAUBAAUAUAUCAAUBoAUCAAUBAAUAoAYAIAUAQAUAgAUCcAUAsAUCIAUCUAUAoAUA4AUB8AUBkAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAAfgAA%22%2C%22tz%22%3A32%2C%22did%22%3A%22DA932FFFFE8816E7%22%2C%22src%22%3A24%7D%5D%2C%22summary%22%3A%22%7B%5C%22v%5C%22%3A6%2C%5C%22slp%5C%22%3A%7B%5C%22st%5C%22%3A1597349880%2C%5C%22ed%5C%22%3A1597369860%2C%5C%22dp%5C%22%3A39%2C%5C%22lt%5C%22%3A294%2C%5C%22wk%5C%22%3A0%2C%5C%22usrSt%5C%22%3A-1440%2C%5C%22usrEd%5C%22%3A-1440%2C%5C%22wc%5C%22%3A0%2C%5C%22is%5C%22%3A169%2C%5C%22lb%5C%22%3A10%2C%5C%22to%5C%22%3A23%2C%5C%22dt%5C%22%3A0%2C%5C%22rhr%5C%22%3A58%2C%5C%22ss%5C%22%3A69%2C%5C%22stage%5C%22%3A%5B%7B%5C%22start%5C%22%3A1698%2C%5C%22stop%5C%22%3A1711%2C%5C%22mode%5C%22%3A4%7D%2C%7B%5C%22start%5C%22%3A1712%2C%5C%22stop%5C%22%3A1728%2C%5C%22mode%5C%22%3A5%7D%2C%7B%5C%22start%5C%22%3A1729%2C%5C%22stop%5C%22%3A1818%2C%5C%22mode%5C%22%3A4%7D%2C%7B%5C%22start%5C%22%3A1819%2C%5C%22stop%5C%22%3A1832%2C%5C%22mode%5C%22%3A5%7D%2C%7B%5C%22start%5C%22%3A1833%2C%5C%22stop%5C%22%3A1920%2C%5C%22mode%5C%22%3A4%7D%2C%7B%5C%22start%5C%22%3A1921%2C%5C%22stop%5C%22%3A1928%2C%5C%22mode%5C%22%3A5%7D%2C%7B%5C%22start%5C%22%3A1929%2C%5C%22stop%5C%22%3A2030%2C%5C%22mode%5C%22%3A4%7D%5D%7D%2C%5C%22stp%5C%22%3A%7B%5C%22ttl%5C%22%3A125%2C%5C%22dis%5C%22%3A82%2C%5C%22cal%5C%22%3A5%2C%5C%22wk%5C%22%3A7%2C%5C%22rn%5C%22%3A0%2C%5C%22runDist%5C%22%3A23%2C%5C%22runCal%5C%22%3A3%7D%2C%5C%22goal%5C%22%3A8000%2C%5C%22tz%5C%22%3A%5C%2228800%5C%22%2C%5C%22sn%5C%22%3A%5C%22e716882f93da%5C%22%7D%22%2C%22source%22%3A24%2C%22type%22%3A0%7D%5D";
-const headers = {
- 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36'
-}
-let login_token = '';
-//需要修改的运动步数波动范围,脚本默认修改步数范围为1w9到2w5
-const step = randomFriendPin($.getdata('xmMinStep')*1 || 19000, $.getdata('xmMaxStep')*1 || 25000);
-function getToken() {
- if ($response.body) {
- const body = JSON.parse($response.body);
- const loginToken = body.token_info.login_token;
- $.log(`${$.name}token\n${loginToken}\n`)
- if ($.getdata('xmSportsToken')) {
- $.msg($.name, '更新Token: 成功🎉', ``);
- } else {
- $.msg($.name, '获取Token: 成功🎉', '');
- }
- $.setdata(loginToken, 'xmSportsToken');
- }
- $.done({})
-}
-
-async function start() {
- login_token = $.getdata('xmSportsToken') ? $.getdata('xmSportsToken') : login_token;
- // console.log(`login_token:::${login_token}`)
- if (login_token) {
- await get_app_token(login_token);
- // console.log(`$.tokenInfo${JSON.stringify($.tokenInfo)}`)
- if ($.tokenInfo && $.tokenInfo.result === 'ok') {
- const {app_token, user_id} = $.tokenInfo.token_info;
- await get_time();
- await change_step(app_token, user_id);
- if ($.changeStepRes && $.changeStepRes.code === 1) {
- console.log(`步数修改成功:${step}步`);
- $.msg($.name, `${step}步🏃修改成功`, `时间:${timeFormat(localtime())}`, { "open-url": "alipays://platformapi/startapp?appId=20000869" })
- } else {
- console.log(`修改运动步数失败`)
- }
- } else {
- $.msg($.name, '失败', `Token已失效,请重新获取`)
- }
- } else {
- $.msg($.name, `失败`, '暂无Token')
- }
- $.done()
-}
-
-function change_step(app_token, user_id) {
- const date = dataJSON.match(/.*?date%22%3A%22(.*?)%22%2C%22data.*?/)[1];
- const ttf = dataJSON.match(/.*?ttl%5C%22%3A(.*?)%2C%5C%22dis.*?/)[1];
- dataJSON = dataJSON.replace(date, timeFormat(localtime()));
- dataJSON = dataJSON.replace(ttf, step.toString());
- console.log(timeFormat(localtime()))
- return new Promise(resolve => {
- const options = {
- "url": `https://api-mifit-cn2.huami.com/v1/data/band_data.json?&t=${$.t}`,
- "body": `userid=${user_id.toString()}&last_sync_data_time=1597306380&device_type=0&last_deviceid=DA932FFFFE8816E7&data_json=${dataJSON}`,
- "headers": {
- "Content-Type":"application/x-www-form-urlencoded;charset=UTF-8",
- "apptoken": app_token,
- }
- }
- $.post(options, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- console.log(`修改步数结果:${data}`);
- $.changeStepRes = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-
-function get_app_token(login_token, headers) {
- return new Promise(resolve => {
- $.get({url: `https://account-cn.huami.com/v1/client/app_tokens?app_name=com.xiaomi.hm.health&dn=api-user.huami.com%2Capi-mifit.huami.com%2Capp-analytics.huami.com&login_token=${login_token}&os_version=4.1.0`, headers}, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- console.log(data)
- if (data) {
- $.tokenInfo = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function get_time() {
- return new Promise(resolve => {
- $.get({url: `http://api.m.taobao.com/rest/api3.do?api=mtop.common.getTimestamp`}, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- console.log(data)
- if (data) {
- data = JSON.parse(data);
- $.t = data.data.t;
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function localtime() {
- return new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000;
-}
-function timeFormat(time) {
- let date;
- if (time) {
- date = new Date(time)
- } else {
- date = new Date();
- }
- return date.getFullYear() + '-' + ((date.getMonth() + 1) >= 10 ? (date.getMonth() + 1) : '0' + (date.getMonth() + 1)) + '-' + (date.getDate() >= 10 ? date.getDate() : '0' + date.getDate());
-}
-//随机生成m(小)到n(大)的数,包含m和n
-function randomFriendPin(m,n) {
- return Math.round(Math.random()*(n - m) + m);
-}
-isRequest ? getToken() : start();
-// prettier-ignore
-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,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("",`\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 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();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){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="",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}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));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)}
diff --git a/backUp/xmly_speed_ccokie.js b/backUp/xmly_speed_ccokie.js
deleted file mode 100644
index 3a707bf..0000000
--- a/backUp/xmly_speed_ccokie.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- 获取Cookie方法:
- 1.将下方设置和[MITM]地址复制的代理软件的相应的区域下
- 2.APP登陆账号后,点击右下角'福利'选项,即可获取Cookie.获取成功后,去代理软件的日志里面寻找 ’喜马拉雅极速版cookie‘
- [MITM]
- hostname = m.ximalaya.com
- Surge
- 喜马拉雅极速版Cookie = type=http-request,pattern=https:\/\/m\.ximalaya\.com\/speed\/task-center\/account\/coin,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/backUp/xmly_speed_ccokie.js
- Loon:
- http-request https:\/\/m\.ximalaya\.com\/speed\/task-center\/account\/coin script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/backUp/xmly_speed_ccokie.js
- , requires-body=true, timeout=10, tag=喜马拉雅极速版Cookie
- QX:
- [rewrite_local]
- # 喜马拉雅极速版Cookie
- https:\/\/m\.ximalaya\.com\/speed\/task-center\/account\/coin url script-request-header https://raw.githubusercontent.com/lxk0301/jd_scripts/master/backUp/xmly_speed_ccokie.js
- */
-
-const $ = new Env('喜马拉雅极速版获取cookie')
-const CookieKey = 'xmlySpeedCookie';
-const isRequest = typeof $request !== 'undefined'
-if (isRequest) {
- GetCookie();
-}
-
-function GetCookie() {
- if ($request && $request.method != 'OPTIONS') {
- const cookieVal = $request.headers['Cookie'];
- console.log(`喜马拉雅极速版cookie\n\n${cookieVal}\n\n`);
- if (cookieVal) $.setdata(cookieVal, CookieKey);
- $.msg($.name, `获取Cookie: 成功🎉`, `请去代理软件的日志里面寻找复制`);
- $.done();
- }
-}
-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
diff --git a/docker/Dockerfile b/docker/Dockerfile
deleted file mode 100644
index 5615cde..0000000
--- a/docker/Dockerfile
+++ /dev/null
@@ -1,23 +0,0 @@
-FROM alpine
-MAINTAINER Akira
-
-RUN set -ex \
- && apk update && apk upgrade\
- && apk add --no-cache tzdata moreutils git nodejs npm\
- && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
- && echo "Asia/Shanghai" > /etc/timezone
-
-RUN git clone https://github.com/lxk0301/jd_scripts /scripts \
- && cd /scripts \
- && mkdir logs \
- && npm install \
- && cd /tmp \
- && npm install request
-
-ENV CRONTAB_LIST_FILE crontab_list_ts.sh
-
-RUN crontab /scripts/docker/crontab_list_ts.sh
-
-WORKDIR /scripts
-
-CMD ["node"]
diff --git a/docker/Readme.md b/docker/Readme.md
deleted file mode 100644
index 7b5d824..0000000
--- a/docker/Readme.md
+++ /dev/null
@@ -1,117 +0,0 @@
-### Usage
-> 推荐使用`docker-compose`所以这里只介绍`docker-compose`使用方式
-
-- `docker-compose` 安装(群晖nas docker自带安装了docker-compose)
-```
-sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
-sudo chmod +x /usr/local/bin/docker-compose
-```
-### 如果需要使用 docker 多个账户独立并发执行定时任务,[参考这里](https://github.com/iouAkira/scripts/blob/patch-1/docker/docker%E5%A4%9A%E8%B4%A6%E6%88%B7%E4%BD%BF%E7%94%A8%E7%8B%AC%E7%AB%8B%E5%AE%B9%E5%99%A8%E4%BD%BF%E7%94%A8%E8%AF%B4%E6%98%8E.md#%E4%BD%BF%E7%94%A8%E6%AD%A4%E6%96%B9%E5%BC%8F%E8%AF%B7%E5%85%88%E7%90%86%E8%A7%A3%E5%AD%A6%E4%BC%9A%E4%BD%BF%E7%94%A8docker%E5%8A%9E%E6%B3%95%E4%B8%80%E7%9A%84%E4%BD%BF%E7%94%A8%E6%96%B9%E5%BC%8F)
-> 注⚠️:前提先理解学会使用这下面的教程
-### 创建一个目录`jd_scripts`用于存放备份配置等数据,迁移重装的时候只需要备份整个jd_scripts目录即可
-需要新建的目录文件结构参考如下:
-```
-jd_scripts
-├── logs
-│ ├── XXXX.log
-│ └── XXXX.log
-├── my_crontab_list.sh
-└── docker-compose.yml
-```
-- `jd_scripts/logs`建一个空文件夹就行
-- `jd_scripts/docker-compose.yml` 参考内容如下:
-- `jd_scripts/docker-compose.yml`里面的环境变量(`environment:`)配置[参考这里](https://github.com/lxk0301/jd_scripts/blob/master/githubAction.md#%E4%B8%8B%E6%96%B9%E6%8F%90%E4%BE%9B%E4%BD%BF%E7%94%A8%E5%88%B0%E7%9A%84-secrets%E5%85%A8%E9%9B%86%E5%90%88)
-```yaml
-jd_scripts:
-jd_scripts:
- image: akyakya/jd_scripts
- container_name: jd_scripts
- restart: always
- #如果需要自定定义定时任务的需要自己写好`my_crontab_list.sh`文件 ,取消下面的挂载注释 ,通过 `volumes`挂载进去。
- volumes:
- # - ./my_crontab_list.sh:/scripts/docker/my_crontab_list.sh
- - ./logs:/scripts/logs
- tty: true
- environment:
- # 注意环境变量填写值的时候一律不需要引号(""或者'')下面这些只是事例,根据自己的需求增加删除
- #jd cookies
- # 例: JD_COOKIE=pt_key=XXX;pt_pin=XXX
- - JD_COOKIE=
- #微信server酱通
- - PUSH_KEY=
- #Bark App通知
- - BARK_PUSH=
- #telegram机器人通知
- - TG_BOT_TOKEN=
- - TG_USER_ID=
- #钉钉机器人通知
- - DD_BOT_TOKEN=
- - DD_BOT_SECRET=
- #京东种豆得豆
- - PLANT_BEAN_SHARECODES=
- #京东农场
- # 例: FRUITSHARECODES=京东农场的互助码
- - FRUITSHARECODES=
- #京东萌宠
- # 例: PETSHARECODES=东东萌宠的互助码
- - PETSHARECODES=
- # 宠汪汪的喂食数量
- - JOY_FEED_COUNT=
- #京小超
- # - SUPERMARKET_SHARECODES=
- #兑换多少数量的京豆(20,或者1000京豆,或者其他奖品的文字)
- # 例: MARKET_COIN_TO_BEANS=1000
- - MARKET_COIN_TO_BEANS=
- #是否开启debug模式打印日志
- # 例: JD_DEBUG=false
- - JD_DEBUG=
- #如果使用自定义定时任务,取消下面一行的注释
- #- CRONTAB_LIST_FILE=my_crontab_list.sh
- command:
- - /bin/sh
- - -c
- - |
- #crontab /scripts/docker/my_crontab_list.sh #如果挂载了自定义任务文件,取消此条注释即可
- crond
- git -C /scripts/ pull
- node
-```
-- `jd_scripts/my_crontab_list.sh` 参考内容如下,自己根据需要调整增加删除,不熟悉用户推荐使用默认配置:
-
-```shell
-0 */1 * * * git -C /scripts/ pull |ts >> /scripts/logs/pull.log 2>&1
-2 0 * * * cd /scripts && node jd_bean_sign.js >> /scripts/logs/jd_bean_sign.log 2>&1
-2 0 * * * node /scripts/jd_blueCoin.js >> /scripts/logs/jd_blueCoin.log 2>&1
-2 0 * * * node /scripts/jd_club_lottery.js >> /scripts/logs/jd_club_lottery.log 2>&1
-20 6-18/6 * * * node /scripts/jd_fruit.js >> /scripts/logs/jd_fruit.log 2>&1
-*/20 */1 * * * node /scripts/jd_joy_feedPets.js >> /scripts/logs/jd_joy_feedPets.log 2>&1
-0 0,4,8,16 * * * node /scripts/jd_joy_reward.js >> /scripts/logs/jd_joy_reward.log 2>&1
-0 1,6 * * * node /scripts/jd_joy_steal.js >> /scripts/logs/jd_joy_steal.log 2>&1
-0 0,1,4,10,15,16 * * * node /scripts/jd_joy.js >> /scripts/logs/jd_joy.log 2>&1
-40 */3 * * * node /scripts/jd_moneyTree.js >> /scripts/logs/jd_moneyTree.log 2>&1
-35 23,4,10 * * * node /scripts/jd_pet.js >> /scripts/logs/jd_pet.log 2>&1
-0 23,0-13/1 * * * node /scripts/jd_plantBean.js >> /scripts/logs/jd_plantBean.log 2>&1
-2 0 * * * node /scripts/jd_redPacket.js >> /scripts/logs/jd_redPacket.log 2>&1
-3 0 * * * node /scripts/jd_shop.js >> /scripts/logs/jd_shop.log 2>&1
-15 * * * * node /scripts/jd_superMarket.js >> /scripts/logs/jd_superMarket.log 2>&1
-55 23 * * * node /scripts/jd_unsubscribe.js >> /scripts/logs/jd_unsubscribe.log 2>&1
-```
-> 定时任务命之后,也就是 `>>` 符号之前加上 `|ts` 可在日志每一行前面显示时间,如下图:
-> 
-- 目录文件配置好之后在 `jd_scripts`目录执行
- `docker-compose up -d` 启动;
- `docker-compose logs` 打印日志;
- `docker-compose pull` 更新镜像;
- `docker-compose stop` 停止容器;
- `docker-compose restart` 重启容器;
- `docker-compose down` 停止并删除容器;
-
-- 如果是群晖用户,在docker注册表搜jd_scripts,双击下载映像。
-不需要docker-compose.yml,只需建个logs/目录,调整`jd_scripts.syno.json`里面对应的配置值,然后导入json配置新建容器。
-若要自定义my_crontab_list.sh,再建个my_crontab_list.sh文件,配置参考`jd_scripts.my_crontab_list.syno.json`。
-
-
-
-
-
-
diff --git a/docker/crontab_list.sh b/docker/crontab_list.sh
deleted file mode 100644
index 9d02d02..0000000
--- a/docker/crontab_list.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-50 */1 * * * git -C /scripts/ pull >> /scripts/logs/pull.log 2>&1
-52 */1 * * * crontab /scripts/docker/${CRONTAB_LIST_FILE}
-53 */1 * * * npm install --prefix /scripts >> /scripts/logs/npm_install.log 2>&1
-# 每3天的23:50分清理一次日志
-50 23 */3 * * rm -rf /scripts/logs/*.log
-
-
-##############短期活动##############
-# 暂无
-
-
-##############长期活动##############
-
-# 签到
-0 0,12,18 * * * cd /scripts && node jd_bean_sign.js >> /scripts/logs/jd_bean_sign.log 2>&1
-# 京小超兑换奖品
-0 0 * * * node /scripts/jd_blueCoin.js >> /scripts/logs/jd_blueCoin.log 2>&1
-# 摇京豆
-0 0 * * * node /scripts/jd_club_lottery.js >> /scripts/logs/jd_club_lottery.log 2>&1
-# 东东农场
-5 6-18/6 * * * node /scripts/jd_fruit.js >> /scripts/logs/jd_fruit.log 2>&1
-# 宠汪汪
-15 */2 * * * node /scripts/jd_joy.js >> /scripts/logs/jd_joy.log 2>&1
-# 宠汪汪喂食
-15 */1 * * * node /scripts/jd_joy_feedPets.js >> /scripts/logs/jd_joy_feedPets.log 2>&1
-# 宠汪汪积分兑换奖品
-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 */2 * * * node /scripts/jd_moneyTree.js >> /scripts/logs/jd_moneyTree.log 2>&1
-# 东东萌宠
-5 6-18/6 * * * node /scripts/jd_pet.js >> /scripts/logs/jd_pet.log 2>&1
-# 京东种豆得豆
-0 7-22/1 * * * node /scripts/jd_plantBean.js >> /scripts/logs/jd_plantBean.log 2>&1
-# 京东全民开红包
-1 1 * * * node /scripts/jd_redPacket.js >> /scripts/logs/jd_redPacket.log 2>&1
-# 进店领豆
-10 0 * * * node /scripts/jd_shop.js >> /scripts/logs/jd_shop.log 2>&1
-# 京东天天加速
-8 */3 * * * node /scripts/jd_speed.js >> /scripts/logs/jd_speed.log 2>&1
-# 东东超市
-11 1-23/5 * * * node /scripts/jd_superMarket.js >> /scripts/logs/jd_superMarket.log 2>&1
-# 取关京东店铺商品
-55 23 * * * node /scripts/jd_unsubscribe.js >> /scripts/logs/jd_unsubscribe.log 2>&1
-# 京豆变动通知
-0 10 * * * node /scripts/jd_bean_change.js >> /scripts/logs/jd_bean_change.log 2>&1
-# 京东抽奖机
-11 1 * * * node /scripts/jd_lotteryMachine.js >> /scripts/logs/jd_lotteryMachine.log 2>&1
-# 京东排行榜
-11 9 * * * node /scripts/jd_rankingList.js >> /scripts/logs/jd_rankingList.log 2>&1
-# 天天提鹅
-18 * * * * node /scripts/jd_daily_egg.js >> /scripts/logs/jd_daily_egg.log 2>&1
-# 金融养猪
-12 * * * * node /scripts/jd_pigPet.js >> /scripts/logs/jd_pigPet.log 2>&1
-# 点点券
-20 0,20 * * * node /scripts/jd_necklace.js >> /scripts/logs/jd_necklace.log 2>&1
-# 京喜工厂
-20 * * * * node /scripts/jd_dreamFactory.js >> /scripts/logs/jd_dreamFactory.log 2>&1
-# 东东小窝
-16 6 * * * node /scripts/jd_small_home.js >> /scripts/logs/jd_small_home.log 2>&1
-# 东东工厂
-36 * * * * node /scripts/jd_jdfactory.js >> /scripts/logs/jd_jdfactory.log 2>&1
-#十元街
-36 8 * * * node /scripts/jd_syj.js >> /scripts/logs/jd_syj.log 2>&1
\ No newline at end of file
diff --git a/docker/crontab_list_ts.sh b/docker/crontab_list_ts.sh
deleted file mode 100644
index d525d30..0000000
--- a/docker/crontab_list_ts.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-50 */1 * * * git -C /scripts/ pull |ts >> /scripts/logs/pull.log 2>&1
-52 */1 * * * crontab /scripts/docker/${CRONTAB_LIST_FILE}
-53 */1 * * * npm install --prefix /scripts |ts >> /scripts/logs/npm_install.log 2>&1
-# 每3天的23:50分清理一次日志
-50 23 */3 * * rm -rf /scripts/logs/*.log
-
-
-##############短期活动##############
-# 暂无
-
-
-##############长期活动##############
-
-# 签到
-0 0,12,18 * * * cd /scripts && node jd_bean_sign.js |ts >> /scripts/logs/jd_bean_sign.log 2>&1
-# 京小超兑换奖品
-0 0 * * * node /scripts/jd_blueCoin.js |ts >> /scripts/logs/jd_blueCoin.log 2>&1
-# 摇京豆
-0 0 * * * node /scripts/jd_club_lottery.js |ts >> /scripts/logs/jd_club_lottery.log 2>&1
-# 东东农场
-5 6-18/6 * * * node /scripts/jd_fruit.js |ts >> /scripts/logs/jd_fruit.log 2>&1
-# 宠汪汪
-15 */2 * * * node /scripts/jd_joy.js |ts >> /scripts/logs/jd_joy.log 2>&1
-# 宠汪汪喂食
-15 */1 * * * node /scripts/jd_joy_feedPets.js |ts >> /scripts/logs/jd_joy_feedPets.log 2>&1
-# 宠汪汪积分兑换奖品
-0 0-16/8 * * * node /scripts/jd_joy_reward.js |ts >> /scripts/logs/jd_joy_reward.log 2>&1
-# 宠汪汪偷好友积分与狗粮
-0 0,6 * * * node /scripts/jd_joy_steal.js |ts >> /scripts/logs/jd_joy_steal.log 2>&1
-# 摇钱树
-0 */2 * * * node /scripts/jd_moneyTree.js |ts >> /scripts/logs/jd_moneyTree.log 2>&1
-# 东东萌宠
-5 6-18/6 * * * node /scripts/jd_pet.js |ts >> /scripts/logs/jd_pet.log 2>&1
-# 京东种豆得豆
-0 7-22/1 * * * node /scripts/jd_plantBean.js |ts >> /scripts/logs/jd_plantBean.log 2>&1
-# 京东全民开红包
-1 1 * * * node /scripts/jd_redPacket.js |ts >> /scripts/logs/jd_redPacket.log 2>&1
-# 进店领豆
-10 0 * * * node /scripts/jd_shop.js |ts >> /scripts/logs/jd_shop.log 2>&1
-# 京东天天加速
-8 */3 * * * node /scripts/jd_speed.js |ts >> /scripts/logs/jd_speed.log 2>&1
-# 东东超市
-11 1-23/5 * * * node /scripts/jd_superMarket.js |ts >> /scripts/logs/jd_superMarket.log 2>&1
-# 取关京东店铺商品
-55 23 * * * node /scripts/jd_unsubscribe.js |ts >> /scripts/logs/jd_unsubscribe.log 2>&1
-# 京豆变动通知
-0 10 * * * node /scripts/jd_bean_change.js |ts >> /scripts/logs/jd_bean_change.log 2>&1
-# 京东抽奖机
-11 1 * * * node /scripts/jd_lotteryMachine.js |ts >> /scripts/logs/jd_lotteryMachine.log 2>&1
-# 京东排行榜
-11 9 * * * node /scripts/jd_rankingList.js |ts >> /scripts/logs/jd_rankingList.log 2>&1
-# 天天提鹅
-18 * * * * node /scripts/jd_daily_egg.js |ts >> /scripts/logs/jd_daily_egg.log 2>&1
-# 金融养猪
-12 * * * * node /scripts/jd_pigPet.js |ts >> /scripts/logs/jd_pigPet.log 2>&1
-# 点点券
-20 0,20 * * * node /scripts/jd_necklace.js |ts >> /scripts/logs/jd_necklace.log 2>&1
-# 京喜工厂
-20 * * * * node /scripts/jd_dreamFactory.js |ts >> /scripts/logs/jd_dreamFactory.log 2>&1
-# 东东小窝
-16 6 * * * node /scripts/jd_small_home.js |ts >> /scripts/logs/jd_small_home.log 2>&1
-# 东东工厂
-36 * * * * node /scripts/jd_jdfactory.js |ts >> /scripts/logs/jd_jdfactory.log 2>&1
-#十元街
-36 8 * * * node /scripts/jd_syj.js |ts >> /scripts/logs/jd_syj.log 2>&1
\ No newline at end of file
diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
deleted file mode 100644
index 93daae3..0000000
--- a/docker/docker-compose.yml
+++ /dev/null
@@ -1,52 +0,0 @@
-jd_scripts:
- image: akyakya/jd_scripts
- container_name: jd_scripts
- restart: always
- #如果需要自定定义定时任务的需要自己写好`my_crontab_list.sh`文件 ,取消下面的挂载注释 ,通过 `volumes`挂载进去。
- volumes:
- # - ./my_crontab_list.sh:/scripts/docker/my_crontab_list.sh
- - ./logs:/scripts/logs
- tty: true
- environment:
- # 注意环境变量填写值的时候一律不需要引号(""或者'')下面这些只是事例,根据自己的需求增加删除
- #jd cookies
- # 例: JD_COOKIE=pt_key=XXX;pt_pin=XXX
- - JD_COOKIE=
- #微信server酱通
- - PUSH_KEY=
- #Bark App通知
- - BARK_PUSH=
- #telegram机器人通知
- - TG_BOT_TOKEN=
- - TG_USER_ID=
- #钉钉机器人通知
- - DD_BOT_TOKEN=
- - DD_BOT_SECRET=
- #京东种豆得豆
- - PLANT_BEAN_SHARECODES=
- #京东农场
- # 例: FRUITSHARECODES=京东农场的互助码
- - FRUITSHARECODES=
- #京东萌宠
- # 例: PETSHARECODES=东东萌宠的互助码
- - PETSHARECODES=
- # 宠汪汪的喂食数量
- - JOY_FEED_COUNT=
- #京小超
- # - SUPERMARKET_SHARECODES=
- #兑换多少数量的京豆(20,或者1000京豆,或者其他奖品的文字)
- # 例: MARKET_COIN_TO_BEANS=1000
- - MARKET_COIN_TO_BEANS=
- #是否开启debug模式打印日志
- # 例: JD_DEBUG=false
- - JD_DEBUG=
- #如果使用自定义定时任务,取消下面一行的注释
- #- CRONTAB_LIST_FILE=my_crontab_list.sh
- command:
- - /bin/sh
- - -c
- - |
- #crontab /scripts/docker/my_crontab_list.sh #如果挂载了自定义任务文件,取消此条注释即可
- crond
- git -C /scripts/ pull
- node
diff --git a/docker/docker多账户使用独立容器使用说明.md b/docker/docker多账户使用独立容器使用说明.md
deleted file mode 100644
index 394061b..0000000
--- a/docker/docker多账户使用独立容器使用说明.md
+++ /dev/null
@@ -1,123 +0,0 @@
-### 使用此方式,请先理解学会使用[docker办法一](https://github.com/lxk0301/jd_scripts/tree/master/docker#%E5%88%9B%E5%BB%BA%E4%B8%80%E4%B8%AA%E7%9B%AE%E5%BD%95jd_scripts%E7%94%A8%E4%BA%8E%E5%AD%98%E6%94%BE%E5%A4%87%E4%BB%BD%E9%85%8D%E7%BD%AE%E7%AD%89%E6%95%B0%E6%8D%AE%E8%BF%81%E7%A7%BB%E9%87%8D%E8%A3%85%E7%9A%84%E6%97%B6%E5%80%99%E5%8F%AA%E9%9C%80%E8%A6%81%E5%A4%87%E4%BB%BD%E6%95%B4%E4%B8%AAjd_scripts%E7%9B%AE%E5%BD%95%E5%8D%B3%E5%8F%AF)的使用方式
-> 发现有人好像希望不同账户任务并发执行,不想一个账户执行完了才能再执行另一个,这里写一个`docker办法一`的基础上实现方式,其实就是不同账户创建不同的容器,他们互不干扰单独定时执行自己的任务。
-配置使用起来还是比较简单的,具体往下看
-### 文件夹目录参考
-
-### 具体使用说明直接在图片标注了,文件参考[图片下方](https://github.com/lxk0301/jd_scripts/new/master/docker#docker-composeyml%E6%96%87%E4%BB%B6%E5%8F%82%E8%80%83),配置完成后的[执行命令]()
-
-#### `docker-compose.yml`文件参考
-```yaml
-version: '3'
-services:
- jd_scripts1:
- image: akyakya/jd_scripts
- restart: always
- container_name: jd_scripts1
- tty: true
- volumes:
- - ./logs1:/scripts/logs
- environment:
- - JD_COOKIE=pt_key=AAJfjaNrADAS8ygfgIsOxxxxxxxKpfDaZ2pSBOYTxtPqLK8U1Q;pt_pin=lxxxxxx5;
- - TG_BOT_TOKEN=130xxxx280:AAExxxxxxWP10zNf91WQ
- - TG_USER_ID=12xxxx206
- - CRONTAB_LIST_FILE=crontab_list.sh
- command:
- - /bin/sh
- - -c
- - |
- git -C /scripts/ pull
- crond
- node
- jd_scripts2:
- image: akyakya/jd_scripts
- restart: always
- container_name: jd_scripts2
- tty: true
- volumes:
- - ./logs2:/scripts/logs
- environment:
- - JD_COOKIE=pt_key=AAJfjaNrADAS8ygfgIsOxxxxxxxKpfDaZ2pSBOYTxtPqLK8U1Q;pt_pin=lxxxxxx5;
- - TG_BOT_TOKEN=130xxxx280:AAExxxxxxWP10zNf91WQ
- - TG_USER_ID=12xxxx206
- - CRONTAB_LIST_FILE=crontab_list.sh
- command:
- - /bin/sh
- - -c
- - |
- git -C /scripts/ pull
- crond
- node
- jd_scripts3:
- image: akyakya/jd_scripts
- restart: always
- container_name: jd_scripts3
- tty: true
- volumes:
- - ./logs3:/scripts/logs
- - ./my_crontab_list3.sh:/scripts/docker/my_crontab_list.sh
- environment:
- - JD_COOKIE=pt_key=AAJfjaNrADAS8ygfgIsOxxxxxxxKpfDaZ2pSBOYTxtPqLK8U1Q;pt_pin=lxxxxxx5;
- - TG_BOT_TOKEN=130xxxx280:AAExxxxxxWP10zNf91WQ
- - TG_USER_ID=12xxxx206
- - CRONTAB_LIST_FILE=my_crontab_list.sh
- command:
- - /bin/sh
- - -c
- - |
- crontab /scripts/docker/my_crontab_list.sh
- git -C /scripts/ pull
- crond
- node
- jd_scripts4:
- image: akyakya/jd_scripts
- restart: always
- container_name: jd_scripts4
- tty: true
- volumes:
- - ./logs4:/scripts/logs
- - ./my_crontab_list4.sh:/scripts/docker/my_crontab_list.sh
- environment:
- - JD_COOKIE=pt_key=AAJfjaNrADAS8ygfgIsOxxxxxxxKpfDaZ2pSBOYTxtPqLK8U1Q;pt_pin=lxxxxxx5;
- - TG_BOT_TOKEN=130xxxx280:AAExxxxxxWP10zNf91WQ
- - TG_USER_ID=12xxxx206
- - CRONTAB_LIST_FILE=my_crontab_list.sh
- command:
- - /bin/sh
- - -c
- - |
- crontab /scripts/docker/my_crontab_list.sh
- git -C /scripts/ pull
- crond
- node
- jd_scripts5:
- image: akyakya/jd_scripts
- restart: always
- container_name: jd_scripts5
- tty: true
- volumes:
- - ./logs5:/scripts/logs
- - ./my_crontab_list5.sh:/scripts/docker/my_crontab_list.sh
- environment:
- - JD_COOKIE=pt_key=AAJfjaNrADAS8ygfgIsOxxxxxxxKpfDaZ2pSBOYTxtPqLK8U1Q;pt_pin=lxxxxxx5;
- - TG_BOT_TOKEN=130xxxx280:AAExxxxxxWP10zNf91WQ
- - TG_USER_ID=12xxxx206
- - CRONTAB_LIST_FILE=my_crontab_list.sh
- command:
- - /bin/sh
- - -c
- - |
- crontab /scripts/docker/my_crontab_list.sh
- git -C /scripts/ pull
- crond
- node
-```
-#### 目录文件配置好之后在 `jd_scripts_multi`目录执行
- `docker-compose up -d` 启动;
- `docker-compose logs` 打印日志;
- `docker-compose pull` 更新镜像;
- `docker-compose stop` 停止容器;
- `docker-compose restart` 重启容器;
- `docker-compose down` 停止并删除容器;
- 
-
-
diff --git a/docker/jd_scripts.my_crontab_list.syno.json b/docker/jd_scripts.my_crontab_list.syno.json
deleted file mode 100644
index 2fddb6b..0000000
--- a/docker/jd_scripts.my_crontab_list.syno.json
+++ /dev/null
@@ -1,65 +0,0 @@
-{
- "cap_add" : [],
- "cap_drop" : [],
- "cmd" : "/bin/sh -c 'crontab /scripts/docker/my_crontab_list.sh && crond && node'",
- "cpu_priority" : 50,
- "devices" : null,
- "enable_publish_all_ports" : false,
- "enable_restart_policy" : true,
- "enabled" : true,
- "env_variables" : [
- {
- "key" : "PATH",
- "value" : "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
- },
- {
- "key" : "CDN_JD_DAILYBONUS",
- "value" : "true"
- },
- {
- "key" : "JD_COOKIE",
- "value" : "pt_key=xxx;pt_pin=xxx;"
- },
- {
- "key" : "PUSH_KEY",
- "value" : ""
- },
- {
- "key" : "CRONTAB_LIST_FILE",
- "value" : "my_crontab_list.sh"
- }
- ],
- "exporting" : false,
- "id" : "3a2f6f27c23f93bc104585c22569c760cc9ce82df09cdb41d53b491fe1d0341c",
- "image" : "akyakya/jd_scripts",
- "is_ddsm" : false,
- "is_package" : false,
- "links" : [],
- "memory_limit" : 0,
- "name" : "jd_scripts",
- "network" : [
- {
- "driver" : "bridge",
- "name" : "bridge"
- }
- ],
- "network_mode" : "default",
- "port_bindings" : [],
- "privileged" : false,
- "shortcut" : {
- "enable_shortcut" : false
- },
- "use_host_network" : false,
- "volume_bindings" : [
- {
- "host_volume_file" : "/docker/jd_scripts/my_crontab_list.sh",
- "mount_point" : "/scripts/docker/my_crontab_list.sh",
- "type" : "rw"
- },
- {
- "host_volume_file" : "/docker/jd_scripts/logs",
- "mount_point" : "/scripts/logs",
- "type" : "rw"
- }
- ]
-}
diff --git a/docker/jd_scripts.syno.json b/docker/jd_scripts.syno.json
deleted file mode 100644
index 042b6de..0000000
--- a/docker/jd_scripts.syno.json
+++ /dev/null
@@ -1,83 +0,0 @@
-{
- "cap_add" : null,
- "cap_drop" : null,
- "cmd" : "/bin/sh -c 'crond && node'",
- "cpu_priority" : 0,
- "devices" : null,
- "enable_publish_all_ports" : false,
- "enable_restart_policy" : true,
- "enabled" : false,
- "env_variables" : [
- {
- "key" : "PATH",
- "value" : "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
- },
- {
- "key" : "CDN_JD_DAILYBONUS",
- "value" : "true"
- },
- {
- "key" : "JD_COOKIE",
- "value" : "pt_key=AAJfjaNrADASxxxxxxxKpfDaZ2pSBOYTxtPqLK8U1Q;pt_pin=lxxxxx5;"
- },
- {
- "key" : "TG_BOT_TOKEN",
- "value" : "13xxxxxx80:AAEkNxxxxxxzNf91WQ"
- },
- {
- "key" : "TG_USER_ID",
- "value" : "12xxxx206"
- },
- {
- "key" : "PLANT_BEAN_SHARECODES",
- "value" : ""
- },
- {
- "key" : "FRUITSHARECODES",
- "value" : ""
- },
- {
- "key" : "PETSHARECODES",
- "value" : ""
- },
- {
- "key" : "SUPERMARKET_SHARECODES",
- "value" : ""
- },
- {
- "key" : "CRONTAB_LIST_FILE",
- "value" : "crontab_list.sh"
- }
- ],
- "exporting" : false,
- "id" : "18af38bc0ac37a40e4b9608a86fef56c464577cc160bbdddec90155284fcf4e5",
- "image" : "akyakya/jd_scripts",
- "is_ddsm" : false,
- "is_package" : false,
- "links" : [],
- "memory_limit" : 0,
- "name" : "jd_scripts",
- "network" : [
- {
- "driver" : "bridge",
- "name" : "bridge"
- }
- ],
- "network_mode" : "default",
- "port_bindings" : [],
- "privileged" : false,
- "shortcut" : {
- "enable_shortcut" : false,
- "enable_status_page" : false,
- "enable_web_page" : false,
- "web_page_url" : ""
- },
- "use_host_network" : false,
- "volume_bindings" : [
- {
- "host_volume_file" : "/docker/jd_scripts/logs",
- "mount_point" : "/scripts/logs",
- "type" : "rw"
- }
- ]
-}
diff --git a/githubAction.md b/githubAction.md
deleted file mode 100644
index 203e5ad..0000000
--- a/githubAction.md
+++ /dev/null
@@ -1,178 +0,0 @@
-## 环境变量说明
-
-
-#### 京东Cookie
-
- - Secret新增`JD_COOKIE`,填入cookie信息,多账号的cookie, 使用`&`或者换行隔开(两种方法)
-
- - 方式已一:`&`号隔开示例(注:后面的英文引号`;`不可缺失)
- 如 `账号一cookie&账号二cookie&账号三cookie`,再多账号就依次类推即可
- ```
- pt_key=xxx1;pt_pin=xxx1;&pt_key=xxx2;pt_pin=xxx2;&pt_key=xxx3;pt_pin=xxx3;
- ```
- - 方式二:按`Enter`键换行隔开示例(这里给下三个账号的示例)
- ```
- pt_key=bbbbbbbbbbbbbb;pt_pin=aaaaaaa;
- pt_key=cccccccc;pt_pin=dddddddd;
- pt_key=eeeeeeeee;pt_pin=ffffffff;
- ```
- - 京东cookie获取看这里
- - [浏览器获取京东cookie教程](https://github.com/lxk0301/jd_scripts/blob/master/backUp/GetJdCookie.md) 或者 [插件获取京东cookie教程](https://github.com/lxk0301/jd_scripts/blob/master/backUp/GetJdCookie2.md)
- - IOS代理软件(Surge, Quantumult X, Loon)等用户有使用过BoxJs的,可在BoxJs里面提取京东cookie(打开BoxJs -> 底部中间的 `应用` -> NobyDa脚本订阅 -> 京东(多合一签到) -> 点击会话右上方的三个点点 -> 修改会话 -> 全选复制即可),再不会看此[图文教程](icon/jd8.png)
-
-
-
-
-
-#### 自动同步Fork后的代码
-
- > 此部分内容由tg@wukongdada和tg@goukey提供
-
- - 方案A - 强制远程分支覆盖自己的分支(**新手推荐使用**)
-
- 1. 参考tg@wukongdada这篇教程 [保持自己github的forks自动和上游仓库同步的教程](https://github.com/lxk0301/jd_scripts/blob/master/backUp/gitSync.md) , 安装[pull插件](https://github.com/apps/pull) 并确认此项目已在pull插件的作用下(参考@twukongdada这篇教程文中1-d)
-
- 2. 确保.github/pull.yml文件正常存在,yml内上游作者填写正确(此项目已填好,无需更改)。
-
- 3. 确保pull.yml里面是`mergeMethod: hardreset`(默认就是`hardreset`)。
-
- 4. ENJOY!上游更改三小时左右就会自动发起同步。
- ```
- # 方案A可参考这里
- version: "1"
- rules: # Array of rules
- - base: master # Required. Target branch
- upstream: lxk0301:master # Required. Must be in the same fork network.
- mergeMethod: hardreset # Optional, one of [none, merge, squash, rebase, hardreset], Default: none.
- mergeUnstable: true # Optional, merge pull request even when the mergeable_state is not clean. Default: false
- ```
- - 方案B - 保留自己仓库已修改过的文件(**需修改脚本或者提PR的使用**)
-
- > 上游变动后pull插件会自动发起pr,但如果有冲突需要自行**手动**确认。
- > 如果上游更新涉及workflow里的文件内容改动,需要自行**手动**确认。
-
- 1. 参考tg@wukongdada这篇教程 [保持自己github的forks自动和上游仓库同步的教程](https://github.com/lxk0301/jd_scripts/blob/master/backUp/gitSync.md) , 安装[pull插件](https://github.com/apps/pull) 并确认此项目已在pull插件的作用下(参考@twukongdada这篇教程文中1-d)
- 2. 确保.github/pull.yml文件正常存在,yml内上游作者填写正确(此项目已填好,无需更改)。
- 3. 将pull.yml里面的`mergeMethod: hardreset`修改为`mergeMethod: merge`保存。
- 4. ENJOY!上游更改三小时左右就会自动发起同步。
- ```
- # 方案B可参考这里
- version: "1"
- rules: # Array of rules
- - base: master # Required. Target branch
- upstream: lxk0301:master # Required. Must be in the same fork network.
- mergeMethod: merge # Optional, one of [none, merge, squash, rebase, hardreset], Default: none.
- mergeUnstable: true # Optional, merge pull request even when the mergeable_state is not clean. Default: false
- ```
- - 方案C - 利用github-action定时cron更新同步(**新手推荐使用**)
-
- > 效果和方案A一样(即:强制更新覆盖)
-
- 新建secret,`Name`为`PAT`,填写的`Value`值需要去申请Personal access tokens,申请教程[看此处](https://www.jianshu.com/p/bb82b3ad1d11) 记得勾选`repo`权限就行
-
-
-
-#### 下方提供使用到的 **Secrets全集合**
-
-| Name | 归属 | 属性 | 说明 |
-| :---------------------: | :----------: | --------- | ------------------------------------------------------------ |
-| `JD_COOKIE` | 京东 | 必须 | 京东cookie,多个账号的cookie使用`&`隔开或者换行。具体获取参考[浏览器获取京东cookie教程](https://github.com/lxk0301/jd_scripts/blob/master/backUp/GetJdCookie.md) 或者 [插件获取京东cookie教程](https://github.com/lxk0301/jd_scripts/blob/master/backUp/GetJdCookie2.md) |
-| `JD_USER_AGENT` | 京东 | 非必须 | 自定义此库里京东系列脚本的UserAgent,不懂不知不会UserAgent的请不要随意填写内容。具体获取参考此[issue](https://github.com/lxk0301/jd_scripts/issues/127) |
-| `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) |
-| `JD_DEBUG` | 脚本打印log | 非必须 | 运行脚本时,是否显示log,默认显示。改成false表示不显示,注重隐私的人可以在设置secret -> `Name:JD_DEBUG,Value:false` |
-| `PUSH_KEY` | 微信推送 | 非必须 | cookie失效推送[server酱的微信通知](http://sc.ftqq.com/3.version) |
-| `BARK_PUSH` | [BARK推送](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) | 非必须 | cookie失效推送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推送,填写自己申请[@BotFather](https://t.me/BotFather)的Token,如`10xxx4:AAFcqxxxxgER5uw` , [具体教程](./backUp/TG_PUSH.md) |
-| `TG_USER_ID` | telegram推送 | 非必须 | tg推送,填写[@getuseridbot](https://t.me/getuseridbot)中获取到的纯数字ID, [具体教程](./backUp/TG_PUSH.md) |
-| `DD_BOT_TOKEN` | 钉钉推送 | 非必须 | 钉钉推送[官方文档](https://ding-doc.dingtalk.com/doc#/serverapi2/qf2nxq) ,只需`https://oapi.dingtalk.com/robot/send?access_token=XXX` 等于符号后面的XXX, 注:如果钉钉推送只填写`DD_BOT_TOKEN`,那么安全设置需勾选`自定义关键词`,内容输入输入`账号`即可,其他安全设置不要勾选 |
-| `DD_BOT_SECRET` | 钉钉推送 | 非必须 | 密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的字符串 , 注:填写了`DD_BOT_TOKEN`和`DD_BOT_SECRET`,钉钉机器人安全设置只需勾选`加签`即可,其他选项不要勾选,再不懂看 [这个图](icon/DD_bot.png) |
-| `IGOT_PUSH_KEY` | iGot推送 | 非必须 | iGot聚合推送,支持多方式推送,确保消息可达。 [参考文档](https://wahao.github.io/Bark-MP-helper ) |
-| `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` |
-| `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的说明)|
-| `FRUITSHARECODES` | 东东农场互助码 | 非必须 | 填写规则请看 [jdFruitShareCodes.js](https://github.com/lxk0301/jd_scripts/blob/master/jdFruitShareCodes.js) 或见下方[互助码的填写规则](#互助码的填写规则) |
-| `PETSHARECODES` | 东东萌宠互助码 | 非必须 | 填写规则请看 [jdPetShareCodes.js](https://github.com/lxk0301/jd_scripts/blob/master/jdPetShareCodes.js) 或见下方[互助码的填写规则](#互助码的填写规则) |
-| `PLANT_BEAN_SHARECODES` | 种豆得豆互助码 | 非必须 | 填写规则请看 [jdPlantBeanShareCodes.js](https://github.com/lxk0301/jd_scripts/blob/master/jdPlantBeanShareCodes.js) 或见下方[互助码的填写规则](#互助码的填写规则) |
-| `SUPERMARKET_SHARECODES`| 京小超商圈互助码 | 非必须 | 填写规则请看 [jdSuperMarketShareCodes.js](https://github.com/lxk0301/jd_scripts/blob/master/jdSuperMarketShareCodes.js) 或见下方[互助码的填写规则](#互助码的填写规则) |
-| `DDFACTORY_SHARECODES`| 东东工厂互助码 | 非必须 | 填写规则请看 [jdFactoryShareCodes.js](https://github.com/lxk0301/jd_scripts/blob/master/jdFactoryShareCodes.js) 或见下方[互助码的填写规则](#互助码的填写规则) |
-| `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 |
-| `MONEY_TREE_SELL_FRUIT` | 摇钱树是否卖出金果 | 非必须 | 控制摇钱树脚本是否自动卖出金果兑换成金币,`true`卖出,`false`不卖出,默认`true` |
-| `FACTORAY_WANTPRODUCT_NAME` | 东东工厂心仪商品 | 非必须 | 提供心仪商品名称(请尽量填写完整和别的商品有区分度),达到条件后兑换,如不提供则会兑换当前所选商品 |
-
-
-##### 互助码的填写规则
-
- > 互助码如何获取:运行相应脚本后,在日志里面可以找到。(如何查看日志上面有写,详见 如何查看action运行情况)
-
-同一个京东账号的好友互助码用@隔开,不同京东账号互助码用&或者换行隔开,下面给一个文字示例和具体互助码示例说明
-
-两个账号各两个互助码的文字示例:
-
- ```
-京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2
- ```
-
- 两个账号各两个互助码的真实示例:
- ```
-0a74407df5df4fa99672a037eec61f7e@dbb21614667246fabcfd9685b6f448f3&6fbd26cc27ac44d6a7fed34092453f77@61ff5c624949454aa88561f2cd721bf6&6fbd26cc27ac44d6a7fed34092453f77@61ff5c624949454aa88561f2cd721bf6
- ```
-
-
-
-#### 取关店铺secret的说明
-
- > secret依次是`取关商品数`,`取关店铺数`,`遇到此商品不再进行取关`,`遇到此店铺不再进行取关`
-
-例如我要取关 `100`个商品,`100`个店铺,商品遇到商品关键字 `iPhone12` 停止取关,店铺遇到 `Apple京东自营旗舰店` 不再取关
-则使用`换行`或者`&`隔开即可,
-下面给出换行隔开示例:
-
- ```
-100
-100
-iPhone12
-Apple京东自营旗舰店
- ```
-
-下面给出`&`符号隔开示例:
- ```
-100&100&iPhone12&Apple京东自营旗舰店
- ```
-
-#### 关于脚本推送通知(微信server酱推送通知,bark app推送通知,telegram机器人推送通知,钉钉机器人推送通知,iGot聚合推送)
-
- > 如果你填写了上面五种推送通知方式中的某一个通知所需secret,那么脚本通知情况如下:
-
- > 目前默认只有jd_fruit.js,jd_pet.js,jd_bean_sign.js,jd_818.js四个脚本每次运行后都通知
-
- ```
-jd_plantBean.js是每周一收集京豆后通知一次,
-jd_joy_reward.js是每次兑换到了京豆通知一次,
-jd_blueCoin.js是每次兑换到了奖品通知一次,
-jd_818.js是每次获取新的互助码会通知一次,以帮助您快速上车,
-其余的脚本平常运行都是不通知,只有在京东cookie失效后,才会推送通知
- ```
-
-
-
-##### 参考文献
-[GitHub Actions 手动触发方式进化史](https://p3terx.com/archives/github-actions-manual-trigger.html)
-
-[GitHub Actions 入门教程](https://p3terx.com/archives/github-actions-started-tutorial.html)
-
diff --git a/iCloud.md b/iCloud.md
deleted file mode 100644
index 4066d16..0000000
--- a/iCloud.md
+++ /dev/null
@@ -1,154 +0,0 @@
-## 1.安装 Node.js 环境
-
-[下载地址](https://nodejs.org/zh-tw/download/ )
-
-根据自己的操作系统下载
-
-傻瓜式安装,一直下一步即可。
-
-
-
-## 2.下载源码
-
-
-
-点击红框处下载压缩包
-
-## 3.安装依赖、增加入口文件、增加cookie
-
-压缩包解压后进入项目文件夹
-
-- Windows 用户按住 **shift** 点击右键,点击 **在此处打开命令窗口**
-- Mac 用户通过终端,自行进入该文件夹
-
-在命令行内输入 `npm i `,等待运行完成。
-
-此时,项目文件夹内会多出一个 `node_modules`文件夹
-
- **增加入口文件**
-
-方案一:同一个仓库下同一个时间,执行多个脚本
-
-在项目文件夹内新建 `index.js`
-
-编辑文件
-
-```javascript
-'use strict';
-exports.main_handler = async (event, context, callback) => {
- //解决云函数热启动问题
- delete require.cache[require.resolve('./jd_xtg1.js')];
- require('./jd_xtg1.js') //这里写你想要的脚本
- require('./jd_xtg2.js') //这里写你想要的脚本
- require('./jd_xtg3.js') //这里写你想要的脚本
-}
-
-```
-此时,同一时间点下,会同时执行多个脚本,触发器触发后,index.js文件中require()下的所有脚本都会被执行
-
-**优点**:同一时间下可以同时执行多个脚本,适合脚本种类少的repository,对脚本数量少的repository推荐使用此方案
**缺点**:多个脚本不同时间点运行无法满足
-
-方案二:同一个仓库下不同的时间点,分别执行不同的脚本(类似GitHub Action执行机制)
-
-在项目文件夹内新建 `index.js`
-
-编辑文件
-
-```javascript
-'use strict';
-exports.main_handler = async (event, context, callback) => {
- for (const v of event["Message"].split("\r\n")) {
- //解决云函数热启动问题
- delete require.cache[require.resolve(`./${v}.js`)];
- console.log(v);
- require(`./${v}.js`)
- }
-}
-
-```
-
-此时触发管理按照下图中进行设置,附加信息选择“是”,内容填写需要传递执行的具体脚本文件名,以回车键换行。触发器触发后,附加信息栏内的脚本会被执行,设置多个不同时间点的触发器达到类似GitHub Action的效果
-
-**优点**:可以满足个性化需求,同一个repository下只需要设置不同的触发器,可以实现不同时间点分别执行不同的脚本
**缺点**:repository下脚本过多,如果需要设置多个触发器,实现个性化运行效果,由于云函数的限制,最多只能设置10个
-
-[](https://imgchr.com/i/B20KxI)
-[](https://imgchr.com/i/BRCG0H)
-
-**注意:**
-Ⅰ方案一与方案二不能混合到同一个index.js文件中使用,同一个仓库下,二者只能选择其一。
-Ⅱ感谢[issues#115](https://github.com/lxk0301/jd_scripts/issues/115)中的解决方案,目前云函数连续测试已经可以规避热启动问题了。
-Ⅲ在确保完全按照本教程设置的情况下测试云函数运行情况,对于部分人运行日志中出现某些脚本运行失败其他正常,并且错误提示带有strict字样的,请自行删除index.js中的```'use strict';```,再做测试
-
- **增加cookie**
-
-打开项目文件内的 `jdCookie.js`
-
-在最上面的 `CookieJDs`里写入 cookie ,多个账号以逗号分隔
-
-例如
-
-```javascript
-let CookieJDs = [
- 'pt_key=xxx;pt_pin=xxx;',
- 'pt_key=zzz;pt_pin=zzz;',
- 'pt_key=aaa;pt_pin=xxxaaa'
-]
-```
-
-
-
-## 4.上传至腾讯云
-
-[腾讯云函数地址]( https://console.cloud.tencent.com/scf/index )
-
-编写函数
-
-登录后,点击管理控制台
-
-单击左侧导航栏**函数服务**,进入“函数服务”页面。
-在页面上方选择一个地域,最好选择离你常用地区近点的,不至于导致账号异常。单击**新建**。如下图所示:
-
-
-
-在“新建函数”页面填写函数基础信息,单击**下一步**。如下图所示:
-
-
-
-**函数名称**:可以自定义,比如为jd。
**运行环境**:选择 “Nodejs 12.16”。
**创建方式**:选择 “空白函数”。
-
-确保环境为Nodejs 12.16,执行方法改为:index.main_handler,提交方式建议选本地文件夹,然后从GitHub项目克隆Zip压缩包,解压成文件夹,然后点击这个上传把文件夹上传进来(记得node_modules文件夹一并上传或者将node_modules文件夹上传到“层”,之后选择“函数管理”-“层管理”绑定上传好的层),完了后点击下面的高级设置。
-
-
-
-内存用不了太大,64MB就够了(64M内存,免费时长6,400,000秒,内存与免费时长大致关系可以参看云函数官方说明),超时时间改为最大的900秒,然后点击最下面的完成。
-
-
-
-## 5.设置触发器
-
-点击刚创建的函数
-
-
-
-点击如图所示
-
-
-
-创建触发器
-
-
-
-触发方式默认“**定时触发**”,定时任务名称随便起个名字,触发周期根据自己需要自行设置。
-
-想进阶使用触发器的自行查看本文中方案一和方案二中的说明
-
-关于触发周期中的自定义触发周期,使用的是 Cron表达式,这个自行学习下吧
-
-
-[Corn文档](https://cloud.tencent.com/document/product/583/9708#cron-.E8.A1.A8.E8.BE.BE.E5.BC.8F)
-
-目前repo中按照每个脚本一个定时器的方式设置到云函数中,大约需要触发器10多个,由于云函数触发器限制最多10个,需要对触发器进行整合,整合后触发器保持在10个以内,以下设置仅供参考
-
-
-
-点击提交,所有流程就结束了。
diff --git a/icon/DD_bot.png b/icon/DD_bot.png
deleted file mode 100644
index d3cdc58..0000000
Binary files a/icon/DD_bot.png and /dev/null differ
diff --git a/icon/Snipaste_2020-08-28_09-31-42.png b/icon/Snipaste_2020-08-28_09-31-42.png
deleted file mode 100644
index 073f989..0000000
Binary files a/icon/Snipaste_2020-08-28_09-31-42.png and /dev/null differ
diff --git a/icon/TG_PUSH1.png b/icon/TG_PUSH1.png
deleted file mode 100644
index 0e2c8a1..0000000
Binary files a/icon/TG_PUSH1.png and /dev/null differ
diff --git a/icon/TG_PUSH2.png b/icon/TG_PUSH2.png
deleted file mode 100644
index a9d8c58..0000000
Binary files a/icon/TG_PUSH2.png and /dev/null differ
diff --git a/icon/TG_PUSH3.png b/icon/TG_PUSH3.png
deleted file mode 100644
index e213067..0000000
Binary files a/icon/TG_PUSH3.png and /dev/null differ
diff --git a/icon/action1.png b/icon/action1.png
deleted file mode 100644
index ca1ab73..0000000
Binary files a/icon/action1.png and /dev/null differ
diff --git a/icon/action2.png b/icon/action2.png
deleted file mode 100644
index 7874958..0000000
Binary files a/icon/action2.png and /dev/null differ
diff --git a/icon/action3.png b/icon/action3.png
deleted file mode 100644
index 32b2db3..0000000
Binary files a/icon/action3.png and /dev/null differ
diff --git a/icon/bark.jpg b/icon/bark.jpg
deleted file mode 100644
index 0cbdadf..0000000
Binary files a/icon/bark.jpg and /dev/null differ
diff --git a/icon/bean_sign_simple.jpg b/icon/bean_sign_simple.jpg
deleted file mode 100644
index 1c01c7c..0000000
Binary files a/icon/bean_sign_simple.jpg and /dev/null differ
diff --git a/icon/disable-action.jpg b/icon/disable-action.jpg
deleted file mode 100644
index 9310908..0000000
Binary files a/icon/disable-action.jpg and /dev/null differ
diff --git a/icon/fork.png b/icon/fork.png
deleted file mode 100644
index 46b5b72..0000000
Binary files a/icon/fork.png and /dev/null differ
diff --git a/icon/git1.jpg b/icon/git1.jpg
deleted file mode 100644
index aeaf461..0000000
Binary files a/icon/git1.jpg and /dev/null differ
diff --git a/icon/git10.jpg b/icon/git10.jpg
deleted file mode 100644
index d0dd7d8..0000000
Binary files a/icon/git10.jpg and /dev/null differ
diff --git a/icon/git11.jpg b/icon/git11.jpg
deleted file mode 100644
index 313c456..0000000
Binary files a/icon/git11.jpg and /dev/null differ
diff --git a/icon/git12.jpg b/icon/git12.jpg
deleted file mode 100644
index e880919..0000000
Binary files a/icon/git12.jpg and /dev/null differ
diff --git a/icon/git13.jpg b/icon/git13.jpg
deleted file mode 100644
index 65c0f69..0000000
Binary files a/icon/git13.jpg and /dev/null differ
diff --git a/icon/git14.jpg b/icon/git14.jpg
deleted file mode 100644
index bd7f377..0000000
Binary files a/icon/git14.jpg and /dev/null differ
diff --git a/icon/git2.jpg b/icon/git2.jpg
deleted file mode 100644
index 7cb7642..0000000
Binary files a/icon/git2.jpg and /dev/null differ
diff --git a/icon/git3.jpg b/icon/git3.jpg
deleted file mode 100644
index 603c79c..0000000
Binary files a/icon/git3.jpg and /dev/null differ
diff --git a/icon/git4.jpg b/icon/git4.jpg
deleted file mode 100644
index ae2f427..0000000
Binary files a/icon/git4.jpg and /dev/null differ
diff --git a/icon/git5.jpg b/icon/git5.jpg
deleted file mode 100644
index 3bfa3fa..0000000
Binary files a/icon/git5.jpg and /dev/null differ
diff --git a/icon/git6.jpg b/icon/git6.jpg
deleted file mode 100644
index 8bf8551..0000000
Binary files a/icon/git6.jpg and /dev/null differ
diff --git a/icon/git7.png b/icon/git7.png
deleted file mode 100644
index d40f2c0..0000000
Binary files a/icon/git7.png and /dev/null differ
diff --git a/icon/git8.jpg b/icon/git8.jpg
deleted file mode 100644
index db30fa4..0000000
Binary files a/icon/git8.jpg and /dev/null differ
diff --git a/icon/git9.jpg b/icon/git9.jpg
deleted file mode 100644
index e44757e..0000000
Binary files a/icon/git9.jpg and /dev/null differ
diff --git a/icon/iCloud1.png b/icon/iCloud1.png
deleted file mode 100644
index 669ac59..0000000
Binary files a/icon/iCloud1.png and /dev/null differ
diff --git a/icon/iCloud2.png b/icon/iCloud2.png
deleted file mode 100644
index fae4485..0000000
Binary files a/icon/iCloud2.png and /dev/null differ
diff --git a/icon/iCloud3.png b/icon/iCloud3.png
deleted file mode 100644
index dcb6b0d..0000000
Binary files a/icon/iCloud3.png and /dev/null differ
diff --git a/icon/iCloud4.png b/icon/iCloud4.png
deleted file mode 100644
index 41e852b..0000000
Binary files a/icon/iCloud4.png and /dev/null differ
diff --git a/icon/iCloud5.png b/icon/iCloud5.png
deleted file mode 100644
index 9f11de9..0000000
Binary files a/icon/iCloud5.png and /dev/null differ
diff --git a/icon/iCloud6.png b/icon/iCloud6.png
deleted file mode 100644
index 8210a7f..0000000
Binary files a/icon/iCloud6.png and /dev/null differ
diff --git a/icon/jd1.jpg b/icon/jd1.jpg
deleted file mode 100644
index 33a9f8f..0000000
Binary files a/icon/jd1.jpg and /dev/null differ
diff --git a/icon/jd2.jpg b/icon/jd2.jpg
deleted file mode 100644
index cd6f839..0000000
Binary files a/icon/jd2.jpg and /dev/null differ
diff --git a/icon/jd3.jpg b/icon/jd3.jpg
deleted file mode 100644
index 264ea71..0000000
Binary files a/icon/jd3.jpg and /dev/null differ
diff --git a/icon/jd4.jpg b/icon/jd4.jpg
deleted file mode 100644
index 7f6f4c8..0000000
Binary files a/icon/jd4.jpg and /dev/null differ
diff --git a/icon/jd5.png b/icon/jd5.png
deleted file mode 100644
index f797266..0000000
Binary files a/icon/jd5.png and /dev/null differ
diff --git a/icon/jd6.png b/icon/jd6.png
deleted file mode 100644
index a49b69d..0000000
Binary files a/icon/jd6.png and /dev/null differ
diff --git a/icon/jd7.png b/icon/jd7.png
deleted file mode 100644
index d05a36c..0000000
Binary files a/icon/jd7.png and /dev/null differ
diff --git a/icon/jd8.png b/icon/jd8.png
deleted file mode 100644
index d763579..0000000
Binary files a/icon/jd8.png and /dev/null differ
diff --git a/icon/jd_moneyTree.png b/icon/jd_moneyTree.png
deleted file mode 100644
index 69024fa..0000000
Binary files a/icon/jd_moneyTree.png and /dev/null differ
diff --git a/icon/jd_pet.png b/icon/jd_pet.png
deleted file mode 100644
index bb231e4..0000000
Binary files a/icon/jd_pet.png and /dev/null differ
diff --git a/icon/thanks.jpg b/icon/thanks.jpg
deleted file mode 100644
index 2b9e805..0000000
Binary files a/icon/thanks.jpg and /dev/null differ
diff --git a/icon/txy.png b/icon/txy.png
deleted file mode 100644
index 2c58d39..0000000
Binary files a/icon/txy.png and /dev/null differ
diff --git a/index.js b/index.js
deleted file mode 100644
index be67f30..0000000
--- a/index.js
+++ /dev/null
@@ -1,26 +0,0 @@
-//'use strict';
-exports.main_handler = async (event, context, callback) => {
- try {
- //如果想在一个定时触发器里面执行多个js文件需要在定时触发器的【附加信息】里面填写对应的名称,用 & 链接
- //例如我想一个定时触发器里执行jd_speed.js和jd_bean_change.js,在定时触发器的【附加信息】里面就填写 jd_speed&jd_bean_change
- for (const v of event["Message"].split("&")) {
- console.log(v);
- var request = require('request');
- //1.执行自己上传的js文件
- //delete require.cache[require.resolve('./'+v+'.js')];
- //require('./'+v+'.js')
-
- //2.执行国内gitee远端js文件如果部署,在国内节点,选择1或2的方式
- //request('https://gitee.com/lxk0301/jd_scripts/raw/master/'+v+'.js', function (error, response, body) {
- // eval(response.body)
- //})
-
- //3.执行github远端的js文件(因github的raw类型的文件被墙,此方法云函数非)
- request('https://raw.githubusercontent.com/lxk0301/jd_scripts/master/' + v + '.js', function (error, response, body) {
- eval(response.body)
- })
- }
- } catch (e) {
- console.error(e)
- }
-}
diff --git a/jdCookie.js b/jdCookie.js
deleted file mode 100644
index 4eb2bb7..0000000
--- a/jdCookie.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-此文件为Node.js专用。其他用户请忽略
- */
-//此处填写京东账号cookie。
-//注:github action用户cookie填写到Settings-Secrets里面,新增JD_COOKIE,多个账号的cookie使用`&`隔开或者换行
-let CookieJDs = [
- '',//账号一ck,例:pt_key=XXX;pt_pin=XXX;
- '',//账号二ck,例:pt_key=XXX;pt_pin=XXX;如有更多,依次类推
-]
-// 判断github action里面是否有京东ck
-if (process.env.JD_COOKIE) {
- if (process.env.JD_COOKIE.indexOf('&') > -1) {
- console.log(`您的cookie选择的是用&隔开\n`)
- CookieJDs = process.env.JD_COOKIE.split('&');
- } else if (process.env.JD_COOKIE.indexOf('\n') > -1) {
- console.log(`您的cookie选择的是用换行隔开\n`)
- CookieJDs = process.env.JD_COOKIE.split('\n');
- } else if (process.env.JD_COOKIE.indexOf('\\n') > -1) {
- //环境变量兼容腾讯云和docker下\n会被转义成\\n
- console.log(`您的cookie选择的是用换行隔开\\n`)
- CookieJDs = process.env.JD_COOKIE.split('\\n');
- } else {
- CookieJDs = [process.env.JD_COOKIE];
- }
- CookieJDs = [...new Set(CookieJDs)]
- console.log(`\n====================共有${CookieJDs.length}个京东账号Cookie=========\n`);
- console.log(`==================脚本执行- 北京时间(UTC+8):${new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000).toLocaleString()}=====================\n`)
- // console.log(`\n==================脚本执行来自 github action=====================\n`)
-}
-for (let i = 0; i < CookieJDs.length; i++) {
- const index = (i + 1 === 1) ? '' : (i + 1);
- exports['CookieJD' + index] = CookieJDs[i];
-}
diff --git a/jdFactoryShareCodes.js b/jdFactoryShareCodes.js
deleted file mode 100644
index 4bbbe48..0000000
--- a/jdFactoryShareCodes.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-京东种豆得豆互助码
-此文件为Node.js专用。其他用户请忽略
-支持京东N个账号
- */
-//云服务器腾讯云函数等NOde.js用户在此处填写东东萌宠的好友码。
-// github action用户的好友互助码填写到Action->Settings->Secrets->new Secret里面(Name填写 PLANT_BEAN_SHARECODES(此处的Name必须按此来写,不能随意更改),内容处填写互助码,填写规则如下)
-// 同一个京东账号的好友互助码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例
-// 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2
-let shareCodes = [
- '',//账号一的好友shareCode,不同好友中间用@符号隔开
- '',//账号二的好友shareCode,不同好友中间用@符号隔开
-]
-// 判断github action里面是否有东东萌宠互助码
-if (process.env.DDFACTORY_SHARECODES) {
- if (process.env.DDFACTORY_SHARECODES.indexOf('&') > -1) {
- console.log(`您的互助码选择的是用&隔开\n`)
- shareCodes = process.env.DDFACTORY_SHARECODES.split('&');
- } else if (process.env.DDFACTORY_SHARECODES.indexOf('\n') > -1) {
- console.log(`您的互助码选择的是用换行隔开\n`)
- shareCodes = process.env.DDFACTORY_SHARECODES.split('\n');
- } else {
- shareCodes = process.env.DDFACTORY_SHARECODES.split();
- }
-} else if (process.env.JD_COOKIE) {
- console.log(`由于您secret里面未提供助力码,故此处运行将会给脚本内置的码进行助力,请知晓!`)
-}
-for (let i = 0; i < shareCodes.length; i++) {
- const index = (i + 1 === 1) ? '' : (i + 1);
- exports['shareCodes' + index] = shareCodes[i];
-}
\ No newline at end of file
diff --git a/jdFruitShareCodes.js b/jdFruitShareCodes.js
deleted file mode 100644
index 17199e0..0000000
--- a/jdFruitShareCodes.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-水果互助码
-此文件为Node.js专用。其他用户请忽略
-支持京东N个账号
- */
-//云服务器腾讯云函数等NOde.js用户在此处填写京东东农场的好友码。
-// github action用户的好友互助码填写到Action->Settings->Secrets->new Secret里面(Name填写 FruitShareCodes(此处的Name必须按此来写,不能随意更改),内容处填写互助码,填写规则如下)
-// 同一个京东账号的好友互助码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例
-// 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2
-let FruitShareCodes = [
- '0a74407df5df4fa99672a037eec61f7e@dbb21614667246fabcfd9685b6f448f3@6fbd26cc27ac44d6a7fed34092453f77@61ff5c624949454aa88561f2cd721bf6',//账号一的好友shareCode,不同好友中间用@符号隔开
- '6fbd26cc27ac44d6a7fed34092453f77@61ff5c624949454aa88561f2cd721bf6@9c52670d52ad4e1a812f894563c746ea@8175509d82504e96828afc8b1bbb9cb3',//账号二的好友shareCode,不同好友中间用@符号隔开
-]
-// 判断github action里面是否有水果互助码
-if (process.env.FRUITSHARECODES) {
- if (process.env.FRUITSHARECODES.indexOf('&') > -1) {
- console.log(`您的东东农场互助码选择的是用&隔开\n`)
- FruitShareCodes = process.env.FRUITSHARECODES.split('&');
- } else if (process.env.FRUITSHARECODES.indexOf('\n') > -1) {
- console.log(`您的东东农场互助码选择的是用换行隔开\n`)
- FruitShareCodes = process.env.FRUITSHARECODES.split('\n');
- } else {
- FruitShareCodes = process.env.FRUITSHARECODES.split();
- }
-} else if (process.env.JD_COOKIE) {
- console.log(`由于您secret里面未提供助力码,故此处运行将会给脚本内置的码进行助力,请知晓!`)
-}
-for (let i = 0; i < FruitShareCodes.length; i++) {
- const index = (i + 1 === 1) ? '' : (i + 1);
- exports['FruitShareCode' + index] = FruitShareCodes[i];
-}
diff --git a/jdPetShareCodes.js b/jdPetShareCodes.js
deleted file mode 100644
index f910ca2..0000000
--- a/jdPetShareCodes.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-东东萌宠互助码
-此文件为Node.js专用。其他用户请忽略
-支持京东N个账号
- */
-//云服务器腾讯云函数等NOde.js用户在此处填写东东萌宠的好友码。
-// github action用户的好友互助码填写到Action->Settings->Secrets->new Secret里面(Name填写 PetShareCodes(此处的Name必须按此来写,不能随意更改),内容处填写互助码,填写规则如下)
-// 同一个京东账号的好友互助码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例
-// 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2
-let PetShareCodes = [
- 'MTAxODc2NTEzNTAwMDAwMDAwMjg3MDg2MA==@MTAxODc2NTEzMzAwMDAwMDAyNzUwMDA4MQ==@MTAxODc2NTEzMjAwMDAwMDAzMDI3MTMyOQ==@MTAxODc2NTEzNDAwMDAwMDAzMDI2MDI4MQ==',//账号一的好友shareCode,不同好友中间用@符号隔开
- 'MTAxODc2NTEzMjAwMDAwMDAzMDI3MTMyOQ==@MTAxODcxOTI2NTAwMDAwMDAyNjA4ODQyMQ==@MTAxODc2NTEzOTAwMDAwMDAyNzE2MDY2NQ==',//账号二的好友shareCode,不同好友中间用@符号隔开
-]
-// 判断github action里面是否有东东萌宠互助码
-if (process.env.PETSHARECODES) {
- if (process.env.PETSHARECODES.indexOf('&') > -1) {
- console.log(`您的东东萌宠互助码选择的是用&隔开\n`)
- PetShareCodes = process.env.PETSHARECODES.split('&');
- } else if (process.env.PETSHARECODES.indexOf('\n') > -1) {
- console.log(`您的东东萌宠互助码选择的是用换行隔开\n`)
- PetShareCodes = process.env.PETSHARECODES.split('\n');
- } else {
- PetShareCodes = process.env.PETSHARECODES.split();
- }
-} else if (process.env.JD_COOKIE) {
- console.log(`由于您secret里面未提供助力码,故此处运行将会给脚本内置的码进行助力,请知晓!`)
-}
-for (let i = 0; i < PetShareCodes.length; i++) {
- const index = (i + 1 === 1) ? '' : (i + 1);
- exports['PetShareCode' + index] = PetShareCodes[i];
-}
\ No newline at end of file
diff --git a/jdPlantBeanShareCodes.js b/jdPlantBeanShareCodes.js
deleted file mode 100644
index 3894909..0000000
--- a/jdPlantBeanShareCodes.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-京东种豆得豆互助码
-此文件为Node.js专用。其他用户请忽略
-支持京东N个账号
- */
-//云服务器腾讯云函数等NOde.js用户在此处填写东东萌宠的好友码。
-// github action用户的好友互助码填写到Action->Settings->Secrets->new Secret里面(Name填写 PLANT_BEAN_SHARECODES(此处的Name必须按此来写,不能随意更改),内容处填写互助码,填写规则如下)
-// 同一个京东账号的好友互助码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例
-// 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2
-let PlantBeanShareCodes = [
- '66j4yt3ebl5ierjljoszp7e4izzbzaqhi5k2unz2afwlyqsgnasq@olmijoxgmjutyrsovl2xalt2tbtfmg6sqldcb3q@e7lhibzb3zek27amgsvywffxx7hxgtzstrk2lba@olmijoxgmjutyx55upqaqxrblt7f3h26dgj2riy',//账号一的好友shareCode,不同好友中间用@符号隔开
- '4npkonnsy7xi3p6pjfxg6ct5gll42gmvnz7zgoy@6dygkptofggtp6ffhbowku3xgu@mlrdw3aw26j3wgzjipsxgonaoyr2evrdsifsziy@mlrdw3aw26j3wgzjipsxgonaoyr2evrdsifsziy',//账号二的好友shareCode,不同好友中间用@符号隔开
-]
-// 判断github action里面是否有东东萌宠互助码
-if (process.env.PLANT_BEAN_SHARECODES) {
- if (process.env.PLANT_BEAN_SHARECODES.indexOf('&') > -1) {
- console.log(`您的种豆互助码选择的是用&隔开\n`)
- PlantBeanShareCodes = process.env.PLANT_BEAN_SHARECODES.split('&');
- } else if (process.env.PLANT_BEAN_SHARECODES.indexOf('\n') > -1) {
- console.log(`您的种豆互助码选择的是用换行隔开\n`)
- PlantBeanShareCodes = process.env.PLANT_BEAN_SHARECODES.split('\n');
- } else {
- PlantBeanShareCodes = process.env.PLANT_BEAN_SHARECODES.split();
- }
-} else if (process.env.JD_COOKIE) {
- console.log(`由于您secret里面未提供助力码,故此处运行将会给脚本内置的码进行助力,请知晓!`)
-}
-for (let i = 0; i < PlantBeanShareCodes.length; i++) {
- const index = (i + 1 === 1) ? '' : (i + 1);
- exports['PlantBeanShareCodes' + index] = PlantBeanShareCodes[i];
-}
\ No newline at end of file
diff --git a/jdSuperMarketShareCodes.js b/jdSuperMarketShareCodes.js
deleted file mode 100644
index 880c8c8..0000000
--- a/jdSuperMarketShareCodes.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-京小超互助码
-此文件为Node.js专用。其他用户请忽略
-支持京东N个账号
- */
-//云服务器腾讯云函数等Node.js用户在此处填写京小超商圈的好友码。
-// github action用户的好友互助码填写到Action->Settings->Secrets->new Secret里面(Name填写 SuperMarketShareCodes(此处的Name必须按此来写,不能随意更改),内容处填写互助码,填写规则如下)
-// 同一个京东账号的好友互助码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例
-// 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2
-let SuperMarketShareCodes = [
- '-4msulYas0O2JsRhE-2TA5XZmBQ@eU9Yar_mb_9z92_WmXNG0w@eU9YaejjYv4g8T2EwnsVhQ',//账号一的好友shareCode,不同好友中间用@符号隔开
- 'aURoM7PtY_Q@eU9Ya-y2N_5z9DvXwyIV0A@eU9YaOnjYK4j-GvWmXIWhA',//账号二的好友shareCode,不同好友中间用@符号隔开
-]
-// 判断github action里面是否有京小超商圈互助码
-if (process.env.SUPERMARKET_SHARECODES) {
- if (process.env.SUPERMARKET_SHARECODES.indexOf('&') > -1) {
- console.log(`您的京小超商圈互助码选择的是用&隔开\n`)
- SuperMarketShareCodes = process.env.SUPERMARKET_SHARECODES.split('&');
- } else if (process.env.SUPERMARKET_SHARECODES.indexOf('\n') > -1) {
- console.log(`您的京小超商圈互助码选择的是用换行隔开\n`)
- SuperMarketShareCodes = process.env.SUPERMARKET_SHARECODES.split('\n');
- } else {
- SuperMarketShareCodes = process.env.SUPERMARKET_SHARECODES.split();
- }
-} else if (process.env.JD_COOKIE) {
- console.log(`由于您secret里面未提供助力码,故此处运行将会给脚本内置的码进行助力,请知晓!`)
-}
-for (let i = 0; i < SuperMarketShareCodes.length; i++) {
- const index = (i + 1 === 1) ? '' : (i + 1);
- exports['SuperMarketShareCode' + index] = SuperMarketShareCodes[i];
-}
\ No newline at end of file
diff --git a/jd_818.js b/jd_818.js
deleted file mode 100644
index ae635a2..0000000
--- a/jd_818.js
+++ /dev/null
@@ -1,920 +0,0 @@
-/*
- * @Author: lxk0301 https://github.com/lxk0301
- * @Date: 2020-11-03 09:25:47
- * @Last Modified by: lxk0301
- * @Last Modified time: 2020-11-23 12:27:07
- */
-/*
-京东手机狂欢城活动,每日可获得30+以上京豆(其中20京豆是往期奖励,需第一天参加活动后,第二天才能拿到)
-活动时间10.21日-11.12日结束,活动23天,保底最少可以拿到690京豆
-活动地址: https://rdcseason.m.jd.com/#/index
-
-其中有20京豆是往期奖励,需第一天参加活动后,第二天才能拿到!!!!
-
-
-每天0/6/12/18点逛新品/店铺/会场可获得京豆,京豆先到先得
-往期奖励一般每天都能拿20京豆
-
-注:脚本运行会给我提供的助力码助力,介意者可删掉脚本第48行helpCode里面的东西。留空即可(const helpCode = []);
-
-支持京东双账号
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-// quantumultx
-[task_local]
-#京东手机狂欢城
-1 0-18/6 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_818.js, tag=京东手机狂欢城, enabled=true
-// Loon
-[Script]
-cron "1 0-18/6 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_818.js,tag=京东手机狂欢城
-// Surge
-京东手机狂欢城 = type=cron,cronexp=1 0-18/6 * * *,wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_818.js
- */
-const $ = new Env('京东手机狂欢城');
-
-const notify = $.isNode() ? require('./sendNotify') : '';
-let jdNotify = false;//是否开启推送互助码
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- cookiesArr.push($.getdata('CookieJD'));
- cookiesArr.push($.getdata('CookieJD2'));
-}
-
-const JD_API_HOST = 'https://rdcseason.m.jd.com/api/';
-const activeEndTime = '2020/11/11 23:59:59+08:00';
-const addUrl = 'http://jd.turinglabs.net/helpcode/create/';
-const printUrl = `http://jd.turinglabs.net/helpcode/print/20/`;
-let helpCode = []
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- $.temp = [];
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- await JD818();
- // await getHelp();
- // await doHelp();
- // await main();
- }
- }
- // console.log($.temp)
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-async function main() {
- // await getHelp();
- await Promise.all([
- getHelp(),
- listGoods(),
- shopInfo(),
- listMeeting(),
- ]);
- await $.wait(10000);
- await Promise.all([
- listGoods(),
- shopInfo(),
- listMeeting(),
- doHelp(),
- myRank(),
- ]);
- await Promise.all([
- getListJbean(),
- getListRank(),
- getListIntegral(),
- ]);
- await showMsg()
-}
-async function JD818() {
- await getHelp();
- await listGoods();//逛新品
- await shopInfo();//逛店铺
- await listMeeting();//逛会场
- await $.wait(10000);
- //再次运行一次,避免出现遗漏的问题
- await listGoods();//逛新品
- await shopInfo();//逛店铺
- await listMeeting();//逛会场
- await doHelp();
- await myRank();//领取往期排名奖励
- await getListJbean();
- await getListRank();
- await getListIntegral();
- await showMsg()
-}
-function listMeeting() {
- const options = {
- 'url': `${JD_API_HOST}task/listMeeting?t=${Date.now()}`,
- 'headers': {
- 'Host': 'rdcseason.m.jd.com',
- 'Accept': 'application/json, text/plain, */*',
- 'Connection':' keep-alive',
- 'Cookie': cookie,
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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',
- 'Referer': `https://rdcseason.m.jd.com/?reloadWQPage=t_${Date.now()}`,
- 'Accept-Encoding': 'gzip, deflate, br'
- }
- }
- return new Promise((resolve) => {
- $.get(options, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- data = JSON.parse(data);
- // console.log('ddd----ddd', data.code)
- if (data.code === 200 && data.data.meetingList) {
- let integralNum = 0, jdNum = 0;
- for (let item of data.data.meetingList) {
- let res = await browseMeeting(item.id);
- if (res.code === 200) {
- let res2 = await getMeetingPrize(item.id);
- integralNum += res2.data.integralNum * 1;
- jdNum += res2.data.jdNum * 1;
- }
- // await browseMeeting('1596206323911');
- // await getMeetingPrize('1596206323911');
- }
- console.log(`逛会场--获得积分:${integralNum}`)
- console.log(`逛会场--获得京豆:${jdNum}`)
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function listGoods() {
- const options = {
- 'url': `${JD_API_HOST}task/listGoods?t=${Date.now()}`,
- 'headers': {
- 'Host': 'rdcseason.m.jd.com',
- 'Accept': 'application/json, text/plain, */*',
- 'Connection':' keep-alive',
- 'Cookie': cookie,
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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',
- 'Referer': `https://rdcseason.m.jd.com/?reloadWQPage=t_${Date.now()}`,
- 'Accept-Encoding': 'gzip, deflate, br'
- }
- }
- return new Promise( (resolve) => {
- $.get(options, async (err, resp, data) => {
- try {
- // console.log('data1', data);
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- data = JSON.parse(data);
- if (data.code === 200 && data.data.goodsList) {
- let integralNum = 0, jdNum = 0;
- for (let item of data.data.goodsList) {
- let res = await browseGoods(item.id);
- if (res.code === 200) {
- let res2 = await getGoodsPrize(item.id);
- // console.log('逛新品领取奖励res2', res2);
- integralNum += res2.data.integralNum * 1;
- jdNum += res2.data.jdNum * 1;
- }
- }
- console.log(`逛新品获得积分:${integralNum}`)
- console.log(`逛新品获得京豆:${jdNum}`)
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- });
-}
-function shopInfo() {
- const options = {
- 'url': `${JD_API_HOST}task/shopInfo?t=${Date.now()}`,
- 'headers': {
- 'Host': 'rdcseason.m.jd.com',
- 'Accept': 'application/json, text/plain, */*',
- 'Connection':' keep-alive',
- 'Cookie': cookie,
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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',
- 'Referer': `https://rdcseason.m.jd.com/?reloadWQPage=t_${Date.now()}`,
- 'Accept-Encoding': 'gzip, deflate, br'
- }
- }
- return new Promise( (resolve) => {
- $.get(options, async (err, resp, data) => {
- try {
- // console.log('data1', data);
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- data = JSON.parse(data);
- if (data.code === 200 && data.data) {
- let integralNum = 0, jdNum = 0;
- for (let item of data.data) {
- let res = await browseShop(item.shopId);
- // console.log('res', res)
- // res = JSON.parse(res);
- // console.log('res', res.code)
- if (res.code === 200) {
- // console.log('---')
- let res2 = await getShopPrize(item.shopId);
- // console.log('res2', res2);
- // res2 = JSON.parse(res2);
- integralNum += res2.data.integralNum * 1;
- jdNum += res2.data.jdNum * 1;
- }
- }
- console.log(`逛店铺获得积分:${integralNum}`)
- console.log(`逛店铺获得京豆:${jdNum}`)
- }
- }
- // console.log('data1', data);
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve()
- }
- })
- })
-
-}
-function browseGoods(id) {
- const options = {
- "url": `${JD_API_HOST}task/browseGoods?t=${Date.now()}&skuId=${id}`,
- "headers": {
- "Host": "rdcseason.m.jd.com",
- "Accept": "application/json, text/plain, */*",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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",
- "Referer": "https://rdcseason.m.jd.com/",
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- return new Promise( (resolve) => {
- $.get(options, (err, resp, data) => {
- try {
- // console.log('data1', data);
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- data = JSON.parse(data);
- }
- // console.log('data1', data);
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-
-function getGoodsPrize(id) {
- const options = {
- "url": `${JD_API_HOST}task/getGoodsPrize?t=${Date.now()}&skuId=${id}`,
- "headers": {
- "Host": "rdcseason.m.jd.com",
- "Accept": "application/json, text/plain, */*",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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",
- "Referer": "https://rdcseason.m.jd.com/",
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- return new Promise( (resolve) => {
- $.get(options, (err, resp, data) => {
- try {
- // console.log('data1', data);
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function browseShop(id) {
- const options2 = {
- "url": `${JD_API_HOST}task/browseShop`,
- "body": `shopId=${id}`,
- "headers": {
- "Host": "rdcseason.m.jd.com",
- "Accept": "application/json, text/plain, */*",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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",
- "Referer": "https://rdcseason.m.jd.com/",
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- return new Promise( (resolve) => {
- $.post(options2, (err, resp, data) => {
- try {
- // console.log('data1', data);
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function getShopPrize(id) {
- const options = {
- "url": `${JD_API_HOST}task/getShopPrize`,
- "body": `shopId=${id}`,
- "headers": {
- "Host": "rdcseason.m.jd.com",
- "Accept": "application/json, text/plain, */*",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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",
- "Referer": "https://rdcseason.m.jd.com/",
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- return new Promise( (resolve) => {
- $.post(options, (err, resp, data) => {
- try {
- // console.log('getShopPrize', data);
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-
-function browseMeeting(id) {
- const options2 = {
- "url": `${JD_API_HOST}task/browseMeeting`,
- "body": `meetingId=${id}`,
- "headers": {
- "Host": "rdcseason.m.jd.com",
- "Accept": "application/json, text/plain, */*",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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",
- "Referer": "https://rdcseason.m.jd.com/",
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- return new Promise( (resolve) => {
- $.post(options2, (err, resp, data) => {
- try {
- // console.log('点击浏览会场', data);
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function getMeetingPrize(id) {
- const options = {
- "url": `${JD_API_HOST}task/getMeetingPrize`,
- "body": `meetingId=${id}`,
- "headers": {
- "Host": "rdcseason.m.jd.com",
- "Accept": "application/json, text/plain, */*",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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",
- "Referer": "https://rdcseason.m.jd.com/",
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- return new Promise( (resolve) => {
- $.post(options, (err, resp, data) => {
- try {
- // console.log('getMeetingPrize', data);
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function myRank() {
- return new Promise(resolve => {
- const options = {
- "url": `${JD_API_HOST}task/myRank?t=${Date.now()}`,
- "headers": {
- "Host": "rdcseason.m.jd.com",
- "Accept": "application/json, text/plain, */*",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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",
- "Referer": "https://rdcseason.m.jd.com/",
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- $.jbeanNum = '';
- $.get(options, async (err, resp, data) => {
- try {
- // console.log('查询获奖列表data', data);
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- data = JSON.parse(data);
- if (data.code === 200 && data.data.myHis) {
- for (let i = 0; i < data.data.myHis.length; i++) {
- $.date = data.data.myHis[0].date;
- if (data.data.myHis[i].status === '21') {
- await $.wait(1000);
- console.log('开始领奖')
- let res = await saveJbean(data.data.myHis[i].id);
- // console.log('领奖结果', res)
- if (res.code === 200 && res.data.rsCode === 200) {
- // $.jbeanNum += Number(res.data.jbeanNum);
- console.log(`${data.data.myHis[i].date}日奖励领取成功${JSON.stringify(res.data.jbeanNum)}`)
- }
- }
- if (i === 0 && data.data.myHis[i].status === '22') {
- $.jbeanNum = data.data.myHis[i].prize;
- }
- }
- // for (let item of data.data.myHis){
- // if (item.status === '21') {
- // await $.wait(1000);
- // console.log('开始领奖')
- // let res = await saveJbean(item.id);
- // // console.log('领奖结果', res)
- // if (res.code === 200 && res.data.rsCode === 200) {
- // $.jbeanNum += Number(res.data.jbeanNum);
- // }
- // }
- // }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function saveJbean(id) {
- return new Promise(resolve => {
- const options = {
- "url": `${JD_API_HOST}task/saveJbean`,
- "body": `prizeId=${id}`,
- "headers": {
- "Host": "rdcseason.m.jd.com",
- "Accept": "application/json, text/plain, */*",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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",
- "Referer": "https://rdcseason.m.jd.com/",
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- $.post(options, (err, resp, data) => {
- try {
- // console.log('领取京豆结果', data);
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-async function doHelp() {
- console.log(`脚本自带助力码数量:${helpCode.length}`)
- let body = '', nowTime = Date.now(), tempCode = [];
- const zone = new Date().getTimezoneOffset();
- if (zone === 0) {
- nowTime += 28800000;//UTC-0时区加上8个小时
- }
- await updateShareCodes();
- if (!$.updatePkActivityIdRes) await updateShareCodesCDN();
- tempCode = $.updatePkActivityIdRes.shareCodes;
- console.log(`是否大于当天九点🕘:${nowTime > new Date(nowTime).setHours(9, 0, 0, 0)}`)
- //当天大于9:00才从API里面取收集的助力码
- if (nowTime > new Date(nowTime).setHours(9, 0, 0, 0)) body = await printAPI();//访问收集的互助码
- if (body) {
- console.log(`printAPI返回助力码数量:${body.replace(/"/g, '').split(',').length}`)
- tempCode = tempCode.concat(body.replace(/"/g, '').split(','))
- }
- console.log(`累计助力码数量:${tempCode.length}`)
- //去掉重复的
- tempCode = [...new Set(tempCode)];
- console.log(`去重后总助力码数量:${tempCode.length}`)
- for (let item of tempCode) {
- if (!item) continue;
- const helpRes = await toHelp(item.trim());
- if (helpRes.data.status === 5) {
- console.log(`助力机会已耗尽,跳出助力`);
- break;
- }
- }
-}
-function printAPI() {
- return new Promise(resolve => {
- $.get({url: `${printUrl}`}, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- // data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function toHelp(code) {
- return new Promise(resolve => {
- const options = {
- "url": `${JD_API_HOST}task/toHelp`,
- "body": `shareId=${code}`,
- "headers": {
- "Host": "rdcseason.m.jd.com",
- "Content-Type": "application/x-www-form-urlencoded",
- "Origin": "https://rdcseason.m.jd.com",
- "Accept-Encoding": "gzip, deflate, br",
- "Cookie": cookie,
- "Connection": "keep-alive",
- "Accept": "application/json, text/plain, */*",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- "Referer": "https://rdcseason.m.jd.com/",
- "Content-Length": "44",
- "Accept-Language": "zh-cn"
- }
- }
- $.post(options, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- console.log(`助力结果:${data}`);
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function getHelp() {
- return new Promise(resolve => {
- const options = {
- "url": `${JD_API_HOST}task/getHelp?t=${Date.now()}`,
- "headers": {
- "Host": "rdcseason.m.jd.com",
- "Accept": "application/json, text/plain, */*",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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",
- "Referer": "https://rdcseason.m.jd.com",
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- $.get(options, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- data = JSON.parse(data);
- if (data.code === 200) {
- console.log(`\n您的助力码shareId(互助码每天都是变化的)\n\n"${data.data.shareId}",\n`);
- console.log(`每日9:00以后复制下面的URL链接在浏览器里面打开一次就能自动上车\n\n${addUrl}${data.data.shareId}\n`);
- let ctrTemp;
- if ($.isNode() && process.env.JD_818_SHAREID_NOTIFY) {
- console.log(`环境变量JD_818_SHAREID_NOTIFY::${process.env.JD_818_SHAREID_NOTIFY}`)
- ctrTemp = `${process.env.JD_818_SHAREID_NOTIFY}` === 'true';
- } else {
- ctrTemp = `${jdNotify}` === 'true';
- }
- console.log(`是否发送上车推送链接:${ctrTemp ? '是': '否'}`)
- // 只在早晨9点钟触发一次
- let NowHours = new Date().getHours();
- const zone = new Date().getTimezoneOffset();
- if (zone === 0) {
- NowHours += 8;//UTC-0时区加上8个小时
- }
- if(ctrTemp && NowHours === 9 && $.isNode()) await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}互助码自动上车`, `[9:00之后上车]您的互助码上车链接是 ↓↓↓ \n\n ${addUrl}${data.data.shareId} \n\n ↑↑↑`, {
- url: `${addUrl}${data.data.shareId}`
- })
- // await $.http.get({url: `http://jd.turinglabs.net/helpcode/add/${data.data.shareId}/`}).then((resp) => {
- // console.log(resp);
- // return
- // if (resp.statusCode === 200) {
- // const { body } = resp;
- // }
- // });
- $.temp.push(data.data.shareId);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-//获取当前活动总京豆数量
-function getListJbean() {
- return new Promise(resolve => {
- const options = {
- "url": `${JD_API_HOST}task/listJbean?pageNum=1`,
- "headers": {
- "Host": "rdcseason.m.jd.com",
- "Accept": "application/json, text/plain, */*",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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",
- "Referer": "https://rdcseason.m.jd.com",
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- $.get(options, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- data = JSON.parse(data);
- if (data.code === 200) {
- $.jbeanCount = data.data.jbeanCount;
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-
-function getListIntegral() {
- return new Promise(resolve => {
- const options = {
- "url": `${JD_API_HOST}task/listIntegral?pageNum=1`,
- "headers": {
- "Host": "rdcseason.m.jd.com",
- "Accept": "application/json, text/plain, */*",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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",
- "Referer": "https://rdcseason.m.jd.com",
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- $.get(options, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- data = JSON.parse(data);
- if (data.code === 200) {
- $.integralCount = data.data.integralCount;
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-
-//查询今日累计积分与排名
-function getListRank() {
- return new Promise(resolve => {
- const options = {
- "url": `${JD_API_HOST}task/listRank?t=${Date.now()}`,
- "headers": {
- "Host": "rdcseason.m.jd.com",
- "Accept": "application/json, text/plain, */*",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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",
- "Referer": "https://rdcseason.m.jd.com",
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- $.get(options, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- data = JSON.parse(data);
- if (data.code === 200) {
- if (data.data.my) {
- $.integer = data.data.my.integer;
- $.num = data.data.my.num;
- }
- if (data.data.last) {
- $.lasNum = data.data.last.num;
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function updateShareCodes(url = 'https://raw.githubusercontent.com/lxk0301/updateTeam/master/jd_shareCodes.json') {
- return new Promise(resolve => {
- //https://cdn.jsdelivr.net/gh/lxk0301/updateTeam@master/jd_shareCodes.json
- //https://raw.githubusercontent.com/lxk0301/updateTeam/master/jd_shareCodes.json
- $.get({url}, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- } else {
- $.updatePkActivityIdRes = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function updateShareCodesCDN(url = 'https://cdn.jsdelivr.net/gh/lxk0301/updateTeam@master/jd_shareCodes.json') {
- return new Promise(resolve => {
- //https://cdn.jsdelivr.net/gh/lxk0301/updateTeam@master/jd_shareCodes.json
- //https://raw.githubusercontent.com/lxk0301/updateTeam/master/jd_shareCodes.json
- $.get({url}, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- $.updatePkActivityIdRes = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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();
- }
- })
- })
-}
-async function showMsg() {
- let nowTime = new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000;
- if (nowTime > new Date(activeEndTime).getTime()) {
- $.msg($.name, '活动已结束', `该活动累计获得京豆:${$.jbeanCount}个\niOS用户请删除此脚本\ngithub action用户请删除.github/workflows/jd_818.yml文件\n如果帮助到您可以点下🌟STAR鼓励我一下,谢谢\n咱江湖再见\nhttps://github.com/lxk0301/jd_scripts`, {"open-url": "https://github.com/lxk0301/jd_scripts"});
- if ($.isNode()) await notify.sendNotify($.name + '活动已结束', `请删除此脚本\ngithub action用户请删除.github/workflows/jd_818.yml文件\n如果帮助到您可以点下🌟STAR鼓励我一下,谢谢\n咱江湖再见\n https://github.com/lxk0301/jd_scripts`)
- } else {
- $.msg($.name, `京东账号${$.index} ${$.nickName || $.UserName}`, `${$.jbeanCount ? `${$.integer ? `今日获得积分:${$.integer}个\n` : ''}${$.num ? `今日排名:${$.num}\n` : ''}今日参数人数:${$.lasNum}人\n累计获得京豆:${$.jbeanCount}个🐶\n` : ''}${$.jbeanCount ? `累计获得积分:${$.integralCount}个\n` : ''}${$.jbeanNum ? `${$.date}日奖品:${$.jbeanNum}\n` : ''}具体详情点击弹窗跳转后即可查看`, {"open-url": "https://rdcseason.m.jd.com/#/hame"});
- }
-}
-// prettier-ignore
-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,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("",`\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 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();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){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="",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}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));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)}
diff --git a/jd_bean_change.js b/jd_bean_change.js
deleted file mode 100644
index f5448a7..0000000
--- a/jd_bean_change.js
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * @Author: lxk0301 https://github.com/lxk0301
- * @Date: 2020-11-01 16:25:41
- * @Last Modified by: lxk0301
- * @Last Modified time: 2020-11-03 16:25:41
- */
-/*
-京豆变动通知脚本:https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_bean_change.js
-统计昨日京豆的变化情况,包括收入,支出,以及显示当前京豆数量,目前小问题:下单使用京豆后,退款重新购买会出现异常
-网页查看地址 : https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean
-支持京东双账号
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-quantumultx
-[task_local]
-#京豆变动通知
-2 9 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_bean_change.js, tag=京豆变动通知, enabled=true
-Loon
-[Script]
-cron "2 9 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_bean_change.js, tag=京豆变动通知
-Surge
-京豆变动通知 = type=cron,cronexp=2 9 * * *,wake-system=1,timeout=440,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_bean_change.js
- */
-const $ = new Env('京豆变动通知');
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- cookiesArr.push($.getdata('CookieJD'));
- cookiesArr.push($.getdata('CookieJD2'));
-}
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.beanCount = 0;
- $.incomeBean = 0;
- $.expenseBean = 0;
- $.errorMsg = '';
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- await bean();
- await showMsg();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-async function showMsg() {
- if ($.errorMsg) return
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `账号${$.index}:${$.nickName || $.UserName}\n昨日收入:${$.incomeBean}京豆 🐶\n昨日支出:${$.expenseBean}京豆 🐶\n当前京豆:${$.beanCount}京豆 🐶`, { url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean` })
- }
- $.msg($.name, '', `账号${$.index}:${$.nickName || $.UserName}\n昨日收入:${$.incomeBean}京豆 🐶\n昨日支出:${$.expenseBean}京豆 🐶\n当前京豆:${$.beanCount}京豆 🐶`, {"open-url": "https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean"});
-}
-async function bean() {
- //前一天的0:0:0时间戳
- // console.log(`北京时间零点时间戳:${parseInt((Date.now() + 28800000) / 86400000) * 86400000 - 28800000}`);
- // console.log(`北京时间2020-10-28 06:16:05::${new Date("2020/10/28 06:16:05+08:00").getTime()}`)
- // 不管哪个时区。得到都是当前时刻北京时间的时间戳 new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000
- const tm = parseInt((Date.now() + 28800000) / 86400000) * 86400000 - 28800000 - (24 * 60 * 60 * 1000);
- // 今天0:0:0时间戳
- const tm1 = parseInt((Date.now() + 28800000) / 86400000) * 86400000 - 28800000;
- let page = 1, t = 0, yesterdayArr = [];
- do {
- let response = await getJingBeanBalanceDetail(page);
- console.log(`第${page}页: ${JSON.stringify(response)}`);
- if (response && response.code === "0") {
- page++;
- let detailList = response.detailList;
- if (detailList && detailList.length > 0) {
- for (let item of detailList) {
- const date = item.date.replace(/-/g, '/') + "+08:00";
- if (tm <= new Date(date).getTime() && new Date(date).getTime() < tm1) {
- //昨日的
- yesterdayArr.push(item);
- } else if (tm > new Date(date).getTime()) {
- //前天的
- t = 1;
- break;
- }
- }
- } else {
- $.errorMsg = `数据异常`;
- $.msg($.name, ``, `账号${$.index}:${$.nickName}\n${$.errorMsg}`);
- t = 1;
- }
- }
- } while (t === 0);
- for (let item of yesterdayArr) {
- if (Number(item.amount) > 0) {
- $.incomeBean += Number(item.amount);
- } else if (Number(item.amount) < 0) {
- $.expenseBean += Number(item.amount);
- }
- }
- // console.log(`昨日收入:${$.incomeBean}个京豆 🐶`);
- // console.log(`昨日支出:${$.expenseBean}个京豆 🐶`)
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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;
- if (data['retcode'] === 0) {
- $.beanCount = data['base'].jdNum;
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function getJingBeanBalanceDetail(page) {
- return new Promise(async resolve => {
- const options = {
- "url": `https://api.m.jd.com/client.action?functionId=getJingBeanBalanceDetail`,
- "body": `body=${escape(JSON.stringify({"pageSize": "20", "page": page.toString()}))}&appid=ld`,
- "headers": {
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- 'Host': 'api.m.jd.com',
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Cookie': cookie,
- }
- }
- $.post(options, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- data = JSON.parse(data);
- // console.log(data)
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-// prettier-ignore
-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,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("",`\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 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();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){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="",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}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));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
diff --git a/jd_bean_sign.js b/jd_bean_sign.js
deleted file mode 100644
index 10d51b3..0000000
--- a/jd_bean_sign.js
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
-京豆签到,自用,可N个京东账号,IOS软件用户请使用 https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js
-Node.JS专用
-更新时间:2020-11-27
-从 github @ruicky改写而来
-version v0.0.1
-create by ruicky
-detail url: https://github.com/ruicky/jd_sign_bot
- */
-const $ = new Env('京豆签到');
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-const exec = require('child_process').execSync
-const fs = require('fs')
-const download = require('download');
-let resultPath = "./result.txt";
-let JD_DailyBonusPath = "./JD_DailyBonus.js";
-let outPutUrl = './';
-let cookiesArr = [], cookie = '';
-
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-}
-!(async() => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- await requireConfig();
- // 下载最新代码
- await downFile();
- const content = await fs.readFileSync(JD_DailyBonusPath, 'utf8')
- for (let i =0; i < cookiesArr.length; i++) {
- cookie = cookiesArr[i];
- if (cookie) {
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.nickName = '';
- await TotalBean();
- console.log(`*****************开始京东账号${$.index} ${$.nickName || $.UserName}京豆签到*******************\n`);
- console.log(`⚠️⚠️⚠️⚠️目前Bark APP推送通知消息对推送内容长度有限制,如使用此推送方式脚本会默认转换成简洁内容推送 ⚠️⚠️⚠️⚠️\n`)
- await changeFile(content);
- await execSign();
- }
- }
-})()
- .catch((e) => $.logErr(e))
- .finally(() => $.done())
-async function execSign() {
- console.log(`\n开始执行脚本签到,请稍等`)
- try {
- if (notify.SCKEY || notify.BARK_PUSH || notify.DD_BOT_TOKEN || (notify.TG_BOT_TOKEN && notify.TG_USER_ID) || notify.IGOT_PUSH_KEY) {
- await exec(`${process.execPath} ${JD_DailyBonusPath} >> ${resultPath}`);
- const notifyContent = await fs.readFileSync(resultPath, "utf8");
- console.log(`👇👇👇👇👇👇👇👇👇👇👇LOG记录👇👇👇👇👇👇👇👇👇👇👇\n${notifyContent}\n👆👆👆👆👆👆👆👆👆LOG记录👆👆👆👆👆👆👆👆👆👆👆`);
- } else {
- // 如果没有提供通知推送,则打印日志
- console.log('没有提供通知推送,则打印脚本执行日志')
- await exec(`${process.execPath} ${JD_DailyBonusPath}`, { stdio: "inherit" });
- }
- // await exec("node JD_DailyBonus.js", { stdio: "inherit" });
- // console.log('执行完毕', new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleDateString())
- //发送通知
- if ($.isNode()) {
- let notifyContent = "";
- let BarkContent = '';
- if (fs.existsSync(resultPath)) {
- notifyContent = await fs.readFileSync(resultPath, "utf8");
- const barkContentStart = notifyContent.indexOf('【签到概览】')
- const barkContentEnd = notifyContent.length;
- if (process.env.JD_BEAN_SIGN_STOP_NOTIFY === 'true') return
- if (notify.BARK_PUSH) process.env.JD_BEAN_SIGN_NOTIFY_SIMPLE = 'true';
- if (process.env.JD_BEAN_SIGN_NOTIFY_SIMPLE === 'true') {
- if (barkContentStart > -1 && barkContentEnd > -1) {
- BarkContent = notifyContent.substring(barkContentStart, barkContentEnd);
- }
- BarkContent = BarkContent.split('\n\n')[0];
- } else {
- if (barkContentStart > -1 && barkContentEnd > -1) {
- BarkContent = notifyContent.substring(barkContentStart, barkContentEnd);
- }
- }
- }
- //不管哪个时区,这里得到的都是北京时间的时间戳;
- const UTC8 = new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000;
- $.beanSignTime = timeFormat(UTC8);
- console.log(`脚本执行完毕时间:${$.beanSignTime}`)
- if (BarkContent) {
- await notify.sendNotify(`京豆签到 - 账号${$.index} - ${$.nickName || $.UserName}`, `【签到号 ${$.index}】: ${$.nickName || $.UserName}\n【签到时间】: ${$.beanSignTime}\n${BarkContent}`);
- }
- }
- //运行完成后,删除下载的文件
- console.log('运行完成后,删除下载的文件\n')
- await deleteFile(resultPath);//删除result.txt
- await deleteFile(JD_DailyBonusPath);//删除JD_DailyBonus.js
- console.log(`*****************京东账号${$.index} ${$.nickName || $.UserName}京豆签到完成*******************\n`);
- } catch (e) {
- console.log("京东签到脚本执行异常:" + e);
- }
-}
-async function downFile () {
- let url = '';
- // if (process.env.CDN_JD_DAILYBONUS) {
- // url = 'https://cdn.jsdelivr.net/gh/NobyDa/Script@master/JD-DailyBonus/JD_DailyBonus.js';
- // } else if (process.env.JD_COOKIE) {
- // url = 'https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js';
- // } else {
- // url = 'https://cdn.jsdelivr.net/gh/NobyDa/Script@master/JD-DailyBonus/JD_DailyBonus.js';
- // }
- await downloadUrl();
- if ($.body) {
- url = 'https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js';
- } else {
- url = 'https://cdn.jsdelivr.net/gh/NobyDa/Script@master/JD-DailyBonus/JD_DailyBonus.js';
- }
- try {
- await download(url, outPutUrl);
- console.log('文件下载完毕');
- } catch (e) {
- console.log("文件下载异常:" + e);
- }
-}
-
-async function changeFile (content) {
- console.log(`开始替换变量`)
- let newContent = content.replace(/var Key = ''/, `var Key = '${cookie}'`);
- if (process.env.JD_BEAN_STOP && process.env.JD_BEAN_STOP !== '0') {
- newContent = newContent.replace(/var stop = 0/, `var stop = ${process.env.JD_BEAN_STOP * 1}`);
- }
- const zone = new Date().getTimezoneOffset();
- if (zone === 0) {
- //此处针对UTC-0时区用户做的
- newContent = newContent.replace(/tm\s=.*/, `tm = new Date(new Date().toLocaleDateString()).getTime() - 28800000;`);
- }
- try {
- await fs.writeFileSync(JD_DailyBonusPath, newContent, 'utf8');
- console.log('替换变量完毕');
- } catch (e) {
- console.log("京东签到写入文件异常:" + e);
- }
-}
-async function deleteFile(path) {
- // 查看文件result.txt是否存在,如果存在,先删除
- const fileExists = await fs.existsSync(path);
- // console.log('fileExists', fileExists);
- if (fileExists) {
- const unlinkRes = await fs.unlinkSync(path);
- // console.log('unlinkRes', unlinkRes)
- }
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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 downloadUrl(url = 'https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js') {
- return new Promise(resolve => {
- $.get({url}, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`检测到您不能访问外网,将使用CDN下载JD_DailyBonus.js文件`)
- } else {
- $.body = data;
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function requireConfig() {
- return new Promise(resolve => {
- const file = 'jd_bean_sign.js';
- fs.access(file, fs.constants.W_OK, (err) => {
- resultPath = err ? '/tmp/result.txt' : resultPath;
- JD_DailyBonusPath = err ? '/tmp/JD_DailyBonus.js' : JD_DailyBonusPath;
- outPutUrl = err ? '/tmp/' : outPutUrl;
- resolve()
- });
- })
-}
-function timeFormat(time) {
- let date;
- if (time) {
- date = new Date(time)
- } else {
- date = new Date();
- }
- 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,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{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=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"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 e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)}
diff --git a/jd_blueCoin.js b/jd_blueCoin.js
deleted file mode 100644
index 34a85a9..0000000
--- a/jd_blueCoin.js
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
-京小超兑换奖品 脚本地址:https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_blueCoin.js
-感谢@yangtingxiao提供PR
-更新时间:2020-11-23
-支持京东多个账号
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-======================quantumultx===============
-[task_local]
-#京小超兑换奖品
-0 0 0 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_blueCoin.js, tag=京小超兑换奖品, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jxc.png, enabled=true
-====================Loon=================
-[Script]
-cron "0 0 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_blueCoin.js,tag=京小超兑换奖品
-===================Surge==================
-京小超兑换奖品 = type=cron,cronexp="0 0 0 * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_blueCoin.js
- */
-const $ = new Env('京小超兑换奖品');
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-let coinToBeans = $.getdata('coinToBeans') || 20; //兑换多少数量的京豆(20或者1000),0表示不兑换,默认兑换20京豆,如需兑换把0改成20或者1000,或者'商品名称'(商品名称放到单引号内)即可
-let jdNotify = false;//是否开启静默运行,默认false关闭(即:奖品兑换成功后会发出通知提示)
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- cookiesArr.push($.getdata('CookieJD'));
- cookiesArr.push($.getdata('CookieJD2'));
-}
-
-const JD_API_HOST = `https://api.m.jd.com/api?appid=jdsupermarket`;
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i =0; i < cookiesArr.length; i++) {
- cookie = cookiesArr[i];
- if (cookie) {
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.data = {};
- $.coincount = 0;
- $.beanscount = 0;
- $.blueCost = 0;
- $.coinerr = "";
- $.beanerr = "";
- $.title = '';
- //console.log($.coincount);
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- console.log(`目前暂无兑换酒类的奖品功能,即使输入酒类名称,脚本也会提示下架\n`)
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- //先兑换京豆
- if ($.isNode()) {
- if (process.env.MARKET_COIN_TO_BEANS) {
- coinToBeans = process.env.MARKET_COIN_TO_BEANS;
- }
- }
- if (`${coinToBeans}` !== '0') {
- await smtgHome();//查询蓝币数量,是否满足兑换的条件
- await PrizeIndex();
- } else {
- console.log('查询到您设置的是不兑换京豆选项,现在为您跳过兑换京豆。如需兑换,请去BoxJs设置或者修改脚本coinToBeans\n')
- }
- await msgShow();
- }
- }
-})()
- .catch((e) => $.logErr(e))
- .finally(() => $.done())
-async function PrizeIndex() {
- await smtg_queryPrize();
- // await smtg_materialPrizeIndex();//兑换酒类奖品,此兑换API与之前的兑换京豆类的不一致,故目前无法进行
- // const prizeList = [...$.queryPrizeData, ...$.materialPrizeIndex];
- const prizeList = [...$.queryPrizeData];
- if (`${coinToBeans}` === '1000') {
- if (prizeList[1].beanType === 'BeanPackage') {
- console.log(`查询换${prizeList[1].title}ID成功,ID:${prizeList[1].prizeId}`)
- $.title = prizeList[1].title;
- $.blueCost = prizeList[1].blueCost;
- } else {
- console.log(`查询换1000京豆ID失败`)
- $.beanerr = `东哥今天不给换`;
- return ;
- }
- if (prizeList[1].inStock === 506) {
- $.beanerr = `失败,1000京豆领光了,请明天再来`;
- return ;
- }
- if (prizeList[1].targetNum === prizeList[1].finishNum) {
- $.beanerr = `${prizeList[1].subTitle}`;
- return ;
- }
- //兑换1000京豆
- if ($.totalBlue > $.blueCost) {
- await smtg_obtainPrize(prizeList[1].prizeId);
- } else {
- console.log(`兑换失败,您目前蓝币${$.totalBlue}个,不足以兑换${$.title}所需的${$.blueCost}个`);
- $.beanerr = `兑换失败,您目前蓝币${$.totalBlue}个,不足以兑换${$.title}所需的${$.blueCost}个`;
- }
- } else if (`${coinToBeans}` === '20') {
- if (prizeList[0].beanType === 'Bean') {
- console.log(`查询换${prizeList[0].title}ID成功,ID:${prizeList[0].prizeId}`)
- $.title = prizeList[0].title;
- $.blueCost = prizeList[0].blueCost;
- } else {
- console.log(`查询换万能的京豆ID失败`)
- $.beanerr = `东哥今天不给换`;
- return ;
- }
- if (prizeList[0].inStock === 506) {
- console.log(`失败,万能的京豆领光了,请明天再来`);
- $.beanerr = `失败,万能的京豆领光了,请明天再来`;
- return ;
- }
- if (prizeList[0].targetNum === prizeList[0].finishNum) {
- $.beanerr = `${prizeList[0].subTitle}`;
- return ;
- }
- //兑换万能的京豆(1-20京豆)
- if ($.totalBlue > $.blueCost) {
- await smtg_obtainPrize(prizeList[0].prizeId,1000);
- } else {
- console.log(`兑换失败,您目前蓝币${$.totalBlue}个,不足以兑换${$.title}所需的${$.blueCost}个`);
- $.beanerr = `兑换失败,您目前蓝币${$.totalBlue}个,不足以兑换${$.title}所需的${$.blueCost}个`;
- }
- } else {
- //自定义输入兑换
- let prizeId = '', i;
- for (let index = 0; index < prizeList.length; index ++) {
- if (prizeList[index].title.indexOf(coinToBeans) > -1) {
- prizeId = prizeList[index].prizeId;
- i = index;
- $.title = prizeList[index].title;
- $.blueCost = prizeList[index].blueCost;
- }
- }
- if (prizeId) {
- if (prizeList[i].inStock === 506 || prizeList[i].inStock === -1) {
- console.log(`失败,您输入设置的${coinToBeans}领光了,请明天再来`);
- $.beanerr = `失败,您输入设置的${coinToBeans}领光了,请明天再来`;
- return ;
- }
- if ((prizeList[i].targetNum) && prizeList[i].targetNum === prizeList[i].finishNum) {
- $.beanerr = `${prizeList[0].subTitle}`;
- return ;
- }
- if ($.totalBlue > $.blueCost) {
- await smtg_obtainPrize(prizeId);
- } else {
- console.log(`兑换失败,您目前蓝币${$.totalBlue}个,不足以兑换${$.title}所需的${$.blueCost}个`);
- $.beanerr = `兑换失败,您目前蓝币${$.totalBlue}个,不足以兑换${$.title}所需的${$.blueCost}个`;
- }
- } else {
- console.log(`奖品兑换列表[${coinToBeans}]已下架,请检查APP是否存在此商品,如存在请检查您的输入是否正确`);
- $.beanerr = `奖品兑换列表[${coinToBeans}]已下架`;
- }
- }
-}
-//查询白酒类奖品列表API
-function smtg_materialPrizeIndex(timeout = 0) {
- return new Promise((resolve) => {
- setTimeout( ()=>{
- let url = {
- url : `${JD_API_HOST}&functionId=smtg_materialPrizeIndex&clientVersion=8.0.0&client=m&body=%7B%22channel%22:%221%22%7D&t=${Date.now()}`,
- headers : {
- 'Origin' : `https://jdsupermarket.jd.com`,
- 'Cookie' : cookie,
- 'Connection' : `keep-alive`,
- 'Accept' : `application/json, text/plain, */*`,
- 'Referer' : `https://jdsupermarket.jd.com/game/?tt=1597540727225`,
- 'Host' : `api.m.jd.com`,
- 'Accept-Encoding' : `gzip, deflate, br`,
- 'Accept-Language' : `zh-cn`
- }
- }
- $.post(url, async (err, resp, data) => {
- try {
- if (safeGet(data)) {
- data = JSON.parse(data);
- if (data.data.bizCode !== 0) {
- $.beanerr = `${data.data.bizMsg}`;
- return
- }
- $.materialPrizeIndex = data.data.result.prizes || [];
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve()
- }
- })
- },timeout)
- })
-}
-//查询任务
-function smtg_queryPrize(timeout = 0){
- return new Promise((resolve) => {
- setTimeout( ()=>{
- let url = {
- url : `${JD_API_HOST}&functionId=smtg_queryPrize&clientVersion=8.0.0&client=m&body=%7B%7D&t=${Date.now()}`,
- headers : {
- 'Origin' : `https://jdsupermarket.jd.com`,
- 'Cookie' : cookie,
- 'Connection' : `keep-alive`,
- 'Accept' : `application/json, text/plain, */*`,
- 'Referer' : `https://jdsupermarket.jd.com/game/?tt=1597540727225`,
- 'Host' : `api.m.jd.com`,
- 'Accept-Encoding' : `gzip, deflate, br`,
- 'Accept-Language' : `zh-cn`
- }
- }
- $.post(url, async (err, resp, data) => {
- try {
- if (safeGet(data)) {
- data = JSON.parse(data);
- $.queryPrizeData = data;
- if (data.data.bizCode !== 0) {
- $.beanerr = `${data.data.bizMsg}`;
- return
- }
- if (data.data.bizCode === 0) {
- const { prizeList } = data.data.result;
- $.queryPrizeData = data.data.result.prizeList || [];
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve()
- }
- })
- },timeout)
- })
-}
-//换京豆
-function smtg_obtainPrize(prizeId, timeout = 0) {
- //1000京豆,prizeId为4401379726
- return new Promise((resolve) => {
- setTimeout( ()=>{
- let url = {
- url : `${JD_API_HOST}&functionId=smtg_obtainPrize&clientVersion=8.0.0&client=m&body=%7B%22prizeId%22:%22${prizeId}%22%7D&t=${Date.now()}`,
- headers : {
- 'Origin' : `https://jdsupermarket.jd.com`,
- 'Cookie' : cookie,
- 'Connection' : `keep-alive`,
- 'Accept' : `application/json, text/plain, */*`,
- 'Referer' : `https://jdsupermarket.jd.com/game/?tt=1597540727225`,
- 'Host' : `api.m.jd.com`,
- 'Accept-Encoding' : `gzip, deflate, br`,
- 'Accept-Language' : `zh-cn`
- }
- }
- $.post(url, async (err, resp, data) => {
- try {
- console.log(`兑换结果:${data}`);
- if (safeGet(data)) {
- data = JSON.parse(data);
- $.data = data;
- if ($.data.data.bizCode !== 0) {
- $.beanerr = `${$.data.data.bizMsg}`;
- //console.log(`【京东账号${$.index}】${$.nickName} 换取京豆失败:${$.data.data.bizMsg}`)
- return
- }
- if ($.data.data.bizCode === 0) {
- if (`${coinToBeans}` === '1000') {
- $.beanscount ++;
- console.log(`【京东账号${$.index}】${$.nickName} 第${$.data.data.result.exchangeNum}次换${$.title}成功`)
- if ($.beanscount === 1) return;
- } else if (`${coinToBeans}` === '20') {
- $.beanscount ++;
- console.log(`【京东账号${$.index}】${$.nickName} 第${$.data.data.result.exchangeNum}次换${$.title}成功`)
- if ($.data.data.result.exchangeNum === 20 || $.beanscount === coinToBeans || $.data.data.result.blue < 500) return;
- } else {
- $.beanscount ++;
- console.log(`【京东账号${$.index}】${$.nickName} 第${$.data.data.result.exchangeNum}次换${$.title}成功`)
- if ($.beanscount === 1) return;
- }
- }
- }
- await smtg_obtainPrize(prizeId,3000);
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve()
- }
- })
- },timeout)
- })
-}
-function smtgHome() {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_home'), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超兑换奖品: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- if (data.data.bizCode === 0) {
- const { result } = data.data;
- $.totalGold = result.totalGold;
- $.totalBlue = result.totalBlue;
- console.log(`【总金币】${$.totalGold}个\n`);
- console.log(`【总蓝币】${$.totalBlue}个\n`);
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve();
- }
- })
- })
-}
-
-//通知
-async function msgShow() {
- // $.msg($.name, ``, `【京东账号${$.index}】${$.nickName}\n【收取蓝币】${$.coincount ? `${$.coincount}个` : $.coinerr }${coinToBeans ? `\n【兑换京豆】${ $.beanscount ? `${$.beanscount}个` : $.beanerr}` : ""}`);
- $.log(`\n【京东账号${$.index}】${$.nickName}\n${coinToBeans ? `【兑换${$.title}】${$.beanscount ? `成功` : $.beanerr}` : "您设置的是不兑换奖品"}\n`);
- let ctrTemp;
- if ($.isNode() && process.env.MARKET_REWARD_NOTIFY) {
- ctrTemp = `${process.env.MARKET_REWARD_NOTIFY}` === 'false';
- } else if ($.getdata('jdSuperMarketRewardNotify')) {
- ctrTemp = $.getdata('jdSuperMarketRewardNotify') === 'false';
- } else {
- ctrTemp = `${jdNotify}` === 'false';
- }
- //默认只在兑换奖品成功后弹窗提醒。情况情况加,只打印日志,不弹窗
- if ($.beanscount && ctrTemp) {
- $.msg($.name, ``, `【京东账号${$.index}】${$.nickName}\n${coinToBeans ? `【兑换${$.title}】${ $.beanscount ? `成功,数量:${$.beanscount}个` : $.beanerr}` : "您设置的是不兑换奖品"}`);
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}】${$.UserName}\n${coinToBeans ? `【兑换${$.title}】${$.beanscount ? `成功,数量:${$.beanscount}个` : $.beanerr}` : "您设置的是不兑换奖品"}`)
- }
- }
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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 safeGet(data) {
- try {
- if (typeof JSON.parse(data) == "object") {
- return true;
- }
- } catch (e) {
- console.log(e);
- console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
- return false;
- }
-}
-function taskUrl(function_id, body = {}) {
- return {
- url: `${JD_API_HOST}&functionId=${function_id}&clientVersion=8.0.0&client=m&body=${escape(JSON.stringify(body))}&t=${Date.now()}`,
- headers: {
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- 'Host': 'api.m.jd.com',
- 'Cookie': cookie,
- 'Referer': 'https://jdsupermarket.jd.com/game',
- 'Origin': 'https://jdsupermarket.jd.com',
- }
- }
-}
-
-function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{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=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"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 e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)}
diff --git a/jd_club_lottery.js b/jd_club_lottery.js
deleted file mode 100644
index bf13da4..0000000
--- a/jd_club_lottery.js
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- * @Author: lxk0301
- * @Date: 2020-11-03 20:35:07
- * @Last Modified by: lxk0301
- * @Last Modified time: 2020-11-23 12:27:09
- 摇京豆(京东APP首页-领京豆-摇京豆)
- 更新时间:2020-10-12
- Modified from https://github.com/Zero-S1/JD_tools/blob/master/JD_vvipclub.py
- 已支持IOS双京东账号,Node.js支持N个京东账号
- 脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
- // QuantumultX
- [task_local]
- #摇京豆
- 5 0 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_club_lottery.js, tag=摇京豆, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdyjd.png, enabled=true
- //Loon
- [Script]
- cron "5 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_club_lottery.js,tag=摇京豆
- //Surge
- 摇京豆 = type=cron,cronexp="5 0 * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_club_lottery.js
- * */
-
-const $ = new Env('摇京豆');
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- cookiesArr.push($.getdata('CookieJD'));
- cookiesArr.push($.getdata('CookieJD2'));
-}
-const JD_API_HOST = 'https://api.m.jd.com/client.action';
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.freeTimes = 0;
- $.prizeBeanCount = 0;
- $.totalBeanCount = 0;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- await clubLottery();
- await showMsg();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-
-async function clubLottery() {
- await doTasks();//做任务
- await getFreeTimes();//获取摇奖次数
- await vvipclub_receive_lottery_times();//新版:领取一次免费的机会
- await vvipclub_shaking_info();//新版:查询多少次摇奖次数
- await shaking();//开始摇奖
-}
-async function doTasks() {
- const browseTaskRes = await getTask('browseTask');
- if (browseTaskRes.success) {
- const { totalPrizeTimes, currentFinishTimes, taskItems } = browseTaskRes.data[0];
- const taskTime = totalPrizeTimes - currentFinishTimes;
- if (taskTime > 0) {
- let taskID = [];
- taskItems.map(item => {
- if (!item.finish) {
- taskID.push(item.id);
- }
- });
- console.log(`开始做浏览页面任务`)
- for (let i = 0; i < new Array(taskTime).fill('').length; i++) {
- await $.wait(1000);
- await doTask('browseTask', taskID[i]);
- }
- }
- } else {
- console.log(`${JSON.stringify(browseTaskRes)}`)
- }
- const attentionTaskRes = await getTask('attentionTask');
- if (attentionTaskRes.success) {
- const { totalPrizeTimes, currentFinishTimes, taskItems } = attentionTaskRes.data[0];
- const taskTime = totalPrizeTimes - currentFinishTimes;
- if (taskTime > 0) {
- let taskID = [];
- taskItems.map(item => {
- if (!item.finish) {
- taskID.push(item.id);
- }
- });
- console.log(`开始做关注店铺任务`)
- for (let i = 0; i < new Array(taskTime).fill('').length; i++) {
- await $.wait(1000);
- await doTask('attentionTask', taskID[i].toString());
- }
- }
- }
-}
-async function shaking() {
- for (let i = 0; i < new Array($.leftShakingTimes).fill('').length; i++) {
- console.log(`开始新版-摇奖`)
- // await $.wait(500);
- const newShakeBeanRes = await vvipclub_shaking_lottery();
- if (newShakeBeanRes.success) {
- console.log(`新版-剩余摇奖次数:${newShakeBeanRes.data.remainLotteryTimes}`)
- if (newShakeBeanRes.data && newShakeBeanRes.data.rewardBeanAmount) {
- $.prizeBeanCount += newShakeBeanRes.data.rewardBeanAmount;
- console.log(`恭喜你,中奖了,获得${newShakeBeanRes.data.rewardBeanAmount}京豆\n`)
- } else {
- console.log(`未中奖\n`)
- }
- }
- }
- for (let i = 0; i < new Array($.freeTimes).fill('').length; i++) {
- console.log(`开始摇奖`)
- await $.wait(1000);
- const shakeBeanRes = await shakeBean();
- if (shakeBeanRes.success) {
- console.log(`剩余摇奖次数:${shakeBeanRes.data.luckyBox.freeTimes}`)
- if (shakeBeanRes.data && shakeBeanRes.data.prizeBean) {
- $.prizeBeanCount += shakeBeanRes.data.prizeBean.count;
- $.totalBeanCount = shakeBeanRes.data.luckyBox.totalBeanCount;
- }
- }
- }
-}
-function showMsg() {
- if ($.prizeBeanCount) {
- $.msg(`${$.name}`, `京东账号${$.index} ${$.nickName}`, `【获得】${$.prizeBeanCount}京豆\n【账号总计】${$.totalBeanCount}京豆`);
- }
-}
-//====================API接口=================
-//查询剩余摇奖次数API
-function vvipclub_shaking_info() {
- return new Promise(resolve => {
- const options = {
- url: `https://api.m.jd.com/?t=${Date.now()}&appid=sharkBean&functionId=vvipclub_shaking_info`,
- headers: {
- "accept": "application/json",
- "accept-encoding": "gzip, deflate, br",
- "accept-language": "zh-CN,zh;q=0.9",
- "cookie": cookie,
- "origin": "https://skuivip.jd.com",
- "referer": "https://skuivip.jd.com/",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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")
- }
- }
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- console.log(`\n${$.name}: API查询请求失败 ‼️‼️`)
- $.logErr(err);
- } else {
- // console.log(data)
- data = JSON.parse(data);
- if (data.success) {
- $.leftShakingTimes = data.data.leftShakingTimes;//剩余抽奖次数
- console.log(`新版——摇奖次数${$.leftShakingTimes}`);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//新版摇奖API
-function vvipclub_shaking_lottery() {
- return new Promise(resolve => {
- const options = {
- url: `https://api.m.jd.com/?t=${Date.now()}&appid=sharkBean&functionId=vvipclub_shaking_lottery&body=%7B%7D`,
- headers: {
- "accept": "application/json",
- "accept-encoding": "gzip, deflate, br",
- "accept-language": "zh-CN,zh;q=0.9",
- "cookie": cookie,
- "origin": "https://skuivip.jd.com",
- "referer": "https://skuivip.jd.com/",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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")
- }
- }
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- console.log(`\n${$.name}: API查询请求失败 ‼️‼️`)
- $.logErr(err);
- } else {
- // console.log(data)
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//领取新版本摇一摇一次免费的次数
-function vvipclub_receive_lottery_times() {
- return new Promise(resolve => {
- const options = {
- url: `https://api.m.jd.com/?t=${Date.now()}&appid=sharkBean&functionId=vvipclub_receive_lottery_times`,
- headers: {
- "accept": "application/json",
- "accept-encoding": "gzip, deflate, br",
- "accept-language": "zh-CN,zh;q=0.9",
- "cookie": cookie,
- "origin": "https://skuivip.jd.com",
- "referer": "https://skuivip.jd.com/",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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")
- }
- }
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- console.log(`\n${$.name}: API查询请求失败 ‼️‼️`)
- $.logErr(err);
- } else {
- // console.log(data)
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//查询多少次机会
-function getFreeTimes() {
- return new Promise(resolve => {
- $.get(taskUrl('vvipclub_luckyBox', { "info": "freeTimes" }), (err, resp, data) => {
- try {
- if (err) {
- console.log(`\n${$.name}: API查询请求失败 ‼️‼️`)
- $.logErr(err);
- } else {
- // console.log(data)
- data = JSON.parse(data);
- if (data.success) {
- $.freeTimes = data.data.freeTimes;
- console.log(`摇奖次数${$.freeTimes}`);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve();
- }
- })
- })
-}
-function getTask(info) {
- return new Promise(resolve => {
- $.get(taskUrl('vvipclub_lotteryTask', { info, "withItem": true }), (err, resp, data) => {
- try {
- if (err) {
- console.log(`\n${$.name}: API查询请求失败 ‼️‼️`)
- $.logErr(err);
- } else {
- // console.log(data)
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function doTask(taskName, taskItemId) {
- return new Promise(resolve => {
- $.get(taskUrl('vvipclub_doTask', { taskName, taskItemId }), (err, resp, data) => {
- try {
- if (err) {
- console.log(`\n${$.name}: API查询请求失败 ‼️‼️`)
- $.logErr(err);
- } else {
- // console.log(data)
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function shakeBean() {
- return new Promise(resolve => {
- $.get(taskUrl('vvipclub_shaking', { "type": '0' }), (err, resp, data) => {
- try {
- if (err) {
- console.log(`\n${$.name}: API查询请求失败 ‼️‼️`)
- $.logErr(err);
- } else {
- console.log(`摇奖结果:${data}`)
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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 taskUrl(function_id, body = {}, appId = 'vip_h5') {
- return {
- url: `${JD_API_HOST}?functionId=${function_id}&appid=${appId}&body=${escape(JSON.stringify(body))}&_=${Date.now()}`,
- headers: {
- 'Cookie': cookie,
- 'Host': 'api.m.jd.com',
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- 'Referer': 'https://vip.m.jd.com/newPage/reward/123dd/slideContent?page=focus',
- }
- }
-}
-// prettier-ignore
-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
diff --git a/jd_collectProduceScore.js b/jd_collectProduceScore.js
deleted file mode 100644
index b34f2c5..0000000
--- a/jd_collectProduceScore.js
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
-京东全民营业领金币
-仅仅是收集一下京东双十一全名营业每秒产生的金币
-
-每小时的第20分运行一次
-20 * * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_collectProduceScore.js
- */
-const $ = new Env('京东全民营业领金币');
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {
- };
-} else {
- cookiesArr.push($.getdata('CookieJD'));
- cookiesArr.push($.getdata('CookieJD2'));
-}
-let UserName = '';
-const JD_API_HOST = `https://api.m.jd.com/client.action`;
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- console.log(`\n小功能::仅仅是收集一下京东双十一全名营业每秒产生的金币,建议一个小时跑一次脚本\n`)
- for (let i = 0; i < cookiesArr.length; i++) {
- cookie = cookiesArr[i];
- if (cookie) {
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- await collectProduceScore()
- }
- }
-})()
- .catch((e) => $.logErr(e))
- .finally(() => $.done())
-
-async function collectProduceScore() {
- await getHomeData();
- if ($.secretp) {
- const temp = {
- "taskId": "collectProducedCoin",
- "rnd": getRnd(),
- "inviteId": "-1",
- "stealId": "-1"
- }
- const extraData = {
- "jj": 6,
- "buttonid": "jmdd-react-smash_0",
- "sceneid": "homePageh5",
- "appid": '50073'
- }
- const body = encode(temp, $.secretp, extraData);
- await stall_collectProduceScore(body);
- }
-}
-function stall_collectProduceScore(body) {
- return new Promise((resolve) => {
- $.post(taskPostUrl('stall_collectProduceScore', body), (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- data = JSON.parse(data);
- if (data && data.data.bizCode === 0) {
- console.log(`京东账号${$.index} ${$.UserName}成功收集金币:${data.data.result.produceScore}个`)
- } else {
- console.log(`京东账号${$.index} ${$.UserName}成功收集金币失败:${data.data.bizMsg}`)
- }
- } else {
- console.log(`请检查自身设备原因`);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve();
- }
- })
- })
-}
-function getHomeData() {
- return new Promise((resolve) => {
- $.post(taskPostUrl('stall_getHomeData'), (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- data = JSON.parse(data);
- if (data && data.data['bizCode'] === 0) {
- $.secretp = data.data.result.homeMainInfo.secretp;
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve();
- }
- })
- })
-}
-function encode(data, aa, extraData) {
- const temp = {
- "extraData": JSON.stringify(extraData),
- "businessData": JSON.stringify(data),
- "secretp": aa,
- }
- return { "ss": (JSON.stringify(temp)) };
-}
-function getRnd() {
- return Math.floor(1e6 * Math.random()).toString();
-}
-function taskPostUrl(functionId, body = {}) {
- return {
- url: `${JD_API_HOST}?functionId=${functionId}`,
- body: `functionId=${functionId}&body=${escape(JSON.stringify(body))}&client=wh5&clientVersion=1.0.0`,
- headers: {
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Host': 'api.m.jd.com',
- 'Cookie': cookie,
- 'Origin': 'https://wbbny.m.jd.com',
- 'Referer': 'https://wbbny.m.jd.com/babelDiy/Zeus/4SJUHwGdUQYgg94PFzjZZbGZRjDd/index.html',
- }
- }
-}
-function Env(t, s) { return new class { constructor(t, s) { this.name = t, this.data = null, this.dataFile = "box.dat", this.logs = [], this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, s), 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 } getScript(t) { return new Promise(s => { $.get({ url: t }, (t, e, i) => s(i)) }) } runScript(t, s) { return new Promise(e => { 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 = s && s.timeout ? s.timeout : o; const [h, a] = i.split("@"), r = { url: `http://${a}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: o }, headers: { "X-Key": h, Accept: "*/*" } }; $.post(r, (t, s, i) => e(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), s = this.path.resolve(process.cwd(), this.dataFile), e = this.fs.existsSync(t), i = !e && this.fs.existsSync(s); if (!e && !i) return {}; { const i = e ? t : s; 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), s = this.path.resolve(process.cwd(), this.dataFile), e = this.fs.existsSync(t), i = !e && this.fs.existsSync(s), o = JSON.stringify(this.data); e ? this.fs.writeFileSync(t, o) : i ? this.fs.writeFileSync(s, o) : this.fs.writeFileSync(t, o) } } lodash_get(t, s, e) { const i = s.replace(/\[(\d+)\]/g, ".$1").split("."); let o = t; for (const t of i) if (o = Object(o)[t], void 0 === o) return e; return o } lodash_set(t, s, e) { return Object(t) !== t ? t : (Array.isArray(s) || (s = s.toString().match(/[^.[\]]+/g) || []), s.slice(0, -1).reduce((t, e, i) => Object(t[e]) === t[e] ? t[e] : t[e] = Math.abs(s[i + 1]) >> 0 == +s[i + 1] ? [] : {}, t)[s[s.length - 1]] = e, t) } getdata(t) { let s = this.getval(t); if (/^@/.test(t)) { const [, e, i] = /^@(.*?)\.(.*?)$/.exec(t), o = e ? this.getval(e) : ""; if (o) try { const t = JSON.parse(o); s = t ? this.lodash_get(t, i, "") : s } catch (t) { s = "" } } return s } setdata(t, s) { let e = !1; if (/^@/.test(s)) { const [, i, o] = /^@(.*?)\.(.*?)$/.exec(s), h = this.getval(i), a = i ? "null" === h ? null : h || "{}" : "{}"; try { const s = JSON.parse(a); this.lodash_set(s, o, t), e = this.setval(JSON.stringify(s), i) } catch (s) { const h = {}; this.lodash_set(h, o, t), e = this.setval(JSON.stringify(h), i) } } else e = $.setval(t, s); return e } 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, s) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, s) : this.isQuanX() ? $prefs.setValueForKey(t, s) : this.isNode() ? (this.data = this.loaddata(), this.data[s] = t, this.writedata(), !0) : this.data && this.data[s] || 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, s = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? $httpClient.get(t, (t, e, i) => { !t && e && (e.body = i, e.statusCode = e.status), s(t, e, i) }) : this.isQuanX() ? $task.fetch(t).then(t => { const { statusCode: e, statusCode: i, headers: o, body: h } = t; s(null, { status: e, statusCode: i, headers: o, body: h }, h) }, t => s(t)) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, s) => { try { const e = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(e, null), s.cookieJar = this.ckjar } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: e, statusCode: i, headers: o, body: h } = t; s(null, { status: e, statusCode: i, headers: o, body: h }, h) }, t => s(t))) } post(t, s = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) $httpClient.post(t, (t, e, i) => { !t && e && (e.body = i, e.statusCode = e.status), s(t, e, i) }); else if (this.isQuanX()) t.method = "POST", $task.fetch(t).then(t => { const { statusCode: e, statusCode: i, headers: o, body: h } = t; s(null, { status: e, statusCode: i, headers: o, body: h }, h) }, t => s(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: e, ...i } = t; this.got.post(e, i).then(t => { const { statusCode: e, statusCode: i, headers: o, body: h } = t; s(null, { status: e, statusCode: i, headers: o, body: h }, h) }, t => s(t)) } } time(t) { let s = { "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 e in s) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? s[e] : ("00" + s[e]).substr(("" + s[e]).length))); return t } msg(s = t, e = "", i = "", o) { const h = t => !t || !this.isLoon() && this.isSurge() ? t : "string" == typeof t ? this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : void 0 : "object" == typeof t && (t["open-url"] || t["media-url"]) ? this.isLoon() ? t["open-url"] : this.isQuanX() ? t : void 0 : void 0; this.isSurge() || this.isLoon() ? $notification.post(s, e, i, h(o)) : this.isQuanX() && $notify(s, e, i, h(o)), this.logs.push("", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="), this.logs.push(s), e && this.logs.push(e), i && this.logs.push(i) } log(...t) { t.length > 0 ? this.logs = [...this.logs, ...t] : console.log(this.logs.join(this.logSeparator)) } logErr(t, s) { const e = !this.isSurge() && !this.isQuanX() && !this.isLoon(); e ? $.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : $.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) } wait(t) { return new Promise(s => setTimeout(s, t)) } done(t = {}) { const s = (new Date).getTime(), e = (s - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, s) }
\ No newline at end of file
diff --git a/jd_daily_egg.js b/jd_daily_egg.js
deleted file mode 100644
index b19ac6b..0000000
--- a/jd_daily_egg.js
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * @Author: lxk0301 https://github.com/lxk0301
- * @Date: 2020-11-10 14:10:27
- * @Last Modified by: lxk0301
- * @Last Modified time: 2020-11-20 14:11:01
- */
-/*
-京东金融-天天提鹅
-定时收鹅蛋,兑换金币
-先这样子吧
- */
-//0 */3 * * *
-const $ = new Env('天天提鹅');
-let cookiesArr = [], cookie = '';
-const JD_API_HOST = 'https://ms.jr.jd.com/gw/generic/uc/h5/m';
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- cookiesArr.push(...[$.getdata('CookieJD'), $.getdata('CookieJD2')])
-}
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n***********开始【京东账号${$.index}】${$.nickName || $.UserName}********\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- await jdDailyEgg();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-async function jdDailyEgg() {
- await toDailyHome()
- await toWithdraw()
- await toGoldExchange();
-}
-function toGoldExchange() {
- return new Promise(async resolve => {
- const body = {
- "timeSign": 0,
- "environment": "jrApp",
- "riskDeviceInfo": "{}"
- }
- $.post(taskUrl('toGoldExchange', body), (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- // console.log(data)
- data = JSON.parse(data);
- if (data.resultCode === 0) {
- if (data.resultData.code === '0000') {
- console.log(`兑换金币:${data.resultData.data.cnumber}`);
- console.log(`当前总金币:${data.resultData.data.goldTotal}`);
- } else if (data.resultData.code !== '0000') {
- console.log(`兑换金币失败:${data.resultData.msg}`)
- }
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function toWithdraw() {
- return new Promise(async resolve => {
- const body = {
- "timeSign": 0,
- "environment": "jrApp",
- "riskDeviceInfo": "{}"
- }
- $.post(taskUrl('toWithdraw', body), (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- // console.log(data)
- data = JSON.parse(data);
- if (data.resultCode === 0) {
- if (data.resultData.code === '0000') {
- console.log(`收取鹅蛋:${data.resultData.data.eggTotal}个成功`);
- console.log(`当前总鹅蛋数量:${data.resultData.data.userLevelDto.userHaveEggNum}`);
- } else if (data.resultData.code !== '0000') {
- console.log(`收取鹅蛋失败:${data.resultData.msg}`)
- }
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function toDailyHome() {
- return new Promise(async resolve => {
- const body = {
- "timeSign": 0,
- "environment": "jrApp",
- "riskDeviceInfo": "{}"
- }
- $.post(taskUrl('toDailyHome', body), (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- // console.log(data)
- data = JSON.parse(data);
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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 taskUrl(function_id, body) {
- return {
- url: `${JD_API_HOST}/${function_id}`,
- body: `reqData=${encodeURIComponent(JSON.stringify(body))}`,
- headers: {
- 'Accept' : `application/json`,
- 'Origin' : `https://uua.jr.jd.com`,
- 'Accept-Encoding' : `gzip, deflate, br`,
- 'Cookie' : cookie,
- 'Content-Type' : `application/x-www-form-urlencoded;charset=UTF-8`,
- 'Host' : `ms.jr.jd.com`,
- 'Connection' : `keep-alive`,
- 'User-Agent' : $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- 'Referer' : `https://uua.jr.jd.com/uc-fe-wxgrowing/moneytree/index`,
- 'Accept-Language' : `zh-cn`
- }
- }
-}
-// prettier-ignore
-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
diff --git a/jd_dreamFactory.js b/jd_dreamFactory.js
deleted file mode 100644
index b799618..0000000
--- a/jd_dreamFactory.js
+++ /dev/null
@@ -1,886 +0,0 @@
-/*
-京东京喜工厂
-活动入口 :京东APP->游戏与互动->查看更多->京喜工厂
-或者: 京东APP首页搜索 "玩一玩" ,造物工厂即可
-
-
-已支持IOS双京东账号,Node.js支持N个京东账号
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-============Quantumultx===============
-[task_local]
-#京喜工厂
-10 * * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_dreamFactory.js, tag=京喜工厂, enabled=true
-
-================Loon==============
-[Script]
-cron "10 * * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_dreamFactory.js,tag=京喜工厂
-
-===============Surge=================
-京喜工厂 = type=cron,cronexp="10 * * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_dreamFactory.js
-
-============小火箭=========
-京喜工厂 = type=cron,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_dreamFactory.js, cronexpr="10 * * * *", timeout=200, enable=true
-
- */
-
-
-const $ = new Env('京喜工厂');
-const JD_API_HOST = 'https://m.jingxi.com';
-
-let ele, factoryId, productionId;
-
-let message = '', subTitle = '', option = {};
-const notify = $.isNode() ? require('./sendNotify') : '';
-let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送
-
-let cookiesArr = [], cookie = '';
-const inviteCodes = ['V5LkjP4WRyjeCKR9VRwcRX0bBuTz7MEK0-E99EJ7u0k='];
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {
- };
-} else {
- cookiesArr.push(...[$.getdata('CookieJD'), $.getdata('CookieJD2')])
-}
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n***********开始【京东账号${$.index}】${$.nickName || $.UserName}********\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : ""}`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- message = '';
- subTitle = '';
- goodsUrl = '';
- taskInfoKey = [];
- option = {};
- await jdDreamFactory();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-
-
-async function jdDreamFactory() {
- ele = 0;
- await userInfo();
- await helpFriends(inviteCodes)
- if ($.unActive) return
- await getUserElectricity();
- await taskList();
- await investElectric();
- // await assistFriend('gB99tYLjvPcEFloDgamoBw==');
- await hireAward();
- await stealFriend();
- await showMsg();
-}
-
-
-// 收取发电机的电力
-function collectElectricity(facId = factoryId, help = false, master) {
- return new Promise(async resolve => {
- let url = `/dreamfactory/generator/CollectCurrentElectricity?zone=dream_factory&apptoken=&pgtimestamp=&phoneID=&factoryid=${facId}&doubleflag=1&sceneval=2&g_login_type=1`;
- if (help && master) {
- url = `/dreamfactory/generator/CollectCurrentElectricity?zone=dream_factory&factoryid=${facId}&master=${master}&sceneval=2&g_login_type=1`;
- }
- $.get(taskurl(url), (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- data = JSON.parse(data);
- if (data['ret'] === 0) {
- if (help) {
- ele += Number(data.data['loginPinCollectElectricity'])
- console.log(`帮助好友收取 ${data.data['CollectElectricity']} 电力,获得 ${data.data['loginPinCollectElectricity']} 电力`);
- message += `【帮助好友】帮助成功,获得 ${data.data['loginPinCollectElectricity']} 电力\n`
- } else {
-
- ele += Number(data.data['CollectElectricity'])
- console.log(`收取 ${data.data['loginPinCollectElectricity']} 电力`);
- message += `【收取发电站】收取成功,获得 ${data.data['CollectElectricity']} 电力\n`
- }
-
- } else {
- console.log(data.msg)
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-
-// 投入电力
-function investElectric() {
- return new Promise(async resolve => {
- const url = `/dreamfactory/userinfo/InvestElectric?zone=dream_factory&productionId=${productionId}&sceneval=2&g_login_type=1`;
- $.get(taskurl(url), (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- // console.log(data)
- data = JSON.parse(data);
- if (data.ret === 0) {
- console.log(`成功投入电力${data.data.investElectric}电力`);
- message += `【投入电力】投入成功,共计 ${data.data.investElectric} 电力\n`;
- } else {
- console.log(`投入失败,${data.msg}`);
- message += `【投入电力】投入失败,${data.msg}\n`;
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-
-// 初始化任务
-function taskList() {
- return new Promise(async resolve => {
- const url = `/newtasksys/newtasksys_front/GetUserTaskStatusList?source=dreamfactory&bizCode=dream_factory&sceneval=2&g_login_type=1`;
- $.get(taskurl(url), async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- // console.log(data)
- data = JSON.parse(data);
- let userTaskStatusList = data['data']['userTaskStatusList'];
- for (let i = 0; i < userTaskStatusList.length; ++i) {
- const vo = userTaskStatusList[i];
- if (vo['awardStatus'] !== 1) {
- if (vo.completedTimes >= vo.targetTimes) {
- console.log(`任务:${vo.description}可完成`)
- await completeTask(vo.taskId, vo.taskName)
- await $.wait(1000);//延迟等待一秒
- } else {
- switch (vo.taskType) {
- case 2: // 逛一逛任务
- case 6: // 浏览商品任务
- case 9: // 开宝箱
- for (let i = vo.completedTimes; i <= vo.configTargetTimes; ++i) {
- console.log(`去做任务:${vo.taskName}`)
- await doTask(vo.taskId)
- await completeTask(vo.taskId, vo.taskName)
- await $.wait(1000);//延迟等待一秒
- }
- break
- case 4: // 招工
- break
- case 5:
- // 收集类
- break
- case 1: // 登陆领奖
- default:
- break
- }
- }
- }
- }
- console.log(`完成任务:共领取${ele}电力`)
- message += `【每日任务】领奖成功,共计 ${ele} 电力\n`;
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-
-// 获得用户电力情况
-function getUserElectricity() {
- return new Promise(async resolve => {
- const url = `/dreamfactory/generator/QueryCurrentElectricityQuantity?zone=dream_factory&factoryid=${factoryId}&sceneval=2&g_login_type=1`
- $.get(taskurl(url), async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- // console.log(data)
- data = JSON.parse(data);
- if (data['ret'] === 0) {
- console.log(`发电机:当前 ${data.data.currentElectricityQuantity} 电力,最大值 ${data.data.maxElectricityQuantity} 电力`)
- if (data.data.currentElectricityQuantity === data.data.maxElectricityQuantity
- && data.data.doubleElectricityFlag) {
- console.log(`发电机:电力可翻倍并收获`)
- await collectElectricity()
- } else {
- message += `【发电机电力】当前 ${data.data.currentElectricityQuantity} 电力,未达到收获标准\n`
- }
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-
-// 收取招工电力
-function hireAward() {
- return new Promise(async resolve => {
- const url = `/dreamfactory/friend/HireAward?zone=dream_factory&date=${new Date().Format("yyyyMMdd")}&type=0&sceneval=2&g_login_type=1`
- $.get(taskurl(url), async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- data = JSON.parse(data);
- if (data['ret'] === 0) {
- console.log(`打工电力:收取成功`)
- message += `【打工电力】:收取成功\n`
- } else {
- console.log(`打工电力:收取失败,${data.msg}`)
- message += `【打工电力】收取失败,${data.msg}\n`
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-async function helpFriends(codes) {
- for (let code of codes) {
- if (code) {
- await assistFriend(code);
- }
- }
-}
-// 帮助用户
-function assistFriend(sharepin) {
-
- return new Promise(async resolve => {
- const url = `/dreamfactory/friend/AssistFriend?zone=dream_factory&sharepin=${escape(sharepin)}&sceneval=2&g_login_type=1`
- $.get(taskurl(url), async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- data = JSON.parse(data);
- if (data['ret'] === 0) {
- console.log(`助力朋友:${sharepin}成功`)
- } else {
- console.log(`助力朋友[${sharepin}]失败:${data.msg}`)
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-
-// 任务领奖
-function completeTask(taskId, taskName) {
- return new Promise(async resolve => {
- const url = `/newtasksys/newtasksys_front/Award?source=dreamfactory&bizCode=dream_factory&taskId=${taskId}&sceneval=2&g_login_type=1`;
- $.get(taskurl(url), (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- // console.log(data)
- data = JSON.parse(data);
- switch (data['data']['awardStatus']) {
- case 1:
- ele += Number(data['data']['prizeInfo'].replace('\\n', ''))
- console.log(`领取${taskName}任务奖励成功,收获:${Number(data['data']['prizeInfo'].replace('\\n', ''))}电力`);
- break
- case 1013:
- case 0:
- console.log(`领取${taskName}任务奖励失败,任务已领奖`);
- break
- default:
- console.log(`领取${taskName}任务奖励失败,${data['msg']}`)
- break
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-
-// 完成任务
-function doTask(taskId) {
- return new Promise(async resolve => {
- const url = `/newtasksys/newtasksys_front/DoTask?source=dreamfactory&bizCode=dream_factory&taskId=${taskId}&sceneval=2&g_login_type=1`;
- $.get(taskurl(url), (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- // console.log(data)
- data = JSON.parse(data);
- if (data.ret === 0) {
- console.log("做任务完成!")
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-
-// 初始化个人信息
-function userInfo() {
- return new Promise(async resolve => {
- const url = `/dreamfactory/userinfo/GetUserInfo?zone=dream_factory&pin=&sharePin=&shareType=&materialTuanPin=&materialTuanId=&sceneval=2`;
- $.get(taskurl(url), async (err, resp, data) => {
- data = JSON.parse(data);
- if (data['ret'] === 0) {
- data = data['data'];
- if (data.factoryList && data.productionList) {
- const production = data.productionList[0];
- const factory = data.factoryList[0];
- factoryId = factory.factoryId;//工厂ID
- productionId = production.productionId;//商品ID
- subTitle = data.user.pin;
- await GetCommodityDetails(production.commodityDimId);
- await DrawProductionStagePrize(productionId);
- console.log(`当前电力:${data.user.electric}`)
- console.log(`分享码: ${data.user.encryptPin}`);
- console.log(`生产进度:${(production.investedElectric / production.needElectric).toFixed(2) * 100}%`);
- message += `【京东账号${$.index}】${$.nickName}\n`
- message += `【生产商品】${$.productName}\n`;
- message += `【生产进度】${((production.investedElectric / production.needElectric) * 100).toFixed(2)}%\n`;
- if (production.investedElectric >= production.needElectric) {
- $.msg($.name, ``, `【京东账号${$.index}】${$.nickName}\n【生产商品】${$.productName}\n已生产完,请速去兑换`, {'open-url': 'openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://wqsd.jd.com/pingou/dream_factory/index.html%22%20%7D'})
- await notify.sendNotify(`${$.name} - 京东账号${$.index} - ${$.nickName}`, `【京东账号${$.index}】${$.nickName}\n【生产商品】${$.productName}\n已生产完,请速去兑换`)
- }
- } else {
- $.unActive = true;//标记是否开启了京喜活动或者选购了商品进行生产
- if (!data.factoryList) {
- console.log('【提示】此账号京喜工厂活动未开始\n请手动去京东APP->游戏与互动->查看更多->京喜工厂 开启活动\n');
- $.msg($.name, '', `【提示】此账号[${$.nickName}]京喜工厂活动未开始\n请手动去京东APP->游戏与互动->查看更多->京喜工厂 开启活动`);
- } else if (data.factoryList && !data.productionList) {
- console.log(`【提示】此账号京喜工厂未选购商品\n请手动去京东APP->游戏与互动->查看更多->京喜工厂 选购\n`)
- $.msg($.name, '', `【提示】此账号[${$.nickName}]京喜工厂未选择商品\n请手动去京东APP->游戏与互动->查看更多->京喜工厂 选择商品`);
- }
- }
- }
- resolve()
- })
- })
-}
-//查询当前生产的商品名称
-function GetCommodityDetails(commodityDimId) {
- return new Promise(async resolve => {
- const url = `/dreamfactory/diminfo/GetCommodityDetails?zone=dream_factory&sceneval=2&g_login_type=1&commodityId=${commodityDimId}`;
- $.get(taskurl(url), (err, resp, data) => {
- data = JSON.parse(data);
- if (data['ret'] === 0) {
- data = data['data'];
- $.productName = data['commodityList'][0].name;
- }
- resolve()
- })
- })
-}
-//领取红包
-function DrawProductionStagePrize(productionId) {
- return new Promise(async resolve => {
- const url = `/dreamfactory/userinfo/DrawProductionStagePrize?zone=dream_factory&sceneval=2&g_login_type=1&productionId=${productionId}`;
- $.get(taskurl(url), (err, resp, data) => {
- console.log(`领取红包(测试中)结果:${data}`)
- data = JSON.parse(data);
- if (data['ret'] === 0) {
- // data = data['data'];
- // $.productName = data['commodityList'][0].name;
- }
- resolve()
- })
- })
-}
-function stealFriend() {
- return new Promise(async resolve => {
- const url = `//dreamfactory/friend/QueryFactoryManagerList?zone=dream_factory&sceneval=2`;
- $.get(taskurl(url), async (err, resp, data) => {
- data = JSON.parse(data);
- if (data['ret'] === 0) {
- data = data['data'];
- for (let i = 0; i < data.list.length; ++i) {
- let pin = data.list[i]['encryptPin'];
- const facId = await getFactoryIdByPin(pin);
- if (facId) await collectElectricity(facId,true, data.list[i]['key'])
- }
- }
- resolve()
- })
- })
-}
-
-function getFactoryIdByPin(pin) {
- return new Promise((resolve, reject) => {
- const url = `/dreamfactory/userinfo/GetUserInfoByPin?zone=dream_factory&pin=${pin}&sceneval=2`;
- $.get(taskurl(url), (err, resp, data) => {
- data = JSON.parse(data);
- if (data['ret'] === 0) {
- if (data.data.factoryList) {
- //做此判断,有时候返回factoryList为null
- resolve(data['data']['factoryList'][0]['factoryId'])
- } else {
- resolve();
- }
- } else {
- reject()
- }
- })
- })
-}
-
-async function showMsg() {
- let ctrTemp;
- if ($.isNode() && process.env.DREAMFACTORY_NOTIFY_CONTROL) {
- ctrTemp = `${process.env.DREAMFACTORY_NOTIFY_CONTROL}` === 'false';
- } else if ($.getdata('jdDreamFactory')) {
- ctrTemp = $.getdata('jdDreamFactory') === 'false';
- } else {
- ctrTemp = `${jdNotify}` === 'false';
- }
- if (ctrTemp) {
- $.msg($.name, subTitle, message, option);
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `${subTitle}\n${message}`);
- }
- } else {
- $.log(`\n${message}\n`);
- }
-}
-
-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": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1"
- }
- }
- $.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();
- }
- })
- })
-}
-
-// 生成url
-function taskurl(url, body) {
- return {
- url: `${JD_API_HOST}${url}`,
- headers: {
- 'Cookie': cookie,
- 'Host': 'm.jingxi.com',
- 'Accept': '*/*',
- 'Connection': 'keep-alive',
- 'User-Agent': 'jdpingou;iPhone;3.14.4;14.0;ae75259f6ca8378672006fc41079cd8c90c53be8;network/wifi;model/iPhone10,2;appBuild/100351;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/1;hasOCPay/0;supportBestPay/0;session/62;pap/JA2015_311210;brand/apple;supportJDSHWK/1;Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148',
- 'Accept-Language': 'zh-cn',
- 'Referer': 'https://wqsd.jd.com/pingou/dream_factory/index.html',
- 'Accept-Encoding': 'gzip, deflate, br',
- }
- }
-}
-
-Date.prototype.Format = function (fmt) { //author: meizz
- var o = {
- "M+": this.getMonth() + 1, //月份
- "d+": this.getDate(), //日
- "h+": this.getHours(), //小时
- "m+": this.getMinutes(), //分
- "s+": this.getSeconds(), //秒
- "q+": Math.floor((this.getMonth() + 3) / 3), //季度
- "S": this.getMilliseconds() //毫秒
- };
- if (/(y+)/.test(fmt))
- fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
- for (var k in o)
- if (new RegExp("(" + k + ")").test(fmt))
- fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
- return fmt;
-}
-
-// prettier-ignore
-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)
-}
diff --git a/jd_fruit.js b/jd_fruit.js
deleted file mode 100644
index effe09f..0000000
--- a/jd_fruit.js
+++ /dev/null
@@ -1,1404 +0,0 @@
-/*
-东东水果:脚本更新地址 https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_fruit.js
-更新时间:2020-11-17
-东东农场活动链接:https://h5.m.jd.com/babelDiy/Zeus/3KSjXqQabiTuD1cJ28QskrpWoBKT/index.html
-已支持IOS双京东账号,Node.js支持N个京东账号
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-互助码shareCode请先手动运行脚本查看打印可看到
-一天只能帮助4个人。多出的助力码无效
-==========================Quantumultx=========================
-[task_local]
-#jd免费水果
-5 6-18/6 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_fruit.js, tag=东东农场, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdnc.png, enabled=true
-=========================Loon=============================
-[Script]
-cron "5 6-18/6 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_fruit.js,tag=东东农场
-
-=========================Surge============================
-东东农场 = type=cron,cronexp="5 6-18/6 * * *",wake-system=1,timeout=120,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_fruit.js
-
-=========================小火箭===========================
-东东农场 = type=cron,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_fruit.js, cronexpr="5 6-18/6 * * *", timeout=200, enable=true
-
-jd免费水果 搬的https://github.com/liuxiaoyucc/jd-helper/blob/a6f275d9785748014fc6cca821e58427162e9336/fruit/fruit.js
-*/
-const $ = new Env('东东农场');
-let cookiesArr = [], cookie = '', jdFruitShareArr = [], isBox = false, notify, newShareCodes;
-//助力好友分享码(最多4个,否则后面的助力失败),原因:京东农场每人每天只有四次助力机会
-//此此内容是IOS用户下载脚本到本地使用,填写互助码的地方,同一京东账号的好友互助码请使用@符号隔开。
-//下面给出两个账号的填写示例(iOS只支持2个京东账号)
-let shareCodes = [ // 这个列表填入你要助力的好友的shareCode
- //账号一的好友shareCode,不同好友的shareCode中间用@符号隔开
- '0a74407df5df4fa99672a037eec61f7e@dbb21614667246fabcfd9685b6f448f3@6fbd26cc27ac44d6a7fed34092453f77@61ff5c624949454aa88561f2cd721bf6',
- //账号二的好友shareCode,不同好友的shareCode中间用@符号隔开
- 'b1638a774d054a05a30a17d3b4d364b8@f92cb56c6a1349f5a35f0372aa041ea0@9c52670d52ad4e1a812f894563c746ea@8175509d82504e96828afc8b1bbb9cb3',
-]
-let message = '', subTitle = '', option = {}, isFruitFinished = false;
-const retainWater = 100;//保留水滴大于多少g,默认100g;
-let jdNotify = false;//是否关闭通知,false打开通知推送,true关闭通知推送
-let jdFruitBeanCard = false;//农场使用水滴换豆卡(如果出现限时活动时100g水换20豆,此时比浇水划算,推荐换豆),true表示换豆(不浇水),false表示不换豆(继续浇水),脚本默认是浇水
-let randomCount = $.isNode() ? 20 : 5;
-const JD_API_HOST = 'https://api.m.jd.com/client.action';
-const urlSchema = `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/3KSjXqQabiTuD1cJ28QskrpWoBKT/index.html%22%20%7D`;
-!(async () => {
- await requireConfig();
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- message = '';
- subTitle = '';
- option = {};
- await shareCodesFormat();
- await jdFruit();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-async function jdFruit() {
- await initForFarm();
- if ($.farmInfo.farmUserPro) {
- // option['media-url'] = $.farmInfo.farmUserPro.goodsImage;
- subTitle = `【京东账号${$.index}】${$.nickName}`;
- message = `【水果名称】${$.farmInfo.farmUserPro.name}\n`;
- console.log(`\n【您的互助码shareCode】 ${$.farmInfo.farmUserPro.shareCode}\n`);
- console.log(`\n【已成功兑换水果】${$.farmInfo.farmUserPro.winTimes}次\n`);
- message += `【已兑换水果】${$.farmInfo.farmUserPro.winTimes}次\n`;
- await masterHelpShare();//助力好友
- if ($.farmInfo.treeState === 2 || $.farmInfo.treeState === 3) {
- option['open-url'] = urlSchema;
- $.msg($.name, ``, `【京东账号${$.index}】${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去京东APP或微信小程序查看\n点击弹窗即达`, option);
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}水果已可领取`, `【京东账号${$.index}】${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去京东APP或微信小程序查看`);
- }
- return
- } else if ($.farmInfo.treeState === 1){
- console.log(`\n${$.farmInfo.farmUserPro.name}种植中...\n`)
- } else if ($.farmInfo.treeState === 0) {
- //已下单购买, 但未开始种植新的水果
- option['open-url'] = urlSchema;
- $.msg($.name, ``, `【京东账号${$.index}】 ${$.nickName || $.UserName}\n【提醒⏰】您忘了种植新的水果\n请去京东APP或微信小程序选购并种植新的水果\n点击弹窗即达`, option);
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 您忘了种植新的水果`, `京东账号${$.index} ${$.nickName}\n【提醒⏰】您忘了种植新的水果\n请去京东APP或微信小程序选购并种植新的水果`);
- }
- return
- }
- await doDailyTask();
- await doTenWater();//浇水十次
- await getFirstWaterAward();//领取首次浇水奖励
- await getTenWaterAward();//领取10浇水奖励
- await getWaterFriendGotAward();//领取为2好友浇水奖励
- await duck();
- await doTenWaterAgain();//再次浇水
- await predictionFruit();//预测水果成熟时间
- } else {
- console.log(`初始化农场数据异常, 请登录京东 app查看农场0元水果功能是否正常,农场初始化数据: ${JSON.stringify($.farmInfo)}`);
- message = `【京东账号${$.index}】 ${$.nickName || $.UserName}\n【数据异常】请手动登录京东app查看此账号${$.name}是否正常`;
- }
- await showMsg();
-}
-async function doDailyTask() {
- await taskInitForFarm();
- console.log(`开始签到`);
- if (!$.farmTask.signInit.todaySigned) {
- await signForFarm(); //签到
- if ($.signResult.code === "0") {
- console.log(`【签到成功】获得${$.signResult.amount}g💧\\n`)
- //message += `【签到成功】获得${$.signResult.amount}g💧\n`//连续签到${signResult.signDay}天
- } else {
- // message += `签到失败,详询日志\n`;
- console.log(`签到结果: ${JSON.stringify($.signResult)}`);
- }
- } else {
- console.log(`今天已签到,连续签到${$.farmTask.signInit.totalSigned},下次签到可得${$.farmTask.signInit.signEnergyEachAmount}g\n`);
- }
- // 被水滴砸中
- console.log(`被水滴砸中: ${$.farmInfo.todayGotWaterGoalTask.canPop ? '是' : '否'}`);
- if ($.farmInfo.todayGotWaterGoalTask.canPop) {
- await gotWaterGoalTaskForFarm();
- if ($.goalResult.code === '0') {
- console.log(`【被水滴砸中】获得${$.goalResult.addEnergy}g💧\\n`);
- // message += `【被水滴砸中】获得${$.goalResult.addEnergy}g💧\n`
- }
- }
- console.log(`签到结束,开始广告浏览任务`);
- if (!$.farmTask.gotBrowseTaskAdInit.f) {
- let adverts = $.farmTask.gotBrowseTaskAdInit.userBrowseTaskAds
- let browseReward = 0
- let browseSuccess = 0
- let browseFail = 0
- for (let advert of adverts) { //开始浏览广告
- if (advert.limit <= advert.hadFinishedTimes) {
- // browseReward+=advert.reward
- console.log(`${advert.mainTitle}+ ' 已完成`);//,获得${advert.reward}g
- continue;
- }
- console.log('正在进行广告浏览任务: ' + advert.mainTitle);
- await browseAdTaskForFarm(advert.advertId, 0);
- if ($.browseResult.code === '0') {
- console.log(`${advert.mainTitle}浏览任务完成`);
- //领取奖励
- await browseAdTaskForFarm(advert.advertId, 1);
- if ($.browseRwardResult.code === '0') {
- console.log(`领取浏览${advert.mainTitle}广告奖励成功,获得${$.browseRwardResult.amount}g`)
- browseReward += $.browseRwardResult.amount
- browseSuccess++
- } else {
- browseFail++
- console.log(`领取浏览广告奖励结果: ${JSON.stringify($.browseRwardResult)}`)
- }
- } else {
- browseFail++
- console.log(`广告浏览任务结果: ${JSON.stringify($.browseResult)}`);
- }
- }
- if (browseFail > 0) {
- console.log(`【广告浏览】完成${browseSuccess}个,失败${browseFail},获得${browseReward}g💧\\n`);
- // message += `【广告浏览】完成${browseSuccess}个,失败${browseFail},获得${browseReward}g💧\n`;
- } else {
- console.log(`【广告浏览】完成${browseSuccess}个,获得${browseReward}g💧\n`);
- // message += `【广告浏览】完成${browseSuccess}个,获得${browseReward}g💧\n`;
- }
- } else {
- console.log(`今天已经做过浏览广告任务\n`);
- }
- //定时领水
- if (!$.farmTask.gotThreeMealInit.f) {
- //
- await gotThreeMealForFarm();
- if ($.threeMeal.code === "0") {
- console.log(`【定时领水】获得${$.threeMeal.amount}g💧\n`);
- // message += `【定时领水】获得${$.threeMeal.amount}g💧\n`;
- } else {
- // message += `【定时领水】失败,详询日志\n`;
- console.log(`定时领水成功结果: ${JSON.stringify($.threeMeal)}`);
- }
- } else {
- console.log('当前不在定时领水时间断或者已经领过\n')
- }
- //给好友浇水
- if (!$.farmTask.waterFriendTaskInit.f) {
- if ($.farmTask.waterFriendTaskInit.waterFriendCountKey < $.farmTask.waterFriendTaskInit.waterFriendMax) {
- await doFriendsWater();
- }
- } else {
- console.log(`给${$.farmTask.waterFriendTaskInit.waterFriendMax}个好友浇水任务已完成\n`)
- }
- // await Promise.all([
- // clockInIn(),//打卡领水
- // executeWaterRains(),//水滴雨
- // masterHelpShare(),//助力好友
- // getExtraAward(),//领取额外水滴奖励
- // turntableFarm()//天天抽奖得好礼
- // ])
- await getAwardInviteFriend();
- await clockInIn();//打卡领水
- await executeWaterRains();//水滴雨
- await getExtraAward();//领取额外水滴奖励
- await turntableFarm()//天天抽奖得好礼
-}
-async function predictionFruit() {
- console.log('开始预测水果成熟时间\n');
- await initForFarm();
- await taskInitForFarm();
- let waterEveryDayT = $.farmTask.totalWaterTaskInit.totalWaterTaskTimes;//今天到到目前为止,浇了多少次水
- message += `【今日共浇水】${waterEveryDayT}次\n`;
- message += `【剩余 水滴】${$.farmInfo.farmUserPro.totalEnergy}g💧\n`;
- message += `【水果🍉进度】${(($.farmInfo.farmUserPro.treeEnergy / $.farmInfo.farmUserPro.treeTotalEnergy) * 100).toFixed(2)}%,已浇水${$.farmInfo.farmUserPro.treeEnergy / 10}次,还需${($.farmInfo.farmUserPro.treeTotalEnergy - $.farmInfo.farmUserPro.treeEnergy) / 10}次\n`
- if ($.farmInfo.toFlowTimes > ($.farmInfo.farmUserPro.treeEnergy / 10)) {
- message += `【开花进度】再浇水${$.farmInfo.toFlowTimes - $.farmInfo.farmUserPro.treeEnergy / 10}次开花\n`
- } else if ($.farmInfo.toFruitTimes > ($.farmInfo.farmUserPro.treeEnergy / 10)) {
- message += `【结果进度】再浇水${$.farmInfo.toFruitTimes - $.farmInfo.farmUserPro.treeEnergy / 10}次结果\n`
- }
- // 预测n天后水果课可兑换功能
- let waterTotalT = ($.farmInfo.farmUserPro.treeTotalEnergy - $.farmInfo.farmUserPro.treeEnergy - $.farmInfo.farmUserPro.totalEnergy) / 10;//一共还需浇多少次水
-
- let waterD = Math.ceil(waterTotalT / waterEveryDayT);
-
- message += `【预测】${waterD === 1 ? '明天' : waterD === 2 ? '后天' : waterD + '天之后'}(${timeFormat(24 * 60 * 60 * 1000 * waterD + Date.now())}日)可兑换水果🍉`
-}
-//浇水十次
-async function doTenWater() {
- jdFruitBeanCard = $.getdata('jdFruitBeanCard') ? $.getdata('jdFruitBeanCard') : jdFruitBeanCard;
- if ($.isNode() && process.env.FRUIT_BEAN_CARD) {
- jdFruitBeanCard = process.env.FRUIT_BEAN_CARD;
- }
- await myCardInfoForFarm();
- const { fastCard, doubleCard, beanCard, signCard } = $.myCardInfoRes;
- if (`${jdFruitBeanCard}` === 'true' && JSON.stringify($.myCardInfoRes).match(`限时翻倍`) && beanCard > 0) {
- console.log(`您设置的是使用水滴换豆卡,且背包有水滴换豆卡${beanCard}张, 跳过10次浇水任务`)
- return
- }
- if ($.farmTask.totalWaterTaskInit.totalWaterTaskTimes < $.farmTask.totalWaterTaskInit.totalWaterTaskLimit) {
- console.log(`\n准备浇水十次`);
- let waterCount = 0;
- isFruitFinished = false;
- for (; waterCount < $.farmTask.totalWaterTaskInit.totalWaterTaskLimit - $.farmTask.totalWaterTaskInit.totalWaterTaskTimes; waterCount++) {
- console.log(`第${waterCount + 1}次浇水`);
- await waterGoodForFarm();
- console.log(`本次浇水结果: ${JSON.stringify($.waterResult)}`);
- if ($.waterResult.code === '0') {
- console.log(`剩余水滴${$.waterResult.totalEnergy}g`);
- if ($.waterResult.finished) {
- // 已证实,waterResult.finished为true,表示水果可以去领取兑换了
- isFruitFinished = true;
- break
- } else {
- if ($.waterResult.totalEnergy < 10) {
- console.log(`水滴不够,结束浇水`)
- break
- }
- await gotStageAward();//领取阶段性水滴奖励
- }
- } else {
- console.log('浇水出现失败异常,跳出不在继续浇水')
- break;
- }
- }
- if (isFruitFinished) {
- option['open-url'] = urlSchema;
- $.msg($.name, `【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取`, '请去京东APP或微信小程序查看\n点击弹窗即达', option);
- $.done();
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}水果已可领取`, `京东账号${$.index} ${$.nickName}\n${$.farmInfo.farmUserPro.name}已可领取`);
- }
- }
- } else {
- console.log('\n今日已完成10次浇水任务\n');
- }
-}
-//领取首次浇水奖励
-async function getFirstWaterAward() {
- await taskInitForFarm();
- //领取首次浇水奖励
- if (!$.farmTask.firstWaterInit.f && $.farmTask.firstWaterInit.totalWaterTimes > 0) {
- await firstWaterTaskForFarm();
- if ($.firstWaterReward.code === '0') {
- console.log(`【首次浇水奖励】获得${$.firstWaterReward.amount}g💧\n`);
- // message += `【首次浇水奖励】获得${$.firstWaterReward.amount}g💧\n`;
- } else {
- // message += '【首次浇水奖励】领取奖励失败,详询日志\n';
- console.log(`领取首次浇水奖励结果: ${JSON.stringify($.firstWaterReward)}`);
- }
- } else {
- console.log('首次浇水奖励已领取\n')
- }
-}
-//领取十次浇水奖励
-async function getTenWaterAward() {
- //领取10次浇水奖励
- if (!$.farmTask.totalWaterTaskInit.f && $.farmTask.totalWaterTaskInit.totalWaterTaskTimes >= $.farmTask.totalWaterTaskInit.totalWaterTaskLimit) {
- await totalWaterTaskForFarm();
- if ($.totalWaterReward.code === '0') {
- console.log(`【十次浇水奖励】获得${$.totalWaterReward.totalWaterTaskEnergy}g💧\n`);
- // message += `【十次浇水奖励】获得${$.totalWaterReward.totalWaterTaskEnergy}g💧\n`;
- } else {
- // message += '【十次浇水奖励】领取奖励失败,详询日志\n';
- console.log(`领取10次浇水奖励结果: ${JSON.stringify($.totalWaterReward)}`);
- }
- } else if ($.farmTask.totalWaterTaskInit.totalWaterTaskTimes < $.farmTask.totalWaterTaskInit.totalWaterTaskLimit) {
- // message += `【十次浇水奖励】任务未完成,今日浇水${$.farmTask.totalWaterTaskInit.totalWaterTaskTimes}次\n`;
- console.log(`【十次浇水奖励】任务未完成,今日浇水${$.farmTask.totalWaterTaskInit.totalWaterTaskTimes}次\n`);
- }
- console.log('finished 水果任务完成!');
-}
-//再次浇水
-async function doTenWaterAgain() {
- console.log('开始检查剩余水滴能否再次浇水再次浇水\n');
- await initForFarm();
- let totalEnergy = $.farmInfo.farmUserPro.totalEnergy;
- console.log(`剩余水滴${totalEnergy}g\n`);
- await myCardInfoForFarm();
- const { fastCard, doubleCard, beanCard, signCard } = $.myCardInfoRes;
- console.log(`背包已有道具:\n快速浇水卡:${fastCard === -1 ? '未解锁': fastCard + '张'}\n水滴翻倍卡:${doubleCard === -1 ? '未解锁': doubleCard + '张'}\n水滴换京豆卡:${beanCard === -1 ? '未解锁' : beanCard + '张'}\n加签卡:${signCard === -1 ? '未解锁' : signCard + '张'}\n`)
- if (totalEnergy >= 100 && doubleCard > 0) {
- //使用翻倍水滴卡
- for (let i = 0; i < new Array(doubleCard).fill('').length; i++) {
- await userMyCardForFarm('doubleCard');
- console.log(`使用翻倍水滴卡结果:${JSON.stringify($.userMyCardRes)}`);
- }
- await initForFarm();
- totalEnergy = $.farmInfo.farmUserPro.totalEnergy;
- }
- if (signCard > 0) {
- //使用加签卡
- for (let i = 0; i < new Array(signCard).fill('').length; i++) {
- await userMyCardForFarm('signCard');
- console.log(`使用加签卡结果:${JSON.stringify($.userMyCardRes)}`);
- }
- await initForFarm();
- totalEnergy = $.farmInfo.farmUserPro.totalEnergy;
- }
- jdFruitBeanCard = $.getdata('jdFruitBeanCard') ? $.getdata('jdFruitBeanCard') : jdFruitBeanCard;
- if ($.isNode() && process.env.FRUIT_BEAN_CARD) {
- jdFruitBeanCard = process.env.FRUIT_BEAN_CARD;
- }
- if (`${jdFruitBeanCard}` === 'true' && JSON.stringify($.myCardInfoRes).match('限时翻倍')) {
- console.log(`\n您设置的是水滴换豆功能,现在为您换豆`);
- if (totalEnergy >= 100 && $.myCardInfoRes.beanCard > 0) {
- //使用水滴换豆卡
- await userMyCardForFarm('beanCard');
- console.log(`使用水滴换豆卡结果:${JSON.stringify($.userMyCardRes)}`);
- if ($.userMyCardRes.code === '0') {
- message += `【水滴换豆卡】获得${$.userMyCardRes.beanCount}个京豆\n`;
- }
- return
- } else {
- console.log(`您目前水滴:${totalEnergy}g,水滴换豆卡${$.myCardInfoRes.beanCard}张,暂不满足水滴换豆的条件,为您继续浇水`)
- }
- }
- // if (totalEnergy > 100 && $.myCardInfoRes.fastCard > 0) {
- // //使用快速浇水卡
- // await userMyCardForFarm('fastCard');
- // console.log(`使用快速浇水卡结果:${JSON.stringify($.userMyCardRes)}`);
- // if ($.userMyCardRes.code === '0') {
- // console.log(`已使用快速浇水卡浇水${$.userMyCardRes.waterEnergy}g`);
- // }
- // await initForFarm();
- // totalEnergy = $.farmInfo.farmUserPro.totalEnergy;
- // }
- // 所有的浇水(10次浇水)任务,获取水滴任务完成后,如果剩余水滴大于等于60g,则继续浇水(保留部分水滴是用于完成第二天的浇水10次的任务)
- let overageEnergy = totalEnergy - retainWater;
- if (totalEnergy >= ($.farmInfo.farmUserPro.treeTotalEnergy - $.farmInfo.farmUserPro.treeEnergy)) {
- //如果现有的水滴,大于水果可兑换所需的对滴(也就是把水滴浇完,水果就能兑换了)
- isFruitFinished = false;
- for (let i = 0; i < ($.farmInfo.farmUserPro.treeTotalEnergy - $.farmInfo.farmUserPro.treeEnergy) / 10; i++) {
- await waterGoodForFarm();
- console.log(`本次浇水结果(水果马上就可兑换了): ${JSON.stringify($.waterResult)}`);
- if ($.waterResult.code === '0') {
- console.log('\n浇水10g成功\n');
- if ($.waterResult.finished) {
- // 已证实,waterResult.finished为true,表示水果可以去领取兑换了
- isFruitFinished = true;
- break
- } else {
- console.log(`目前水滴【${$.waterResult.totalEnergy}】g,继续浇水,水果马上就可以兑换了`)
- }
- } else {
- console.log('浇水出现失败异常,跳出不在继续浇水')
- break;
- }
- }
- if (isFruitFinished) {
- option['open-url'] = urlSchema;
- $.msg($.name, `【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取`, '请去京东APP或微信小程序查看\n点击弹窗即达', option);
- $.done();
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}水果已可领取`, `京东账号${$.index} ${$.nickName}\n${$.farmInfo.farmUserPro.name}已可领取`);
- }
- }
- } else if (overageEnergy >= 10) {
- console.log("目前剩余水滴:【" + totalEnergy + "】g,可继续浇水");
- isFruitFinished = false;
- for (let i = 0; i < parseInt(overageEnergy / 10); i++) {
- await waterGoodForFarm();
- console.log(`本次浇水结果: ${JSON.stringify($.waterResult)}`);
- if ($.waterResult.code === '0') {
- console.log(`\n浇水10g成功,剩余${$.waterResult.totalEnergy}\n`)
- if ($.waterResult.finished) {
- // 已证实,waterResult.finished为true,表示水果可以去领取兑换了
- isFruitFinished = true;
- break
- } else {
- await gotStageAward()
- }
- } else {
- console.log('浇水出现失败异常,跳出不在继续浇水')
- break;
- }
- }
- if (isFruitFinished) {
- option['open-url'] = urlSchema;
- $.msg($.name, `【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取`, '请去京东APP或微信小程序查看\n点击弹窗即达', option);
- $.done();
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}水果已可领取`, `京东账号${$.index} ${$.nickName}\n${$.farmInfo.farmUserPro.name}已可领取`);
- }
- }
- } else {
- console.log("目前剩余水滴:【" + totalEnergy + "】g,不再继续浇水,保留部分水滴用于完成第二天【十次浇水得水滴】任务")
- }
-}
-//领取阶段性水滴奖励
-function gotStageAward() {
- return new Promise(async resolve => {
- if ($.waterResult.waterStatus === 0 && $.waterResult.treeEnergy === 10) {
- console.log('果树发芽了,奖励30g水滴');
- await gotStageAwardForFarm('1');
- console.log(`浇水阶段奖励1领取结果 ${JSON.stringify($.gotStageAwardForFarmRes)}`);
- if ($.gotStageAwardForFarmRes.code === '0') {
- // message += `【果树发芽了】奖励${$.gotStageAwardForFarmRes.addEnergy}\n`;
- console.log(`【果树发芽了】奖励${$.gotStageAwardForFarmRes.addEnergy}\n`);
- }
- } else if ($.waterResult.waterStatus === 1) {
- console.log('果树开花了,奖励40g水滴');
- await gotStageAwardForFarm('2');
- console.log(`浇水阶段奖励2领取结果 ${JSON.stringify($.gotStageAwardForFarmRes)}`);
- if ($.gotStageAwardForFarmRes.code === '0') {
- // message += `【果树开花了】奖励${$.gotStageAwardForFarmRes.addEnergy}g💧\n`;
- console.log(`【果树开花了】奖励${$.gotStageAwardForFarmRes.addEnergy}g💧\n`);
- }
- } else if ($.waterResult.waterStatus === 2) {
- console.log('果树长出小果子啦, 奖励50g水滴');
- await gotStageAwardForFarm('3');
- console.log(`浇水阶段奖励3领取结果 ${JSON.stringify($.gotStageAwardForFarmRes)}`)
- if ($.gotStageAwardForFarmRes.code === '0') {
- // message += `【果树结果了】奖励${$.gotStageAwardForFarmRes.addEnergy}g💧\n`;
- console.log(`【果树结果了】奖励${$.gotStageAwardForFarmRes.addEnergy}g💧\n`);
- }
- }
- resolve()
- })
-}
-//天天抽奖活动
-async function turntableFarm() {
- await initForTurntableFarm();
- if ($.initForTurntableFarmRes.code === '0') {
- //领取定时奖励 //4小时一次
- let {timingIntervalHours, timingLastSysTime, sysTime, timingGotStatus, remainLotteryTimes, turntableInfos} = $.initForTurntableFarmRes;
-
- if (!timingGotStatus) {
- console.log(`是否到了领取免费赠送的抽奖机会----${sysTime > (timingLastSysTime + 60*60*timingIntervalHours*1000)}`)
- if (sysTime > (timingLastSysTime + 60*60*timingIntervalHours*1000)) {
- await timingAwardForTurntableFarm();
- console.log(`领取定时奖励结果${JSON.stringify($.timingAwardRes)}`);
- await initForTurntableFarm();
- remainLotteryTimes = $.initForTurntableFarmRes.remainLotteryTimes;
- } else {
- console.log(`免费赠送的抽奖机会未到时间`)
- }
- } else {
- console.log('4小时候免费赠送的抽奖机会已领取')
- }
- if ($.initForTurntableFarmRes.turntableBrowserAds && $.initForTurntableFarmRes.turntableBrowserAds.length > 0) {
- for (let index = 0; index < $.initForTurntableFarmRes.turntableBrowserAds.length; index++) {
- if (!$.initForTurntableFarmRes.turntableBrowserAds[index].status) {
- console.log(`开始浏览天天抽奖的第${index + 1}个逛会场任务`)
- await browserForTurntableFarm(1, $.initForTurntableFarmRes.turntableBrowserAds[index].adId);
- if ($.browserForTurntableFarmRes.code === '0' && $.browserForTurntableFarmRes.status) {
- console.log(`第${index + 1}个逛会场任务完成,开始领取水滴奖励\n`)
- await browserForTurntableFarm(2, $.initForTurntableFarmRes.turntableBrowserAds[index].adId);
- if ($.browserForTurntableFarmRes.code === '0') {
- console.log(`第${index + 1}个逛会场任务领取水滴奖励完成\n`)
- await initForTurntableFarm();
- remainLotteryTimes = $.initForTurntableFarmRes.remainLotteryTimes;
- }
- }
- } else {
- console.log(`浏览天天抽奖的第${index + 1}个逛会场任务已完成`)
- }
- }
- }
- //天天抽奖助力
- console.log('开始天天抽奖--好友助力--每人每天只有三次助力机会.')
- for (let code of newShareCodes) {
- if (code === $.farmInfo.farmUserPro.shareCode) {
- console.log('天天抽奖-不能自己给自己助力\n')
- continue
- }
- await lotteryMasterHelp(code);
- // console.log('天天抽奖助力结果',lotteryMasterHelpRes.helpResult)
- if ($.lotteryMasterHelpRes.helpResult.code === '0') {
- console.log(`天天抽奖-助力${$.lotteryMasterHelpRes.helpResult.masterUserInfo.nickName}成功\n`)
- } else if ($.lotteryMasterHelpRes.helpResult.code === '11') {
- console.log(`天天抽奖-不要重复助力${$.lotteryMasterHelpRes.helpResult.masterUserInfo.nickName}\n`)
- } else if ($.lotteryMasterHelpRes.helpResult.code === '13') {
- console.log(`天天抽奖-助力${$.lotteryMasterHelpRes.helpResult.masterUserInfo.nickName}失败,助力次数耗尽\n`);
- break;
- }
- }
- console.log(`---天天抽奖次数remainLotteryTimes----${remainLotteryTimes}次`)
- //抽奖
- if (remainLotteryTimes > 0) {
- console.log('开始抽奖')
- let lotteryResult = '';
- for (let i = 0; i < new Array(remainLotteryTimes).fill('').length; i++) {
- await lotteryForTurntableFarm()
- console.log(`第${i + 1}次抽奖结果${JSON.stringify($.lotteryRes)}`);
- if ($.lotteryRes.code === '0') {
- turntableInfos.map((item) => {
- if (item.type === $.lotteryRes.type) {
- console.log(`lotteryRes.type${$.lotteryRes.type}`);
- if ($.lotteryRes.type.match(/bean/g) && $.lotteryRes.type.match(/bean/g)[0] === 'bean') {
- lotteryResult += `${item.name}个,`;
- } else if ($.lotteryRes.type.match(/water/g) && $.lotteryRes.type.match(/water/g)[0] === 'water') {
- lotteryResult += `${item.name},`;
- } else {
- lotteryResult += `${item.name},`;
- }
- }
- })
- //没有次数了
- if ($.lotteryRes.remainLotteryTimes === 0) {
- break
- }
- }
- }
- if (lotteryResult) {
- console.log(`【天天抽奖】${lotteryResult.substr(0, lotteryResult.length - 1)}\n`)
- // message += `【天天抽奖】${lotteryResult.substr(0, lotteryResult.length - 1)}\n`;
- }
- } else {
- console.log('天天抽奖--抽奖机会为0次')
- }
- } else {
- console.log('初始化天天抽奖得好礼失败')
- }
-}
-//领取额外奖励水滴
-async function getExtraAward() {
- await masterHelpTaskInitForFarm();
- if ($.masterHelpResult.code === '0') {
- if ($.masterHelpResult.masterHelpPeoples && $.masterHelpResult.masterHelpPeoples.length >= 5) {
- // 已有五人助力。领取助力后的奖励
- if (!$.masterHelpResult.masterGotFinal) {
- await masterGotFinishedTaskForFarm();
- if ($.masterGotFinished.code === '0') {
- console.log(`已成功领取好友助力奖励:【${$.masterGotFinished.amount}】g水`);
- message += `【额外奖励】${$.masterGotFinished.amount}g水领取成功\n`;
- }
- } else {
- console.log("已经领取过5好友助力额外奖励");
- message += `【额外奖励】已被领取过\n`;
- }
- } else {
- console.log("助力好友未达到5个");
- message += `【额外奖励】领取失败,原因:给您助力的人未达5个\n`;
- }
- if ($.masterHelpResult.masterHelpPeoples && $.masterHelpResult.masterHelpPeoples.length > 0) {
- let str = '';
- $.masterHelpResult.masterHelpPeoples.map((item, index) => {
- if (index === ($.masterHelpResult.masterHelpPeoples.length - 1)) {
- str += item.nickName || "匿名用户";
- } else {
- str += (item.nickName || "匿名用户") + ',';
- }
- let date = new Date(item.time);
- let time = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getMinutes();
- console.log(`\n京东昵称【${item.nickName || "匿名用户"}】 在 ${time} 给您助过力\n`);
- })
- message += `【助力您的好友】${str}\n`;
- }
- console.log('领取额外奖励水滴结束\n');
- }
-}
-//助力好友
-async function masterHelpShare() {
- console.log('开始助力好友')
- let salveHelpAddWater = 0;
- let remainTimes = 4;//今日剩余助力次数,默认4次(京东农场每人每天4次助力机会)。
- let helpSuccessPeoples = '';//成功助力好友
- console.log(`格式化后的助力码::${JSON.stringify(newShareCodes)}\n`);
-
- for (let code of newShareCodes) {
- console.log(`开始助力京东账号${$.index} - ${$.nickName}的好友: ${code}`);
- if (!code) continue;
- if (code === $.farmInfo.farmUserPro.shareCode) {
- console.log('不能为自己助力哦,跳过自己的shareCode\n')
- continue
- }
- await masterHelp(code);
- if ($.helpResult.code === '0') {
- if ($.helpResult.helpResult.code === '0') {
- //助力成功
- salveHelpAddWater += $.helpResult.helpResult.salveHelpAddWater;
- console.log(`【助力好友结果】: 已成功给【${$.helpResult.helpResult.masterUserInfo.nickName}】助力`);
- console.log(`给好友【${$.helpResult.helpResult.masterUserInfo.nickName}】助力获得${$.helpResult.helpResult.salveHelpAddWater}g水滴`)
- helpSuccessPeoples += ($.helpResult.helpResult.masterUserInfo.nickName || '匿名用户') + ',';
- } else if ($.helpResult.helpResult.code === '8') {
- console.log(`【助力好友结果】: 助力【${$.helpResult.helpResult.masterUserInfo.nickName}】失败,您今天助力次数已耗尽`);
- } else if ($.helpResult.helpResult.code === '9') {
- console.log(`【助力好友结果】: 之前给【${$.helpResult.helpResult.masterUserInfo.nickName}】助力过了`);
- } else if ($.helpResult.helpResult.code === '10') {
- console.log(`【助力好友结果】: 好友【${$.helpResult.helpResult.masterUserInfo.nickName}】已满五人助力`);
- } else {
- console.log(`助力其他情况:${JSON.stringify($.helpResult.helpResult)}`);
- }
- console.log(`【今日助力次数还剩】${$.helpResult.helpResult.remainTimes}次\n`);
- remainTimes = $.helpResult.helpResult.remainTimes;
- if ($.helpResult.helpResult.remainTimes === 0) {
- console.log(`您当前助力次数已耗尽,跳出助力`);
- break
- }
- } else {
- console.log(`助力失败::${JSON.stringify($.helpResult)}`);
- }
- }
- if ($.isLoon() || $.isQuanX() || $.isSurge()) {
- let helpSuccessPeoplesKey = timeFormat() + $.farmInfo.farmUserPro.shareCode;
- if (!$.getdata(helpSuccessPeoplesKey)) {
- //把前一天的清除
- $.setdata('', timeFormat(Date.now() - 24 * 60 * 60 * 1000) + $.farmInfo.farmUserPro.shareCode);
- $.setdata('', helpSuccessPeoplesKey);
- }
- if (helpSuccessPeoples) {
- if ($.getdata(helpSuccessPeoplesKey)) {
- $.setdata($.getdata(helpSuccessPeoplesKey) + ',' + helpSuccessPeoples, helpSuccessPeoplesKey);
- } else {
- $.setdata(helpSuccessPeoples, helpSuccessPeoplesKey);
- }
- }
- helpSuccessPeoples = $.getdata(helpSuccessPeoplesKey);
- }
- if (helpSuccessPeoples && helpSuccessPeoples.length > 0) {
- message += `【您助力的好友👬】${helpSuccessPeoples.substr(0, helpSuccessPeoples.length - 1)}\n`;
- }
- if (salveHelpAddWater > 0) {
- // message += `【助力好友👬】获得${salveHelpAddWater}g💧\n`;
- console.log(`【助力好友👬】获得${salveHelpAddWater}g💧\n`);
- }
- message += `【今日剩余助力👬】${remainTimes}次\n`;
- console.log('助力好友结束,即将开始领取额外水滴奖励\n');
-}
-//水滴雨
-async function executeWaterRains() {
- let executeWaterRain = !$.farmTask.waterRainInit.f;
- if (executeWaterRain) {
- console.log(`水滴雨任务,每天两次,最多可得10g水滴`);
- console.log(`两次水滴雨任务是否全部完成:${$.farmTask.waterRainInit.f ? '是' : '否'}`);
- if ($.farmTask.waterRainInit.lastTime) {
- if (Date.now() < ($.farmTask.waterRainInit.lastTime + 3 * 60 * 60 * 1000)) {
- executeWaterRain = false;
- // message += `【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】未到时间,请${new Date($.farmTask.waterRainInit.lastTime + 3 * 60 * 60 * 1000).toLocaleTimeString()}再试\n`;
- console.log(`\`【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】未到时间,请${new Date($.farmTask.waterRainInit.lastTime + 3 * 60 * 60 * 1000).toLocaleTimeString()}再试\n`);
- }
- }
- if (executeWaterRain) {
- console.log(`开始水滴雨任务,这是第${$.farmTask.waterRainInit.winTimes + 1}次,剩余${2 - ($.farmTask.waterRainInit.winTimes + 1)}次`);
- await waterRainForFarm();
- console.log('水滴雨waterRain');
- if ($.waterRain.code === '0') {
- console.log('水滴雨任务执行成功,获得水滴:' + $.waterRain.addEnergy + 'g');
- console.log(`【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】获得${$.waterRain.addEnergy}g水滴\n`);
- // message += `【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】获得${$.waterRain.addEnergy}g水滴\n`;
- }
- }
- } else {
- // message += `【水滴雨】已全部完成,获得20g💧\n`;
- }
-}
-//打卡领水活动
-async function clockInIn() {
- console.log('开始打卡领水活动(签到,关注,领券)');
- await clockInInitForFarm();
- if ($.clockInInit.code === '0') {
- // 签到得水滴
- if (!$.clockInInit.todaySigned) {
- console.log('开始今日签到');
- await clockInForFarm();
- console.log(`打卡结果${JSON.stringify($.clockInForFarmRes)}`);
- if ($.clockInForFarmRes.code === '0') {
- // message += `【第${$.clockInForFarmRes.signDay}天签到】获得${$.clockInForFarmRes.amount}g💧\n`;
- console.log(`【第${$.clockInForFarmRes.signDay}天签到】获得${$.clockInForFarmRes.amount}g💧\n`)
- if ($.clockInForFarmRes.signDay === 7) {
- //可以领取惊喜礼包
- console.log('开始领取--惊喜礼包38g水滴');
- await gotClockInGift();
- if ($.gotClockInGiftRes.code === '0') {
- // message += `【惊喜礼包】获得${$.gotClockInGiftRes.amount}g💧\n`;
- console.log(`【惊喜礼包】获得${$.gotClockInGiftRes.amount}g💧\n`);
- }
- }
- }
- }
- // 限时关注得水滴
- if ($.clockInInit.themes && $.clockInInit.themes.length > 0) {
- for (let item of $.clockInInit.themes) {
- if (!item.hadGot) {
- console.log(`关注ID${item.id}`);
- await clockInFollowForFarm(item.id, "theme", "1");
- console.log(`themeStep1--结果${JSON.stringify($.themeStep1)}`);
- if ($.themeStep1.code === '0') {
- await clockInFollowForFarm(item.id, "theme", "2");
- console.log(`themeStep2--结果${JSON.stringify($.themeStep2)}`);
- if ($.themeStep2.code === '0') {
- console.log(`关注${item.name},获得水滴${$.themeStep2.amount}g`);
- }
- }
- }
- }
- }
- // 限时领券得水滴
- if ($.clockInInit.venderCoupons && $.clockInInit.venderCoupons.length > 0) {
- for (let item of $.clockInInit.venderCoupons) {
- if (!item.hadGot) {
- console.log(`领券的ID${item.id}`);
- await clockInFollowForFarm(item.id, "venderCoupon", "1");
- console.log(`venderCouponStep1--结果${JSON.stringify($.venderCouponStep1)}`);
- if ($.venderCouponStep1.code === '0') {
- await clockInFollowForFarm(item.id, "venderCoupon", "2");
- if ($.venderCouponStep2.code === '0') {
- console.log(`venderCouponStep2--结果${JSON.stringify($.venderCouponStep2)}`);
- console.log(`从${item.name}领券,获得水滴${$.venderCouponStep2.amount}g`);
- }
- }
- }
- }
- }
- }
- console.log('开始打卡领水活动(签到,关注,领券)结束\n');
-}
-//
-async function getAwardInviteFriend() {
- await friendListInitForFarm();
- await receiveFriendInvite();
- console.log(`\n今日已邀请好友${$.friendList.inviteFriendCount}个 / 每日邀请上限${$.friendList.inviteFriendMax}个`);
- if ($.friendList.inviteFriendCount > 0) {
- if ($.friendList.inviteFriendCount > $.friendList.inviteFriendGotAwardCount) {
- console.log('开始领取邀请好友的奖励');
- await awardInviteFriendForFarm();
- console.log(`领取邀请好友的奖励结果::${JSON.stringify($.awardInviteFriendRes)}`);
- }
- } else {
- console.log('今日未邀请过好友')
- }
-}
-//给好友浇水
-async function doFriendsWater() {
- await friendListInitForFarm();
- console.log('开始给好友浇水...');
- await taskInitForFarm();
- const { waterFriendCountKey, waterFriendMax } = $.farmTask.waterFriendTaskInit;
- console.log(`今日已给${waterFriendCountKey}个好友浇水`);
- if (waterFriendCountKey < waterFriendMax) {
- let needWaterFriends = [];
- if ($.friendList.friends && $.friendList.friends.length > 0) {
- $.friendList.friends.map((item, index) => {
- if (item.friendState === 1) {
- if (needWaterFriends.length < (waterFriendMax - waterFriendCountKey)) {
- needWaterFriends.push(item.shareCode);
- }
- }
- });
- //TODO ,发现bug,github action运行发现有些账号第一次没有给3个好友浇水
- console.log(`需要浇水的好友列表shareCodes:${JSON.stringify(needWaterFriends)}`);
- let waterFriendsCount = 0, cardInfoStr = '';
- for (let index = 0; index < needWaterFriends.length; index ++) {
- await waterFriendForFarm(needWaterFriends[index]);
- console.log(`为第${index+1}个好友浇水结果:${JSON.stringify($.waterFriendForFarmRes)}\n`)
- if ($.waterFriendForFarmRes.code === '0') {
- waterFriendsCount ++;
- if ($.waterFriendForFarmRes.cardInfo) {
- console.log('为好友浇水获得道具了');
- if ($.waterFriendForFarmRes.cardInfo.type === 'beanCard') {
- console.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
- cardInfoStr += `水滴换豆卡,`;
- } else if ($.waterFriendForFarmRes.cardInfo.type === 'fastCard') {
- console.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
- cardInfoStr += `快速浇水卡,`;
- } else if ($.waterFriendForFarmRes.cardInfo.type === 'doubleCard') {
- console.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
- cardInfoStr += `水滴翻倍卡,`;
- } else if ($.waterFriendForFarmRes.cardInfo.type === 'signCard') {
- console.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
- cardInfoStr += `加签卡,`;
- }
- }
- } else if ($.waterFriendForFarmRes.code === '11') {
- console.log('水滴不够,跳出浇水')
- }
- }
- // message += `【好友浇水】已给${waterFriendsCount}个好友浇水,消耗${waterFriendsCount * 10}g水\n`;
- console.log(`【好友浇水】已给${waterFriendsCount}个好友浇水,消耗${waterFriendsCount * 10}g水\n`);
- if (cardInfoStr && cardInfoStr.length > 0) {
- // message += `【好友浇水奖励】${cardInfoStr.substr(0, cardInfoStr.length - 1)}\n`;
- console.log(`【好友浇水奖励】${cardInfoStr.substr(0, cardInfoStr.length - 1)}\n`);
- }
- } else {
- console.log('您的好友列表暂无好友,快去邀请您的好友吧!')
- }
- } else {
- console.log(`今日已为好友浇水量已达${waterFriendMax}个`)
- }
-}
-//领取给3个好友浇水后的奖励水滴
-async function getWaterFriendGotAward() {
- await taskInitForFarm();
- const { waterFriendCountKey, waterFriendMax, waterFriendSendWater, waterFriendGotAward } = $.farmTask.waterFriendTaskInit
- if (waterFriendCountKey >= waterFriendMax) {
- if (!waterFriendGotAward) {
- await waterFriendGotAwardForFarm();
- console.log(`领取给${waterFriendMax}个好友浇水后的奖励水滴::${JSON.stringify($.waterFriendGotAwardRes)}`)
- if ($.waterFriendGotAwardRes.code === '0') {
- // message += `【给${waterFriendMax}好友浇水】奖励${$.waterFriendGotAwardRes.addWater}g水滴\n`;
- console.log(`【给${waterFriendMax}好友浇水】奖励${$.waterFriendGotAwardRes.addWater}g水滴\n`);
- }
- } else {
- console.log(`给好友浇水的${waterFriendSendWater}g水滴奖励已领取\n`);
- // message += `【给${waterFriendMax}好友浇水】奖励${waterFriendSendWater}g水滴已领取\n`;
- }
- } else {
- console.log(`暂未给${waterFriendMax}个好友浇水\n`);
- }
-}
-//接收成为对方好友的邀请
-async function receiveFriendInvite() {
- for (let code of newShareCodes) {
- if (code === $.farmInfo.farmUserPro.shareCode) {
- console.log('自己不能邀请自己成为好友噢\n')
- continue
- }
- await inviteFriend(code);
- console.log(`接收邀请成为好友结果:${JSON.stringify($.inviteFriendRes.helpResult)}`)
- if ($.inviteFriendRes.helpResult.code === '0') {
- console.log(`您已成为${$.inviteFriendRes.helpResult.masterUserInfo.nickName}的好友`)
- } else if ($.inviteFriendRes.helpResult.code === '17') {
- console.log(`对方已是您的好友`)
- }
- }
- // console.log(`开始接受6fbd26cc27ac44d6a7fed34092453f77的邀请\n`)
- // await inviteFriend('6fbd26cc27ac44d6a7fed34092453f77');
- // console.log(`接收邀请成为好友结果:${JSON.stringify($.inviteFriendRes.helpResult)}`)
- // if ($.inviteFriendRes.helpResult.code === '0') {
- // console.log(`您已成为${$.inviteFriendRes.helpResult.masterUserInfo.nickName}的好友`)
- // } else if ($.inviteFriendRes.helpResult.code === '17') {
- // console.log(`对方已是您的好友`)
- // }
-}
-async function duck() {
- for (let i = 0; i < 10; i++) {
- //这里循环十次
- await getFullCollectionReward();
- if ($.duckRes.code === '0') {
- if (!$.duckRes.hasLimit) {
- console.log(`小鸭子游戏:${$.duckRes.title}`);
- // if ($.duckRes.type !== 3) {
- // console.log(`${$.duckRes.title}`);
- // if ($.duckRes.type === 1) {
- // message += `【小鸭子】为你带回了水滴\n`;
- // } else if ($.duckRes.type === 2) {
- // message += `【小鸭子】为你带回快速浇水卡\n`
- // }
- // }
- } else {
- console.log(`${$.duckRes.title}`)
- break;
- }
- } else if ($.duckRes.code === '10') {
- console.log(`小鸭子游戏达到上限`)
- break;
- }
- }
-}
-// ========================API调用接口========================
-//鸭子,点我有惊喜
-async function getFullCollectionReward() {
- return new Promise(resolve => {
- const body = {"type": 2, "version": 6, "channel": 2};
- $.post(taskUrl("getFullCollectionReward", body), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n东东农场: API查询请求失败 ‼️‼️');
- console.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- $.duckRes = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-
-/**
- * 领取10次浇水奖励API
- */
-async function totalWaterTaskForFarm() {
- const functionId = arguments.callee.name.toString();
- $.totalWaterReward = await request(functionId);
-}
-//领取首次浇水奖励API
-async function firstWaterTaskForFarm() {
- const functionId = arguments.callee.name.toString();
- $.firstWaterReward = await request(functionId);
-}
-//领取给3个好友浇水后的奖励水滴API
-async function waterFriendGotAwardForFarm() {
- const functionId = arguments.callee.name.toString();
- $.waterFriendGotAwardRes = await request(functionId, {"version": 4, "channel": 1});
-}
-// 查询背包道具卡API
-async function myCardInfoForFarm() {
- const functionId = arguments.callee.name.toString();
- $.myCardInfoRes = await request(functionId, {"version": 5, "channel": 1});
-}
-//使用道具卡API
-async function userMyCardForFarm(cardType) {
- const functionId = arguments.callee.name.toString();
- $.userMyCardRes = await request(functionId, {"cardType": cardType});
-}
-/**
- * 领取浇水过程中的阶段性奖励
- * @param type
- * @returns {Promise}
- */
-async function gotStageAwardForFarm(type) {
- $.gotStageAwardForFarmRes = await request(arguments.callee.name.toString(), {'type': type});
-}
-//浇水API
-async function waterGoodForFarm() {
- const functionId = arguments.callee.name.toString();
- $.waterResult = await request(functionId);
-}
-// 初始化集卡抽奖活动数据API
-async function initForTurntableFarm() {
- $.initForTurntableFarmRes = await request(arguments.callee.name.toString(), {version: 4, channel: 1});
-}
-async function lotteryForTurntableFarm() {
- await $.wait(2000);
- console.log('等待了5秒')
- $.lotteryRes = await request(arguments.callee.name.toString(), {type: 1, version: 4, channel: 1});
-}
-
-async function timingAwardForTurntableFarm() {
- $.timingAwardRes = await request(arguments.callee.name.toString(), {version: 4, channel: 1});
-}
-
-async function browserForTurntableFarm(type, adId) {
- if (type === 1) {
- console.log('浏览爆品会场');
- }
- if (type === 2) {
- console.log('天天抽奖浏览任务领取水滴');
- }
- const body = {"type": type,"adId": adId,"version":4,"channel":1};
- $.browserForTurntableFarmRes = await request(arguments.callee.name.toString(), body);
- // 浏览爆品会场8秒
-}
-//天天抽奖浏览任务领取水滴API
-async function browserForTurntableFarm2(type) {
- const body = {"type":2,"adId": type,"version":4,"channel":1};
- $.browserForTurntableFarm2Res = await request('browserForTurntableFarm', body);
-}
-/**
- * 天天抽奖拿好礼-助力API(每人每天三次助力机会)
- */
-async function lotteryMasterHelp() {
- $.lotteryMasterHelpRes = await request(`initForFarm`, {
- imageUrl: "",
- nickName: "",
- shareCode: arguments[0] + '-3',
- babelChannel: "3",
- version: 4,
- channel: 1
- });
-}
-
-//领取5人助力后的额外奖励API
-async function masterGotFinishedTaskForFarm() {
- const functionId = arguments.callee.name.toString();
- $.masterGotFinished = await request(functionId);
-}
-//助力好友信息API
-async function masterHelpTaskInitForFarm() {
- const functionId = arguments.callee.name.toString();
- $.masterHelpResult = await request(functionId);
-}
-//接受对方邀请,成为对方好友的API
-async function inviteFriend() {
- $.inviteFriendRes = await request(`initForFarm`, {
- imageUrl: "",
- nickName: "",
- shareCode: arguments[0] + '-inviteFriend',
- version: 4,
- channel: 2
- });
-}
-// 助力好友API
-async function masterHelp() {
- $.helpResult = await request(`initForFarm`, {
- imageUrl: "",
- nickName: "",
- shareCode: arguments[0],
- babelChannel: "3",
- version: 2,
- channel: 1
- });
-}
-/**
- * 水滴雨API
- */
-async function waterRainForFarm() {
- const functionId = arguments.callee.name.toString();
- const body = {"type": 1, "hongBaoTimes": 100, "version": 3};
- $.waterRain = await request(functionId, body);
-}
-/**
- * 打卡领水API
- */
-async function clockInInitForFarm() {
- const functionId = arguments.callee.name.toString();
- $.clockInInit = await request(functionId);
-}
-
-// 连续签到API
-async function clockInForFarm() {
- const functionId = arguments.callee.name.toString();
- $.clockInForFarmRes = await request(functionId, {"type": 1});
-}
-
-//关注,领券等API
-async function clockInFollowForFarm(id, type, step) {
- const functionId = arguments.callee.name.toString();
- let body = {
- id,
- type,
- step
- }
- if (type === 'theme') {
- if (step === '1') {
- $.themeStep1 = await request(functionId, body);
- } else if (step === '2') {
- $.themeStep2 = await request(functionId, body);
- }
- } else if (type === 'venderCoupon') {
- if (step === '1') {
- $.venderCouponStep1 = await request(functionId, body);
- } else if (step === '2') {
- $.venderCouponStep2 = await request(functionId, body);
- }
- }
-}
-
-// 领取连续签到7天的惊喜礼包API
-async function gotClockInGift() {
- $.gotClockInGiftRes = await request('clockInForFarm', {"type": 2})
-}
-
-//定时领水API
-async function gotThreeMealForFarm() {
- const functionId = arguments.callee.name.toString();
- $.threeMeal = await request(functionId);
-}
-/**
- * 浏览广告任务API
- * type为0时, 完成浏览任务
- * type为1时, 领取浏览任务奖励
- */
-async function browseAdTaskForFarm(advertId, type) {
- const functionId = arguments.callee.name.toString();
- if (type === 0) {
- $.browseResult = await request(functionId, {advertId, type});
- } else if (type === 1) {
- $.browseRwardResult = await request(functionId, {advertId, type});
- }
-}
-// 被水滴砸中API
-async function gotWaterGoalTaskForFarm() {
- $.goalResult = await request(arguments.callee.name.toString(), {type: 3});
-}
-//签到API
-async function signForFarm() {
- const functionId = arguments.callee.name.toString();
- $.signResult = await request(functionId);
-}
-/**
- * 初始化农场, 可获取果树及用户信息API
- */
-async function initForFarm() {
- return new Promise(resolve => {
- const option = {
- url: `${JD_API_HOST}?functionId=initForFarm`,
- body: `body=${escape(JSON.stringify({"version":4}))}&appid=wh5&clientVersion=9.1.0`,
- headers: {
- "accept": "*/*",
- "accept-encoding": "gzip, deflate, br",
- "accept-language": "zh-CN,zh;q=0.9",
- "cache-control": "no-cache",
- "cookie": cookie,
- "origin": "https://home.m.jd.com",
- "pragma": "no-cache",
- "referer": "https://home.m.jd.com/myJd/newhome.action",
- "sec-fetch-dest": "empty",
- "sec-fetch-mode": "cors",
- "sec-fetch-site": "same-site",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- "Content-Type": "application/x-www-form-urlencoded"
- }
- };
- $.post(option, (err, resp, data) => {
- try {
- if (err) {
- console.log('\n东东农场: API查询请求失败 ‼️‼️');
- console.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- $.farmInfo = JSON.parse(data)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-
-// 初始化任务列表API
-async function taskInitForFarm() {
- console.log('\n初始化任务列表')
- const functionId = arguments.callee.name.toString();
- $.farmTask = await request(functionId);
-}
-//获取好友列表API
-async function friendListInitForFarm() {
- $.friendList = await request('friendListInitForFarm', {"version": 4, "channel": 1});
- // console.log('aa', aa);
-}
-// 领取邀请好友的奖励API
-async function awardInviteFriendForFarm() {
- $.awardInviteFriendRes = await request('awardInviteFriendForFarm');
-}
-//为好友浇水API
-async function waterFriendForFarm(shareCode) {
- const body = {"shareCode": shareCode, "version": 6, "channel": 1}
- $.waterFriendForFarmRes = await request('waterFriendForFarm', body);
-}
-async function showMsg() {
- let ctrTemp;
- if ($.isNode() && process.env.FRUIT_NOTIFY_CONTROL) {
- ctrTemp = `${process.env.FRUIT_NOTIFY_CONTROL}` === 'false';
- } else if ($.getdata('jdFruitNotify')) {
- ctrTemp = $.getdata('jdFruitNotify') === 'false';
- } else {
- ctrTemp = `${jdNotify}` === 'false';
- }
- if (ctrTemp) {
- $.msg($.name, subTitle, message, option);
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `${subTitle}\n${message}`);
- }
- } else {
- $.log(`\n${message}\n`);
- }
-}
-
-function timeFormat(time) {
- let date;
- if (time) {
- date = new Date(time)
- } else {
- date = new Date();
- }
- return date.getFullYear() + '-' + ((date.getMonth() + 1) >= 10 ? (date.getMonth() + 1) : '0' + (date.getMonth() + 1)) + '-' + (date.getDate() >= 10 ? date.getDate() : '0' + date.getDate());
-}
-function readShareCode() {
- return new Promise(resolve => {
- $.get({url: `http://api.turinglabs.net/api/v1/jd/farm/read/${randomCount}/`}, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- console.log(`随机取个${randomCount}码放到您固定的互助码后面`)
- data = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function shareCodesFormat() {
- return new Promise(async resolve => {
- // console.log(`第${$.index}个京东账号的助力码:::${jdFruitShareArr[$.index - 1]}`)
- newShareCodes = [];
- if (jdFruitShareArr[$.index - 1]) {
- newShareCodes = jdFruitShareArr[$.index - 1].split('@');
- } else {
- console.log(`由于您第${$.index}个京东账号未提供shareCode,将采纳本脚本自带的助力码\n`)
- const tempIndex = $.index > shareCodes.length ? (shareCodes.length - 1) : ($.index - 1);
- newShareCodes = shareCodes[tempIndex].split('@');
- }
- const readShareCodeRes = await readShareCode();
- if (readShareCodeRes && readShareCodeRes.code === 200) {
- // newShareCodes = newShareCodes.concat(readShareCodeRes.data || []);
- newShareCodes = [...new Set([...newShareCodes, ...(readShareCodeRes.data || [])])];
- }
- console.log(`第${$.index}个京东账号将要助力的好友${JSON.stringify(newShareCodes)}`)
- resolve();
- })
-}
-function requireConfig() {
- return new Promise(resolve => {
- console.log('开始获取配置文件\n')
- notify = $.isNode() ? require('./sendNotify') : '';
- //Node.js用户请在jdCookie.js处填写京东ck;
- const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
- const jdFruitShareCodes = $.isNode() ? require('./jdFruitShareCodes.js') : '';
- //IOS等用户直接用NobyDa的jd cookie
- if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- if (jdCookieNode[item]) {
- cookiesArr.push(jdCookieNode[item])
- }
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
- } else {
- cookiesArr.push(...[$.getdata('CookieJD'), $.getdata('CookieJD2')]);
- }
- console.log(`共${cookiesArr.length}个京东账号\n`)
- if ($.isNode()) {
- Object.keys(jdFruitShareCodes).forEach((item) => {
- if (jdFruitShareCodes[item]) {
- jdFruitShareArr.push(jdFruitShareCodes[item])
- }
- })
- } else {
- const boxShareCodeArr = ['jd_fruit1', 'jd_fruit2', 'jd_fruit3', 'jd_fruit4'];
- const boxShareCodeArr2 = ['jd2_fruit1', 'jd2_fruit2', 'jd2_fruit3', 'jd2_fruit4'];
- const isBox1 = boxShareCodeArr.some((item) => {
- const boxShareCode = $.getdata(item);
- return (boxShareCode !== undefined && boxShareCode !== null && boxShareCode !== '');
- });
- const isBox2 = boxShareCodeArr2.some((item) => {
- const boxShareCode = $.getdata(item);
- return (boxShareCode !== undefined && boxShareCode !== null && boxShareCode !== '');
- });
- isBox = isBox1 ? isBox1 : isBox2;
- if (isBox1) {
- let temp = [];
- for (const item of boxShareCodeArr) {
- if ($.getdata(item)) {
- temp.push($.getdata(item))
- }
- }
- jdFruitShareArr.push(temp.join('@'));
- }
- if (isBox2) {
- let temp = [];
- for (const item of boxShareCodeArr2) {
- if ($.getdata(item)) {
- temp.push($.getdata(item))
- }
- }
- jdFruitShareArr.push(temp.join('@'));
- }
- }
- // console.log(`jdFruitShareArr::${JSON.stringify(jdFruitShareArr)}`)
- // console.log(`jdFruitShareArr账号长度::${jdFruitShareArr.length}`)
- console.log(`您提供了${jdFruitShareArr.length}个账号的农场助力码\n`);
- resolve()
- })
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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 request(function_id, body = {}, timeout = 1000){
- return new Promise(resolve => {
- setTimeout(() => {
- $.get(taskUrl(function_id, body), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n东东农场: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- console.log(`function_id:${function_id}`)
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- }, timeout)
- })
-}
-function safeGet(data) {
- try {
- if (typeof JSON.parse(data) == "object") {
- return true;
- }
- } catch (e) {
- console.log(e);
- console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
- return false;
- }
-}
-function taskUrl(function_id, body = {}) {
- return {
- url: `${JD_API_HOST}?functionId=${function_id}&appid=wh5&body=${escape(JSON.stringify(body))}`,
- headers: {
- Cookie: cookie,
- UserAgent: $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- }
- }
-}
-// prettier-ignore
-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)}
diff --git a/jd_jdfactory.js b/jd_jdfactory.js
deleted file mode 100644
index 69f1e02..0000000
--- a/jd_jdfactory.js
+++ /dev/null
@@ -1,674 +0,0 @@
-/*
- * @Author: lxk0301 https://github.com/lxk0301
- * @Date: 2020-11-25 18:19:21
- * @Last Modified by: lxk0301
- * @Last Modified time: 2020-11-27 09:58:02
- */
-/*
-东东工厂,不是京喜工厂
-免费产生的电量(10秒1个电量,500个电量满,5000秒到上限不生产,算起来是84分钟达到上限)
-故建议1小时运行一次
-开会员任务和去京东首页点击“数码电器任务目前未做
-不会每次运行脚本都投入电力
-只有当心仪的商品存在,并且收集起来的电量满足当前商品所需电力,才投入
-已支持IOS双京东账号,Node.js支持N个京东账号
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-============Quantumultx===============
-[task_local]
-#京东工厂
-10 * * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdfactory.js, tag=东东工厂, enabled=true
-
-================Loon==============
-[Script]
-cron "10 * * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdfactory.js,tag=东东工厂
-
-===============Surge=================
-东东工厂 = type=cron,cronexp="10 * * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdfactory.js
-
-============小火箭=========
-东东工厂 = type=cron,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdfactory.js, cronexpr="10 * * * *", timeout=200, enable=true
- */
-const $ = new Env('东东工厂');
-
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送
-const randomCount = $.isNode() ? 20 : 5;
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '', message;
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- cookiesArr.push(...[$.getdata('CookieJD'), $.getdata('CookieJD2')]);
-}
-let wantProduct = ``;//心仪商品名称
-const JD_API_HOST = 'https://api.m.jd.com/client.action';
-const inviteCodes = [`P04z54XCjVWnYaS5u2ak7ZCdan1Bdd2GGiWvC6_uERj`, 'P04z54XCjVWnYaS5m9cZ2ariXVJwHf0bgkG7Uo'];
-!(async () => {
- await requireConfig();
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- message = '';
- await TotalBean();
- console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- await shareCodesFormat();
- await jdFactory()
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-async function jdFactory() {
- await jdfactory_getHomeData();
- await helpFriends();
- // $.newUser !==1 && $.haveProduct === 2,老用户但未选购商品
- // $.newUser === 1新用户
- if ($.newUser === 1) return
- await jdfactory_collectElectricity();//收集产生的电量
- await jdfactory_getTaskDetail();
- await doTask();
- await algorithm();//投入电力逻辑
- await showMsg();
-}
-function showMsg() {
- return new Promise(resolve => {
- if (!jdNotify) {
- $.msg($.name, '', `${message}`);
- } else {
- $.log(message);
- }
- resolve()
- })
-}
-async function algorithm() {
- // 当心仪的商品存在,并且收集起来的电量满足当前商品所需,就投入
- return new Promise(resolve => {
- $.post(taskPostUrl('jdfactory_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);
- if (data.data.bizCode === 0) {
- $.haveProduct = data.data.result.haveProduct;
- $.userName = data.data.result.userName;
- $.newUser = data.data.result.newUser;
- wantProduct = $.isNode() ? (process.env.FACTORAY_WANTPRODUCT_NAME ? process.env.FACTORAY_WANTPRODUCT_NAME : wantProduct) : ($.getdata('FACTORAY_WANTPRODUCT_NAME') ? $.getdata('FACTORAY_WANTPRODUCT_NAME') : wantProduct);
- if (data.data.result.factoryInfo) {
- let { totalScore, useScore, produceScore, remainScore, couponCount, name } = data.data.result.factoryInfo
- console.log(`\n已选商品:${name}`);
- console.log(`当前已投入电量/所需电量:${useScore}/${totalScore}`);
- console.log(`已选商品剩余量:${couponCount}`);
- console.log(`当前总电量:${remainScore * 1 + useScore * 1}`);
- console.log(`当前完成度:${((remainScore * 1 + useScore * 1)/(totalScore * 1)).toFixed(2) * 100}%\n`);
- message += `京东账号${$.index} ${$.nickName}\n`;
- message += `已选商品:${name}\n`;
- message += `当前已投入电量/所需电量:${useScore}/${totalScore}\n`;
- message += `已选商品剩余量:${couponCount}\n`;
- message += `当前总电量:${remainScore * 1 + useScore * 1}\n`;
- message += `当前完成度:${((remainScore * 1 + useScore * 1)/(totalScore * 1)).toFixed(2) * 100}%\n`;
- if (wantProduct) {
- console.log(`BoxJs或环境变量提供的心仪商品:${wantProduct}\n`);
- await jdfactory_getProductList(true);
- let wantProductSkuId = '';
- for (let item of $.canMakeList) {
- if (item.name.indexOf(wantProduct) > - 1) {
- totalScore = item['fullScore'] * 1;
- couponCount = item.couponCount;
- name = item.name;
- }
- if (item.name.indexOf(wantProduct) > - 1 && item.couponCount > 0) {
- wantProductSkuId = item.skuId;
- }
- }
- // console.log(`\n您心仪商品${name}\n当前数量为:${couponCount}\n兑换所需电量为:${totalScore}\n您当前总电量为:${remainScore * 1 + useScore * 1}\n`);
- if (wantProductSkuId && ((remainScore * 1 + useScore * 1) >= (totalScore * 1 + 100000))) {
- console.log(`\n提供的心仪商品${name}目前数量:${couponCount},且当前总电量为:${remainScore * 1 + useScore * 1},【满足】兑换此商品所需总电量:${totalScore + 100000}`);
- console.log(`请去活动页面更换成心仪商品并手动投入电量兑换\n`);
- $.msg($.name, '', `京东账号${$.index}${$.nickName}\n您提供的心仪商品${name}目前数量:${couponCount}\n当前总电量为:${remainScore * 1 + useScore * 1}\n【满足】兑换此商品所需总电量:${totalScore}\n请点击弹窗直达活动页面\n更换成心仪商品并手动投入电量兑换`, {'open-url': 'openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/2uSsV2wHEkySvompfjB43nuKkcHp/index.html%22%20%7D'});
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `您提供的心仪商品${name}目前数量:${couponCount}\n当前总电量为:${remainScore * 1 + useScore * 1}\n【满足】兑换此商品所需总电量:${totalScore}\n请去活动页面更换成心仪商品并手动投入电量兑换`);
- } else {
- console.log(`您心仪商品${name}\n当前数量为:${couponCount}\n兑换所需电量为:${totalScore}\n您当前总电量为:${remainScore * 1 + useScore * 1}\n不满足兑换心仪商品的条件\n`)
- }
- } else {
- console.log(`BoxJs或环境变量暂未提供心仪商品\n如需兑换心仪商品,请提供心仪商品名称,否则满足条件后会为您兑换当前所选商品:${name}\n`);
- if (((remainScore * 1 + useScore * 1) >= totalScore * 1 + 100000) && (couponCount * 1 > 0)) {
- console.log(`\n所选商品${name}目前数量:${couponCount},且当前总电量为:${remainScore * 1 + useScore * 1},【满足】兑换此商品所需总电量:${totalScore}`);
- console.log(`BoxJs或环境变量暂未提供心仪商品,下面为您目前选的${name} 发送提示通知\n`);
- // await jdfactory_addEnergy();
- $.msg($.name, '', `京东账号${$.index}${$.nickName}\n您所选商品${name}目前数量:${couponCount}\n当前总电量为:${remainScore * 1 + useScore * 1}\n【满足】兑换此商品所需总电量:${totalScore}\n请点击弹窗直达活动页面查看`, {'open-url': 'openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/2uSsV2wHEkySvompfjB43nuKkcHp/index.html%22%20%7D'});
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `所选商品${name}目前数量:${couponCount}\n当前总电量为:${remainScore * 1 + useScore * 1}\n【满足】兑换此商品所需总电量:${totalScore}\n请速去活动页面查看`);
- } else {
- console.log(`\n所选商品${name}目前数量:${couponCount},且当前总电量为:${remainScore * 1 + useScore * 1},【不满足】兑换此商品所需总电量:${totalScore}`)
- console.log(`故不一次性投入电力,一直放到蓄电池累计\n`);
- }
- }
- } else {
- console.log(`\n此账号${$.index}${$.nickName}暂未选择商品\n`);
- if (wantProduct) {
- console.log(`BoxJs或环境变量提供的心仪商品:${wantProduct}\n`);
- await jdfactory_getProductList(true);
- let wantProductSkuId = '', name, totalScore, couponCount, remainScore;
- for (let item of $.canMakeList) {
- if (item.name.indexOf(wantProduct) > - 1) {
- totalScore = item['fullScore'] * 1;
- couponCount = item.couponCount;
- name = item.name;
- }
- if (item.name.indexOf(wantProduct) > - 1 && item.couponCount > 0) {
- wantProductSkuId = item.skuId;
- }
- }
- if (wantProductSkuId && (($.batteryValue * 1) >= (totalScore))) {
- console.log(`\n提供的心仪商品${name}目前数量:${couponCount},且当前总电量为:${$.batteryValue * 1},【满足】兑换此商品所需总电量:${totalScore}`);
- console.log(`请去活动页面选择心仪商品并手动投入电量兑换\n`);
- $.msg($.name, '', `京东账号${$.index}${$.nickName}\n您提供的心仪商品${name}目前数量:${couponCount}\n当前总电量为:${$.batteryValue * 1}\n【满足】兑换此商品所需总电量:${totalScore}\n请点击弹窗直达活动页面\n选择此心仪商品并手动投入电量兑换`, {'open-url': 'openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/2uSsV2wHEkySvompfjB43nuKkcHp/index.html%22%20%7D'});
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `您提供的心仪商品${name}目前数量:${couponCount}\n当前总电量为:${$.batteryValue * 1}\n【满足】兑换此商品所需总电量:${totalScore}\n请去活动页面选择此心仪商品并手动投入电量兑换`);
- } else {
- console.log(`您心仪商品${name}\n当前数量为:${couponCount}\n兑换所需电量为:${totalScore}\n您当前总电量为:${$.batteryValue * 1}\n不满足兑换心仪商品的条件\n`)
- }
- } else {
- console.log(`BoxJs或环境变量暂未提供心仪商品\n如需兑换心仪商品,请提供心仪商品名称\n`);
- }
- }
- } else {
- console.log(`异常:${JSON.stringify(data)}`)
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-async function helpFriends() {
- for (let code of $.newShareCodes) {
- if (!code) continue
- const helpRes = await jdfactory_collectScore(code);
- if (helpRes.code === 0 && helpRes.data.bizCode === -7) {
- console.log(`助力机会已耗尽,跳出`);
- break
- }
- }
-}
-async function doTask() {
- for (let item of $.taskVos) {
- if (item.taskType === 1) {
- //关注店铺任务
- if (item.status === 1) {
- console.log(`准备做此任务:${item.taskName}`);
- for (let task of item.followShopVo) {
- if (task.status === 1) {
- await jdfactory_collectScore(task.taskToken);
- }
- }
- } else {
- console.log(`${item.taskName}已做完`)
- }
- }
- if (item.taskType === 2) {
- //看看商品任务
- if (item.status === 1) {
- console.log(`准备做此任务:${item.taskName}`);
- for (let task of item.productInfoVos) {
- if (task.status === 1) {
- await jdfactory_collectScore(task.taskToken);
- }
- }
- } else {
- console.log(`${item.taskName}已做完`)
- }
- }
- if (item.taskType === 3) {
- //逛会场任务
- if (item.status === 1) {
- console.log(`准备做此任务:${item.taskName}`);
- for (let task of item.shoppingActivityVos) {
- if (task.status === 1) {
- await jdfactory_collectScore(task.taskToken);
- }
- }
- } else {
- console.log(`${item.taskName}已做完`)
- }
- }
- if (item.taskType === 10) {
- if (item.status === 1) {
- if (item.threeMealInfoVos.status === 1) {
- //可以做此任务
- console.log(`准备做此任务:${item.taskName}`);
- await jdfactory_collectScore(item.threeMealInfoVos.taskToken);
- } else if (item.threeMealInfoVos.status === 0) {
- console.log(`${item.taskName} 任务已错过时间`)
- }
- } else if (item.status === 2){
- console.log(`${item.taskName}已完成`);
- }
- }
- if (item.taskType === 21) {
- //开通会员任务
- if (item.status === 1) {
- console.log(`此任务:${item.taskName},跳过`);
- // for (let task of item.brandMemberVos) {
- // if (task.status === 1) {
- // await jdfactory_collectScore(task.taskToken);
- // }
- // }
- } else {
- console.log(`${item.taskName}已做完`)
- }
- }
- if (item.taskType === 13) {
- //每日打卡
- if (item.status === 1) {
- console.log(`准备做此任务:${item.taskName}`);
- await jdfactory_collectScore(item.simpleRecordInfoVo.taskToken);
- } else {
- console.log(`${item.taskName}已完成`);
- }
- }
- if (item.taskType === 14) {
- //好友助力
- if (item.status === 1) {
- console.log(`准备做此任务:${item.taskName}`);
- // await jdfactory_collectScore(item.simpleRecordInfoVo.taskToken);
- } else {
- console.log(`${item.taskName}已完成`);
- }
- }
- if (item.taskType === 23) {
- //从数码电器首页进入
- if (item.status === 1) {
- console.log(`准备做此任务:${item.taskName}`);
- await jdfactory_collectScore(item.simpleRecordInfoVo.taskToken);
- } else {
- console.log(`${item.taskName}已完成`);
- }
- }
- }
-}
-
-//领取做完任务的奖励
-function jdfactory_collectScore(taskToken) {
- return new Promise(resolve => {
- $.post(taskPostUrl("jdfactory_collectScore", { taskToken }, "jdfactory_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);
- if (data.data.bizCode === 0) {
- $.taskVos = data.data.result.taskVos;//任务列表
- console.log(`领取做完任务的奖励:${JSON.stringify(data.data.result)}`);
- } else {
- console.log(JSON.stringify(data))
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-//给商品投入电量
-function jdfactory_addEnergy() {
- return new Promise(resolve => {
- $.post(taskPostUrl("jdfactory_addEnergy"), 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) {
- console.log(`给商品投入电量:${JSON.stringify(data.data.result)}`)
- // $.taskConfigVos = data.data.result.taskConfigVos;
- // $.exchangeGiftConfigs = data.data.result.exchangeGiftConfigs;
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-
-//收集电量
-function jdfactory_collectElectricity() {
- return new Promise(resolve => {
- $.post(taskPostUrl("jdfactory_collectElectricity"), 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) {
- console.log(`成功收集${data.data.result.electricityValue}电量,当前蓄电池总电量:${data.data.result.batteryValue}\n`);
- $.batteryValue = data.data.result.batteryValue;
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-//获取任务列表
-function jdfactory_getTaskDetail() {
- return new Promise(resolve => {
- $.post(taskPostUrl("jdfactory_getTaskDetail", {}, "jdfactory_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);
- if (data.data.bizCode === 0) {
- $.taskVos = data.data.result.taskVos;//任务列表
- $.taskVos.map(item => {
- if (item.taskType === 14) {
- console.log(`\n您的${$.name}好友助力邀请码:${item.assistTaskDetailVo.taskToken}\n`)
- }
- })
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-//选择一件商品,只能在 $.newUser !== 1 && $.haveProduct === 2 并且 sellOut === 0的时候可用
-function jdfactory_makeProduct(skuId) {
- return new Promise(resolve => {
- $.post(taskPostUrl('jdfactory_makeProduct', { skuId }), 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) {
- console.log(`选购商品成功:${JSON.stringify(data)}`);
- } else {
- console.log(`异常:${JSON.stringify(data)}`)
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-//查询当前商品列表
-function jdfactory_getProductList(flag) {
- return new Promise(resolve => {
- $.post(taskPostUrl('jdfactory_getProductList'), 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) {
- $.canMakeList = data.data.result.canMakeList;//当前可选商品列表 sellOut:1为已抢光,0为目前可选择
- if (!flag) {
- console.log(`商品名称 可选状态 剩余量`)
- for (let item of $.canMakeList) {
- console.log(`${item.name.slice(-4)} ${item.sellOut === 1 ? '已抢光':'可选'} ${item.couponCount}`);
- if (item.name.indexOf(wantProduct) > -1 && item.couponCount > 0 && item.sellOut === 0) {
- await jdfactory_makeProduct(item.skuId);
- break
- }
- }
- }
- } else {
- console.log(`异常:${JSON.stringify(data)}`)
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function jdfactory_getHomeData() {
- return new Promise(resolve => {
- $.post(taskPostUrl('jdfactory_getHomeData'), async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- console.log(data);
- data = JSON.parse(data);
- if (data.data.bizCode === 0) {
- $.haveProduct = data.data.result.haveProduct;
- $.userName = data.data.result.userName;
- $.newUser = data.data.result.newUser;
- if (data.data.result.factoryInfo) {
- $.totalScore = data.data.result.factoryInfo.totalScore;//选中的商品,一共需要的电量
- $.userScore = data.data.result.factoryInfo.userScore;//已使用电量
- $.produceScore = data.data.result.factoryInfo.produceScore;//此商品已投入电量
- $.remainScore = data.data.result.factoryInfo.remainScore;//当前蓄电池电量
- $.couponCount = data.data.result.factoryInfo.couponCount;//已选中商品当前剩余量
- $.hasProduceName = data.data.result.factoryInfo.name;//已选中商品当前剩余量
- }
- if ($.newUser === 1) {
- //新用户
- console.log(`此京东账号${$.index}${$.nickName}为新用户暂未开启${$.name}活动\n现在为您从库存里面现有数量中选择一商品`);
- if ($.haveProduct === 2) {
- await jdfactory_getProductList();//选购商品
- }
- // $.msg($.name, '暂未开启活动', `京东账号${$.index}${$.nickName}暂未开启${$.name}活动\n请去京东APP->搜索'玩一玩'->东东工厂->开启\n或点击弹窗即可到达${$.name}活动`, {'open-url': 'openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/2uSsV2wHEkySvompfjB43nuKkcHp/index.html%22%20%7D'});
- }
- if ($.newUser !== 1 && $.haveProduct === 2) {
- console.log(`此京东账号${$.index}${$.nickName}暂未选购商品\n现在也能为您做任务和收集免费电力`);
- // $.msg($.name, '暂未选购商品', `京东账号${$.index}${$.nickName}暂未选购商品\n请去京东APP->搜索'玩一玩'->东东工厂->选购一件商品\n或点击弹窗即可到达${$.name}活动`, {'open-url': 'openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/2uSsV2wHEkySvompfjB43nuKkcHp/index.html%22%20%7D'});
- // await jdfactory_getProductList();//选购商品
- }
- } else {
- console.log(`异常:${JSON.stringify(data)}`)
- }
- }
- }
- } 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/ddfactory/read/${randomCount}/`}, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- console.log(`随机取个${randomCount}码放到您固定的互助码后面`)
- data = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- // await $.wait(2000);
- // resolve()
- })
-}
-//格式化助力码
-function shareCodesFormat() {
- return new Promise(async resolve => {
- // console.log(`第${$.index}个京东账号的助力码:::${$.shareCodesArr[$.index - 1]}`)
- $.newShareCodes = [];
- if ($.shareCodesArr[$.index - 1]) {
- $.newShareCodes = $.shareCodesArr[$.index - 1].split('@');
- } else {
- console.log(`由于您第${$.index}个京东账号未提供shareCode,将采纳本脚本自带的助力码\n`)
- const tempIndex = $.index > inviteCodes.length ? (inviteCodes.length - 1) : ($.index - 1);
- $.newShareCodes = inviteCodes[tempIndex].split('@');
- }
- const readShareCodeRes = await readShareCode();
- if (readShareCodeRes && readShareCodeRes.code === 200) {
- $.newShareCodes = [...new Set([...$.newShareCodes, ...(readShareCodeRes.data || [])])];
- }
- console.log(`第${$.index}个京东账号将要助力的好友${JSON.stringify($.newShareCodes)}`)
- resolve();
- })
-}
-function requireConfig() {
- return new Promise(resolve => {
- console.log(`开始获取${$.name}配置文件\n`);
- //Node.js用户请在jdCookie.js处填写京东ck;
- const shareCodes = $.isNode() ? require('./jdFactoryShareCodes.js') : '';
- console.log(`共${cookiesArr.length}个京东账号\n`);
- $.shareCodesArr = [];
- if ($.isNode()) {
- Object.keys(shareCodes).forEach((item) => {
- if (shareCodes[item]) {
- $.shareCodesArr.push(shareCodes[item])
- }
- })
- }
- // console.log(`\n种豆得豆助力码::${JSON.stringify($.shareCodesArr)}`);
- console.log(`您提供了${$.shareCodesArr.length}个账号的${$.name}助力码\n`);
- resolve()
- })
-}
-function taskPostUrl(function_id, body = {}, function_id2) {
- let url = `${JD_API_HOST}`;
- if (function_id2) {
- url += `?functionId=${function_id2}`;
- }
- return {
- url,
- body: `functionId=${function_id}&body=${escape(JSON.stringify(body))}&client=wh5&clientVersion=9.1.0`,
- headers: {
- "Cookie": cookie,
- "origin": "https://h5.m.jd.com",
- "referer": "https://h5.m.jd.com/",
- 'Content-Type': 'application/x-www-form-urlencoded',
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- }
- }
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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 safeGet(data) {
- try {
- if (typeof JSON.parse(data) == "object") {
- return true;
- }
- } catch (e) {
- console.log(e);
- console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
- return false;
- }
-}
-// prettier-ignore
-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,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("",`\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 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();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){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="",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}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));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
diff --git a/jd_joy.js b/jd_joy.js
deleted file mode 100644
index 7df3fff..0000000
--- a/jd_joy.js
+++ /dev/null
@@ -1,757 +0,0 @@
-/*
-jd宠汪汪 搬的https://github.com/uniqueque/QuantumultX/blob/4c1572d93d4d4f883f483f907120a75d925a693e/Script/jd_joy.js
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-IOS用户支持京东双账号,NodeJs用户支持N个京东账号
-更新时间:2020-11-03
-建议先凌晨0点运行jd_joy.js脚本获取狗粮后,再运行此脚本(jd_joy_steal.js)可偷好友积分,6点运行可偷好友狗粮
-feedCount:自定义 每次喂养数量; 等级只和喂养次数有关,与数量无关
-推荐每次投喂10个,积累狗粮,然后去聚宝盆赌每小时的幸运奖,据观察,投入3000-6000中奖概率大,超过7000基本上注定亏本,即使是第一名
-Combine from Zero-S1/JD_tools(https://github.com/Zero-S1/JD_tools)
-更新时间:2020-10-20
-注:如果使用Node.js, 需自行安装'crypto-js,got,http-server,tough-cookie'模块. 例: npm install crypto-js http-server tough-cookie got --save
-*/
-// quantumultx
-// [task_local]
-// #京东宠汪汪
-// 15 */2 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy.js, tag=京东宠汪汪, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdcww.png, enabled=true
-// Loon
-// [Script]
-// cron "15 */2 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy.js,tag=京东宠汪汪
-// Surge
-// 京东宠汪汪 = type=cron,cronexp="15 */2 * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy.js
-const $ = new Env('宠汪汪');
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- cookiesArr.push($.getdata('CookieJD'));
- cookiesArr.push($.getdata('CookieJD2'));
-}
-let message = '', subTitle = '';
-let FEED_NUM = ($.getdata('joyFeedCount') * 1) || 10; //每次喂养数量 [10,20,40,80]
-//是否参加宠汪汪双人赛跑(据目前观察,参加双人赛跑不消耗狗粮,如需参加其他多人赛跑,请关闭)
-// 默认 'true' 参加双人赛跑,如需关闭 ,请改成 'false';
-let joyRunFlag = true;
-let jdNotify = true;//是否开启静默运行,默认true开启
-const JD_API_HOST = 'https://jdjoy.jd.com/pet'
-const weAppUrl = 'https://draw.jdfcloud.com//pet';
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- message = '';
- subTitle = '';
- await jdJoy();
- await showMsg();
- // await joinTwoPeopleRun();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-async function jdJoy() {
- await getPetTaskConfig();
- if ($.getPetTaskConfigRes.success) {
- if ($.isNode()) {
- if (process.env.JOY_FEED_COUNT) {
- if ([10, 20, 40, 80].indexOf(process.env.JOY_FEED_COUNT * 1) > -1) {
- FEED_NUM = process.env.JOY_FEED_COUNT ? process.env.JOY_FEED_COUNT * 1 : FEED_NUM;
- } else {
- console.log(`您输入的 JOY_FEED_COUNT 为非法数字,请重新输入`);
- }
- }
- }
- await feedPets(FEED_NUM);//喂食
- await Promise.all([
- petTask(),
- appPetTask()
- ])
- await deskGoodsTask();//限时货柜
- await enterRoom();
- await joinTwoPeopleRun()//参加双人赛跑
- } else {
- message += `${$.getPetTaskConfigRes.errorMessage}`;
- }
-}
-//逛商品得100积分奖励任务
-async function deskGoodsTask() {
- const deskGoodsRes = await getDeskGoodDetails();
- if (deskGoodsRes && deskGoodsRes.success) {
- if (deskGoodsRes.data && deskGoodsRes.data.deskGoods) {
- const { deskGoods, taskChance, followCount = 0 } = deskGoodsRes.data;
- console.log(`浏览货柜商品 ${followCount ? followCount : 0}/${taskChance}`);
- if (taskChance === followCount) return
- for (let item of deskGoods) {
- if (!item['status'] && item['sku']) {
- await followScan(item['sku'])
- }
- }
- } else {
- console.log(`限时商品货架已下架`);
- }
- }
-}
-//参加双人赛跑
-async function joinTwoPeopleRun() {
- joyRunFlag = $.getdata('joyRunFlag') ? $.getdata('joyRunFlag') : joyRunFlag;
- if ($.isNode() && process.env.JOY_RUN_FLAG) {
- joyRunFlag = process.env.JOY_RUN_FLAG;
- }
- if (`${joyRunFlag}` === 'true') {
- console.log(`\n===========以下是双人赛跑信息========\n`)
- await getPetRace();
- if ($.petRaceResult) {
- let petRaceResult = $.petRaceResult.data.petRaceResult;
- let raceUsers = $.petRaceResult.data.raceUsers;
- console.log(`赛跑状态:${petRaceResult}\n`);
- if (petRaceResult === 'not_participate') {
- console.log('暂未参赛,现在为您参加双人赛跑');
- await runMatch(2);
- if ($.runMatchResult.success) {
- console.log(`双人赛跑参加成功\n`);
- message += `双人赛跑:成功参加\n`;
- await getPetRace();
- petRaceResult = $.petRaceResult.data.petRaceResult;
- raceUsers = $.petRaceResult.data.raceUsers;
- // console.log(`参赛后的状态:${petRaceResult}`)
- console.log(`双人赛跑助力请自己手动去邀请好友,脚本不带赛跑助力功能\n`);
- }
- }
- if (petRaceResult === 'unbegin') {
- console.log('比赛还未开始,请九点再来');
- }
- if (petRaceResult === 'time_over') {
- console.log('今日参赛的比赛已经结束,请明天九点再来');
- }
- if (petRaceResult === 'unreceive') {
- console.log('今日参赛的比赛已经结束,现在领取奖励');
- await receiveJoyRunAward();
- console.log(`领取赛跑奖励结果:${JSON.stringify($.receiveJoyRunAwardRes)}`)
- if ($.receiveJoyRunAwardRes.success) {
- $.msg($.name, '双人赛跑取得获胜', `【京东账号${$.index}】${$.nickName}\n太棒了,恭喜您获得300积分奖励`)
- }
- }
- if (petRaceResult === 'participate') {
- if(raceUsers) {
- for (let index =0; index < raceUsers.length; index++) {
- if (raceUsers[index].myself) {
- console.log(`您当前里程:${raceUsers[index].distance}KM\n`);
- message += `您当前里程:${raceUsers[index].distance}km\n`;
- } else {
- console.log(`对手当前里程:${raceUsers[index].distance}KM\n`);
- message += `对手当前里程:${raceUsers[index].distance}km\n`;
- }
- }
- }
- console.log('今日已参赛,下面显示应援团信息\n');
- await getBackupInfo();
- if ($.getBackupInfoResult.success) {
- const { currentNickName, totalMembers, totalDistance, backupList } = $.getBackupInfoResult.data;
- console.log(`${currentNickName}的应援团信息如下\n团员:${totalMembers}个\n团员助力的里程数:${totalDistance}\n`);
- if (backupList && backupList.length > 0) {
- for (let item of backupList) {
- console.log(`${item.nickName}为您助力${item.distance}km\n`);
- }
- } else {
- console.log(`暂无好友为您助力赛跑,如需助力,请手动去邀请好友助力\n`);
- }
- }
- }
- }
- } else {
- console.log(`您设置的是不参加双人赛跑`)
- }
-}
-//日常任务
-async function petTask() {
- for (let item of $.getPetTaskConfigRes.datas) {
- const joinedCount = item.joinedCount || 0;
- if (item['receiveStatus'] === 'chance_full') {
- console.log(`${item.taskName} 任务已完成`)
- continue
- }
- //每日签到
- if (item['taskType'] === 'SignEveryDay') {
- if (item['receiveStatus'] === 'chance_left') {
- console.log('未完成,需要自己手动去微信小程序【来客有礼】签到,可获得京豆奖励')
- } else if (item['receiveStatus'] === 'unreceive') {
- //已签到,领取签到后的狗粮
- const res = await getFood('SignEveryDay');
- console.log(`领取每日签到狗粮结果:${res.data}`);
- }
- }
- //邀请用户助力,领狗粮.(需手动去做任务)
- if (item['taskType'] === 'InviteUser') {
- if (item['receiveStatus'] === 'chance_left') {
- console.log('未完成,需要自己手动去邀请好友给你助力,可以获得狗粮')
- } else if (item['receiveStatus'] === 'unreceive') {
- const InviteUser = await getFood('InviteUser');
- console.log(`领取助力后的狗粮结果::${JSON.stringify(InviteUser)}`);
- }
- }
- //每日三餐
- if (item['taskType'] === 'ThreeMeals') {
- console.log('-----每日三餐-----');
- if (item['receiveStatus'] === 'unreceive') {
- const ThreeMealsRes = await getFood('ThreeMeals');
- if (ThreeMealsRes.success) {
- if (ThreeMealsRes.errorCode === 'received') {
- console.log(`三餐结果领取成功`)
- message += `【三餐】领取成功,获得${ThreeMealsRes.data}g狗粮\n`;
- }
- }
- }
- }
- //关注店铺
- if (item['taskType'] === 'FollowShop') {
- console.log('-----关注店铺-----');
- const followShops = item.followShops;
- for (let shop of followShops) {
- if (!shop.status) {
- const followShopRes = await followShop(shop.shopId);
- console.log(`关注店铺${shop.name}结果::${JSON.stringify(followShopRes)}`)
- }
- }
- }
- //逛会场
- if (item['taskType'] === 'ScanMarket') {
- console.log('----逛会场----');
- const scanMarketList = item.scanMarketList;
- for (let scanMarketItem of scanMarketList) {
- if (!scanMarketItem.status) {
- const body = {
- "marketLink": scanMarketItem.marketLink,
- "taskType": "ScanMarket",
- "reqSource": "weapp"
- };
- const scanMarketRes = await scanMarket('scan', body);
- console.log(`逛会场-${scanMarketItem.marketName}结果::${JSON.stringify(scanMarketRes)}`)
- }
- }
- }
- //浏览频道
- if (item['taskType'] === 'FollowChannel') {
- console.log('----浏览频道----');
- const followChannelList = item.followChannelList;
- for (let followChannelItem of followChannelList) {
- if (!followChannelItem.status) {
- const body = {
- "channelId": followChannelItem.channelId,
- "taskType": "FollowChannel",
- "reqSource": "weapp"
- };
- const scanMarketRes = await scanMarket('scan', body);
- console.log(`浏览频道-${followChannelItem.channelName}结果::${JSON.stringify(scanMarketRes)}`)
- }
- }
- }
- //关注商品
- if (item['taskType'] === 'FollowGood') {
- console.log('----关注商品----');
- const followGoodList = item.followGoodList;
- for (let followGoodItem of followGoodList) {
- if (!followGoodItem.status) {
- const body = `sku=${followGoodItem.sku}&reqSource=h5`;
- const scanMarketRes = await scanMarket('followGood', body, 'application/x-www-form-urlencoded');
- // const scanMarketRes = await appScanMarket('followGood', `sku=${followGoodItem.sku}&reqSource=h5`, 'application/x-www-form-urlencoded');
- console.log(`关注商品-${followGoodItem.skuName}结果::${JSON.stringify(scanMarketRes)}`)
- }
- }
- }
- //看激励视频
- if (item['taskType'] === 'ViewVideo') {
- console.log('----浏览频道----');
- if (item.taskChance === joinedCount) {
- console.log('今日激励视频已看完')
- } else {
- for (let i = 0; i < new Array(item.taskChance - joinedCount).fill('').length; i++) {
- console.log(`开始第${i+1}次看激励视频`);
- const body = {"taskType":"ViewVideo","reqSource":"weapp"}
- let sanVideoRes = await scanMarket('scan', body);
- console.log(`看视频激励结果--${JSON.stringify(sanVideoRes)}`);
- }
- }
- }
- }
-}
-async function appPetTask() {
- await appGetPetTaskConfig();
- // console.log('$.appGetPetTaskConfigRes', $.appGetPetTaskConfigRes.success)
- if ($.appGetPetTaskConfigRes.success) {
- for (let item of $.appGetPetTaskConfigRes.datas) {
- if (item['taskType'] === 'ScanMarket' && item['receiveStatus'] === 'chance_left') {
- const scanMarketList = item.scanMarketList;
- for (let scan of scanMarketList) {
- if (!scan.status && scan.showDest === 'h5') {
- const body = { marketLink: scan.marketLinkH5, taskType: 'ScanMarket', reqSource: 'h5' }
- await appScanMarket('scan', body);
- }
- }
- }
- }
- }
-}
-function getDeskGoodDetails() {
- return new Promise(resolve => {
- const url = `${JD_API_HOST}/getDeskGoodDetails`;
- const host = `jdjoy.jd.com`;
- const reqSource = 'h5';
- $.get(taskUrl(url, host, reqSource), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function followScan(sku) {
- return new Promise(resolve => {
- const url = `${JD_API_HOST}/scan`;
- const host = `jdjoy.jd.com`;
- const reqSource = 'h5';
- const body = {
- "taskType": "ScanDeskGood",
- "reqSource": "h5",
- sku
- }
- $.post(taskPostUrl(url, JSON.stringify(body), reqSource, host, 'application/json'), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//小程序逛会场,浏览频道,关注商品API
-function scanMarket(type, body, cType = 'application/json') {
- return new Promise(resolve => {
- const url = `${weAppUrl}/${type}`;
- const host = `draw.jdfcloud.com`;
- const reqSource = 'weapp';
- if (cType === 'application/json') {
- body = JSON.stringify(body)
- }
- $.post(taskPostUrl(url, body, reqSource, host, cType), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//app逛会场
-function appScanMarket(type, body) {
- return new Promise(resolve => {
- const url = `${JD_API_HOST}/${type}`;
- const host = `jdjoy.jd.com`;
- const reqSource = 'h5';
- $.post(taskPostUrl(url, JSON.stringify(body), reqSource, host, 'application/json'), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- // data = JSON.parse(data);
- console.log(`京东app逛会场结果::${data}`)
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-
-//领取狗粮API
-function getFood(type) {
- return new Promise(resolve => {
- const url = `${weAppUrl}/getFood?reqSource=weapp&taskType=${type}`;
- const host = `draw.jdfcloud.com`;
- const reqSource = 'weapp';
- $.get(taskUrl(url, host, reqSource), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//关注店铺api
-function followShop(shopId) {
- return new Promise(resolve => {
- const url = `${weAppUrl}/followShop`;
- const body = `shopId=${shopId}`;
- const reqSource = 'weapp';
- const host = 'draw.jdfcloud.com';
- $.post(taskPostUrl(url, body, reqSource, host,'application/x-www-form-urlencoded'), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function enterRoom() {
- return new Promise(resolve => {
- const url = `${weAppUrl}/enterRoom?reqSource=weapp`;
- const host = `draw.jdfcloud.com`;
- const reqSource = 'weapp';
- $.get(taskUrl(url, host, reqSource), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- // console.log('JSON.parse(data)', JSON.parse(data))
-
- $.roomData = JSON.parse(data);
-
- console.log(`现有狗粮: ${$.roomData.data.petFood}\n`)
-
- subTitle = `【用户名】${$.roomData.data.pin}`
- message = `现有积分: ${$.roomData.data.petCoin}\n现有狗粮: ${$.roomData.data.petFood}\n喂养次数: ${$.roomData.data.feedCount}\n宠物等级: ${$.roomData.data.petLevel}\n`
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve();
- }
- })
- })
-}
-function appGetPetTaskConfig() {
- return new Promise(resolve => {
- const url = `${JD_API_HOST}/getPetTaskConfig?reqSource=h5`;
- const host = `jdjoy.jd.com`;
- const reqSource = 'h5';
- $.get(taskUrl(url, host, reqSource), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- // console.log('----', JSON.parse(data))
- $.appGetPetTaskConfigRes = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve();
- }
- })
- })
-}
-//喂食
-function feedPets(feedNum) {
- return new Promise(resolve => {
- console.log(`您设置的喂食数量:${FEED_NUM}g\n`);
- console.log(`实际的喂食数量:${feedNum}g\n`);
- const url = `${weAppUrl}/feed?feedCount=${feedNum}&reqSource=weapp`;
- const host = `draw.jdfcloud.com`;
- const reqSource = 'weapp';
- $.get(taskUrl(url, host, reqSource), async (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- data = JSON.parse(data);
- if (data.success) {
- if (data.errorCode === 'feed_ok') {
- console.log('喂食成功')
- message += `【喂食成功】消耗${feedNum}g狗粮\n`;
- } else if (data.errorCode === 'time_error') {
- console.log('喂食失败:您的汪汪正在食用中,请稍后再喂食')
- message += `【喂食失败】您的汪汪正在食用中,请稍后再喂食\n`;
- } else if (data.errorCode === 'food_insufficient') {
- console.log(`当前喂食${feedNum}g狗粮不够, 现为您降低一档次喂食\n`)
- if ((feedNum) === 80) {
- feedNum = 40;
- } else if ((feedNum) === 40) {
- feedNum = 20;
- } else if ((feedNum) === 20) {
- feedNum = 10;
- } else if ((feedNum) === 10) {
- feedNum = 0;
- }
- // 如果喂食设置的数量失败, 就降低一个档次喂食.
- if ((feedNum) !== 0) {
- await feedPets(feedNum);
- } else {
- console.log('您的狗粮已不足10g')
- message += `【喂食失败】您的狗粮已不足10g\n`;
- }
- } else {
- console.log(`其他状态${data.errorCode}`)
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve();
- }
- })
- })
-}
-function getPetTaskConfig() {
- return new Promise(resolve => {
- const url = `${weAppUrl}/getPetTaskConfig?reqSource=weapp`;
- const host = `draw.jdfcloud.com`;
- const reqSource = 'weapp';
- $.get(taskUrl(url, host, reqSource), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- // console.log('JSON.parse(data)', JSON.parse(data))
- $.getPetTaskConfigRes = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve();
- }
- })
- })
-}
-//查询赛跑信息API
-function getPetRace() {
- return new Promise(resolve => {
- const url = `${JD_API_HOST}/combat/detail/v2?help=false`;
- const host = `jdjoy.jd.com`;
- const reqSource = 'h5';
- $.get(taskUrl(url, host, reqSource), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- // console.log('查询赛跑信息API',(data))
- // $.appGetPetTaskConfigRes = JSON.parse(data);
- $.petRaceResult = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve();
- }
- })
- })
-}
-//参加赛跑API
-function runMatch(teamLevel, timeout = 5000) {
- console.log(`正在参赛中,请稍等${timeout / 1000}秒,以防多个账号匹配到统一赛场\n`)
- return new Promise(async resolve => {
- await $.wait(timeout);
- const url = `${JD_API_HOST}/combat/match?teamLevel=${teamLevel}`;
- const host = `jdjoy.jd.com`;
- const reqSource = 'h5';
- $.get(taskUrl(url, host, reqSource), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- // console.log('参加赛跑API', JSON.parse(data))
- // $.appGetPetTaskConfigRes = JSON.parse(data);
- $.runMatchResult = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve();
- }
- })
- })
-}
-//查询应援团信息API
-function getBackupInfo() {
- return new Promise(resolve => {
- const url = `${JD_API_HOST}/combat/getBackupInfo`;
- const host = `jdjoy.jd.com`;
- const reqSource = 'h5';
- $.get(taskUrl(url, host, reqSource), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- // console.log('查询应援团信息API',(data))
- // $.appGetPetTaskConfigRes = JSON.parse(data);
- $.getBackupInfoResult = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve();
- }
- })
- })
-}
-//领取赛跑奖励API
-function receiveJoyRunAward() {
- return new Promise(resolve => {
- const url = `${JD_API_HOST}/combat/receive`;
- const host = `jdjoy.jd.com`;
- const reqSource = 'h5';
- $.get(taskUrl(url, host, reqSource), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- // console.log('查询应援团信息API',(data))
- // $.appGetPetTaskConfigRes = JSON.parse(data);
- $.receiveJoyRunAwardRes = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve();
- }
- })
- })
-}
-function showMsg() {
- jdNotify = $.getdata('jdJoyNotify') ? $.getdata('jdJoyNotify') : jdNotify;
- if (!jdNotify || jdNotify === 'false') {
- $.msg($.name, subTitle, message);
- } else {
- $.log(`\n${message}\n`);
- }
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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 taskUrl(url, Host, reqSource) {
- return {
- url: url,
- headers: {
- 'Cookie': cookie,
- 'reqSource': reqSource,
- 'Host': Host,
- 'Connection': 'keep-alive',
- 'Content-Type': 'application/json',
- 'Referer': 'https://jdjoy.jd.com/pet/index',
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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',
- }
- }
-}
-function taskPostUrl(url, body, reqSource, Host, ContentType) {
- return {
- url: url,
- body: body,
- headers: {
- 'Cookie': cookie,
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- 'reqSource': reqSource,
- 'Content-Type': ContentType,
- 'Host': Host,
- 'Referer': 'https://jdjoy.jd.com/pet/index',
- 'Accept-Language': 'zh-cn',
- 'Accept-Encoding': 'gzip, deflate, br',
- }
- }
-}
-// prettier-ignore
-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)}
diff --git a/jd_joy_feedPets.js b/jd_joy_feedPets.js
deleted file mode 100644
index 1e497cb..0000000
--- a/jd_joy_feedPets.js
+++ /dev/null
@@ -1,239 +0,0 @@
-/*****
-宠汪汪喂食(如果喂食80g失败,降级一个档次喂食(40g),依次类推),三餐,建议一小时运行一次
-更新时间:2020-11-03
-支持京东多个账号
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-****/
-// quantumultx
-// [task_local]
-// #京东宠汪汪喂食
-// 15 */1 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_feedPets.js, tag=京东宠汪汪喂食, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdcww.png, enabled=true
-// Loon
-// [Script]
-// cron "15 */1 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_feedPets.js,tag=京东宠汪汪喂食
-// Surge
-// 京东宠汪汪喂食 = type=cron,cronexp="15 */1 * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_feedPets.js
-
-const $ = new Env('宠汪汪🐕喂食');
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- let cookiesData = $.getdata('CookiesJD') || "[]";
- cookiesData = jsonParse(cookiesData);
- cookiesArr = cookiesData.map(item => item.cookie);
- cookiesArr.push(...[$.getdata('CookieJD'), $.getdata('CookieJD2')]);
-}
-let jdNotify = true;//是否开启静默运行。默认true开启
-let message = '', subTitle = '';
-const JD_API_HOST = 'https://jdjoy.jd.com'
-let FEED_NUM = ($.getdata('joyFeedCount') * 1) || 10; //喂食数量默认10g,可选 10,20,40,80 , 其他数字不可.
-
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- message = '';
- subTitle = '';
- if ($.isNode()) {
- if (process.env.JOY_FEED_COUNT) {
- if ([10, 20, 40, 80].indexOf(process.env.JOY_FEED_COUNT * 1) > -1) {
- FEED_NUM = process.env.JOY_FEED_COUNT ? process.env.JOY_FEED_COUNT * 1 : FEED_NUM;
- } else {
- console.log(`您输入的 JOY_FEED_COUNT 为非法数字,请重新输入`);
- }
- }
- }
- await feedPets(FEED_NUM);//喂食
- await ThreeMeals();//三餐
- await showMsg();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-function showMsg() {
- $.log(`\n${message}\n`);
- jdNotify = $.getdata('jdJoyNotify') ? $.getdata('jdJoyNotify') : jdNotify;
- if (!jdNotify || jdNotify === 'false') {
- $.msg($.name, subTitle, `【京东账号${$.index}】${$.UserName}\n` + message);
- }
-}
-function feedPets(feedNum) {
- return new Promise(resolve => {
- console.log(`您设置的喂食数量::${FEED_NUM}g\n`);
- console.log(`实际的喂食数量::${feedNum}g\n`);
- const options = {
- url: `${JD_API_HOST}/pet/feed?feedCount=${feedNum}`,
- headers: {
- 'Cookie': cookie,
- 'reqSource': 'h5',
- 'Host': 'jdjoy.jd.com',
- 'Connection': 'keep-alive',
- 'Content-Type': 'application/json',
- 'Referer': 'https://jdjoy.jd.com/pet/index',
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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',
- }
- }
- $.get(options, async (err, resp, data) => {
- try {
- $.data = JSON.parse(data);
- if ($.data.success) {
- if ($.data.errorCode === 'feed_ok') {
- console.log('喂食成功')
- message += `【喂食成功】${feedNum}g\n`;
- } else if ($.data.errorCode === 'time_error') {
- console.log('喂食失败:正在食用')
- message += `【喂食失败】您的汪汪正在食用\n`;
- } else if ($.data.errorCode === 'food_insufficient') {
- console.log(`当前喂食${feedNum}g狗粮不够, 现为您降低一档次喂食\n`)
- if ((feedNum) === 80) {
- feedNum = 40;
- } else if ((feedNum) === 40) {
- feedNum = 20;
- } else if ((feedNum) === 20) {
- feedNum = 10;
- } else if ((feedNum) === 10) {
- feedNum = 0;
- }
- // 如果喂食设置的数量失败, 就降低一个档次喂食.
- if ((feedNum) !== 0) {
- await feedPets(feedNum);
- } else {
- console.log('您的狗粮已不足10g')
- message += `【喂食失败】您的狗粮已不足10g\n`;
- }
- } else {
- console.log(`其他状态${$.data.errorCode}`)
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve($.data);
- }
- })
- })
-}
-
-//三餐
-function ThreeMeals() {
- return new Promise(resolve => {
- const options = {
- url: `${JD_API_HOST}/pet/getFood?taskType=ThreeMeals`,
- headers: {
- 'Cookie': cookie,
- 'reqSource': 'h5',
- 'Host': 'jdjoy.jd.com',
- 'Connection': 'keep-alive',
- 'Content-Type': 'application/json',
- 'Referer': 'https://jdjoy.jd.com/pet/index',
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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',
- }
- }
- $.get(options, async (err, resp, data) => {
- try {
- data = JSON.parse(data);
- if (data.success) {
- if (data.errorCode === 'received') {
- console.log(`三餐结果领取成功`)
- message += `【三餐】领取成功,获得${data.data}g狗粮\n`;
- }
- }
- } catch (e) {
- $.logErr(resp, e);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function jsonParse(str) {
- if (typeof str == "string") {
- try {
- return JSON.parse(str);
- } catch (e) {
- console.log(e);
- $.msg($.name, '', '不要在BoxJS手动复制粘贴修改cookie')
- return [];
- }
- }
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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();
- }
- })
- })
-}
-// prettier-ignore
-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)}
diff --git a/jd_joy_help.js b/jd_joy_help.js
deleted file mode 100644
index 090ad07..0000000
--- a/jd_joy_help.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
-宠汪汪强制为别人助力(助力一个好友你自己可以获得30积分,一天上限是帮助3个好友,自己获得90积分,不管助力是否成功,对方都会成为你的好友)
-更新地址:https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_help.js
-更新时间:2020-11-12
-目前提供了304位好友的friendPin供使用。脚本随机从里面获取一个,助力成功后,退出小程序重新点击进去开始助力新的好友
-欢迎大家使用 https://jdjoy.jd.com/pet/getFriends?itemsPerPage=20¤tPage=1 (currentPage=1表示第一页好友,=2表示第二页好友)
-提供各自账号列表的friendPin给我
-如果想设置固定好友,那下载下来放到本地使用,可以修改friendPin换好友(助力一好友后,更换一次friendPin里面的内容)
-感谢github @Zero-S1提供
-使用方法:
-①设置好相应软件的重写
-②从京东APP宠汪汪->领狗粮->邀请好友助力,分享给你小号微信或者微信的文件传输助手。 自己再打开刚才的分享,助力成功后,返回到此小程序首页重新进去宠汪汪即可助力下一位好友
-③如提示好友人气旺,说明此好友已满了三人助力,需重新进出小程序,重新进入来客有礼-宠汪汪。
-[MITM]
-hostname = draw.jdfcloud.com
-======================Surge=====================
-[Script]
-宠汪汪强制为别人助力= type=http-request,pattern= ^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/pet\/enterRoom\/h5\?reqSource=weapp&invitePin=.*+(&inviteSource=task_invite&shareSource=\w+&inviteTimeStamp=\d+&openId=\w+)?|^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/pet\/helpFriend\?friendPin,requires-body=1,max-size=0,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_help.js
-
-===================圈x=====================
-[rewrite_local]
-^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/pet\/enterRoom\/h5\?reqSource=weapp&invitePin=.*+(&inviteSource=task_invite&shareSource=\w+&inviteTimeStamp=\d+&openId=\w+)?|^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/pet\/helpFriend\?friendPin url script-request-header https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_help.js
-
- =====================LOON=====================
-[Script]
-http-request ^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/pet\/enterRoom\/h5\?reqSource=weapp&invitePin=.*+(&inviteSource=task_invite&shareSource=\w+&inviteTimeStamp=\d+&openId=\w+)?|^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/pet\/helpFriend\?friendPin script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_help.js, requires-body=true, timeout=10, tag=宠汪汪强制为别人助力
-
-
-你也可从下面链接拿好友的friendPin(复制链接到有京东ck的浏览器打开即可)
-
-https://jdjoy.jd.com/pet/getFriends?itemsPerPage=20¤tPage=1
-**/
-let url = $request.url
-const friendsArr = ["yhr_19820404", "13008094886_p", "13966269193_p", "jd_4e4d9825e5fb1", "jd_5ff306cf94512", "ququkoko", "jd_59a9823f35496", "529577509-275616", "18923155789_p", "jd_455da88071d1e", "dreamscometrue5120", "蒋周南19620607", "jd_620ceca400151", "杉雨2011", "MARYMY88", "13682627696_p", "jd_6777ee65f9fcc", "夏海东12315", "jd_437b4f3fa5d83", "zyjyc9998", "meoygua", "MLHK7288", "jd_42d9ce3001acd", "jd_57650a30ef6eb", "jd_44ca1016e0f96", "jd_74332d1d62a97", "jd_7dbe4f8a40a7d", "jd_4fa238e4e3039", "elbereth1122", "jd_4d9be23908e41", "jd_51f0d43d78900", "13588108107_p", "123by456", "09niuniuma", "143798682-947527", "jd_560c6f30e6951", "jd_54ddb8af5374a", "夏革平", "247466310", "wang2011", "chensue", "1362245003-624122", "wdGefYCBlyOuvz", "jd_412f7eb363cd8", "18311575050_p", "1307976-34738981", "wdgOGLtOJjjbnp", "klhzdx", "jd_5fdcdcb183d7d", "jd_5862fd8834680", "jd_6cd93e613b0e5", "jd_51a64a9da6b94", "302990512-553401", "jd_4078f69a72873", "jd_ewYCRdmukzQH", "13348822441_p", "hlcx86021", "390823571-784974", "jd_79af2bc7a56a3", "15053231812_p", "jd_6f53253d117c5", "jd_5bf29dffa62ea", "jd_47a1c4ad02103", "刘凤苓", "145391572-102667", "yanglan0409", "jd_4b8a70f3b06c3", "弑神X", "jd_59d962a076126", "sjw3000", "jd_4d4def8b59787", "L1518235423", "jd_579b891fbea9b", "frank818", "hellohuhua", "jd_4cf1918577871", "jd_akYbyiXqrIDC", "李纪红", "jd_54a4260ca986c", "jd_4cba35cfa8220", "13654075776_p", "13916051043", "jd_6f9b9a6769afb", "iamkgbfox", "jd_5fbda9be54d5b", "jd_76763ba485c5e", "jd_45a6b5953b15b", "jd_485c757b79422", "xiaojingang_0", "lanye1545", "chenzhiyun2002", "lmpbjs1988", "jd_SmPxpudoGYOb", "jwl19690905", "荷舞弄清影88", "jd_750d6a9734717", "jd_64e37854e713f", "jd_573c9832d8989", "wdkplHVQlgowTW", "wwk232323", "jd_6bfe51f915c90", "我手机号码", "13681610268_p", "ss836580793", "15868005933_p", "zooooo58", "陌上花开花又落", "jd_701f52f8badbb", "jd_462f9229c20e4", "jd_42193689987a0", "jd_7dc5829121bcc", "13656692651_phz", "jd_47f49f22f1dc3", "handechun959", "13775208986_p", "guoyizhang", "jd_677dd20bf2749", "被折叠的记忆33", "jd_FfAnqFVEoBul", "jd_4e59841cae4f9", "jd_5279d593e7803", "思绪随风2011", "jd_62e335d785872", "suyugen", "jd_4e68b48d16f7b", "jd_56b7a4e092e85", "cocoty", "jd_7b6d6e7dc98f1", "jd_63423cd594e8b", "greatyunyun", "4349小丢丢", "18027486801_p", "15207695569_p", "llbai11", "wdNRUvbJItetlvB", "jd_54154982c707f", "85192cool", "jd_60d497271825b", "greatyunyun9320", "ky252571504", "jd_74e60dbcae365", "wdiicnSbYSHWwE", "jd_529a0a309d418", "jd_7be92b11b7e8f", "13486659225_p", "jd_iFnquhpWWAzO", "jd_6e348ece13e20", "jd_6f5b49bb757cb", "znz传奇", "418001066_m", "jd_67ded5748c3ab", "361372-27819972", "jd_5fafb631c98af", "jd_76dd04e844d63", "小鹿Jenny", "00数字方程式", "jd_77a82b603c6c3", "勇敢的小泪", "jd_4481f68984466", "jd_758f5224ee957", "mwb1992062_m", "15975229552_p", "zdj8341", "pet_virtual_friend_胡皋三", "pet_virtual_friend_绿茶sama", "pet_virtual_friend_Ainio", "jd_4915949b7bfa1", "jd_7ca74ed9224ef", "jd_42764f5ea2341", "5317123-63418293", "jd_40a2d9485cbdb", "qazmcl1230", "jd_7ced325aba4fd", "jd_402fe7425fcaf", "95581245-627991", "luffy-314_m", "jd_BCXgLlmxHdiS", "jd_610b3d00928e5", "你要醒来", "338379384-148135", "pet_virtual_friend_乔治桑", "jd_54130a3e282ea", "jd_6169b3411ed5b", "jd_428d930ca56a5", "qq6924309", "pet_virtual_friend_路遇狗与少年", "jd_712bd3bfd55d6", "jd_4e97fe5ca4003", "tommy_he1", "13981372001_p", "129867657-673064", "jd_525d6e7a57e7c", "wdZuirGekSHKmF", "jd_75e1da74980ab", "jd_RVMXldNSQNOP", "jd_5f94da0265e0d", "jd_67ab629be7e61", "13887490621_p", "jd_4e0d529ba3c35", "jd_493918e314b50", "jd_71a220104187a", "jd_vVhhkdUpTkJQ", "gary388jingdong", "wdjQkAbFobMTyo", "cloud_kim", "jd_558ed75f52d39", "15555448319_p", "wdhxZuEvXhhvCf", "jd_72b940be8c0f4", "congcong炒葱葱", "jd_7eb0de64eb25a", "13209558123_p", "jd_53bf7cb6fb8e6", "jd_4fe620f72fa7c", "夏雨的爱情", "jd_47ba82eb392a5", "jd_LXnFHXoJwXkW", "62160785-578856", "醒醒该睡了", "jd_LOEWgvNwQIWD", "xiiirww", "pet_virtual_friend_特兰克斯", "pet_virtual_friend_Talon", "jd_4f7cd5b108733", "jd_NgNWXMVkJIvk", "jadonglin", "玩家卫弈", "liangxuejingdong", "jd_627171efb7c0a", "jd_53bc7a14f64d6", "15809290902_p", "jd_65a2ab73d9aa5", "jd_6edb943cacbfb", "jd_7f7eabc5caf7d", "jd_725e17effb6a9", "蔡辉煌", "voxb", "gdxx_hhw_m", "jd_78f0d6524a1dc", "jd_sDtnONLeHwfG", "xyyshy1983", "yinlang46", "ypqian", "15817094457_p", "fdxwb", "wuyaoxin2012", "明子溪", "henry1927_m", "chamy99", "jd_461e384274c34", "248358330-645106", "jd_4fd63de4a6033", "蜜糖向日葵", "wonghe", "36453197-121619", "琳琅满目cbb", "jd_5b7cc9e532426", "134795344-89911673", "15211488203_p", "jd_6f1f0722f8365", "jd_JmGCpqgpCtqG", "墨明棋妙陈", "pet_virtual_friend_1314爱澳", "1209815-33190621", "zhouhuayh", "jd_6d3cbb8b0751a", "jd_6e00e826f939b", "jd_704a2e5e28a66", "mztvip", "davidharry", "sara35424", "sun5025", "jd_62ce2385bb364", "352834026-406289", "pet_virtual_friend_丁座的真爱粉", "jd_582eecf8d27a9", "jd_49acdb02e8514", "13976911784_p", "jd_uGzohbhFpRuz", "wzywolfgang", "yjbonny", "沧海不轮回", "649297742_327799447", "倚兰椒", "琳琳8796", "snzh2013", "jd_73751adc04afd", "wdNnlMzPGJJKgqI", "yygt1158", "jd_53df36eb204a0", "花开花花落", "jd_611e082213c89", "jd_71e77d9235cf5", "jd_596fd9fea411f", "jd_7277d200aa1ac", "15230573701_p", "zb19881021", "692620136落", "168876810-159969", "zhushidan100", "上自习的猪", "15602231009_p", "jd_5213fd3fd5e09", "jd_6711f97ee4dfe", "44787591-640051", "MisterGlasses", "jd_7b22bbfe1e7e5", "138555963-81748582", "jd_QEVVkkDTQAlJ", "4932713-24535180", "jd_6dce98c07a644", "jd_DUtPtiiDamDr", "wangyneu", "wBm1TsDy3p_m", "jd_6acd3a6cc79cc","jd_444f5c020f31c","jd_71caf6b3ec4cb"]
-//随机生成m(小)到n(大)的数,包含m和n
-function randomFriendPin(m,n) {
- return Math.round(Math.random()*(n - m) + m);
-}
-let friendPin = friendsArr[randomFriendPin(0, friendsArr.length - 1)] //强制为对方助力,可成为好友关系
-friendPin = encodeURI(friendPin);
-const timestamp = new Date().getTime()
-newUrl = url.replace(/friendPin=.*?$/i, "friendPin=" + friendPin).replace(/invitePin=.*?$/i, "invitePin=" + friendPin).replace(/inviteTimeStamp=.*?$/i, "inviteTimeStamp=" + timestamp + "&")
-console.log(newUrl)
-$done({ url: newUrl })
diff --git a/jd_joy_reward.js b/jd_joy_reward.js
deleted file mode 100644
index 1f5749c..0000000
--- a/jd_joy_reward.js
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
-宠汪汪积分兑换奖品脚本, 目前脚本只兑换京豆,兑换京豆成功,才会发出通知提示,其他情况不通知。
-更新时间:2020-11-20
-兑换规则:一个账号一天只能兑换一次京豆。
-兑换奖品成功后才会有系统弹窗通知
-每日京豆库存会在0:00、8:00、16:00更新,经测试发现中午12:00也会有补发京豆。
-支持京东双账号
-脚本兼容: Quantumult X, Surge, Loon, JSBox, Node.js
-// Quantumult X
-[task_local]
-#宠汪汪积分兑换奖品
-0 0-16/8 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_reward.js, tag=宠汪汪积分兑换奖品, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdcww.png, enabled=true
-// Loon
-[Script]
-cron "0 0-16/8 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_reward.js,tag=宠汪汪积分兑换奖品
-// Surge
-宠汪汪积分兑换奖品 = type=cron,cronexp="0 0-16/8 * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_reward.js
- */
-const $ = new Env('宠汪汪积分兑换奖品');
-let joyRewardName = 20;//是否兑换京豆,默认开启兑换功能,其中20为兑换20京豆,500为兑换500京豆,0为不兑换京豆.数量有限先到先得
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-const notify = $.isNode() ? require('./sendNotify') : '';
-let jdNotify = false;//是否开启静默运行,默认false关闭(即:奖品兑换成功后会发出通知提示)
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- cookiesArr.push($.getdata('CookieJD'));
- cookiesArr.push($.getdata('CookieJD2'));
-}
-const JD_API_HOST = 'https://jdjoy.jd.com';
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg('【京东账号一】宠汪汪积分兑换奖品失败', '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- await joyReward();
- // $.msg($.name, '兑换脚本暂不能使用', `请停止使用,等待后期更新\n如果新版本兑换您有兑换机会,请抓包兑换\n再把抓包数据发送telegram用户@lxk0301`);
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-
-async function joyReward() {
- await getExchangeRewards();
- if ($.getExchangeRewardsRes && $.getExchangeRewardsRes.success) {
- // console.log('success', $.getExchangeRewardsRes);
- const data = $.getExchangeRewardsRes.data;
- const levelSaleInfos = data.levelSaleInfos;
- const giftSaleInfos = levelSaleInfos.giftSaleInfos;
- console.log(`当前积分 ${data.coin}\n`);
- console.log(`宠物等级 ${data.level}\n`);
- console.log(`京东昵称 ${$.nickName}\n`);
- let saleInfoId = '', giftValue = '', extInfo = '', leftStock = 0, salePrice = 0;
- let rewardNum = 0;
- if ($.isNode() && process.env.JD_JOY_REWARD_NAME) {
- rewardNum = process.env.JD_JOY_REWARD_NAME * 1;
- } else if ($.getdata('joyRewardName')) {
- if ($.getdata('joyRewardName') * 1 === 1) {
- //兼容之前的BoxJs设置
- rewardNum = 20;
- } else {
- rewardNum = $.getdata('joyRewardName') * 1;
- }
- } else {
- rewardNum = joyRewardName;
- }
- for (let item of giftSaleInfos) {
- if (item.giftType === 'jd_bean' && item['giftValue'] === rewardNum) {
- saleInfoId = item.id;
- leftStock = item.leftStock;
- salePrice = item.salePrice;
- giftValue = item.giftValue;
- }
- }
- console.log(`当前京豆库存:${leftStock}`)
- console.log(`saleInfoId:${saleInfoId}`)
- // 兼容之前BoxJs兑换设置的数据
- if (rewardNum && (rewardNum === 1 || rewardNum === 20 || rewardNum === 50 || rewardNum === 100 || rewardNum === 500 || rewardNum === 1000)) {
- //开始兑换
- if (data.coin >= salePrice) {
- if (leftStock) {
- if (!saleInfoId) return
- console.log(`当前账户积分:${data.coin}\n当前京豆库存:${leftStock}\n满足兑换条件,开始为您兑换京豆\n`);
- await exchange(saleInfoId, 'pet');
- if ($.exchangeRes && $.exchangeRes.success) {
- if ($.exchangeRes.errorCode === 'buy_success') {
- console.log(`兑换${giftValue}成功,【宠物等级】${data.level}\n【消耗积分】${salePrice}个\n【剩余积分】${data.coin - salePrice}个\n`)
- let ctrTemp;
- if ($.isNode() && process.env.JD_JOY_REWARD_NOTIFY) {
- ctrTemp = `${process.env.JD_JOY_REWARD_NOTIFY}` === 'false';
- } else if ($.getdata('jdJoyRewardNotify')) {
- ctrTemp = $.getdata('jdJoyRewardNotify') === 'false';
- } else {
- ctrTemp = `${jdNotify}` === 'false';
- }
- if (ctrTemp) {
- $.msg($.name, `兑换${giftValue}京豆成功`, `【京东账号${$.index}】${$.nickName}\n【宠物等级】${data.level}\n【积分详情】消耗积分 ${salePrice}, 剩余积分 ${data.coin - salePrice}`);
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}】 ${$.nickName}\n【兑换${giftValue}京豆】成功\n【宠物等级】${data.level}\n【积分详情】消耗积分 ${salePrice}, 剩余积分 ${data.coin - salePrice}`);
- }
- }
- // if ($.isNode()) {
- // await notify.BarkNotify(`${$.name}`, `【京东账号${$.index}】 ${$.nickName}\n【兑换${giftName}】成功\n【宠物等级】${data.level}\n【消耗积分】${salePrice}分\n【当前剩余】${data.coin - salePrice}积分`);
- // }
- } else if ($.exchangeRes && $.exchangeRes.errorCode === 'buy_limit') {
- console.log(`兑换${rewardNum}京豆失败,原因:兑换京豆已达上限,请把机会留给更多的小伙伴~`)
- //$.msg($.name, `兑换${giftName}失败`, `【京东账号${$.index}】${$.nickName}\n兑换京豆已达上限\n请把机会留给更多的小伙伴~\n`)
- } else {
- console.log(`兑奖异常:${JSON.stringify($.exchangeRes)}`)
- }
- } else {
- console.log(`兑换京豆异常:${JSON.stringify($.exchangeRes)}`)
- }
- } else {
- console.log(`兑换${rewardNum}京豆失败,原因:京豆库存不足,已抢完,请下一场再兑换`)
- }
- } else {
- console.log(`兑换${rewardNum}京豆失败,原因:您目前只有${data.coin}积分,已不足兑换${giftValue}京豆所需的${salePrice}积分\n`)
- //$.msg($.name, `兑换${giftName}失败`, `【京东账号${$.index}】${$.nickName}\n目前只有${data.coin}积分\n已不足兑换${giftName}所需的${salePrice}积分\n`)
- }
- } else {
- console.log('您设置了不兑换京豆,如需兑换京豆,请去BoxJs重新设置或修改第20行代码')
- }
- } else {
- console.log(`${$.name}getExchangeRewards异常,${JSON.stringify($.getExchangeRewardsRes)}`)
- }
-}
-function getExchangeRewards() {
- return new Promise((resolve) => {
- const option = {
- url: `${JD_API_HOST}/gift/getHomeInfo`,
- headers: {
- "Host": "jdjoy.jd.com",
- "Content-Type": "application/json",
- "Cookie": cookie,
- "reqSource": "h5",
- "Connection": "keep-alive",
- "Accept": "*/*",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- "Referer": "https://jdjoy.jd.com/pet/index",
- "Accept-Language": "zh-cn",
- "Accept-Encoding": "gzip, deflate, br"
- },
- }
- $.get(option, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- $.getExchangeRewardsRes = JSON.parse(data);
- } else {
- console.log(`${$.name}api返回数据为空,请检查自身原因`)
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve();
- }
- });
- })
-}
-function exchange(saleInfoId, orderSource) {
- return new Promise((resolve) => {
- const option = {
- url: `${JD_API_HOST}/gift/exchange`,
- body: `${JSON.stringify({ saleInfoId, orderSource })}`,
- headers: {
- "Host": "jdjoy.jd.com",
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-cn",
- "Content-Type": "application/json",
- "Origin": "https://jdjoy.jd.com",
- "reqSource": "h5",
- "Connection": "keep-alive",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- "Referer": "https://jdjoy.jd.com/pet/index",
- "Content-Length": "10",
- "Cookie": cookie
- },
- }
- $.post(option, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- $.exchangeRes = JSON.parse(data);
- } else {
- console.log(`${$.name}api返回数据为空,请检查自身原因`)
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve();
- }
- });
- })
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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();
- }
- })
- })
-}
-// prettier-ignore
-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)}
diff --git a/jd_joy_run.js b/jd_joy_run.js
deleted file mode 100644
index cfefcc5..0000000
--- a/jd_joy_run.js
+++ /dev/null
@@ -1,370 +0,0 @@
-/**
- 宠汪汪邀请助力与赛跑助力脚本,感谢github@Zero-S1提供帮助
- 更新时间:2020-11-16(宠汪汪助力更新Token的配置正则表达式已改)
-
- token时效很短,几个小时就失效了,闲麻烦的放弃就行
- 每天拿到token后,可一次性运行完毕即可。
- 互助码friendPin是京东用户名,不是昵称(可在京东APP->我的->设置 查看获得)
- token获取途径:
- 1、微信搜索'来客有礼'小程序,登陆京东账号,点击底部的'我的'或者'发现'两处地方,即可获取Token,脚本运行提示token失效后,继续按此方法获取即可
- 2、或者每天去'来客有礼'小程序->宠汪汪里面,领狗粮->签到领京豆 也可获取Token(此方法每天只能获取一次)
- 脚本里面有内置提供的friendPin,如果你没有修改脚本或者BoxJs处填写自己的互助码,会默认给脚本内置的助力。
-[MITM]
-hostname = draw.jdfcloud.com
-
-Surge
-[Script]
-宠汪汪邀请助力与赛跑助力 = type=cron,cronexp="15 10 * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_run.js
-宠汪汪助力更新Token = type=http-response,pattern=^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/api\/user\/addUser\?code=, requires-body=1, max-size=0, script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_run.js
-宠汪汪助力获取Token = type=http-request,pattern=^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/api\/user\/user\/detail\?openId=, requires-body=1, max-size=0, script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_run.js
-
-圈X
-[task_local]
-# 宠汪汪邀请助力与赛跑助力
-15 10 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_run.js, tag=宠汪汪邀请助力与赛跑助力, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdcww.png, enabled=true
-[rewrite_local]
-# 宠汪汪助力更新Token
-^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/api\/user\/addUser\?code= url script-response-body https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_run.js
-# 宠汪汪助力获取Token
-^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/api\/user\/user\/detail\?openId= url script-request-header https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_run.js
-
-*****Loon****
-[Script]
-cron "15 10 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_run.js, tag=宠汪汪邀请助力与赛跑助力
-http-response ^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/api\/user\/addUser\?code= script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_run.js, requires-body=true, timeout=10, tag=宠汪汪助力更新Token
-http-request ^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/api\/user\/user\/detail\?openId= script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_run.js, requires-body=true, timeout=10, tag=宠汪汪助力获取Token
- **/
-const isRequest = typeof $request != "undefined"
-const $ = new Env('来客有礼宠汪汪');
-const JD_BASE_API = `https://draw.jdfcloud.com//pet`;
-//此处填入你需要助力好友的京东用户名
-//给下面好友邀请助力的
-let invite_pins = ["jd_6cd93e613b0e5,被折叠的记忆33,jd_704a2e5e28a66,jd_45a6b5953b15b,zooooo58"];
-//给下面好友赛跑助力
-let run_pins = ["jd_6cd93e613b0e5,被折叠的记忆33,jd_704a2e5e28a66,jd_45a6b5953b15b,zooooo58"];
-// $.LKYLToken = '76fe7794c475c18711e3b47185f114b5' || $.getdata('jdJoyRunToken');
-$.LKYLToken = $.getdata('jdJoyRunToken');
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-const headers = {
- 'Connection' : 'keep-alive',
- 'Accept-Encoding' : 'gzip, deflate, br',
- 'App-Id' : '',
- 'Lottery-Access-Signature' : '',
- 'Content-Type' : 'application/json',
- 'reqSource' : 'weapp',
- 'User-Agent' : $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- 'Cookie' : '',
- 'openId' : '',
- 'Host' : 'draw.jdfcloud.com',
- 'Referer' : 'https://servicewechat.com/wxccb5c536b0ecd1bf/633/page-frame.html',
- 'Accept-Language' : 'zh-cn',
- 'Accept' : '*/*',
- 'LKYLToken' : ''
-}
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
-} else {
- //支持 "京东多账号 Ck 管理"的cookie
- let cookiesData = $.getdata('CookiesJD') || "[]";
- cookiesData = jsonParse(cookiesData);
- cookiesArr = cookiesData.map(item => item.cookie);
- cookiesArr.push(...[$.getdata('CookieJD'), $.getdata('CookieJD2')]);
- if ($.getdata('jd_joy_invite_pin')) {
- invite_pins = [];
- invite_pins.push($.getdata('jd_joy_invite_pin'));
- }
- if ($.getdata('jd2_joy_invite_pin')) {
- if (invite_pins.length > 0) {
- invite_pins.push($.getdata('jd2_joy_invite_pin'))
- } else {
- invite_pins = [];
- invite_pins.push($.getdata('jd2_joy_invite_pin'));
- }
- }
- if ($.getdata('jd_joy_run_pin')) {
- run_pins = []
- run_pins.push($.getdata('jd_joy_run_pin'));
- }
- if ($.getdata('jd2_joy_run_pin')) {
- if (run_pins.length > 0) {
- run_pins.push($.getdata('jd2_joy_run_pin'))
- } else {
- run_pins = [];
- run_pins.push($.getdata('jd2_joy_run_pin'));
- }
- }
-}
-
-//获取来客有礼Token
-function getToken() {
- const url = $request.url;
- $.log(`${$.name}url\n${url}\n`)
- if (isURL(url, /^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/api\/user\/addUser\?code=/)) {
- const body = JSON.parse($response.body);
- const LKYLToken = body.data.token;
- $.log(`${$.name} token\n${LKYLToken}\n`)
- if ($.getdata('jdJoyRunToken')) {
- $.msg($.name, '更新Token: 成功🎉', `\n${LKYLToken}\n`);
- } else {
- $.msg($.name, '更新Token: 成功🎉', `\n${LKYLToken}\n`);
- }
- $.setdata(LKYLToken, 'jdJoyRunToken');
- $.done({ body: JSON.stringify(body) })
- } else if (isURL(url, /^https:\/\/draw\.jdfcloud\.com(\/mirror)?\/\/api\/user\/user\/detail\?openId=/)){
- if ($request && $request.method !== 'OPTIONS') {
- const LKYLToken = $request.headers['LKYLToken'];
- //if ($.getdata('jdJoyRunToken')) {
- //if ($.getdata('jdJoyRunToken') !== LKYLToken) {
-
- //}
- //$.msg($.name, '更新获取Token: 成功🎉', `\n${LKYLToken}\n`);
- //} else {
- //$.msg($.name, '获取Token: 成功🎉', `\n${LKYLToken}\n`);
- //}
- $.setdata(LKYLToken, 'jdJoyRunToken');
-
- $.msg($.name, '获取Token: 成功🎉', `\n${LKYLToken}\n`);
-
- // $.done({ body: JSON.stringify(body) })
- $.done({ url: url })
- }
- } else {
- $.done({})
- }
-}
-async function main() {
- console.log(`打印token \n${$.getdata('jdJoyRunToken')}\n`)
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- if (!$.LKYLToken) {
- $.msg($.name, '【提示】请先获取来客有礼宠汪汪token', "微信搜索'来客有礼'小程序\n点击底部的'发现'Tab\n即可获取Token");
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.inviteReward = 0;
- $.runReward = 0;
- console.log(`\n开始【京东账号${$.index}】${UserName}\n`);
- $.jdLogin = true;
- $.LKYLLogin = true;
- console.log(`=============【开始邀请助力】===============`)
- const inviteIndex = $.index > invite_pins.length ? (invite_pins.length - 1) : ($.index - 1);
- const new_invite_pins = invite_pins[inviteIndex].split(',');
- await invite(new_invite_pins);
- if ($.jdLogin && $.LKYLLogin) {
- console.log(`===========【开始助力好友赛跑】===========`)
- const runIndex = $.index > run_pins.length ? (run_pins.length - 1) : ($.index - 1);
- const new_run_pins = run_pins[runIndex].split(',');
- await run(new_run_pins);
- }
- }
- }
- $.done()
-}
-//邀请助力
-async function invite(invite_pins) {
- console.log(`账号${$.index} [${UserName}] 给下面名单的人进行邀请助力\n${invite_pins.map(item => item.trim())}\n`);
- for (let item of invite_pins.map(item => item.trim())) {
- console.log(`\n账号${$.index} [${UserName}] 开始给好友 [${item}] 进行邀请助力`)
- const data = await enterRoom(item);
- if (!data.success && data.errorCode === 'B0001') {
- console.log('京东Cookie失效');
- $.msg($.name, `【提示】京东cookie已失效`, `京东账号${$.index} ${UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
- $.jdLogin = false;
- break
- } else {
- const { helpStatus } = data.data;
- console.log(`helpStatus ${helpStatus}`)
- if (helpStatus=== 'help_full') {
- console.log(`您的邀请助力机会已耗尽\n`)
- break;
- } else if (helpStatus=== 'cannot_help') {
- console.log(`已给该好友 ${item} 助力过或者此friendPin是你自己\n`)
- continue;
- } else if (helpStatus=== 'invite_full') {
- console.log(`助力失败,该好友 ${item} 已经满3人给他助力了,无需您再次助力\n`)
- continue;
- } else if (helpStatus=== 'can_help') {
- console.log(`开始给好友 ${item} 助力\n`)
- const LKYL_DATA = await helpInviteFriend(item);
- if (LKYL_DATA.errorCode === 'L0001' && !LKYL_DATA.success) {
- console.log('来客有礼宠汪汪token失效');
- $.setdata('', 'jdJoyRunToken');
- $.msg($.name, '【提示】来客有礼token失效,请重新获取', "微信搜索'来客有礼'小程序\n点击底部的'发现'Tab\n即可获取Token")
- $.LKYLLogin = false;
- break
- } else {
- $.LKYLLogin = true;
- }
- }
- $.jdLogin = true;
- }
- }
- if ($.inviteReward > 0) {
- $.msg($.name, ``, `账号${$.index} [${UserName}]\n给${$.inviteReward/5}人邀请助力成功\n获得狗粮${$.inviteReward}g`)
- }
-}
-function enterRoom(invitePin) {
- return new Promise(resolve => {
- headers.Cookie = cookie;
- headers.LKYLToken = $.LKYLToken;
- const options = {
- url: `${JD_BASE_API}/enterRoom?reqSource=weapp&invitePin=${encodeURI(invitePin)}`,
- headers
- }
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- $.log('API请求失败')
- $.logErr(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- // console.log('进入房间', data)
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- });
- })
-}
-function helpInviteFriend(friendPin) {
- return new Promise((resolve) => {
- headers.Cookie = cookie;
- headers.LKYLToken = $.LKYLToken;
- const options = {
- url: `${JD_BASE_API}/helpFriend?friendPin=${encodeURI(friendPin)}`,
- headers
- }
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- $.log('API请求失败')
- $.logErr(JSON.stringify(err));
- } else {
- $.log(`邀请助力结果:${data}`);
- data = JSON.parse(data);
- // {"errorCode":"help_ok","errorMessage":null,"currentTime":1600254297789,"data":29466,"success":true}
- if (data.success && data.errorCode === 'help_ok') {
- $.inviteReward += 5;
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- });
- })
-}
-//赛跑助力
-async function run(run_pins) {
- console.log(`账号${$.index} [${UserName}] 给下面名单的人进行赛跑助力\n${(run_pins.map(item => item.trim()))}\n`);
- for (let item of run_pins.map(item => item.trim())) {
- console.log(`\n账号${$.index} [${UserName}] 开始给好友 [${item}] 进行赛跑助力`)
- const combatDetailRes = await combatDetail(item);
- const { petRaceResult } = combatDetailRes.data;
- console.log(`petRaceResult ${petRaceResult}`);
- if (petRaceResult === 'help_full') {
- console.log('您的赛跑助力机会已耗尽');
- break;
- } else if (petRaceResult === 'can_help') {
- console.log(`开始赛跑助力好友 ${item}`)
- const LKYL_DATA = await combatHelp(item);
- if (LKYL_DATA.errorCode === 'L0001' && !LKYL_DATA.success) {
- console.log('来客有礼宠汪汪token失效');
- $.setdata('', 'jdJoyRunToken');
- $.msg($.name, '【提示】来客有礼token失效,请重新获取', "微信搜索'来客有礼'小程序\n点击底部的'发现'Tab\n即可获取Token")
- $.LKYLLogin = false;
- break
- } else {
- $.LKYLLogin = true;
- }
- }
- }
- if ($.runReward > 0) {
- $.msg($.name, ``, `账号${$.index} [${UserName}]\n给${$.runReward/5}人赛跑助力成功\n获得狗粮${$.runReward}g`)
- }
-}
-function combatHelp(friendPin) {
- return new Promise(resolve => {
- headers.Cookie = cookie;
- headers.LKYLToken = $.LKYLToken;
- const options = {
- url: `${JD_BASE_API}/combat/help?friendPin=${encodeURI(friendPin)}`,
- headers
- }
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- $.log('API请求失败')
- $.logErr(JSON.stringify(err));
- } else {
- $.log(`赛跑助力结果${data}`);
- data = JSON.parse(data);
- // {"errorCode":"help_ok","errorMessage":null,"currentTime":1600479266133,"data":{"rewardNum":5,"helpStatus":"help_ok","newUser":false},"success":true}
- if (data.errorCode === 'help_ok' && data.data.helpStatus === 'help_ok') {
- console.log(`助力${friendPin}成功\n获得狗粮${data.data.rewardNum}g\n`);
- $.runReward += data.data.rewardNum;
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- });
- })
-}
-function combatDetail(invitePin) {
- return new Promise(resolve => {
- headers.Cookie = cookie;
- headers.LKYLToken = $.LKYLToken;
- const options = {
- url: `${JD_BASE_API}/combat/detail/v2?help=true&inviterPin=${encodeURI(invitePin)}`,
- headers
- }
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- $.log('API请求失败')
- $.logErr(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- });
- })
-}
-function isURL(domain, reg) {
- // const name = reg;
- return reg.test(domain);
-}
-function jsonParse(str) {
- if (typeof str == "string") {
- try {
- return JSON.parse(str);
- } catch (e) {
- console.log(e);
- $.msg($.name, '', '不要在BoxJS手动复制粘贴修改cookie')
- return [];
- }
- }
-}
-isRequest ? getToken() : main();
-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)}
diff --git a/jd_joy_steal.js b/jd_joy_steal.js
deleted file mode 100644
index c17d16d..0000000
--- a/jd_joy_steal.js
+++ /dev/null
@@ -1,532 +0,0 @@
-/*
-jd宠汪汪偷好友积分与狗粮,及给好友喂食
-偷好友积分上限是20个好友(即获得100积分),帮好友喂食上限是20个好友(即获得200积分),偷好友狗粮上限也是20个好友(最多获得120g狗粮)
-IOS用户支持京东双账号,NodeJs用户支持N个京东账号
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-更新时间:2020-11-03
-如果开启了给好友喂食功能,建议先凌晨0点运行jd_joy.js脚本获取狗粮后,再运行此脚本(jd_joy_steal.js)可偷好友积分,6点运行可偷好友狗粮
-注:如果使用Node.js, 需自行安装'crypto-js,got,http-server,tough-cookie'模块. 例: npm install crypto-js http-server tough-cookie got --save
-*/
-// quantumultx
-// [task_local]
-// #宠汪汪偷好友积分与狗粮
-// 0 0,6 * * * https://raw.githubusercontent.com/lxk0301/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/lxk0301/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/lxk0301/jd_scripts/master/jd_joy_steal.js
-const $ = new Env('宠汪汪偷好友积分与狗粮');
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- cookiesArr.push($.getdata('CookieJD'));
- cookiesArr.push($.getdata('CookieJD2'));
-}
-let message = '', subTitle = '';
-
-let jdNotify = false;//是否开启静默运行,false关闭静默运行(即通知),true打开静默运行(即不通知)
-let jdJoyHelpFeed = false;//是否给好友喂食,false为不给喂食,true为给好友喂食,默认不给好友喂食
-let jdJoyStealCoin = true;//是否偷好友积分与狗粮,false为否,true为是,默认是偷
-const weAppUrl = 'https://draw.jdfcloud.com//pet';
-const JD_API_HOST = 'https://jdjoy.jd.com/pet'
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- message = '';
- subTitle = '';
- await jdJoySteal();
- await showMsg();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-async function jdJoySteal() {
- await getFriends();
- if ($.getFriendsData && $.getFriendsData.success) {
- message += `【京东账号${$.index}】${$.nickName}\n`;
- await getCoinChanges();
- if ($.getFriendsData && $.getFriendsData.datas && $.getFriendsData.datas.length > 0) {
- const { lastPage } = $.getFriendsData.page;
- console.log('lastPage', lastPage)
- $.allFriends = [];
- for (let i = 1; i <= new Array(lastPage).fill('').length; i++) {
- console.log(`开始查询第${i}页好友\n`);
- await getFriends(i);
- $.allFriends = $.allFriends.concat($.getFriendsData.datas);
- }
- for (let index = 0; index < $.allFriends.length; index ++) {
- //剔除自己
- if (!$.allFriends[index].stealStatus) {
- $.allFriends.splice(index, 1);
- }
- }
- console.log(`共${$.allFriends.length}个好友`);
- $.helpFood = 0;
- $.stealFriendCoin = 0;
- $.stealFood = 0;
- await Promise.all([
- stealFriendCoinFun(),//偷积分
- stealFriendsFood(),//偷好友狗粮
- helpFriendsFeed()//给好友喂食
- ])
- }
- } else {
- message += `${$.getFriendsData && $.getFriendsData.errorMessage}\n`;
- }
-}
-async function stealFriendsFood() {
- let jdJoyStealCoinTemp;
- if ($.isNode() && process.env.jdJoyStealCoin) {
- jdJoyStealCoinTemp = `${process.env.jdJoyStealCoin}` === 'true';
- } else if ($.getdata('jdJoyStealCoin')) {
- jdJoyStealCoinTemp = $.getdata('jdJoyStealCoin') === 'true';
- } else {
- jdJoyStealCoinTemp = `${jdJoyStealCoin}` === 'true';
- }
- if (jdJoyStealCoinTemp) {
- console.log(`开始偷好友狗粮`);
- for (let friends of $.allFriends) {
- const { friendPin, status, stealStatus } = friends;
- console.log(`stealFriendsFood---好友【${friendPin}】--偷食状态:${stealStatus}\n`);
- // console.log(`stealFriendsFood---好友【${friendPin}】--喂食状态:${status}\n`);
- if (stealStatus === 'can_steal') {
- //可偷狗粮
- //偷好友狗粮
- console.log(`发现好友【${friendPin}】可偷狗粮\n`)
- await enterFriendRoom(friendPin);
- await doubleRandomFood(friendPin);
- const getRandomFoodRes = await getRandomFood(friendPin);
- console.log(`偷好友狗粮结果:${JSON.stringify(getRandomFoodRes)}`)
- if (getRandomFoodRes && getRandomFoodRes.success) {
- if (getRandomFoodRes.errorCode === 'steal_ok') {
- $.stealFood += getRandomFoodRes.data;
- }
- }
- } else if (stealStatus === 'chance_full') {
- console.log('偷好友狗粮已达上限,跳出循环');
- break;
- }
- }
- }
-}
-//偷好友积分
-async function stealFriendCoinFun() {
- let jdJoyStealCoinTemp;
- if ($.isNode() && process.env.jdJoyStealCoin) {
- jdJoyStealCoinTemp = `${process.env.jdJoyStealCoin}` === 'true';
- } else if ($.getdata('jdJoyStealCoin')) {
- jdJoyStealCoinTemp = $.getdata('jdJoyStealCoin') === 'true';
- } else {
- jdJoyStealCoinTemp = `${jdJoyStealCoin}` === 'true';
- }
- if (jdJoyStealCoinTemp) {
- if ($.visit_friend !== 100) {
- console.log('开始偷好友积分')
- for (let friends of $.allFriends) {
- const { friendPin } = friends;
- await stealFriendCoin(friendPin);//领好友积分
- if ($.stealFriendCoin * 1 === 100) {
- console.log(`偷好友积分已达上限${$.stealFriendCoin}个,现跳出循环`)
- break
- }
- }
- } else {
- console.log('偷好友积分已达上限(已获得100积分)')
- $.stealFriendCoin = `已达上限(已获得100积分)`
- }
- }
-}
-//给好友喂食
-async function helpFriendsFeed() {
- if ($.help_feed !== 200) {
- //可给好友喂食
- let ctrTemp;
- if ($.isNode() && process.env.JOY_HELP_FEED) {
- ctrTemp = `${process.env.JOY_HELP_FEED}` === 'true';
- } else if ($.getdata('jdJoyHelpFeed')) {
- ctrTemp = $.getdata('jdJoyHelpFeed') === 'true';
- } else {
- ctrTemp = `${jdJoyHelpFeed}` === 'true';
- }
- if (ctrTemp) {
- console.log(`\n开始给好友喂食`);
- for (let friends of $.allFriends) {
- const { friendPin, status, stealStatus } = friends;
- // console.log(`\nhelpFriendsFeed---好友【${friendPin}】--偷食状态:${stealStatus}`);
- console.log(`\nhelpFriendsFeed---好友【${friendPin}】--喂食状态:${status}`);
- if (status === 'not_feed') {
- const helpFeedRes = await helpFeed(friendPin);
- // console.log(`帮忙喂食结果--${JSON.stringify(helpFeedRes)}`)
- if (helpFeedRes && helpFeedRes.errorCode === 'help_ok' && helpFeedRes.success) {
- console.log(`帮好友[${friendPin}]喂食10g狗粮成功,你获得10积分\n`);
- $.helpFood += 10;
- } else if (helpFeedRes && helpFeedRes.errorCode === 'chance_full') {
- console.log('喂食已达上限,不再喂食\n')
- break
- } else if (helpFeedRes && helpFeedRes.errorCode === 'food_insufficient') {
- console.log('帮好友喂食失败,您的狗粮不足10g\n')
- break
- } else {
- console.log(JSON.stringify(helpFeedRes))
- }
- } else if (status === 'time_error') {
- console.log(`帮好友喂食失败,好友[${friendPin}]的汪汪正在食用\n`)
- }
- }
- } else {
- console.log('您已设置不为好友喂食,现在跳过喂食,如需为好友喂食请在BoxJs打开喂食开关或者更改脚本 jdJoyHelpFeed 处')
- }
- } else {
- console.log('帮好友喂食已达上限(已帮喂20个好友获得200积分)')
- $.helpFood = '已达上限(已帮喂20个好友获得200积分)'
- }
-}
-function getFriends(currentPage = '1') {
- return new Promise(resolve => {
- const options = {
- url: `${JD_API_HOST}/getFriends?itemsPerPage=20¤tPage=${currentPage}`,
- headers: {
- 'Cookie': cookie,
- 'reqSource': 'h5',
- 'Host': 'jdjoy.jd.com',
- 'Connection': 'keep-alive',
- 'Content-Type': 'application/json',
- 'Referer': 'https://jdjoy.jd.com/pet/index',
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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',
- }
- }
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- throw new Error(err);
- } else {
- // console.log('JSON.parse(data)', JSON.parse(data))
- if (data) {
- $.getFriendsData = JSON.parse(data);
- } else {
- console.log(`京豆api返回数据为空,请检查自身原因`)
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve();
- }
- })
- })
-}
-
-async function stealFriendCoin(friendPin) {
- // console.log(`进入好友 ${friendPin}的房间`)
- const enterFriendRoomRes = await enterFriendRoom(friendPin);
- if (enterFriendRoomRes) {
- const { friendHomeCoin } = enterFriendRoomRes.data;
- if (friendHomeCoin > 0) {
- //领取好友积分
- console.log(`好友 ${friendPin}的房间可领取积分${friendHomeCoin}个\n`)
- const getFriendCoinRes = await getFriendCoin(friendPin);
- console.log(`偷好友积分结果:${JSON.stringify(getFriendCoinRes)}\n`)
- if (getFriendCoinRes && getFriendCoinRes.errorCode === 'coin_took_ok') {
- $.stealFriendCoin += getFriendCoinRes.data;
- }
- } else {
- console.log(`好友 ${friendPin}的房间暂无可领取积分\n`)
- }
- }
-}
-//进入好友房间
-function enterFriendRoom(friendPin) {
- console.log(`\nfriendPin:: ${friendPin}\n`);
- return new Promise(async resolve => {
- $.get(taskUrl('enterFriendRoom', (friendPin)), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- console.log(`\n${JSON.stringify(err)}`)
- console.log(`\n${err}\n`)
- throw new Error(err);
- } else {
- // console.log('进入好友房间', JSON.parse(data))
- if (data) {
- data = JSON.parse(data);
- console.log(`可偷狗粮:${data.data.stealFood}`)
- console.log(`可偷积分:${data.data.friendHomeCoin}`)
- } else {
- console.log(`京豆api返回数据为空,请检查自身原因`)
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//收集好友金币
-function getFriendCoin(friendPin) {
- return new Promise(resolve => {
- $.get(taskUrl('getFriendCoin', friendPin), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- throw new Error(err);
- } else {
- if (data) {
- data = JSON.parse(data);
- } else {
- console.log(`京豆api返回数据为空,请检查自身原因`)
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//帮好友喂食
-function helpFeed(friendPin) {
- return new Promise(resolve => {
- $.get(taskUrl('helpFeed', friendPin), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- throw new Error(err);
- } else {
- if (data) {
- data = JSON.parse(data);
- } else {
- console.log(`京豆api返回数据为空,请检查自身原因`)
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//收集好友狗粮,已实现分享可得双倍狗粮功能
-//①分享
-function doubleRandomFood(friendPin) {
- return new Promise(resolve => {
- $.get(taskUrl('doubleRandomFood', friendPin), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- throw new Error(err);
- } else {
- // console.log('分享', JSON.parse(data))
- // $.appGetPetTaskConfigRes = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve();
- }
- })
- })
-}
-//②领取双倍狗粮
-function getRandomFood(friendPin) {
- return new Promise(resolve => {
- $.get(taskUrl('getRandomFood', friendPin), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- throw new Error(err);
- } else {
- if (data) {
- console.log(`领取双倍狗粮结果--${data}`)
- data = JSON.parse(data);
- } else {
- console.log(`京豆api返回数据为空,请检查自身原因`)
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function getCoinChanges() {
- return new Promise(resolve => {
- const options = {
- url: `${JD_API_HOST}/getCoinChanges?changeDate=${Date.now()}`,
- headers: {
- 'Cookie': cookie,
- 'reqSource': 'h5',
- 'Host': 'jdjoy.jd.com',
- 'Connection': 'keep-alive',
- 'Content-Type': 'application/json',
- 'Referer': 'https://jdjoy.jd.com/pet/index',
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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',
- }
- }
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- throw new Error(err);
- } else {
- // console.log('getCoinChanges', JSON.parse(data))
- if (data) {
- data = JSON.parse(data);
- if (data.datas && data.datas.length > 0) {
- $.help_feed = 0;
- $.visit_friend = 0;
- for (let item of data.datas) {
- if ($.time('yyyy-MM-dd') === timeFormat(item.createdDate) && item.changeEvent === 'help_feed'){
- $.help_feed = item.changeCoin;
- }
- if ($.time('yyyy-MM-dd') === timeFormat(item.createdDate) && item.changeEvent === 'visit_friend') {
- $.visit_friend = item.changeCoin;
- }
- }
- console.log(`$.help_feed给好友喂食获得积分:${$.help_feed}`);
- console.log(`$.visit_friend领取好友积分:${$.visit_friend}`);
- }
- } else {
- console.log(`京豆api返回数据为空,请检查自身原因`)
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve();
- }
- })
- })
-}
-function showMsg() {
- $.stealFood = $.stealFood >= 0 ? `【偷好友狗粮】获取${$.stealFood}g狗粮\n` : `【偷好友狗粮】${$.stealFood}\n`;
- $.stealFriendCoin = $.stealFriendCoin >= 0 ? `【领取好友积分】获得${$.stealFriendCoin}个\n` : `【领取好友积分】${$.stealFriendCoin}\n`;
- $.helpFood = $.helpFood >= 0 ? `【给好友喂食】消耗${$.helpFood}g狗粮,获得积分${$.helpFood}个\n` : `【给好友喂食】${$.helpFood}\n`;
- message += $.stealFriendCoin;
- message += $.stealFood;
- message += $.helpFood;
- let ctrTemp;
- if ($.getdata('jdJoyStealNotify')) {
- ctrTemp = `${$.getdata('jdJoyStealNotify')}` === 'false';
- } else {
- ctrTemp = `${jdNotify}` === 'false';
- }
- if (ctrTemp) {
- $.msg($.name, '', message);
- } else {
- $.log(`\n${message}\n`);
- }
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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 taskUrl(functionId, friendPin) {
- return {
- url: `${JD_API_HOST}/${functionId}?friendPin=${encodeURI(friendPin)}`,
- headers: {
- 'Cookie': cookie,
- 'reqSource': 'h5',
- 'Host': 'jdjoy.jd.com',
- 'Connection': 'keep-alive',
- 'Content-Type': 'application/json',
- 'Referer': 'https://jdjoy.jd.com/pet/index',
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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',
- }
- }
-}
-function timeFormat(time) {
- let date;
- if (time) {
- date = new Date(time)
- } else {
- date = new Date();
- }
- return date.getFullYear() + '-' + ((date.getMonth() + 1) >= 10 ? (date.getMonth() + 1) : '0' + (date.getMonth() + 1)) + '-' + (date.getDate() >= 10 ? date.getDate() : '0' + date.getDate());
-}
-// prettier-ignore
-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
diff --git a/jd_lotteryMachine.js b/jd_lotteryMachine.js
deleted file mode 100644
index 452a1d6..0000000
--- a/jd_lotteryMachine.js
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-自用于github action
-author:yangtingxiao
-github: https://github.com/yangtingxiao
-京东抽奖机
-更新时间:2020-11-07 11:09
-脚本说明:五个抽奖活动,【东东抽奖机】【新店福利】【东东福利屋】【东东生活】【闪购盲盒】,点通知只能跳转一个,入口在京东APP玩一玩里面可以看到
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-// quantumultx
-[task_local]
-#京东抽奖机
-11 1 * * * https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_lotteryMachine.js, tag=京东抽奖机, img-url=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/image/jd.png, enabled=true
-// Loon
-[Script]
-cron "11 1 * * *" script-path=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_lotteryMachine.js,tag=京东抽奖机
-// Surge
-京东抽奖机 = type=cron,cronexp=11 1 * * *,wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_lotteryMachine.js
- */
-const $ = new Env('京东抽奖机');
-main();
-async function main() {
- $.http.get({url: `https://purge.jsdelivr.net/gh/yangtingxiao/QuantumultX@master/scripts/jd/jd_lotteryMachine.js`}).then((resp) => {
- if (resp.statusCode === 200) {
- console.log(`${$.name}CDN缓存刷新成功`)
- }
- });
- await updateShareCodes();
- if (!$.body) await updateShareCodesCDN();
- if ($.body) {
- eval($.body);
- }
-}
-function updateShareCodes(url = 'https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_lotteryMachine.js') {
- return new Promise(resolve => {
- $.get({url}, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- } else {
- $.body = data;
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function updateShareCodesCDN(url = 'https://cdn.jsdelivr.net/gh/yangtingxiao/QuantumultX@master/scripts/jd/jd_lotteryMachine.js') {
- return new Promise(resolve => {
- $.get({url}, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- $.body = data;
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-
-
-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,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("",`\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 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();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){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="",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}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));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)}
diff --git a/jd_mohe.js b/jd_mohe.js
deleted file mode 100644
index 600221c..0000000
--- a/jd_mohe.js
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
-热8超级盲盒,可抽奖获得京豆,建议在凌晨0点时运行脚本,白天抽奖基本没有京东
-活动地址: https://blindbox.jd.com
-活动时间到18号
-支持京东双账号
-更新时间:2020-08-17
-脚本兼容: QuantumultX, Surge,Loon, JSBox, Node.js
-// quantumultx
-[task_local]
-#热8超级盲盒
-1 0,1-23/3 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_mohe.js, tag=热8超级盲盒, enabled=true
-// Loon
-[Script]
-cron "1 0,1-23/3 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_mohe.js,tag=热8超级盲盒
-// Surge
-热8超级盲盒 = type=cron,cronexp=1 0,1-23/3 * * *,wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_mohe.js
- */
-const $ = new Env('热8超级盲盒');
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
-//直接用NobyDa的jd cookie
-let cookie = jdCookieNode.CookieJD ? jdCookieNode.CookieJD : $.getdata('CookieJD');
-const cookie2 = jdCookieNode.CookieJD2 ? jdCookieNode.CookieJD2 : $.getdata('CookieJD2');
-let UserName = '';
-const JD_API_HOST = 'https://blindbox.jd.com';
-let shareId = '';
-!(async () => {
- if (!cookie) {
- $.msg('【京东账号一】热8超级盲盒', '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- } else {
- UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1]);
- // await shareUrl();
- // await addShare();
- await getCoin();//领取每三小时自动生产的热力值
- await Promise.all([
- task0(),
- task1(),
- ])
- await taskList();
- await getAward();//抽奖
- if ($.time('yyyy-MM-dd') === '2020-08-19') {
- $.msg($.name, '活动已结束', `请禁用或删除脚本\n如果帮助到您可以点下🌟STAR鼓励我一下,谢谢\n咱江湖再见\nhttps://github.com/lxk0301/jd_scripts\n`, {"open-url": "https://github.com/lxk0301/jd_scripts"});
- } else {
- $.msg($.name, '', `【京东账号一】${UserName}\n任务已做完.\n 抽奖详情查看 https://blindbox.jd.com\n`, {"open-url": "https://blindbox.jd.com"});
- }
- }
- await $.wait(1000);
- if (cookie2) {
- cookie = cookie2;
- UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1]);
- console.log(`\n开始【京东账号二】${UserName}\n`)
- await getCoin();//领取每三小时自动生产的热力值
- await Promise.all([
- task0(),
- task1(),
- ])
- await taskList();
- await getAward();//抽奖
- $.msg($.name, '', `【京东账号二】${UserName}\n任务已做完.\n 抽奖详情查看 https://blindbox.jd.com\n`, {"open-url": "https://blindbox.jd.com"});
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-
-
-async function task0() {
- const confRes = await conf();
- if (confRes.code === 200) {
- const { brandList, skuList } = confRes.data;
- if (skuList && skuList.length > 0) {
- for (let item of skuList) {
- if (item.state === 0) {
- let homeGoBrowseRes = await homeGoBrowse(0, item.id);
- console.log('商品', homeGoBrowseRes);
- await $.wait(1000);
- const taskHomeCoin0Res = await taskHomeCoin(0, item.id);
- console.log('商品领取金币', taskHomeCoin0Res);
- // if (homeGoBrowseRes.code === 200) {
- // await $.wait(1000);
- // await taskHomeCoin(0, item.id);
- // }
- } else {
- console.log('精选好物任务已完成')
- }
- }
- }
- }
-}
-async function task1() {
- const confRes = await conf();
- if (confRes.code === 200) {
- const { brandList, skuList } = confRes.data;
- if (brandList && brandList.length > 0) {
- for (let item of brandList) {
- if (item.state === 0) {
- let homeGoBrowseRes = await homeGoBrowse(1, item.id);
- // console.log('店铺', homeGoBrowseRes);
- await $.wait(1000);
- const taskHomeCoin1Res = await taskHomeCoin(1, item.id);
- console.log('店铺领取金币', taskHomeCoin1Res);
- // if (homeGoBrowseRes.code === 200) {
- // await $.wait(1000);
- // await taskHomeCoin(1, item.id);
- // }
- } else {
- console.log('精选店铺-任务已完成')
- }
- }
- }
- }
-}
-function addShare(id) {
- console.log(`shareId${shareId}`);
- return new Promise((resolve) => {
- const url = `addShare?shareId=${shareId}&t=${Date.now()}`;
- $.get(taskurl(url), (err, resp, data) => {
- try {
- // console.log('ddd----ddd', data)
- data = JSON.parse(data);
- // console.log('ddd----ddd', data)
-
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function conf() {
- return new Promise((resolve) => {
- const url = `conf`;
- $.get(taskurl(url), (err, resp, data) => {
- try {
- // console.log('ddd----ddd', data)
- data = JSON.parse(data);
- // console.log('ddd----ddd', data)
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function homeGoBrowse(type, id) {
- return new Promise((resolve) => {
- const url = `homeGoBrowse?type=${type}&id=${id}`;
- $.get(taskurl(url), (err, resp, data) => {
- try {
- // console.log('homeGoBrowse', data)
- data = JSON.parse(data);
- // console.log('homeGoBrowse', data)
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function taskHomeCoin(type, id) {
- return new Promise((resolve) => {
- const url = `taskHomeCoin?type=${type}&id=${id}`;
- $.get(taskurl(url), (err, resp, data) => {
- try {
- // console.log('homeGoBrowse', data)
- data = JSON.parse(data);
- // console.log('homeGoBrowse', data)
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function getCoin() {
- return new Promise((resolve) => {
- const url = `getCoin?t=${Date.now()}`;
- $.get(taskurl(url), (err, resp, data) => {
- try {
- // console.log('homeGoBrowse', data)
- data = JSON.parse(data);
- // console.log('homeGoBrowse', data)
- if (data.code === 1001) {
- console.log(data.msg);
- $.msg($.name, '领取失败', `${data.msg}`);
- $.done();
- } else {
- console.log(`成功领取${data.data}热力值`)
- resolve(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- }
- })
- })
-}
-function taskList() {
- return new Promise((resolve) => {
- const url = `taskList?t=${Date.now()}`;
- $.get(taskurl(url), async (err, resp, data) => {
- try {
- // console.log('homeGoBrowse', data)
- data = JSON.parse(data);
- console.log(`请继续等待,正在做任务,不要退出哦`)
- // console.log(`成功领取${data.data}热力值`)
- if (data.code === 200) {
- const { task4, task6, task2, task1 } = data.data;
- if (task4.finishNum < task4.totalNum) {
- await browseProduct(task4.skuId);
- await taskCoin(task4.type);
- }
- //浏览会场
- if (task1.finishNum < task1.totalNum) {
- await strollActive((task1.finishNum + 1));
- await taskCoin(task1.type);
- }
- if (task2.finishNum < task2.totalNum) {
- await strollShop(task2.shopId);
- await taskCoin(task2.type);
- }
- if (task6.finishNum < task6.totalNum) {
- await strollMember(task6.venderId);
- await taskCoin(task6.type);
- }
- if (task4.state === 2 && task1.state === 2 && task2.state === 2 && task6.state === 2) {
- console.log('taskList的任务全部做完了---')
- } else {
- await taskList();
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//浏览商品(16个)
-function browseProduct(skuId) {
- return new Promise((resolve) => {
- const url = `browseProduct?0=${skuId}&t=${Date.now()}`;
- $.get(taskurl(url), (err, resp, data) => {
- try {
- // console.log('homeGoBrowse', data)
- data = JSON.parse(data);
- // console.log('homeGoBrowse', data)
- // console.log(`成功领取${data.data}热力值`)
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-// 浏览会场(10个)
-function strollActive(index) {
- return new Promise((resolve) => {
- const url = `strollActive?0=${index}&t=${Date.now()}`;
- $.get(taskurl(url), (err, resp, data) => {
- try {
- // console.log('homeGoBrowse', data)
- data = JSON.parse(data);
- // console.log('homeGoBrowse', data)
- // console.log(`成功领取${data.data}热力值`)
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//关注或浏览店铺(9个)
-function strollShop(shopId) {
- return new Promise((resolve) => {
- const url = `strollShop?shopId=${shopId}&t=${Date.now()}`;
- $.get(taskurl(url), (err, resp, data) => {
- try {
- // console.log('homeGoBrowse', data)
- data = JSON.parse(data);
- // console.log('homeGoBrowse', data)
- // console.log(`成功领取${data.data}热力值`)
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-// 加入会员(7)
-function strollMember(venderId) {
- return new Promise((resolve) => {
- const url = `strollMember?venderId=${venderId}&t=${Date.now()}`;
- $.get(taskurl(url), (err, resp, data) => {
- try {
- // console.log('homeGoBrowse', data)
- data = JSON.parse(data);
- // console.log('homeGoBrowse', data)
- // console.log(`成功领取${data.data}热力值`)
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-
-function taskCoin(type) {
- return new Promise((resolve) => {
- const url = `taskCoin?type=${type}&t=${Date.now()}`;
- $.get(taskurl(url), (err, resp, data) => {
- try {
- // console.log('homeGoBrowse', data)
- data = JSON.parse(data);
- // console.log('homeGoBrowse', data)
- // console.log(`成功领取${data.data}热力值`)
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-async function getAward() {
- const coinRes = await coin();
- if (coinRes.code === 200) {
- const { total, need } = coinRes.data;
- if (total > need) {
- const times = Math.floor(total / need);
- for (let i = 0; i < times; i++) {
- await $.wait(2000);
- let lotteryRes = await lottery();
- if (lotteryRes.code === 200) {
- console.log(`====抽奖结果====,${JSON.stringify(lotteryRes.data)}`);
- console.log(lotteryRes.data.name);
- console.log(lotteryRes.data.beanNum);
- } else if (lotteryRes.code === 4001) {
- console.log(`抽奖失败,${lotteryRes.msg}`);
- break;
- }
- }
- } else {
- console.log(`目前热力值${total},不够抽奖`)
- }
- }
-}
-//获取有多少热力值
-function coin() {
- return new Promise((resolve) => {
- const url = `coin?t=${Date.now()}`;
- $.get(taskurl(url), (err, resp, data) => {
- try {
- // console.log('homeGoBrowse', data)
- data = JSON.parse(data);
- // console.log('homeGoBrowse', data)
- // console.log(`成功领取${data.data}热力值`)
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//抽奖API
-function lottery() {
- return new Promise((resolve) => {
- const options = {
- 'url': `${JD_API_HOST}/prize/lottery?t=${Date.now()}`,
- 'headers': {
- "accept": "*/*",
- "accept-encoding": "gzip, deflate, br",
- "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
- "content-type": "application/x-www-form-urlencoded",
- "cookie": cookie,
- "referer": "https://blindbox.jd.com/",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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")
- }
- }
- $.get(options, (err, resp, data) => {
- try {
- // console.log('homeGoBrowse', data)
- data = JSON.parse(data);
- // console.log('homeGoBrowse', data)
- // console.log(`成功领取${data.data}热力值`)
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function taskurl(url) {
- return {
- 'url': `${JD_API_HOST}/active/${url}`,
- 'headers': {
- "accept": "*/*",
- "accept-encoding": "gzip, deflate, br",
- "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
- "content-type": "application/x-www-form-urlencoded",
- "cookie": cookie,
- "referer": "https://blindbox.jd.com/",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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")
- }
- }
-}
-// prettier-ignore
-function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{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=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"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 e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)}
\ No newline at end of file
diff --git a/jd_moneyTree.js b/jd_moneyTree.js
deleted file mode 100644
index b2f5cc4..0000000
--- a/jd_moneyTree.js
+++ /dev/null
@@ -1,648 +0,0 @@
-/*
-京东摇钱树 :https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_moneyTree.js
-更新时间:2020-11-16
-京东摇钱树支持京东双账号
-注:如果使用Node.js, 需自行安装'crypto-js,got,http-server,tough-cookie'模块. 例: npm install crypto-js http-server tough-cookie got --save
-*/
-// quantumultx
-// [task_local]
-// #京东摇钱树
-// 3 */2 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_moneyTree.js, tag=京东摇钱树, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdyqs.png, enabled=true
-// Loon
-// [Script]
-// cron "3 */2 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_moneyTree.js,tag=京东摇钱树
-// Surge
-//京东摇钱树 = type=cron,cronexp="3 */2 * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_moneyTree.js
-const $ = new Env('京东摇钱树');
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- cookiesArr.push($.getdata('CookieJD'));
- cookiesArr.push($.getdata('CookieJD2'));
-}
-
-let jdNotify = true;//是否开启静默运行,默认true开启
-const JD_API_HOST = 'https://ms.jr.jd.com/gw/generic/uc/h5/m';
-let userInfo = null, taskInfo = [], message = '', subTitle = '', fruitTotal = 0;
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- message = '';
- subTitle = '';
- await jd_moneyTree();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-async function jd_moneyTree() {
- const userRes = await user_info();
- if (!userRes || !userRes.realName) return
- await signEveryDay();
- await dayWork();
- await harvest();
- await sell();
- await myWealth();
- await stealFriendFruit()
-
- $.log(`\n${message}\n`);
- if (!jdNotify || jdNotify === 'false') {
- $.msg($.name, subTitle, message);
- }
-}
-function user_info() {
- console.log('初始化摇钱树个人信息');
- const params = {
- "sharePin":"",
- "shareType":1,
- "channelLV":"",
- "source":0,
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- }
- params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);
- // await $.wait(5000); //歇口气儿, 不然会报操作频繁
- return new Promise((resolve, reject) => {
- $.post(taskurl('login', params), async (err, resp, data) => {
- try {
- if (err) {
- console.log("\n摇钱树京东API请求失败 ‼️‼️")
- console.log(JSON.stringify(err));
- } else {
- if (data) {
- const res = JSON.parse(data);
- if (res && res.resultCode === 0) {
- $.isLogin = true;
- console.log('resultCode为0')
- if (res.resultData.data) {
- userInfo = res.resultData.data;
- // userInfo.realName = null;
- if (userInfo.realName) {
- // console.log(`助力码sharePin为::${userInfo.sharePin}`);
- $.treeMsgTime = userInfo.sharePin;
- subTitle = `【${userInfo.nick}】${userInfo.treeInfo.treeName}`;
- // message += `【我的金果数量】${userInfo.treeInfo.fruit}\n`;
- // message += `【我的金币数量】${userInfo.treeInfo.coin}\n`;
- // message += `【距离${userInfo.treeInfo.level + 1}级摇钱树还差】${userInfo.treeInfo.progressLeft}\n`;
- } else {
- $.msg($.name, `【提示】京东账号${$.index}${$.UserName}运行失败`, '此账号未实名认证或者未参与过此活动\n①如未参与活动,请先去京东app参加摇钱树活动\n入口:我的->游戏与互动->查看更多\n②如未实名认证,请进行实名认证', {"open-url": "openApp.jdMobile://"});
- }
- }
- } else {
- console.log(`其他情况::${JSON.stringify(res)}`);
- }
- } else {
- console.log(`京豆api返回数据为空,请检查自身原因`)
- }
- }
- } catch (eor) {
- $.msg("摇钱树-初始化个人信息" + eor.name + "‼️", JSON.stringify(eor), eor.message)
- } finally {
- resolve(userInfo)
- }
- })
- })
-}
-
-function dayWork() {
- console.log(`开始做任务userInfo了\n`)
- return new Promise(async resolve => {
- const data = {
- "source":0,
- "linkMissionIds":["666","667"],
- "LinkMissionIdValues":[7,7],
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- };
- let response = await request('dayWork', data);
- // console.log(`获取任务的信息:${JSON.stringify(response)}\n`)
- let canTask = [];
- taskInfo = [];
- if (response && response.resultCode === 0) {
- if (response.resultData.code === '200') {
- response.resultData.data.map((item) => {
- if (item.prizeType === 2) {
- canTask.push(item);
- }
- if (item.workType === 7 && item.prizeType === 0) {
- // missionId.push(item.mid);
- taskInfo.push(item);
- }
- // if (item.workType === 7 && item.prizeType === 0) {
- // missionId2 = item.mid;
- // }
- })
- }
- }
- console.log(`canTask::${JSON.stringify(canTask)}\n`)
- console.log(`浏览任务列表taskInfo::${JSON.stringify(taskInfo)}\n`)
- for (let item of canTask) {
- if (item.workType === 1) {
- // 签到任务
- // let signRes = await sign();
- // console.log(`签到结果:${JSON.stringify(signRes)}`);
- if (item.workStatus === 0) {
- // const data = {"source":2,"workType":1,"opType":2};
- // let signRes = await request('doWork', data);
- let signRes = await sign();
- console.log(`三餐签到结果:${JSON.stringify(signRes)}`);
- } else if (item.workStatus === 2) {
- console.log(`三餐签到任务已经做过`)
- } else if (item.workStatus === -1) {
- console.log(`三餐签到任务不在时间范围内`)
- }
- } else if (item.workType === 2) {
- // 分享任务
- if (item.workStatus === 0) {
- // share();
- const data = {"source":0,"workType":2,"opType":1};
- //开始分享
- // let shareRes = await request('doWork', data);
- let shareRes = await share(data);
- console.log(`开始分享的动作:${JSON.stringify(shareRes)}`);
- const b = {"source":0,"workType":2,"opType":2};
- // let shareResJL = await request('doWork', b);
- let shareResJL = await share(b);
- console.log(`领取分享后的奖励:${JSON.stringify(shareResJL)}`)
- } else if (item.workStatus === 2) {
- console.log(`分享任务已经做过`)
- }
- }
- }
- for (let task of taskInfo) {
- if (task.mid && task.workStatus === 0) {
- console.log('开始做浏览任务');
- // yield setUserLinkStatus(task.mid);
- let aa = await setUserLinkStatus(task.mid);
- console.log(`aaa${JSON.stringify(aa)}`);
- } else if (task.mid && task.workStatus === 1){
- console.log(`workStatus === 1开始领取浏览后的奖励:mid:${task.mid}`);
- let receiveAwardRes = await receiveAward(task.mid);
- console.log(`领取浏览任务奖励成功:${JSON.stringify(receiveAwardRes)}`)
- } else if (task.mid && task.workStatus === 2) {
- console.log('所有的浏览任务都做完了')
- }
- }
- resolve();
- });
-}
-
-function harvest() {
- console.log(`收获的操作:${JSON.stringify(userInfo)}\n`)
- if (!userInfo) return
- const data = {
- "source": 2,
- "sharePin": "",
- "userId": userInfo.userInfo,
- "userToken": userInfo.userToken
- }
- return new Promise((rs, rj) => {
- request('harvest', data).then((harvestRes) => {
- if (harvestRes && harvestRes.resultCode === 0 && harvestRes.resultData.code === '200') {
- console.log('收获金果')
- let data = harvestRes.resultData.data;
- message += `【距离${data.treeInfo.level + 1}级摇钱树还差】${data.treeInfo.progressLeft}\n`;
- fruitTotal = data.treeInfo.fruit;
- }
- rs()
- // gen.next();
- })
- })
- // request('harvest', data).then((harvestRes) => {
- // if (harvestRes.resultCode === 0 && harvestRes.resultData.code === '200') {
- // let data = harvestRes.resultData.data;
- // message += `【距离${data.treeInfo.level + 1}级摇钱树还差】${data.treeInfo.progressLeft}\n`;
- // fruitTotal = data.treeInfo.fruit;
- // gen.next();
- // }
- // })
-}
-//卖出金果,得到金币
-function sell() {
- return new Promise((rs, rj) => {
- const params = {
- "source": 2,
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- }
- params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);//这一步,不可省略,否则提交会报错(和login接口一样)
- console.log(`目前金果数量${fruitTotal}`)
- if ($.isNode()) {
- if (process.env.MONEY_TREE_SELL_FRUIT && process.env.MONEY_TREE_SELL_FRUIT === 'false') {
- rs()
- return
- }
- }
- if (fruitTotal > 380) {
- request('sell', params).then((sellRes) => {
- console.log(`卖出金果结果:${JSON.stringify(sellRes)}\n`)
- rs()
- })
- } else {
- rs()
- }
- // request('sell', params).then(response => {
- // rs(response);
- // })
- })
- // request('sell', params).then((sellRes) => {
- // console.log(`卖出金果结果:${JSON.stringify(sellRes)}\n`)
- // gen.next();
- // })
-}
-//获取金币和金果数量
-function myWealth() {
- return new Promise((resolve) => {
- const params = {
- "source": 2,
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- }
- params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);//这一步,不可省略,否则提交会报错(和login接口一样)
- request('myWealth', params).then(res=> {
- if (res && res.resultCode === 0 && res.resultData.code === '200') {
- console.log(`金币数量和金果::${JSON.stringify(res)}`);
- message += `【我的金果数量】${res.resultData.data.gaAmount}\n`;
- message += `【我的金币数量】${res.resultData.data.gcAmount}\n`;
- }
- resolve();
- })
- });
-}
-function sign() {
- console.log('开始三餐签到')
- const data = {"source":2,"workType":1,"opType":2};
- return new Promise((rs, rj) => {
- request('doWork', data).then(response => {
- rs(response);
- })
- })
-}
-function signIndex() {
- const params = {
- "source":0,
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- }
- return new Promise((rs, rj) => {
- request('signIndex', params).then(response => {
- rs(response);
- })
- })
-}
-function signEveryDay() {
- return new Promise(async (resolve) => {
- let signIndexRes = await signIndex();
- if (signIndexRes.resultCode === 0) {
- console.log(`每日签到条件查询:${signIndexRes.resultData.data.canSign === 2 ? '可以签到' : '已经签到过了'}`);
- if (signIndexRes.resultData && signIndexRes.resultData.data.canSign == 2) {
- console.log('准备每日签到')
- let signOneRes = await signOne(signIndexRes.resultData.data.signDay);
- console.log(`第${signIndexRes.resultData.data.signDay}日签到结果:${JSON.stringify(signOneRes)}`);
- if (signIndexRes.resultData.data.signDay === 7) {
- let getSignAwardRes = await getSignAward();
- console.log(`店铺券(49-10)领取结果:${JSON.stringify(getSignAwardRes)}`)
- if (getSignAwardRes.resultCode === 0 && getSignAwardRes.data.code === 0) {
- message += `【7日签到奖励领取】${getSignAwardRes.datamessage}\n`
- }
- }
- }
- }
- resolve()
- })
-}
-function signOne(signDay) {
- const params = {
- "source":0,
- "signDay": signDay,
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- }
- return new Promise((rs, rj) => {
- request('signOne', params).then(response => {
- rs(response);
- })
- })
-}
-// 领取七日签到后的奖励(店铺优惠券)
-function getSignAward() {
- const params = {
- "source":2,
- "awardType": 2,
- "deviceRiskParam": 1,
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- }
- return new Promise((rs, rj) => {
- request('getSignAward', params).then(response => {
- rs(response);
- })
- })
-}
-// 浏览任务
-async function setUserLinkStatus(missionId) {
- let index = 0;
- do {
- const params = {
- "missionId": missionId,
- "pushStatus": 1,
- "keyValue": index,
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- }
- let response = await request('setUserLinkStatus', params)
- console.log(`missionId为${missionId}::第${index + 1}次浏览活动完成: ${JSON.stringify(response)}`);
- // if (resultCode === 0) {
- // let sportRevardResult = await getSportReward();
- // console.log(`领取遛狗奖励完成: ${JSON.stringify(sportRevardResult)}`);
- // }
- index++;
- } while (index < 7) //不知道结束的条件,目前写死循环7次吧
- console.log('浏览店铺任务结束');
- console.log('开始领取浏览后的奖励');
- let receiveAwardRes = await receiveAward(missionId);
- console.log(`领取浏览任务奖励成功:${JSON.stringify(receiveAwardRes)}`)
- return new Promise((resolve, reject) => {
- resolve(receiveAwardRes);
- })
- // gen.next();
-}
-// 领取浏览后的奖励
-function receiveAward(mid) {
- if (!mid) return
- mid = mid + "";
- const params = {
- "source":0,
- "workType": 7,
- "opType": 2,
- "mid": mid,
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- }
- return new Promise((rs, rj) => {
- request('doWork', params).then(response => {
- rs(response);
- })
- })
-}
-function share(data) {
- if (data.opType === 1) {
- console.log(`开始做分享任务\n`)
- } else {
- console.log(`开始做领取分享后的奖励\n`)
- }
- return new Promise((rs, rj) => {
- request('doWork', data).then(response => {
- rs(response);
- })
- })
- // const data = 'reqData={"source":0,"workType":2,"opType":1}';
- // request('doWork', data).then(res => {
- // console.log(`分享111:${JSON.stringify(res)}`)
- // setTimeout(() => {
- // const data2 = 'reqData={"source":0,"workType":2,"opType":2}';
- // request('doWork', data2).then(res => {
- // console.log(`分享222:${JSON.stringify(res)}`)
- // })
- // }, 2000)
- // })
- // await sleep(3);
-}
-function msgControl() {
- return new Promise((resolve) => {
- let time = $.getdata($.treeMsgTime) * 1;
- time ++;
- $.setdata(`${time}`, $.treeMsgTime);
- resolve();
- })
-}
-async function stealFriendFruit() {
- await friendRank();
- if ($.friendRankList && $.friendRankList.length > 0) {
- const canSteal = $.friendRankList.some((item) => {
- const boxShareCode = item.steal
- return (boxShareCode === true);
- });
- if (canSteal) {
- $.amount = 0;
- for (let item of $.friendRankList) {
- if (!item.self && item.steal) {
- await friendTreeRoom(item.encryPin);
- const stealFruitRes = await stealFruit(item.encryPin, $.friendTree.stoleInfo);
- if (stealFruitRes && stealFruitRes.resultCode === 0 && stealFruitRes.resultData.code === '200') {
- $.amount += stealFruitRes.resultData.data.amount;
- }
- }
- }
- message += `【偷取好友金果】共${$.amount}个\n`;
- } else {
- console.log(`今日已偷过好友的金果了,暂无好友可偷,请明天再来\n`)
- }
- } else {
- console.log(`您暂无好友,故跳过`);
- }
-}
-//获取好友列表API
-async function friendRank() {
- await $.wait(1000); //歇口气儿, 不然会报操作频繁
- const params = {
- "source": 2,
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- }
- params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);//这一步,不可省略,否则提交会报错(和login接口一样)
- return new Promise((resolve, reject) => {
- $.post(taskurl('friendRank', params), (err, resp, data) => {
- try {
- if (err) {
- console.log("\n摇钱树京东API请求失败 ‼️‼️");
- console.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (data) {
- data = JSON.parse(data);
- $.friendRankList = data.resultData.data;
- } else {
- console.log(`京豆api返回数据为空,请检查自身原因`)
- }
- }
- } catch (eor) {
- $.msg("摇钱树-初始化个人信息" + eor.name + "‼️", JSON.stringify(eor), eor.message)
- } finally {
- resolve()
- }
- })
- })
-}
-// 进入好友房间API
-async function friendTreeRoom(friendPin) {
- await $.wait(1000); //歇口气儿, 不然会报操作频繁
- const params = {
- "source": 2,
- "friendPin": friendPin,
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- }
- params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);//这一步,不可省略,否则提交会报错(和login接口一样)
- return new Promise((resolve, reject) => {
- $.post(taskurl('friendTree', params), (err, resp, data) => {
- try {
- if (err) {
- console.log("\n摇钱树京东API请求失败 ‼️‼️");
- console.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (data) {
- data = JSON.parse(data);
- $.friendTree = data.resultData.data;
- } else {
- console.log(`京豆api返回数据为空,请检查自身原因`)
- }
- }
- } catch (eor) {
- $.msg("摇钱树-初始化个人信息" + eor.name + "‼️", JSON.stringify(eor), eor.message)
- } finally {
- resolve()
- }
- })
- })
-}
-//偷好友金果API
-async function stealFruit(friendPin, stoleId) {
- await $.wait(1000); //歇口气儿, 不然会报操作频繁
- const params = {
- "source": 2,
- "friendPin": friendPin,
- "stoleId": stoleId,
- "riskDeviceParam":{"eid":"","dt":"","ma":"","im":"","os":"","osv":"","ip":"","apid":"","ia":"","uu":"","cv":"","nt":"","at":"1","fp":"","token":""}
- }
- params.riskDeviceParam = JSON.stringify(params.riskDeviceParam);//这一步,不可省略,否则提交会报错(和login接口一样)
- return new Promise((resolve, reject) => {
- $.post(taskurl('stealFruit', params), (err, resp, data) => {
- try {
- if (err) {
- console.log("\n摇钱树京东API请求失败 ‼️‼️");
- console.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (data) {
- data = JSON.parse(data);
- } else {
- console.log(`京豆api返回数据为空,请检查自身原因`)
- }
- }
- } catch (eor) {
- $.msg("摇钱树-初始化个人信息" + eor.name + "‼️", JSON.stringify(eor), eor.message)
- } finally {
- resolve(data)
- }
- })
- })
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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();
- }
- })
- })
-}
-async function request(function_id, body = {}) {
- await $.wait(1000); //歇口气儿, 不然会报操作频繁
- return new Promise((resolve, reject) => {
- $.post(taskurl(function_id,body), (err, resp, data) => {
- try {
- if (err) {
- console.log("\n摇钱树京东API请求失败 ‼️‼️");
- console.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (data) {
- data = JSON.parse(data);
- } else {
- console.log(`京豆api返回数据为空,请检查自身原因`)
- }
- }
- } catch (eor) {
- $.msg("摇钱树-初始化个人信息" + eor.name + "‼️", JSON.stringify(eor), eor.message)
- } finally {
- resolve(data)
- }
- })
- })
-}
-
-function taskurl(function_id, body) {
- return {
- url: JD_API_HOST + '/' + function_id + '?_=' + new Date().getTime()*1000,
- body: `reqData=${function_id === 'harvest' || function_id === 'login' || function_id === 'signIndex' || function_id === 'signOne' || function_id === 'setUserLinkStatus' || function_id === 'dayWork' || function_id === 'getSignAward' || function_id === 'sell' || function_id === 'friendRank' || function_id === 'friendTree' || function_id === 'stealFruit' ? encodeURIComponent(JSON.stringify(body)) : JSON.stringify(body)}`,
- headers: {
- 'Accept' : `application/json`,
- 'Origin' : `https://uua.jr.jd.com`,
- 'Accept-Encoding' : `gzip, deflate, br`,
- 'Cookie' : cookie,
- 'Content-Type' : `application/x-www-form-urlencoded;charset=UTF-8`,
- 'Host' : `ms.jr.jd.com`,
- 'Connection' : `keep-alive`,
- 'User-Agent' : $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- 'Referer' : `https://uua.jr.jd.com/uc-fe-wxgrowing/moneytree/index/?channel=yxhd&lng=113.325896&lat=23.204600&sid=2d98e88cf7d182f60d533476c2ce777w&un_area=19_1601_50258_51885`,
- 'Accept-Language' : `zh-cn`
- }
- }
-}
-// prettier-ignore
-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
diff --git a/jd_necklace.js b/jd_necklace.js
deleted file mode 100644
index c6cb87d..0000000
--- a/jd_necklace.js
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * @Author: lxk0301 https://github.com/lxk0301
- * @Date: 2020-11-20 11:42:03
- * @Last Modified by: lxk0301
- * @Last Modified time: 2020-11-23 12:27:14
- */
-/*
-点点券,可以兑换无门槛红包(1元,5元,10元,100元,部分红包需抢购)
-APP活动入口:“最新版本京东APP >领券中心/券后9.9>领点点券”页面
-网页入口:https://h5.m.jd.com/babelDiy/Zeus/41Lkp7DumXYCFmPYtU3LTcnTTXTX/index.html
-已支持IOS双京东账号,Node.js支持N个京东账号
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-===============Quantumultx===============
-[task_local]
-#点点券
-10 0,20 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_necklace.js, tag=点点券, enabled=true
-
-================Loon==============
-[Script]
-cron "10 0,20 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_necklace.js,tag=点点券
-
-===============Surge=================
-点点券 = type=cron,cronexp="10 0,20 * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_necklace.js
-
-============小火箭=========
-点点券 = type=cron,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_necklace.js, cronexpr="10 0,20 * * *", timeout=200, enable=true
- */
-const $ = new Env('点点券');
-
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- cookiesArr.push(...[$.getdata('CookieJD'), $.getdata('CookieJD2')]);
-}
-
-const JD_API_HOST = 'https://api.m.jd.com/api';
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- await jd_necklace();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-async function jd_necklace() {
- await necklace_homePage();
- await doTask();
- await necklace_homePage();
- await receiveBubbles();
- await sign();
- await necklace_homePage();
- await showMsg();
-}
-function showMsg() {
- return new Promise(resolve => {
- $.msg($.name, '', `京东账号 ${$.index} ${$.nickName}\n当前${$.name}${$.totalScore}个`);
- resolve()
- })
-}
-async function doTask() {
- for (let item of $.taskConfigVos) {
- if (item.taskStage === 0) {
- console.log(`${item.taskName}未完成`);
- await necklace_startTask(item.id);
- await $.wait(2000);
- await necklace_startTask(item.id);
- } else if (item.taskStage === 2) {
- console.log(`${item.taskName}任务已做完,奖励未领取`);
- } else if (item.taskStage === 3) {
- console.log(`${item.taskName}奖励已领取`);
- }
- }
-}
-async function receiveBubbles() {
- for (let item of $.bubbles) {
- console.log(`开始领取点点券\n`);
- await necklace_chargeScores(item.id)
- }
-}
-async function sign() {
- if ($.signInfo.todayCurrentSceneSignStatus === 1) {
- await necklace_sign();
- } else {
- console.log(`当前${new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000).toLocaleString()}已签到`)
- }
-}
-//每日签到福利
-function necklace_sign() {
- return new Promise(resolve => {
- const body = {
- currentDate: $.lastRequestTime.replace(/:/g, "%3A"),
- }
- $.post(taskPostUrl("necklace_sign", body), async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- console.log(data);
- if (safeGet(data)) {
- data = JSON.parse(data);
- if (data.rtn_code === 0) {
- if (data.data.biz_code === 0) {
- console.log(`签到成功,时间:${new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000).toLocaleString()}`)
- // $.taskConfigVos = data.data.result.taskConfigVos;
- // $.exchangeGiftConfigs = data.data.result.exchangeGiftConfigs;
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-//领取奖励
-function necklace_chargeScores(bubleId) {
- return new Promise(resolve => {
- const body = {
- bubleId,
- currentDate: $.lastRequestTime.replace(/:/g, "%3A"),
- }
- $.post(taskPostUrl("necklace_chargeScores", body), async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- console.log(data);
- if (safeGet(data)) {
- data = JSON.parse(data);
- if (data.rtn_code === 0) {
- if (data.data.biz_code === 0) {
- // $.taskConfigVos = data.data.result.taskConfigVos;
- // $.exchangeGiftConfigs = data.data.result.exchangeGiftConfigs;
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function necklace_startTask(taskId) {
- return new Promise(resolve => {
- const body = {
- taskId,
- currentDate: $.lastRequestTime.replace(/:/g, "%3A"),
- }
- $.post(taskPostUrl("necklace_startTask", body), async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- console.log(data);
- if (safeGet(data)) {
- data = JSON.parse(data);
- if (data.rtn_code === 0) {
- if (data.data.biz_code === 0) {
- // $.taskConfigVos = data.data.result.taskConfigVos;
- // $.exchangeGiftConfigs = data.data.result.exchangeGiftConfigs;
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function necklace_homePage() {
- return new Promise(resolve => {
- $.post(taskPostUrl('necklace_homePage'), 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.rtn_code === 0) {
- if (data.data.biz_code === 0) {
- $.taskConfigVos = data.data.result.taskConfigVos;
- $.exchangeGiftConfigs = data.data.result.exchangeGiftConfigs;
- $.lastRequestTime = data.data.result.lastRequestTime;
- $.bubbles = data.data.result.bubbles;
- $.signInfo = data.data.result.signInfo;
- $.totalScore = data.data.result.totalScore;
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function taskPostUrl(function_id, body = {}) {
- const time = new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000;
- return {
- url: `${JD_API_HOST}?functionId=${function_id}&appid=jd_mp_h5&loginType=2&client=jd_mp_h5&t=${time}&body=${escape(JSON.stringify(body))}`,
- headers: {
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- }
- }
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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 safeGet(data) {
- try {
- if (typeof JSON.parse(data) == "object") {
- return true;
- }
- } catch (e) {
- console.log(e);
- console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
- return false;
- }
-}
-// prettier-ignore
-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,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("",`\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 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();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){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="",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}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));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
diff --git a/jd_pet.js b/jd_pet.js
deleted file mode 100644
index 19d3888..0000000
--- a/jd_pet.js
+++ /dev/null
@@ -1,607 +0,0 @@
-/*
-东东萌宠 更新地址: https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pet.js
-更新时间:2020-11-21
-已支持IOS双京东账号,Node.js支持N个京东账号
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-
-互助码shareCode请先手动运行脚本查看打印可看到
-一天只能帮助5个人。多出的助力码无效
-
-=================================Quantumultx=========================
-[task_local]
-#东东萌宠
-15 6-18/6 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pet.js, tag=东东萌宠, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdmc.png, enabled=true
-
-=================================Loon===================================
-[Script]
-cron "15 6-18/6 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pet.js,tag=东东萌宠
-
-===================================Surge================================
-东东萌宠 = type=cron,cronexp="15 6-18/6 * * *",wake-system=1,timeout=120,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pet.js
-
-====================================小火箭=============================
-东东萌宠 = type=cron,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pet.js, cronexpr="15 6-18/6 * * *", timeout=200, enable=true
-
-*/
-const $ = new Env('东东萌宠');
-let cookiesArr = [], cookie = '', jdPetShareArr = [], isBox = false, notify, newShareCodes;
-//助力好友分享码(最多5个,否则后面的助力失败),原因:京东农场每人每天只有四次助力机会
-//此此内容是IOS用户下载脚本到本地使用,填写互助码的地方,同一京东账号的好友互助码请使用@符号隔开。
-//下面给出两个账号的填写示例(iOS只支持2个京东账号)
-let shareCodes = [ // IOS本地脚本用户这个列表填入你要助力的好友的shareCode
- //账号一的好友shareCode,不同好友的shareCode中间用@符号隔开
- 'MTAxODc2NTEzNTAwMDAwMDAwMjg3MDg2MA==@MTAxODc2NTEzMzAwMDAwMDAyNzUwMDA4MQ==@MTAxODc2NTEzMjAwMDAwMDAzMDI3MTMyOQ==@MTAxODc2NTEzNDAwMDAwMDAzMDI2MDI4MQ==@MTAxODcxOTI2NTAwMDAwMDAxOTQ3MjkzMw==',
- //账号二的好友shareCode,不同好友的shareCode中间用@符号隔开
- 'MTAxODc2NTEzMjAwMDAwMDAzMDI3MTMyOQ==@MTAxODcxOTI2NTAwMDAwMDAyNjA4ODQyMQ==@MTAxODc2NTEzOTAwMDAwMDAyNzE2MDY2NQ==',
-]
-let message = '', subTitle = '', option = {};
-let jdNotify = false;//是否关闭通知,false打开通知推送,true关闭通知推送
-const JD_API_HOST = 'https://api.m.jd.com/client.action';
-let goodsUrl = '', taskInfoKey = [];
-let randomCount = $.isNode() ? 20 : 5;
-!(async () => {
- await requireConfig();
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- message = '';
- subTitle = '';
- goodsUrl = '';
- taskInfoKey = [];
- option = {};
- await shareCodesFormat();
- await jdPet();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-async function jdPet() {
- //查询jd宠物信息
- const initPetTownRes = await request('initPetTown');
- message = `【京东账号${$.index}】${$.nickName}\n`;
- if (initPetTownRes.code === '0' && initPetTownRes.resultCode === '0' && initPetTownRes.message === 'success') {
- $.petInfo = initPetTownRes.result;
- if ($.petInfo.userStatus === 0) {
- $.msg($.name, '【提示】此账号萌宠活动未开始,请手动去京东APP开启活动\n入口:我的->游戏与互动->查看更多', '', { "open-url": "openapp.jdmoble://" });
- return
- }
- goodsUrl = $.petInfo.goodsInfo && $.petInfo.goodsInfo.goodsUrl;
- // option['media-url'] = goodsUrl;
- // console.log(`初始化萌宠信息完成: ${JSON.stringify(petInfo)}`);
- if ($.petInfo.petStatus === 5) {
- await slaveHelp();//可以兑换而没有去兑换,也能继续助力好友
- option['open-url'] = "openApp.jdMobile://";
- $.msg($.name, `【提醒⏰】${$.petInfo.goodsInfo.goodsName}已可领取`, '请去京东APP或微信小程序查看', option);
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}奖品已可领取`, `京东账号${$.index} ${$.nickName}\n${$.petInfo.goodsInfo.goodsName}已可领取`);
- }
- return
- } else if ($.petInfo.petStatus === 6) {
- await slaveHelp();//已领取红包,但未领养新的,也能继续助力好友
- option['open-url'] = "openApp.jdMobile://";
- $.msg($.name, `【提醒⏰】已领取红包,但未继续领养新的物品`, '请去京东APP或微信小程序继续领养', option);
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}奖品已可领取`, `京东账号${$.index} ${$.nickName}\n已领取红包,但未继续领养新的物品`);
- }
- return
- }
- console.log(`\n【您的互助码shareCode】 ${$.petInfo.shareCode}\n`);
- await taskInit();
- if ($.taskInit.resultCode === '9999' || !$.taskInit.result) {
- console.log('初始化任务异常, 请稍后再试');
- return
- }
- $.taskInfo = $.taskInit.result;
-
- await petSport();//遛弯
- await slaveHelp();//助力好友
- await masterHelpInit();//获取助力的信息
- await doTask();//做日常任务
- await feedPetsAgain();//再次投食
- await energyCollect();//收集好感度
- await showMsg();
- console.log('全部任务完成, 如果帮助到您可以点下🌟STAR鼓励我一下, 明天见~');
- } else if (initPetTownRes.code === '0'){
- console.log(`初始化萌宠失败: ${initPetTownRes.message}`);
- }
-}
-// 收取所有好感度
-async function energyCollect() {
- console.log('开始收取任务奖励好感度');
- let function_id = arguments.callee.name.toString();
- const response = await request(function_id);
- // console.log(`收取任务奖励好感度完成:${JSON.stringify(response)}`);
- if (response.code === '0') {
- message += `【第${response.result.medalNum + 1}块勋章完成进度】${response.result.medalPercent}%,还需收集${response.result.needCollectEnergy}好感\n`;
- message += `【已获得勋章】${response.result.medalNum}块,还需收集${response.result.needCollectMedalNum}块即可兑换奖品“${$.petInfo.goodsInfo.goodsName}”\n`;
- }
-}
-//再次投食
-async function feedPetsAgain() {
- const response = await request('initPetTown');//再次初始化萌宠
- if (response.code === '0' && response.resultCode === '0' && response.message === 'success') {
- $.petInfo = response.result;
- let foodAmount = $.petInfo.foodAmount; //剩余狗粮
- if (foodAmount - 100 >= 10) {
- for (let i = 0; i < parseInt((foodAmount - 100) / 10); i++) {
- const feedPetRes = await request('feedPets');
- console.log(`投食feedPetRes`);
- if (feedPetRes.resultCode == 0 && feedPetRes.code == 0) {
- console.log('投食成功')
- }
- }
- const response2 = await request('initPetTown');
- $.petInfo = response2.result;
- subTitle = $.petInfo.goodsInfo.goodsName;
- // message += `【与爱宠相识】${$.petInfo.meetDays}天\n`;
- // message += `【剩余狗粮】${$.petInfo.foodAmount}g\n`;
- } else {
- console.log("目前剩余狗粮:【" + foodAmount + "】g,不再继续投食,保留部分狗粮用于完成第二天任务");
- subTitle = $.petInfo.goodsInfo.goodsName;
- // message += `【与爱宠相识】${$.petInfo.meetDays}天\n`;
- // message += `【剩余狗粮】${$.petInfo.foodAmount}g\n`;
- }
- } else {
- console.log(`初始化萌宠失败: ${JSON.stringify($.petInfo)}`);
- }
-}
-
-
-async function doTask() {
- const { signInit, threeMealInit, firstFeedInit, feedReachInit, inviteFriendsInit, browseShopsInit, taskList } = $.taskInfo;
- for (let item of taskList) {
- if ($.taskInfo[item].finished) {
- console.log(`任务 ${item} 已完成`)
- }
- }
- //每日签到
- if (signInit && !signInit.finished) {
- await signInitFun();
- }
- // 首次喂食
- if (firstFeedInit && !firstFeedInit.finished) {
- await firstFeedInitFun();
- }
- // 三餐
- if (threeMealInit && !threeMealInit.finished) {
- if (threeMealInit.timeRange === -1) {
- console.log(`未到三餐时间`);
- return
- }
- await threeMealInitFun();
- }
- if (browseShopsInit && !browseShopsInit.finished) {
- await browseShopsInitFun();
- }
- let browseSingleShopInitList = [];
- taskList.map((item) => {
- if (item.indexOf('browseSingleShopInit') > -1) {
- browseSingleShopInitList.push(item);
- }
- });
- // 去逛逛好货会场
- for (let item of browseSingleShopInitList) {
- const browseSingleShopInitTask = $.taskInfo[item];
- if (browseSingleShopInitTask && !browseSingleShopInitTask.finished) {
- await browseSingleShopInit(browseSingleShopInitTask);
- }
- }
- if (inviteFriendsInit && !inviteFriendsInit.finished) {
- await inviteFriendsInitFun();
- }
- // 投食10次
- if (feedReachInit && !feedReachInit.finished) {
- await feedReachInitFun();
- }
-}
-// 好友助力信息
-async function masterHelpInit() {
- let res = await request(arguments.callee.name.toString());
- // console.log(`助力信息: ${JSON.stringify(res)}`);
- if (res.code === '0' && res.resultCode === '0') {
- if (res.result.masterHelpPeoples && res.result.masterHelpPeoples.length >= 5) {
- if(!res.result.addedBonusFlag) {
- console.log("开始领取额外奖励");
- let getHelpAddedBonusResult = await request('getHelpAddedBonus');
- console.log(`领取30g额外奖励结果:【${getHelpAddedBonusResult.message}】`);
- message += `【额外奖励${getHelpAddedBonusResult.result.reward}领取】${getHelpAddedBonusResult.message}\n`;
- } else {
- console.log("已经领取过5好友助力额外奖励");
- message += `【额外奖励】已领取\n`;
- }
- } else {
- console.log("助力好友未达到5个")
- message += `【额外奖励】领取失败,原因:给您助力的人未达5个\n`;
- }
- if (res.result.masterHelpPeoples && res.result.masterHelpPeoples.length > 0) {
- console.log('帮您助力的好友的名单开始')
- let str = '';
- res.result.masterHelpPeoples.map((item, index) => {
- if (index === (res.result.masterHelpPeoples.length - 1)) {
- str += item.nickName || "匿名用户";
- } else {
- str += (item.nickName || "匿名用户") + ',';
- }
- })
- message += `【助力您的好友】${str}\n`;
- }
- }
-}
-/**
- * 助力好友, 暂时支持一个好友, 需要拿到shareCode
- * shareCode为你要助力的好友的
- * 运行脚本时你自己的shareCode会在控制台输出, 可以将其分享给他人
- */
-async function slaveHelp() {
- let helpPeoples = '';
- for (let code of newShareCodes) {
- console.log(`开始助力京东账号${$.index} - ${$.nickName}的好友: ${code}`);
- if (!code) continue;
- let response = await request(arguments.callee.name.toString(), {'shareCode': code});
- if (response.code === '0' && response.resultCode === '0') {
- if (response.result.helpStatus === 0) {
- console.log('已给好友: 【' + response.result.masterNickName + '】助力');
- helpPeoples += response.result.masterNickName + ',';
- } else if (response.result.helpStatus === 1) {
- // 您今日已无助力机会
- console.log(`助力好友${response.result.masterNickName}失败,您今日已无助力机会`);
- break;
- } else if (response.result.helpStatus === 2) {
- //该好友已满5人助力,无需您再次助力
- console.log(`该好友${response.result.masterNickName}已满5人助力,无需您再次助力`);
- } else {
- console.log(`助力其他情况:${JSON.stringify(response)}`);
- }
- } else {
- console.log(`助理好友结果: ${response.message}`);
- }
- }
- if (helpPeoples && helpPeoples.length > 0) {
- message += `【您助力的好友】${helpPeoples.substr(0, helpPeoples.length - 1)}\n`;
- }
-}
-// 遛狗, 每天次数上限10次, 随机给狗粮, 每次遛狗结束需调用getSportReward领取奖励, 才能进行下一次遛狗
-async function petSport() {
- console.log('开始遛弯');
- let times = 1
- const code = 0
- let resultCode = 0
- do {
- let response = await request(arguments.callee.name.toString())
- console.log(`第${times}次遛狗完成: ${JSON.stringify(response)}`);
- resultCode = response.resultCode;
- if (resultCode == 0) {
- let sportRevardResult = await request('getSportReward');
- console.log(`领取遛狗奖励完成: ${JSON.stringify(sportRevardResult)}`);
- }
- times++;
- } while (resultCode == 0 && code == 0)
- if (times > 1) {
- // message += '【十次遛狗】已完成\n';
- }
-}
-// 初始化任务, 可查询任务完成情况
-async function taskInit() {
- console.log('开始任务初始化');
- $.taskInit = await request(arguments.callee.name.toString(), {"version":1});
-}
-// 每日签到, 每天一次
-async function signInitFun() {
- console.log('准备每日签到');
- const response = await request("getSignReward");
- console.log(`每日签到结果: ${JSON.stringify(response)}`);
- if (response.code === '0' && response.resultCode === '0') {
- console.log(`【每日签到成功】奖励${response.result.signReward}g狗粮\n`);
- // message += `【每日签到成功】奖励${response.result.signReward}g狗粮\n`;
- } else {
- console.log(`【每日签到】${response.message}\n`);
- // message += `【每日签到】${response.message}\n`;
- }
-}
-
-// 三餐签到, 每天三段签到时间
-async function threeMealInitFun() {
- console.log('准备三餐签到');
- const response = await request("getThreeMealReward");
- console.log(`三餐签到结果: ${JSON.stringify(response)}`);
- if (response.code === '0' && response.resultCode === '0') {
- console.log(`【定时领狗粮】获得${response.result.threeMealReward}g\n`);
- // message += `【定时领狗粮】获得${response.result.threeMealReward}g\n`;
- } else {
- console.log(`【定时领狗粮】${response.message}\n`);
- // message += `【定时领狗粮】${response.message}\n`;
- }
-}
-
-// 浏览指定店铺 任务
-async function browseSingleShopInit(item) {
- console.log(`开始做 ${item.title} 任务, ${item.desc}`);
- const body = {"index": item['index'], "version":1, "type":1};
- const body2 = {"index": item['index'], "version":1, "type":2};
- const response = await request("getSingleShopReward", body);
- // console.log(`点击进去response::${JSON.stringify(response)}`);
- if (response.code === '0' && response.resultCode === '0') {
- const response2 = await request("getSingleShopReward", body2);
- // console.log(`浏览完毕领取奖励:response2::${JSON.stringify(response2)}`);
- if (response2.code === '0' && response2.resultCode === '0') {
- console.log(`【浏览指定店铺】获取${response2.result.reward}g\n`);
- // message += `【浏览指定店铺】获取${response2.result.reward}g\n`;
- }
- }
-}
-
-// 浏览店铺任务, 任务可能为多个? 目前只有一个
-async function browseShopsInitFun() {
- console.log('开始浏览店铺任务');
- let times = 0;
- let resultCode = 0;
- let code = 0;
- do {
- let response = await request("getBrowseShopsReward");
- console.log(`第${times}次浏览店铺结果: ${JSON.stringify(response)}`);
- code = response.code;
- resultCode = response.resultCode;
- times++;
- } while (resultCode == 0 && code == 0 && times < 5)
- console.log('浏览店铺任务结束');
-}
-// 首次投食 任务
-function firstFeedInitFun() {
- console.log('首次投食任务合并到10次喂食任务中\n');
-}
-
-// 邀请新用户
-async function inviteFriendsInitFun() {
- console.log('邀请新用户功能未实现');
- if ($.taskInfo.inviteFriendsInit.status == 1 && $.taskInfo.inviteFriendsInit.inviteFriendsNum > 0) {
- // 如果有邀请过新用户,自动领取60gg奖励
- const res = await request('getInviteFriendsReward');
- if (res.code == 0 && res.resultCode == 0) {
- console.log(`领取邀请新用户奖励成功,获得狗粮现有狗粮${$.taskInfo.inviteFriendsInit.reward}g,${res.result.foodAmount}g`);
- message += `【邀请新用户】获取狗粮${$.taskInfo.inviteFriendsInit.reward}g\n`;
- }
- }
-}
-
-/**
- * 投食10次 任务
- */
-async function feedReachInitFun() {
- console.log('投食任务开始...');
- let finishedTimes = $.taskInfo.feedReachInit.hadFeedAmount / 10; //已经喂养了几次
- let needFeedTimes = 10 - finishedTimes; //还需要几次
- let tryTimes = 20; //尝试次数
- do {
- console.log(`还需要投食${needFeedTimes}次`);
- const response = await request('feedPets');
- console.log(`本次投食结果: ${JSON.stringify(response)}`);
- if (response.resultCode == 0 && response.code == 0) {
- needFeedTimes--;
- }
- if (response.resultCode == 3003 && response.code == 0) {
- console.log('剩余狗粮不足, 投食结束');
- needFeedTimes = 0;
- }
- tryTimes--;
- } while (needFeedTimes > 0 && tryTimes > 0)
- console.log('投食任务结束...\n');
-}
-async function showMsg() {
- let ctrTemp;
- if ($.isNode() && process.env.PET_NOTIFY_CONTROL) {
- ctrTemp = `${process.env.PET_NOTIFY_CONTROL}` === 'false';
- } else if ($.getdata('jdPetNotify')) {
- ctrTemp = $.getdata('jdPetNotify') === 'false';
- } else {
- ctrTemp = `${jdNotify}` === 'false';
- }
- // jdNotify = `${notify.petNotifyControl}` === 'false' && `${jdNotify}` === 'false' && $.getdata('jdPetNotify') === 'false';
- if (ctrTemp) {
- $.msg($.name, subTitle, message, option);
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `${subTitle}\n${message}`);
- }
- } else {
- $.log(`\n${message}\n`);
- }
-}
-function readShareCode() {
- return new Promise(resolve => {
- $.get({url: `http://api.turinglabs.net/api/v1/jd/pet/read/${randomCount}/`}, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- console.log(`随机取个${randomCount}码放到您固定的互助码后面`)
- data = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function shareCodesFormat() {
- return new Promise(async resolve => {
- // console.log(`第${$.index}个京东账号的助力码:::${jdPetShareArr[$.index - 1]}`)
- newShareCodes = [];
- if (jdPetShareArr[$.index - 1]) {
- newShareCodes = jdPetShareArr[$.index - 1].split('@');
- } else {
- console.log(`由于您第${$.index}个京东账号未提供shareCode,将采纳本脚本自带的助力码\n`)
- const tempIndex = $.index > shareCodes.length ? (shareCodes.length - 1) : ($.index - 1);
- newShareCodes = shareCodes[tempIndex].split('@');
- }
- const readShareCodeRes = await readShareCode();
- if (readShareCodeRes && readShareCodeRes.code === 200) {
- newShareCodes = [...new Set([...newShareCodes, ...(readShareCodeRes.data || [])])];
- }
- console.log(`第${$.index}个京东账号将要助力的好友${JSON.stringify(newShareCodes)}`)
- resolve();
- })
-}
-function requireConfig() {
- return new Promise(resolve => {
- console.log('开始获取东东萌宠配置文件\n')
- notify = $.isNode() ? require('./sendNotify') : '';
- //Node.js用户请在jdCookie.js处填写京东ck;
- const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
- const jdPetShareCodes = $.isNode() ? require('./jdPetShareCodes.js') : '';
- //IOS等用户直接用NobyDa的jd cookie
- if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- if (jdCookieNode[item]) {
- cookiesArr.push(jdCookieNode[item])
- }
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
- } else {
- cookiesArr.push(...[$.getdata('CookieJD'), $.getdata('CookieJD2')]);
- }
- console.log(`共${cookiesArr.length}个京东账号\n`)
- if ($.isNode()) {
- Object.keys(jdPetShareCodes).forEach((item) => {
- if (jdPetShareCodes[item]) {
- jdPetShareArr.push(jdPetShareCodes[item])
- }
- })
- } else {
- const boxShareCodeArr = ['jd_pet1', 'jd_pet2', 'jd_pet3', 'jd_pet4', 'jd_pet5'];
- const boxShareCodeArr2 = ['jd2_pet1', 'jd2_pet2', 'jd2_pet3', 'jd2_pet4', 'jd2_pet5'];
- const isBox1 = boxShareCodeArr.some((item) => {
- const boxShareCode = $.getdata(item);
- return (boxShareCode !== undefined && boxShareCode !== null && boxShareCode !== '');
- });
- const isBox2 = boxShareCodeArr2.some((item) => {
- const boxShareCode = $.getdata(item);
- return (boxShareCode !== undefined && boxShareCode !== null && boxShareCode !== '');
- });
- isBox = isBox1 ? isBox1 : isBox2;
- if (isBox1) {
- let temp = [];
- for (const item of boxShareCodeArr) {
- if ($.getdata(item)) {
- temp.push($.getdata(item))
- }
- }
- jdPetShareArr.push(temp.join('@'));
- }
- if (isBox2) {
- let temp = [];
- for (const item of boxShareCodeArr2) {
- if ($.getdata(item)) {
- temp.push($.getdata(item))
- }
- }
- jdPetShareArr.push(temp.join('@'));
- }
- }
- // console.log(`jdPetShareArr::${JSON.stringify(jdPetShareArr)}`)
- // console.log(`jdPetShareArr账号长度::${jdPetShareArr.length}`)
- console.log(`您提供了${jdPetShareArr.length}个账号的东东萌宠助力码\n`);
- resolve()
- })
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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();
- }
- })
- })
-}
-// 请求
-async function request(function_id, body = {}) {
- await $.wait(3000); //歇口气儿, 不然会报操作频繁
- return new Promise((resolve, reject) => {
- $.get(taskUrl(function_id, body), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n东东萌宠: API查询请求失败 ‼️‼️');
- console.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data)
- }
- })
- })
-}
-function taskUrl(function_id, body = {}) {
- return {
- url: `${JD_API_HOST}?functionId=${function_id}&appid=wh5&loginWQBiz=pet-town&body=${escape(JSON.stringify(body))}`,
- headers: {
- Cookie: cookie,
- UserAgent: $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- }
- };
-}
-
-// prettier-ignore
-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
diff --git a/jd_petTreasureBox.js b/jd_petTreasureBox.js
deleted file mode 100644
index 3d08910..0000000
--- a/jd_petTreasureBox.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- 更新时间:2020-11-12
- 从github@Zero-S1搬的[https://github.com/Zero-S1/JD_tools/blob/master/jbp.js]
-【宠汪汪聚宝盆辅助脚本】
-1、进入聚宝盆,显示本轮狗粮池投入总数,方便估算
-2、可能有两位数误差,影响不大
-3、聚宝盆最下方显示上轮前六名的投入狗粮,收入积分,以及纯收益(即:收入积分 - 投入狗粮)
-[MITM]
-hostname = jdjoy.jd.com,draw.jdfcloud.com
-
-surge
-[Script]
-聚宝盆投狗粮辅助 = type=http-response,pattern=^https:\/\/jdjoy\.jd\.com\/pet\/getPetTreasureBox|^https:\/\/draw\.jdfcloud\.com\/\/pet\/getPetTreasureBox,requires-body=1,max-size=0,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_petTreasureBox.js
-
-Qx
-[rewrite_local]
-^https:\/\/jdjoy\.jd\.com\/pet\/getPetTreasureBox|^https:\/\/draw\.jdfcloud\.com\/\/pet\/getPetTreasureBox url script-response-body https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_petTreasureBox.js
-
-LOON:
-[Script]
-http-response ^https:\/\/jdjoy\.jd\.com\/pet\/getPetTreasureBox|^https:\/\/draw\.jdfcloud\.com\/\/pet\/getPetTreasureBox script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_petTreasureBox.js, requires-body=true, timeout=10, tag=聚宝盆投狗粮辅助
-
-**/
-let body = $response.body
-body = JSON.parse(body)
-food = body['data']['food']
-function f(v) {
- return (v < 0) ? v : `+${v}`;
-}
-var sum = 0
-lastHourWinInfos = body["data"]["lastHourWinInfos"]
-for (var i in lastHourWinInfos) {
- sum += lastHourWinInfos[i]["petCoin"]
-}
-for (var i in lastHourWinInfos) {
- body["data"]["lastHourWinInfos"][i]["petCoin"] = `{${lastHourWinInfos[i]["food"]}} [${lastHourWinInfos[i]["petCoin"]}] (${f(lastHourWinInfos[i]["petCoin"] - lastHourWinInfos[i]["food"])}) `
-}
-
-body["data"]["lastHourWinInfos"].unshift({
- 'pin': "",
- 'nickName': '',
- 'investHour': lastHourWinInfos[0]['investHour'],
- 'stage': '2',
- 'food': 0,
- 'rank': 0,
- 'foodDif': "",
- 'petCoin': '{投} [收入] (纯收入)',
- 'userTag': "",
- 'win': true
-})
-lastTurnFood = parseInt(sum / 0.09 * 0.91)
-body['data']['food'] = `${food} (+${food - lastTurnFood})`
-body = JSON.stringify(body)
-$done({ body })
diff --git a/jd_pigPet.js b/jd_pigPet.js
deleted file mode 100644
index e71c979..0000000
--- a/jd_pigPet.js
+++ /dev/null
@@ -1,669 +0,0 @@
-/*
- * @Author: lxk0301 https://github.com/lxk0301
- * @Date: 2020-11-10 14:07:07
- * @Last Modified by: lxk0301
- * @Last Modified time: 2020-11-23 12:27:16
- */
-/*
-京东金融养猪猪
-一键开完所有的宝箱功能。耗时70秒
-大转盘抽奖
-喂食
-每日签到
-完成分享任务得猪粮
-12 * * * *
- */
-
-const $ = new Env('金融养猪');
-let cookiesArr = [], cookie = '';
-const JD_API_HOST = 'https://ms.jr.jd.com/gw/generic/uc/h5/m';
-const MISSION_BASE_API = `https://ms.jr.jd.com/gw/generic/mission/h5/m`;
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- cookiesArr.push(...[$.getdata('CookieJD'), $.getdata('CookieJD2')])
-}
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- await jdPigPet();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-async function jdPigPet() {
- await pigPetLogin();
- if (!$.hasPig) return
- await pigPetSignIndex();
- await pigPetSign();
- await pigPetOpenBox();
- await pigPetLotteryIndex();
- await pigPetLottery();
- await pigPetMissionList();
- await missions();
- await pigPetUserBag();
-}
-async function pigPetLottery() {
- if ($.currentCount > 0) {
- for (let i = 0; i < $.currentCount; i ++) {
- await pigPetLotteryPlay();
- }
- }
-}
-async function pigPetSign() {
- if (!$.sign) {
- await pigPetSignOne();
- } else {
- console.log(`第${$.no}天已签到\n`)
- }
-}
-function pigPetSignOne() {
- return new Promise(async resolve => {
- const body = {
- "source":2,
- "channelLV":"juheye",
- "riskDeviceParam": "{}",
- "no": $.no
- }
- $.post(taskUrl('pigPetSignOne', body), (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- console.log('签到结果',data)
- // data = JSON.parse(data);
- // if (data.resultCode === 0) {
- // if (data.resultData.resultCode === 0) {
- // if (data.resultData.resultData) {
- // console.log(`当前大转盘剩余免费抽奖次数::${data.resultData.resultData.currentCount}`);
- // $.sign = data.resultData.resultData.sign;
- // $.no = data.resultData.resultData.today;
- // }
- // } else {
- // console.log(`查询签到情况异常:${JSON.stringify(data)}`)
- // }
- // }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-//查询背包食物
-function pigPetUserBag() {
- return new Promise(async resolve => {
- const body = {"source":0,"channelLV":"yqs","riskDeviceParam":"{}","t":Date.now(),"skuId":"1001003004","category":"1001"};
- $.post(taskUrl('pigPetUserBag', body), async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- data = JSON.parse(data);
- if (data.resultCode === 0) {
- if (data.resultData.resultCode === 0) {
- if (data.resultData.resultData && data.resultData.resultData.goods) {
- console.log(`\n食物名称 数量`);
- for (let item of data.resultData.resultData.goods) {
- console.log(`${item.goodsName} ${item.count}g`);
- }
- for (let item of data.resultData.resultData.goods) {
- if (item.count >= 20) {
- console.log(`10秒后开始喂食${item.goodsName},当前数量为${item.count}g`)
- await $.wait(10000);
- await pigPetAddFood(item.sku);
- }
- }
- } else {
- console.log(`暂无食物`)
- }
- } else {
- console.log(`开宝箱其他情况:${JSON.stringify(data)}`)
- }
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-//喂食
-function pigPetAddFood(skuId) {
- return new Promise(async resolve => {
- console.log(`skuId::::${skuId}`)
- const body = {
- "source": 0,
- "channelLV":"yqs",
- "riskDeviceParam":"{}",
- "skuId": skuId.toString(),
- "category":"1001",
- }
- // const body = {
- // "source": 2,
- // "channelLV":"juheye",
- // "riskDeviceParam":"{}",
- // "skuId": skuId.toString(),
- // }
- $.post(taskUrl('pigPetAddFood', body), (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- console.log(`喂食结果:${data}`)
- data = JSON.parse(data);
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function pigPetLogin() {
- return new Promise(async resolve => {
- const body = {
- "source":2,
- "channelLV":"juheye",
- "riskDeviceParam":"{}",
- }
- $.post(taskUrl('pigPetLogin', body), async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- data = JSON.parse(data);
- if (data.resultCode === 0) {
- if (data.resultData.resultCode === 0) {
- $.hasPig = data.resultData.resultData.hasPig;
- if (!$.hasPig) {
- console.log(`\n京东账号${$.index} ${$.nickName} 未开启养猪活动,请手动去京东金融APP开启此活动\n`)
- }
- } else {
- console.log(`Login其他情况:${JSON.stringify(data)}`)
- }
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-//开宝箱
-function pigPetOpenBox() {
- return new Promise(async resolve => {
- const body = {"source":0,"channelLV":"yqs","riskDeviceParam":"{}","no":5,"category":"1001","t": Date.now()}
- $.post(taskUrl('pigPetOpenBox', body), async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- // console.log(data)
- data = JSON.parse(data);
- if (data.resultCode === 0) {
- if (data.resultData.resultCode === 0) {
- if (data.resultData.resultData && data.resultData.resultData.award) {
- console.log(`开宝箱获得${data.resultData.resultData.award.content},数量:${data.resultData.resultData.award.count}`);
-
- } else {
- console.log(`开宝箱暂无奖励`)
- }
- await $.wait(2000);
- await pigPetOpenBox();
- } else if (data.resultData.resultCode === 420) {
- console.log(`开宝箱失败:${data.resultData.resultMsg}`)
- } else {
- console.log(`开宝箱其他情况:${JSON.stringify(data)}`)
- }
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-//查询大转盘的次数
-function pigPetLotteryIndex() {
- $.currentCount = 0;
- return new Promise(async resolve => {
- const body = {
- "source":0,
- "channelLV":"juheye",
- "riskDeviceParam": "{}"
- }
- $.post(taskUrl('pigPetLotteryIndex', body), (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- // console.log(data)
- data = JSON.parse(data);
- if (data.resultCode === 0) {
- if (data.resultData.resultCode === 0) {
- if (data.resultData.resultData) {
- console.log(`当前大转盘剩余免费抽奖次数::${data.resultData.resultData.currentCount}`);
- $.currentCount = data.resultData.resultData.currentCount;
- }
- } else {
- console.log(`查询大转盘的次数:${JSON.stringify(data)}`)
- }
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-//查询签到情况
-function pigPetSignIndex() {
- $.sign = true;
- return new Promise(async resolve => {
- const body = {
- "source":2,
- "channelLV":"juheye",
- "riskDeviceParam": "{}"
- }
- $.post(taskUrl('pigPetSignIndex', body), (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- // console.log(data)
- data = JSON.parse(data);
- if (data.resultCode === 0) {
- if (data.resultData.resultCode === 0) {
- if (data.resultData.resultData) {
- $.sign = data.resultData.resultData.sign;
- $.no = data.resultData.resultData.today;
- }
- } else {
- console.log(`查询签到情况异常:${JSON.stringify(data)}`)
- }
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-//抽奖
-function pigPetLotteryPlay() {
- return new Promise(async resolve => {
- const body = {
- "source":0,
- "channelLV":"juheye",
- "riskDeviceParam":"{}",
- "t":Date.now(),
- "type":0,
- }
- $.post(taskUrl('pigPetLotteryPlay', body), (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- // console.log(data)
- data = JSON.parse(data);
- if (data.resultCode === 0) {
- if (data.resultData.resultCode === 0) {
- if (data.resultData.resultData) {
- // console.log(`当前大转盘剩余免费抽奖次数::${data.resultData.resultData.currentCount}`);
- $.currentCount = data.resultData.resultData.currentCount;//抽奖后剩余的抽奖次数
- }
- } else {
- console.log(`其他情况:${JSON.stringify(data)}`)
- }
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-async function missions() {
- for (let item of $.missions) {
- if (item.status === 4) {
- console.log(`\n${item.missionName}任务已做完,开始领取奖励`)
- await pigPetDoMission(item.mid);
- } else if (item.status === 5){
- console.log(`\n${item.missionName}已领取`)
- } else if (item.status === 3){
- console.log(`\n${item.missionName}未完成`)
- if (item.mid === 'CPD01') {
- await pigPetDoMission(item.mid);
- } else {
- //TODO
- // await pigPetDoMission(item.mid);
- // await queryMissionReceiveAfterStatus(item.mid);
- // await finishReadMission(item.mid);
- }
- }
- }
-}
-//领取做完任务的奖品
-function pigPetDoMission(mid) {
- return new Promise(async resolve => {
- const body = {
- "source":0,
- "channelLV":"",
- "riskDeviceParam":"{}",
- mid
- }
- $.post(taskUrl('pigPetDoMission', body), (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- console.log('pigPetDoMission',data)
- data = JSON.parse(data);
- if (data.resultCode === 0) {
- if (data.resultData.resultCode === 0) {
- if (data.resultData.resultData) {
- if (data.resultData.resultData.award) {
- console.log(`奖励${data.resultData.resultData.award.name},数量:${data.resultData.resultData.award.count}`)
- }
- }
- } else {
- console.log(`其他情况:${JSON.stringify(data)}`)
- }
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-//查询任务列表
-function pigPetMissionList() {
- return new Promise(async resolve => {
- const body = {
- "source":0,
- "channelLV":"",
- "riskDeviceParam":"{}",
- }
- $.post(taskUrl('pigPetMissionList', body), (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- // console.log(data)
- data = JSON.parse(data);
- if (data.resultCode === 0) {
- if (data.resultData.resultCode === 0) {
- if (data.resultData.resultData) {
- $.missions = data.resultData.resultData.missions;//抽奖后剩余的抽奖次数
- }
- } else {
- console.log(`其他情况:${JSON.stringify(data)}`)
- }
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function queryMissionReceiveAfterStatus(missionId) {
- return new Promise(resolve => {
- const body = {"missionId": missionId.toString()};
- const options = {
- "url": `${MISSION_BASE_API}/queryMissionReceiveAfterStatus?reqData=%7B%2522missionId%2522:%2522${Number(missionId)}%2522%7D`,
- "headers": {
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-CN,zh;q=0.9",
- "Connection": "keep-alive",
- "Host": "ms.jr.jd.com",
- "Cookie": cookie,
- "Origin": "https://jdjoy.jd.com",
- "Referer": "https://jdjoy.jd.com/",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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")
- }
- }
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- console.log('queryMissionReceiveAfterStatus',data)
- // data = JSON.parse(data);
- // if (data.resultCode === 0) {
- // if (data.resultData.resultCode === 0) {
- // if (data.resultData.resultData) {
- // // console.log(`当前大转盘剩余免费抽奖次数::${data.resultData.resultData.currentCount}`);
- // $.currentCount = data.resultData.resultData.currentCount;//抽奖后剩余的抽奖次数
- // }
- // } else {
- // console.log(`其他情况:${JSON.stringify(data)}`)
- // }
- // }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-//做完浏览任务发送信息API
-function finishReadMission(missionId) {
- return new Promise(async resolve => {
- const body = {"missionId": missionId.toString(),"readTime":10};
- const options = {
- "url": `${MISSION_BASE_API}/finishReadMission?reqData=%7B%2522missionId%2522:%2522${Number(missionId)}%2522,%2522readTime%2522:10%7D`,
- "headers": {
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-CN,zh;q=0.9",
- "Connection": "keep-alive",
- "Host": "ms.jr.jd.com",
- "Cookie": cookie,
- "Origin": "https://jdjoy.jd.com",
- "Referer": "https://jdjoy.jd.com/",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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")
- }
- }
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- console.log('finishReadMission',data)
- // data = JSON.parse(data);
- // if (data.resultCode === 0) {
- // if (data.resultData.resultCode === 0) {
- // if (data.resultData.resultData) {
- // // console.log(`当前大转盘剩余免费抽奖次数::${data.resultData.resultData.currentCount}`);
- // $.currentCount = data.resultData.resultData.currentCount;//抽奖后剩余的抽奖次数
- // }
- // } else {
- // console.log(`其他情况:${JSON.stringify(data)}`)
- // }
- // }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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 taskUrl(function_id, body) {
- return {
- url: `${JD_API_HOST}/${function_id}?_=${Date.now()}`,
- body: `reqData=${encodeURIComponent(JSON.stringify(body))}`,
- headers: {
- 'Accept' : `*/*`,
- 'Origin' : `https://u.jr.jd.com`,
- 'Accept-Encoding' : `gzip, deflate, br`,
- 'Cookie' : cookie,
- 'Content-Type' : `application/x-www-form-urlencoded;charset=UTF-8`,
- 'Host' : `ms.jr.jd.com`,
- 'Connection' : `keep-alive`,
- // 'User-Agent' : `jdapp;iPhone;9.0.0;13.4.1;e35caf0a69be42084e3c97eef56c3af7b0262d01;network/4g;ADID/F75E8AED-CB48-4EAC-A213-E8CE4018F214;supportApplePay/3;hasUPPay/0;pushNoticeIsOpen/1;model/iPhone11,8;addressid/2005183373;hasOCPay/0;appBuild/167237;supportBestPay/0;jdSupportDarkMode/0;pv/1287.19;apprpd/MyJD_GameMain;ref/https%3A%2F%2Fuua.jr.jd.com%2Fuc-fe-wxgrowing%2Fmoneytree%2Findex%2F%3Fchannel%3Dyxhd%26lng%3D113.325843%26lat%3D23.204628%26sid%3D2d98e88cf7d182f60d533476c2ce777w%26un_area%3D19_1601_50258_51885;psq/1;ads/;psn/e35caf0a69be42084e3c97eef56c3af7b0262d01|3485;jdv/0|kong|t_1000170135|tuiguang|notset|1593059927172|1593059927;adk/;app_device/IOS;pap/JA2015_311210|9.0.0|IOS 13.4.1;Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1`,
- 'User-Agent' : `jdapp;android;8.5.12;9;network/wifi;model/GM1910;addressid/1302541636;aid/ac31e03386ddbec6;oaid/;osVer/28;appBuild/73078;adk/;ads/;pap/JA2015_311210|8.5.12|ANDROID 9;osv/9;pv/117.24;jdv/0|kong|t_1000217905_|jingfen|644e9b005c8542c1ac273da7763971d8|1589905791552|1589905794;ref/com.jingdong.app.mall.WebActivity;partner/oppo;apprpd/Home_Main;Mozilla/5.0 (Linux; Android 9; GM1910 Build/PKQ1.190110.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36 Edg/86.0.4240.111`,
- 'Referer' : `https://u.jr.jd.com/`,
- 'Accept-Language' : `zh-cn`
- }
- }
-}
-// prettier-ignore
-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
diff --git a/jd_plantBean.js b/jd_plantBean.js
deleted file mode 100644
index 5a14323..0000000
--- a/jd_plantBean.js
+++ /dev/null
@@ -1,728 +0,0 @@
-/*
-种豆得豆 脚本更新地址:https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_plantBean.js
-更新时间:2020-11-04
-已支持IOS京东双账号,云端N个京东账号
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-注:会自动关注任务中的店铺跟商品,介意者勿使用。
-互助码shareCode请先手动运行脚本查看打印可看到
-每个京东账号每天只能帮助3个人。多出的助力码将会助力失败。
-=====================================Quantumult X=================================
-[task_local]
-1 7-21/2 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_plantBean.js, tag=种豆得豆, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdzd.png, enabled=true
-
-=====================================Loon================================
-[Script]
-cron "1 7-21/2 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_plantBean.js,tag=京东种豆得豆
-
-======================================Surge==========================
-京东种豆得豆 = type=cron,cronexp="1 7-21/2 * * *",wake-system=1,timeout=120,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_plantBean.js
-
-====================================小火箭=============================
-京东种豆得豆 = type=cron,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_plantBean.js, cronexpr="1 7-21/2 * * *", timeout=200, enable=true
-
-搬的https://github.com/uniqueque/QuantumultX/blob/4c1572d93d4d4f883f483f907120a75d925a693e/Script/jd_plantBean.js
-*/
-const $ = new Env('京东种豆得豆');
-//Node.js用户请在jdCookie.js处填写京东ck;
-//ios等软件用户直接用NobyDa的jd cookie
-let jdNotify = true;//是否开启静默运行。默认true开启
-let cookiesArr = [], cookie = '', jdPlantBeanShareArr = [], isBox = false, notify, newShareCodes, option, message,subTitle;
-//京东接口地址
-const JD_API_HOST = 'https://api.m.jd.com/client.action';
-//助力好友分享码(最多3个,否则后面的助力失败)
-//此此内容是IOS用户下载脚本到本地使用,填写互助码的地方,同一京东账号的好友互助码请使用@符号隔开。
-//下面给出两个账号的填写示例(iOS只支持2个京东账号)
-let shareCodes = [ // IOS本地脚本用户这个列表填入你要助力的好友的shareCode
- //账号一的好友shareCode,不同好友的shareCode中间用@符号隔开
- '66j4yt3ebl5ierjljoszp7e4izzbzaqhi5k2unz2afwlyqsgnasq@olmijoxgmjutyrsovl2xalt2tbtfmg6sqldcb3q@e7lhibzb3zek27amgsvywffxx7hxgtzstrk2lba@e7lhibzb3zek32e72n4xesxmgc2m76eju62zk3y',
- //账号二的好友shareCode,不同好友的shareCode中间用@符号隔开
- 'olmijoxgmjutyx55upqaqxrblt7f3h26dgj2riy@4npkonnsy7xi3p6pjfxg6ct5gll42gmvnz7zgoy@6dygkptofggtp6ffhbowku3xgu@mlrdw3aw26j3wgzjipsxgonaoyr2evrdsifsziy',
-]
-let currentRoundId = null;//本期活动id
-let lastRoundId = null;//上期id
-let roundList = [];
-let awardState = '';//上期活动的京豆是否收取
-let randomCount = $.isNode() ? 20 : 5;
-!(async () => {
- await requireConfig();
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- message = '';
- subTitle = '';
- option = {};
- await shareCodesFormat();
- await jdPlantBean();
- await showMsg();
- }
- }
-})().catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
-}).finally(() => {
- $.done();
-})
-
-async function jdPlantBean() {
- console.log(`获取任务及基本信息`)
- await plantBeanIndex();
- // console.log(plantBeanIndexResult.data.taskList);
- if ($.plantBeanIndexResult.code === '0') {
- const shareUrl = $.plantBeanIndexResult.data.jwordShareInfo.shareUrl
- $.myPlantUuid = getParam(shareUrl, 'plantUuid')
- console.log(`\n【您的互助码plantUuid】 ${$.myPlantUuid}\n`);
- roundList = $.plantBeanIndexResult.data.roundList;
- currentRoundId = roundList[1].roundId;//本期的roundId
- lastRoundId = roundList[0].roundId;//上期的roundId
- awardState = roundList[0].awardState;
- $.taskList = $.plantBeanIndexResult.data.taskList;
- subTitle = `【京东昵称】${$.plantBeanIndexResult.data.plantUserInfo.plantNickName}`;
- message += `【上期时间】${roundList[0].dateDesc}\n`;
- message += `【上期成长值】${roundList[0].growth}\n`;
- await receiveNutrients();//定时领取营养液
- await doHelp();//助力
- await doTask();//做日常任务
- await doEgg();
- await stealFriendWater();
- await doCultureBean();
- await doGetReward();
- await showTaskProcess();
- await plantShareSupportList();
- } else {
- console.log(`种豆得豆-初始失败: ${JSON.stringify($.plantBeanIndexResult)}`);
- }
-}
-async function doGetReward() {
- console.log(`【上轮京豆】${awardState === '4' ? '采摘中' : awardState === '5' ? '可收获了' : '已领取'}`);
- if (awardState === '4') {
- //京豆采摘中...
- message += `【上期状态】${roundList[0].tipBeanEndTitle}\n`;
- } else if (awardState === '5') {
- //收获
- await getReward();
- console.log('开始领取京豆');
- if ($.getReward.code === '0') {
- console.log('京豆领取成功');
- message += `【上期兑换京豆】${$.getReward.data.awardBean}个\n`;
- $.msg($.name, subTitle, message);
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}`, `京东账号${$.index} ${$.nickName}\n${message}`);
- }
- }
- } else if (awardState === '6') {
- //京豆已领取
- message += `【上期兑换京豆】${roundList[0].awardBeans}个\n`;
- }
- if (roundList[1].dateDesc.indexOf('本期 ') > -1) {
- roundList[1].dateDesc = roundList[1].dateDesc.substr(roundList[1].dateDesc.indexOf('本期 ') + 3, roundList[1].dateDesc.length);
- }
- message += `【本期时间】${roundList[1].dateDesc}\n`;
- message += `【本期成长值】${roundList[1].growth}\n`;
-}
-async function doCultureBean() {
- await plantBeanIndex();
- if ($.plantBeanIndexResult.code === '0') {
- const plantBeanRound = $.plantBeanIndexResult.data.roundList[1]
- if (plantBeanRound.roundState === '2') {
- //收取营养液
- console.log(`开始收取营养液`)
- for (let bubbleInfo of plantBeanRound.bubbleInfos) {
- console.log(`收取-${bubbleInfo.name}-的营养液`)
- await cultureBean(plantBeanRound.roundId, bubbleInfo.nutrientsType)
- console.log(`收取营养液结果:${JSON.stringify($.cultureBeanRes)}`)
- }
- }
- } else {
- console.log(`plantBeanIndexResult:${JSON.stringify($.plantBeanIndexResult)}`)
- }
-}
-async function stealFriendWater() {
- await stealFriendList();
- if ($.stealFriendList.code === '0') {
- if ($.stealFriendList.data.tips) {
- console.log('偷取好友营养液今日已达上限');
- return
- }
- if ($.stealFriendList.data && $.stealFriendList.data.friendInfoList && $.stealFriendList.data.friendInfoList.length > 0) {
- for (let item of $.stealFriendList.data.friendInfoList) {
- if (item.nutrCount >= 3) {
- // console.log(`可以偷的好友的信息::${JSON.stringify(item)}`);
- console.log(`可以偷的好友的信息paradiseUuid::${JSON.stringify(item.paradiseUuid)}`);
- await collectUserNutr(item.paradiseUuid);
- console.log(`偷取好友营养液情况:${JSON.stringify($.stealFriendRes)}`)
- if ($.stealFriendRes.code === '0') {
- console.log(`偷取好友营养液成功`)
- }
- }
- }
- }
- }
-}
-async function doEgg() {
- await egg();
- if ($.plantEggLotteryRes.code === '0') {
- if ($.plantEggLotteryRes.data.restLotteryNum > 0) {
- const eggL = new Array($.plantEggLotteryRes.data.restLotteryNum).fill('');
- console.log(`目前共有${eggL.length}次扭蛋的机会`)
- for (let i = 0; i < eggL.length; i++) {
- console.log(`开始第${i + 1}次扭蛋`);
- await plantEggDoLottery();
- console.log(`天天扭蛋成功:${JSON.stringify($.plantEggDoLotteryResult)}`);
- }
- } else {
- console.log('暂无扭蛋机会')
- }
- } else {
- console.log('查询天天扭蛋的机会失败')
- }
-}
-async function doTask() {
- if ($.taskList && $.taskList.length > 0) {
- for (let item of $.taskList) {
- if (item.isFinished === 1) {
- console.log(`${item.taskName} 任务已完成\n`);
- continue;
- } else {
- if (item.taskType === 8) {
- console.log(`\n【${item.taskName}】任务未完成,需自行手动去京东APP完成,${item.desc}营养液\n`)
- } else {
- console.log(`\n【${item.taskName}】任务未完成,${item.desc}营养液\n`)
- }
- }
- if (item.dailyTimes === 1 && item.taskType !== 8) {
- console.log(`\n开始做 ${item.taskName}任务`);
- // $.receiveNutrientsTaskRes = await receiveNutrientsTask(item.taskType);
- await receiveNutrientsTask(item.taskType);
- console.log(`做 ${item.taskName}任务结果:${JSON.stringify($.receiveNutrientsTaskRes)}\n`);
- }
- if (item.taskType === 3) {
- //浏览店铺
- console.log(`开始做 ${item.taskName}任务`);
- let unFinishedShopNum = item.totalNum - item.gainedNum;
- if (unFinishedShopNum === 0) {
- continue
- }
- await shopTaskList();
- const { data } = $.shopTaskListRes;
- let goodShopListARR = [], moreShopListARR = [], shopList = [];
- const { goodShopList, moreShopList } = data;
- for (let i of goodShopList) {
- if (i.taskState === '2') {
- goodShopListARR.push(i);
- }
- }
- for (let j of moreShopList) {
- if (j.taskState === '2') {
- moreShopListARR.push(j);
- }
- }
- shopList = goodShopListARR.concat(moreShopListARR);
- for (let shop of shopList) {
- const { shopId, shopTaskId } = shop;
- const body = {
- "monitor_refer": "plant_shopNutrientsTask",
- "shopId": shopId,
- "shopTaskId": shopTaskId
- }
- const shopRes = await requestGet('shopNutrientsTask', body);
- console.log(`shopRes结果:${JSON.stringify(shopRes)}`);
- if (shopRes.code === '0') {
- if (shopRes.data && shopRes.data.nutrState && shopRes.data.nutrState === '1') {
- unFinishedShopNum --;
- }
- }
- if (unFinishedShopNum <= 0) {
- console.log(`${item.taskName}任务已做完\n`)
- break;
- }
- }
- }
- if (item.taskType === 5) {
- //挑选商品
- console.log(`开始做 ${item.taskName}任务`);
- let unFinishedProductNum = item.totalNum - item.gainedNum;
- if (unFinishedProductNum === 0) {
- continue
- }
- await productTaskList();
- // console.log('productTaskList', $.productTaskList);
- const { data } = $.productTaskList;
- let productListARR = [], productList = [];
- const { productInfoList } = data;
- for (let i = 0; i < productInfoList.length; i++) {
- for (let j = 0; j < productInfoList[i].length; j++){
- productListARR.push(productInfoList[i][j]);
- }
- }
- for (let i of productListARR) {
- if (i.taskState === '2') {
- productList.push(i);
- }
- }
- for (let product of productList) {
- const { skuId, productTaskId } = product;
- const body = {
- "monitor_refer": "plant_productNutrientsTask",
- "productTaskId": productTaskId,
- "skuId": skuId
- }
- const productRes = await requestGet('productNutrientsTask', body);
- if (productRes.code === '0') {
- // console.log('nutrState', productRes)
- //这里添加多重判断,有时候会出现活动太火爆的问题,导致nutrState没有
- if (productRes.data && productRes.data.nutrState && productRes.data.nutrState === '1') {
- unFinishedProductNum --;
- }
- }
- if (unFinishedProductNum <= 0) {
- console.log(`${item.taskName}任务已做完\n`)
- break;
- }
- }
- }
- if (item.taskType === 10) {
- //关注频道
- console.log(`开始做 ${item.taskName}任务`);
- let unFinishedChannelNum = item.totalNum - item.gainedNum;
- if (unFinishedChannelNum === 0) {
- continue
- }
- await plantChannelTaskList();
- const { data } = $.plantChannelTaskList;
- // console.log('goodShopList', data.goodShopList);
- // console.log('moreShopList', data.moreShopList);
- let goodChannelListARR = [], normalChannelListARR = [], channelList = [];
- const { goodChannelList, normalChannelList } = data;
- for (let i of goodChannelList) {
- if (i.taskState === '2') {
- goodChannelListARR.push(i);
- }
- }
- for (let j of normalChannelList) {
- if (j.taskState === '2') {
- normalChannelListARR.push(j);
- }
- }
- channelList = goodChannelListARR.concat(normalChannelListARR);
- for (let channelItem of channelList) {
- const { channelId, channelTaskId } = channelItem;
- const body = {
- "channelId": channelId,
- "channelTaskId": channelTaskId
- }
- const channelRes = await requestGet('plantChannelNutrientsTask', body);
- console.log(`channelRes结果:${JSON.stringify(channelRes)}`);
- if (channelRes.code === '0') {
- if (channelRes.data && channelRes.data.nutrState && channelRes.data.nutrState === '1') {
- unFinishedChannelNum --;
- }
- }
- if (unFinishedChannelNum <= 0) {
- console.log(`${item.taskName}任务已做完\n`)
- break;
- }
- }
- }
- }
- }
-}
-function showTaskProcess() {
- return new Promise(async resolve => {
- await plantBeanIndex();
- $.taskList = $.plantBeanIndexResult.data.taskList;
- if ($.taskList && $.taskList.length > 0) {
- console.log(" 任务 进度");
- for (let item of $.taskList) {
- console.log(`[${item["taskName"]}] ${item["gainedNum"]}/${item["totalNum"]} ${item["isFinished"]}`);
- }
- }
- resolve()
- })
-}
-//助力好友
-async function doHelp() {
- for (let plantUuid of newShareCodes) {
- console.log(`开始助力京东账号${$.index} - ${$.nickName}的好友: ${plantUuid}`);
- if (!plantUuid) continue;
- if (plantUuid === $.myPlantUuid) {
- console.log(`\n跳过自己的plantUuid\n`)
- continue
- }
- console.log(`\n开始助力好友: ${plantUuid}`);
- await helpShare(plantUuid);
- if ($.helpResult.code === '0') {
- // console.log(`助力好友结果: ${JSON.stringify($.helpResult.data.helpShareRes)}`);
- if ($.helpResult.data.helpShareRes) {
- if ($.helpResult.data.helpShareRes.state === '1') {
- console.log(`助力好友${plantUuid}成功`)
- console.log(`${$.helpResult.data.helpShareRes.promptText}\n`);
- } else if ($.helpResult.data.helpShareRes.state === '2') {
- console.log('您今日助力的机会已耗尽,已不能再帮助好友助力了\n');
- break;
- } else if ($.helpResult.data.helpShareRes.state === '3') {
- console.log('该好友今日已满9人助力/20瓶营养液,明天再来为Ta助力吧\n')
- } else if ($.helpResult.data.helpShareRes.state === '4') {
- console.log(`${$.helpResult.data.helpShareRes.promptText}\n`)
- } else {
- console.log(`助力其他情况:${JSON.stringify($.helpResult.data.helpShareRes)}`);
- }
- }
- } else {
- console.log(`助力好友失败: ${JSON.stringify($.helpResult)}`);
- }
- }
-}
-function showMsg() {
- $.log(`\n${message}\n`);
- jdNotify = $.getdata('jdPlantBeanNotify') ? $.getdata('jdPlantBeanNotify') : jdNotify;
- if (!jdNotify || jdNotify === 'false') {
- $.msg($.name, subTitle, message);
- }
-}
-// ================================================此处是API=================================
-//每轮种豆活动获取结束后,自动收取京豆
-async function getReward() {
- const body = {
- "roundId": lastRoundId
- }
- $.getReward = await request('receivedBean', body);
-}
-//收取营养液
-async function cultureBean(currentRoundId, nutrientsType) {
- let functionId = arguments.callee.name.toString();
- let body = {
- "roundId": currentRoundId,
- "nutrientsType": nutrientsType,
- }
- $.cultureBeanRes = await request(functionId, body);
-}
-//偷营养液大于等于3瓶的好友
-//①查询好友列表
-async function stealFriendList() {
- const body = {
- pageNum: '1'
- }
- $.stealFriendList = await request('plantFriendList', body);
-}
-
-//②执行偷好友营养液的动作
-async function collectUserNutr(paradiseUuid) {
- console.log('开始偷好友');
- // console.log(paradiseUuid);
- let functionId = arguments.callee.name.toString();
- const body = {
- "paradiseUuid": paradiseUuid,
- "roundId": currentRoundId
- }
- $.stealFriendRes = await request(functionId, body);
-}
-async function receiveNutrients() {
- $.receiveNutrientsRes = await request('receiveNutrients', {"roundId": currentRoundId, "monitor_refer": "plant_receiveNutrients"})
- // console.log(`定时领取营养液结果:${JSON.stringify($.receiveNutrientsRes)}`)
-}
-async function plantEggDoLottery() {
- $.plantEggDoLotteryResult = await requestGet('plantEggDoLottery');
-}
-//查询天天扭蛋的机会
-async function egg() {
- $.plantEggLotteryRes = await requestGet('plantEggLotteryIndex');
-}
-async function productTaskList() {
- let functionId = arguments.callee.name.toString();
- $.productTaskList = await requestGet(functionId, {"monitor_refer": "plant_productTaskList"});
-}
-async function plantChannelTaskList() {
- let functionId = arguments.callee.name.toString();
- $.plantChannelTaskList = await requestGet(functionId);
- // console.log('$.plantChannelTaskList', $.plantChannelTaskList)
-}
-async function shopTaskList() {
- let functionId = arguments.callee.name.toString();
- $.shopTaskListRes = await requestGet(functionId, {"monitor_refer": "plant_receiveNutrients"});
- // console.log('$.shopTaskListRes', $.shopTaskListRes)
-}
-async function receiveNutrientsTask(awardType) {
- const functionId = arguments.callee.name.toString();
- const body = {
- "monitor_refer": "receiveNutrientsTask",
- "awardType": `${awardType}`,
- }
- $.receiveNutrientsTaskRes = await requestGet(functionId, body);
-}
-async function plantShareSupportList() {
- $.shareSupportList = await requestGet('plantShareSupportList', {"roundId": ""});
- if ($.shareSupportList && $.shareSupportList.code === '0') {
- const { data } = $.shareSupportList;
- //当日北京时间0点时间戳
- const UTC8_Zero_Time = parseInt((Date.now() + 28800000) / 86400000) * 86400000 - 28800000;
- //次日北京时间0点时间戳
- const UTC8_End_Time = parseInt((Date.now() + 28800000) / 86400000) * 86400000 - 28800000 + (24 * 60 * 60 * 1000);
- let friendList = [];
- data.map(item => {
- if (UTC8_Zero_Time <= item['createTime'] && item['createTime'] < UTC8_End_Time) {
- friendList.push(item);
- }
- })
- message += `【助力您的好友】共${friendList.length}人`;
- } else {
- console.log(`异常情况:${JSON.stringify($.shareSupportList)}`)
- }
-}
-//助力好友的api
-async function helpShare(plantUuid) {
- const body = {
- "plantUuid": plantUuid,
- "wxHeadImgUrl": "",
- "shareUuid": "",
- "followType": "1",
- }
- $.helpResult = await request(`plantBeanIndex`, body);
-}
-async function plantBeanIndex() {
- $.plantBeanIndexResult = await request('plantBeanIndex');//plantBeanIndexBody
-}
-function readShareCode() {
- return new Promise(resolve => {
- $.get({url: `http://api.turinglabs.net/api/v1/jd/bean/read/${randomCount}/`}, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- console.log(`随机取个${randomCount}码放到您固定的互助码后面`)
- data = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-//格式化助力码
-function shareCodesFormat() {
- return new Promise(async resolve => {
- // console.log(`第${$.index}个京东账号的助力码:::${jdPlantBeanShareArr[$.index - 1]}`)
- newShareCodes = [];
- if (jdPlantBeanShareArr[$.index - 1]) {
- newShareCodes = jdPlantBeanShareArr[$.index - 1].split('@');
- } else {
- console.log(`由于您第${$.index}个京东账号未提供shareCode,将采纳本脚本自带的助力码\n`)
- const tempIndex = $.index > shareCodes.length ? (shareCodes.length - 1) : ($.index - 1);
- newShareCodes = shareCodes[tempIndex].split('@');
- }
- const readShareCodeRes = await readShareCode();
- if (readShareCodeRes && readShareCodeRes.code === 200) {
- newShareCodes = [...new Set([...newShareCodes, ...(readShareCodeRes.data || [])])];
- }
- console.log(`第${$.index}个京东账号将要助力的好友${JSON.stringify(newShareCodes)}`)
- resolve();
- })
-}
-function requireConfig() {
- return new Promise(resolve => {
- console.log('开始获取种豆得豆配置文件\n')
- notify = $.isNode() ? require('./sendNotify') : '';
- //Node.js用户请在jdCookie.js处填写京东ck;
- const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
- const jdPlantBeanShareCodes = $.isNode() ? require('./jdPlantBeanShareCodes.js') : '';
- //IOS等用户直接用NobyDa的jd cookie
- if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- if (jdCookieNode[item]) {
- cookiesArr.push(jdCookieNode[item])
- }
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
- } else {
- cookiesArr.push(...[$.getdata('CookieJD'), $.getdata('CookieJD2')]);
- }
- console.log(`共${cookiesArr.length}个京东账号\n`)
- if ($.isNode()) {
- Object.keys(jdPlantBeanShareCodes).forEach((item) => {
- if (jdPlantBeanShareCodes[item]) {
- jdPlantBeanShareArr.push(jdPlantBeanShareCodes[item])
- }
- })
- } else {
- const boxShareCodeArr = ['jd_plantBean1', 'jd_plantBean2', 'jd_plantBean3'];
- const boxShareCodeArr2 = ['jd2_plantBean1', 'jd2_plantBean2', 'jd2_plantBean3'];
- const isBox1 = boxShareCodeArr.some((item) => {
- const boxShareCode = $.getdata(item);
- return (boxShareCode !== undefined && boxShareCode !== null && boxShareCode !== '');
- });
- const isBox2 = boxShareCodeArr2.some((item) => {
- const boxShareCode = $.getdata(item);
- return (boxShareCode !== undefined && boxShareCode !== null && boxShareCode !== '');
- });
- isBox = isBox1 ? isBox1 : isBox2;
- if (isBox1) {
- let temp = [];
- for (const item of boxShareCodeArr) {
- if ($.getdata(item)) {
- temp.push($.getdata(item))
- }
- }
- jdPlantBeanShareArr.push(temp.join('@'));
- }
- if (isBox2) {
- let temp = [];
- for (const item of boxShareCodeArr2) {
- if ($.getdata(item)) {
- temp.push($.getdata(item))
- }
- }
- jdPlantBeanShareArr.push(temp.join('@'));
- }
- }
- // console.log(`\n种豆得豆助力码::${JSON.stringify(jdPlantBeanShareArr)}`);
- console.log(`您提供了${jdPlantBeanShareArr.length}个账号的种豆得豆助力码\n`);
- resolve()
- })
-}
-function requestGet(function_id, body = {}) {
- if (!body.version) {
- body["version"] = "9.0.0.1";
- }
- body["monitor_source"] = "plant_app_plant_index";
- body["monitor_refer"] = "";
- return new Promise(async resolve => {
- await $.wait(2000);
- const option = {
- url: `${JD_API_HOST}?functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=ld`,
- headers: {
- 'Cookie': cookie,
- 'Host': 'api.m.jd.com',
- 'Accept': '*/*',
- 'Connection': 'keep-alive',
- 'User-Agent': 'JD4iPhone/167283 (iPhone;iOS 13.6.1;Scale/3.00)',
- 'Accept-Language': 'zh-Hans-CN;q=1,en-CN;q=0.9',
- 'Accept-Encoding': 'gzip, deflate, br',
- 'Content-Type': "application/x-www-form-urlencoded"
- }
- };
- $.get(option, (err, resp, data) => {
- try {
- if (err) {
- console.log('\n种豆得豆: API查询请求失败 ‼️‼️')
- $.logErr(err);
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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 request(function_id, body = {}){
- return new Promise(async resolve => {
- await $.wait(2000);
- $.post(taskUrl(function_id, body), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n种豆得豆: API查询请求失败 ‼️‼️')
- console.log(`function_id:${function_id}`)
- $.logErr(err);
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function taskUrl(function_id, body) {
- body["version"] = "9.0.0.1";
- body["monitor_source"] = "plant_app_plant_index";
- body["monitor_refer"] = "";
- return {
- url: JD_API_HOST,
- body: `functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=ld&client=apple&area=5_274_49707_49973&build=167283&clientVersion=9.1.0`,
- headers: {
- 'Cookie': cookie,
- 'Host': 'api.m.jd.com',
- 'Accept': '*/*',
- 'Connection': 'keep-alive',
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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-Hans-CN;q=1,en-CN;q=0.9',
- 'Accept-Encoding': 'gzip, deflate, br',
- 'Content-Type': "application/x-www-form-urlencoded"
- }
- }
-}
-function getParam(url, name) {
- const reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i")
- const r = url.match(reg)
- if (r != null) return unescape(r[2]);
- return null;
-}
-// prettier-ignore
-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)}
diff --git a/jd_rankingList.js b/jd_rankingList.js
deleted file mode 100644
index 71bf00c..0000000
--- a/jd_rankingList.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-自用于github action
-author:yangtingxiao
-github: https://github.com/yangtingxiao
-京东排行榜
-更新时间:2020-11-05 16:07
-脚本说明:京东排行榜签到得京豆
-活动入口:找不着了,点击脚本通知进入吧
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-// quantumultx
-[task_local]
-#京东排行榜
-11 9 * * * https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_rankingList.js, tag=京东排行榜, img-url=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/image/jd.png, enabled=true
-// Loon
-[Script]
-cron "11 9 * * *" script-path=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_rankingList.js,tag=京东排行榜
-// Surge
-京东排行榜 = type=cron,cronexp=11 9 * * *,wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_rankingList.js
- */
-const $ = new Env('京东排行榜');
-main();
-async function main() {
- $.http.get({url: `https://purge.jsdelivr.net/gh/yangtingxiao/QuantumultX@master/scripts/jd/jd_rankingList.js`}).then((resp) => {
- if (resp.statusCode === 200) {
- console.log(`${$.name}CDN缓存刷新成功`)
- }
- });
- await updateShareCodes();
- if (!$.body) await scriptsCDN();
- if ($.body) {
- eval($.body);
- }
-}
-function updateShareCodes(url = 'https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_rankingList.js') {
- return new Promise(resolve => {
- $.get({url}, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- } else {
- $.body = data;
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function scriptsCDN(url = 'https://cdn.jsdelivr.net/gh/yangtingxiao/QuantumultX@master/scripts/jd/jd_rankingList.js') {
- return new Promise(resolve => {
- $.get({url}, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- $.body = data;
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-
-
-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,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("",`\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 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();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){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="",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}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));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
diff --git a/jd_redPacket.js b/jd_redPacket.js
deleted file mode 100644
index c72f8b9..0000000
--- a/jd_redPacket.js
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * @Author: lxk0301
- * @Date: 2020-11-03 18:12:38
- * @Last Modified by: lxk0301
- * @Last Modified time: 2020-11-23 12:27:18
-*/
-/*
-京东全民开红包(京东app->主页->领券->抢红包(在底部))
-已完成功能:
-①浏览活动
-②关注频道
-③领取红包
-未实现功能:
-领3张券功能,邀请好友未实现
-
-支持京东双账号
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-QuantumultX
-[task_local]
-#京东全民开红包
-1 1 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_redPacket.js, tag=京东全民开红包, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_redPacket.png, enabled=true
-Loon
-[Script]
-cron "1 1 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_redPacket.js, tag=京东全民开红包
-Surge
-京东全民开红包 = type=cron,cronexp=1 1 * * *,wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_redPacket.js
- */
-const $ = new Env('京东全民开红包');
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- cookiesArr.push($.getdata('CookieJD'));
- cookiesArr.push($.getdata('CookieJD2'));
-}
-
-const JD_API_HOST = 'https://api.m.jd.com/api';
-
-
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- $.discount = 0;
- await redPacket();
- await showMsg();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-
-async function redPacket() {
- const response = await taskHomePage();
- if (response.code === 0) {
- $.taskInfo = response.data.result.taskInfos;
- if ($.taskInfo && $.taskInfo.length > 0) {
- console.log(` 任务 状态 红包是否领取`);
- for (let item of $.taskInfo) {
- console.log(`${item.title.slice(-6)} ${item.alreadyReceivedCount ? item.alreadyReceivedCount: 0}/${item.requireCount} ${item.innerStatus === 4 ? '是':'否'}`)
- }
- for (let item of $.taskInfo) {
- //innerStatus=4已领取红包,3:任务已完成,红包未领取,2:任务未完成,7,未领取任务
- if (item.innerStatus === 4) {
- console.log(`[${item.title}] 已经领取奖励`)
- } else if (item.innerStatus === 3) {
- await receiveTaskRedpacket(item.taskType);
- } else if (item.innerStatus !== 4) {
- await startTask(item.taskType);
- if (item.taskType !== 0) {
- console.log(`开始做浏览任务\n`);
- await active(item.taskType);
- await receiveTaskRedpacket(item.taskType);
- } else {
- //TODO 领3张优惠券
- console.log(`[${item.title}] 任务未开发`)
- }
- }
- }
- }
- }
-}
-
-//获取任务列表
-function taskHomePage() {
- return new Promise((resolve) => {
- $.post(taskUrl(arguments.callee.name.toString(), {"clientInfo":{}}), (err, resp, data) => {
- try {
- if (err) {
- console.log(`\n${$.name}: API查询请求失败 ‼️‼️`);
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//领取任务
-function startTask(taskType) {
- // 从taskHomePage返回的数据里面拿taskType
- const data = {"clientInfo":{}, taskType};
- return new Promise((resolve) => {
- $.post(taskUrl(arguments.callee.name.toString(), data), (err, resp, data) => {
- try {
- if (err) {
- console.log(`\n${$.name}: API查询请求失败 ‼️‼️`);
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-
-async function active(taskType) {
- const getTaskDetailForColorRes = await getTaskDetailForColor(taskType);
- if (getTaskDetailForColorRes && getTaskDetailForColorRes.code === 0) {
- if (getTaskDetailForColorRes.data && getTaskDetailForColorRes.data.result) {
- const { advertDetails } = getTaskDetailForColorRes.data.result;
- for (let item of advertDetails) {
- await $.wait(1000);
- if (item.id && item.status == 0) {
- let taskReportForColorRes = await taskReportForColor(taskType, item.id);
- // console.log(`完成任务的动作---${JSON.stringify(taskReportForColorRes)}`)
- }
- }
- } else {
- console.log(`任务列表为空,手动进入app内检查 是否存在[从京豆首页进领券中心逛30秒]的任务,如存在,请手动完成再运行脚本`)
- $.msg(`${$.name}`, '', '手动进入app内检查\n是否存在[从京豆首页进领券中心逛30秒]的任务\n如存在,请手动完成再运行脚本');
- if ($.isNode()) await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `执行脚本出现异常\n请手动进入app内检查\n是否存在[从京豆首页进领券中心逛30秒]的任务\n如存在,请手动完成再运行脚本`)
- }
- } else {
- console.log(`---具体任务详情---${JSON.stringify(getTaskDetailForColorRes)}`);
- }
-}
-
-//获取具体任务详情
-function getTaskDetailForColor(taskType) {
- const data = {"clientInfo":{}, taskType};
- return new Promise((resolve) => {
- $.post(taskUrl(arguments.callee.name.toString(), data), (err, resp, data) => {
- try {
- if (err) {
- console.log(`\n${$.name}: API查询请求失败 ‼️‼️`);
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//完成任务的动作
-function taskReportForColor(taskType, detailId) {
- const data = {"clientInfo":{}, taskType, detailId};
- //console.log(`活动id:::${detailId}\n`)
- return new Promise((resolve) => {
- $.post(taskUrl(arguments.callee.name.toString(), data), (err, resp, data) => {
- try {
- if (err) {
- console.log(`\n${$.name}: API查询请求失败 ‼️‼️`);
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//领取 领3张券任务后的红包
-function receiveTaskRedpacket(taskType) {
- const body = {"clientInfo":{}, taskType};
- return new Promise((resolve) => {
- $.post(taskUrl(arguments.callee.name.toString(), body), (err, resp, data) => {
- try {
- if (err) {
- console.log(`\n${$.name}: API查询请求失败 ‼️‼️`);
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- if (data.data.success && data.data.biz_code === 0) {
- $.discount += Number(data.data.result.discount);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function showMsg() {
- console.log(`${$.name}获得红包:${$.discount}元`);
-}
-// function newReceiveRvcCouponWithTask() {
-// const data = {"taskType":"0","extend":"","source":"couponCenter_app","pageClickKey":"CouponCenter","rcType":"1","taskId":"415","childActivityUrl":"","eid":"","shshshfpb":"","lat":"","lng":""};
-// request(arguments.callee.name.toString(), data).then((response) => {
-// try {
-// // taskInfo = res.data.result.taskInfos;
-// console.log(`领券结果:${JSON.stringify(response)}`);
-// step.next();
-// } catch (e) {
-// console.log(e);
-// console.log('初始化任务异常');
-// }
-// })
-// }
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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 taskUrl(function_id, body) {
- return {
- url: `${JD_API_HOST}?appid=jd_mp_h5&functionId=${function_id}&loginType=2&client=jd_mp_h5&t=${new Date().getTime()*1000}`,
- body: `body=${JSON.stringify(body)}`,
- headers: {
- "Host": "api.m.jd.com",
- "Content-Type": "application/x-www-form-urlencoded",
- "Origin": "https://happy.m.jd.com",
- "Accept-Encoding": "gzip, deflate, br",
- "Cookie": cookie,
- "Connection": "keep-alive",
- "Accept": "*/*",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- "Referer": "https://happy.m.jd.com/babelDiy/zjyw/3ugedFa7yA6NhxLN5gw2L3PF9sQC/index.html",
- "Content-Length": "36",
- "Accept-Language": "zh-cn"
- }
- }
-}
-// prettier-ignore
-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,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("",`\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 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();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){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="",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}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));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)}
diff --git a/jd_shop.js b/jd_shop.js
deleted file mode 100644
index fe62485..0000000
--- a/jd_shop.js
+++ /dev/null
@@ -1,205 +0,0 @@
-/**
- 进店领豆(京东APP首页-领京豆-进店领豆),每天可拿四京豆
- 更新时间:2020-11-03
- 已支持IOS双京东账号,Node.js支持N个京东账号
- 脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
- // quantumultx
- [task_local]
- #进店领豆
- 10 0 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_shop.js, tag=进店领豆, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_shop.png, enabled=true
- //Loon
- [Script]
- cron "10 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_shop.js,tag=进店领豆
- //Surge
- 进店领豆 = type=cron,cronexp="10 0 * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_shop.js
-* */
-const $ = new Env('进店领豆');
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- cookiesArr.push($.getdata('CookieJD'));
- cookiesArr.push($.getdata('CookieJD2'));
-}
-let message = '', subTitle = '';
-
-const JD_API_HOST = 'https://api.m.jd.com/client.action';
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- message = '';
- subTitle = '';
- await jdShop();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-async function jdShop() {
- const taskData = await getTask();
- if (taskData.code === '0') {
- if (!taskData.data.taskList) {
- console.log(`${taskData.data.taskErrorTips}\n`);
- $.msg($.name, '', `京东账号 ${$.index} ${$.nickName}\n${taskData.data.taskErrorTips}`);
- } else {
- const { taskList } = taskData.data;
- let beanCount = 0;
- for (let item of taskList) {
- if (item.taskStatus === 3) {
- console.log(`${item.shopName} 已拿到2京豆\n`)
- } else {
- console.log(`taskId::${item.taskId}`)
- const doTaskRes = await doTask(item.taskId);
- if (doTaskRes.code === '0') {
- beanCount += 2;
- }
- }
- }
- console.log(`beanCount::${beanCount}`);
- if (beanCount > 0) {
- $.msg($.name, '', `京东账号 ${$.index} ${$.nickName}\n成功领取${beanCount}京豆`);
- // if ($.isNode()) {
- // await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `京东账号${$.index} ${UserName}\n成功领取${beanCount}京豆`);
- // }
- // if ($.isNode()) {
- // await notify.BarkNotify(`${$.name}`, `京东账号${$.index} ${UserName}\n成功领取${beanCount}京豆`);
- // }
- }
- }
- }
-}
-function doTask(taskId) {
- console.log(`doTask-taskId::${taskId}`)
- return new Promise(resolve => {
- const body = { 'taskId': `${taskId}` };
- const options = {
- url: `${JD_API_HOST}`,
- body: `functionId=takeTask&body=${escape(JSON.stringify(body))}&appid=ld`,
- headers: {
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- 'Host': 'api.m.jd.com',
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Cookie': cookie,
- }
- }
- $.post(options, (err, resp, data) => {
- try {
- if (err) {
- console.log('\n进店领豆: API查询请求失败 ‼️‼️')
- $.logErr(err);
- } else {
- // console.log(data)
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function getTask(body = {}) {
- return new Promise(resolve => {
- const options = {
- url: `${JD_API_HOST}`,
- body: `functionId=queryTaskIndex&body=${escape(JSON.stringify(body))}&appid=ld`,
- headers: {
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- 'Host': 'api.m.jd.com',
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Cookie': cookie,
- }
- }
- $.post(options, (err, resp, data) => {
- try {
- if (err) {
- console.log('\n进店领豆: API查询请求失败 ‼️‼️')
- $.logErr(err);
- } else {
- // console.log(data)
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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();
- }
- })
- })
-}
-// prettier-ignore
-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
diff --git a/jd_small_home.js b/jd_small_home.js
deleted file mode 100644
index e991d08..0000000
--- a/jd_small_home.js
+++ /dev/null
@@ -1,798 +0,0 @@
-/*
- * @Author: lxk0301 https://github.com/lxk0301
- * @Date: 2020-11-12 11:42:12
- * @Last Modified by: lxk0301
- * @Last Modified time: 2020-11-23 12:27:20
- */
-/*
-东东小窝 https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_small_home.js
-现有功能:
-做日常任务任务,每日抽奖(有机会活动京豆,使用的是免费机会,不消耗WO币)
-助力好友:一个账号一天只能助力一次(即:每个人助力机会只有一次)
-后期有空优化相互助力功能
-TODO;装扮领京豆(使用WO币购买装饰品可以获得京豆,分别可获得5,20,50,100,200,400,700,1200京豆)
-
-注:目前使用此脚本会给脚本内置的两个码进行助力,请知晓
-
-APP活动入口:
-京东APP首页 ->搜索 玩一玩 -> DIY理想家
-或 京东APP -> 我的-> 游戏与更多 - > 东东小窝
-微信小程序入口:
-来客有礼 - > 首页 -> 东东小窝
-网页入口(注:进入后不能再此刷新,否则会有问题,需重新输入此链接进入)
-https://h5.m.jd.com/babelDiy/Zeus/2HFSytEAN99VPmMGZ6V4EYWus1x/index.html
-
-已支持IOS双京东账号,Node.js支持N个京东账号
-脚本兼容: QuantumultX, Surge, Loon, 小火箭,JSBox, Node.js
-===============Quantumultx===============
-[task_local]
-#东东小窝
-16 0 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_small_home.js, tag=东东小窝, img-url=https://raw.githubusercontent.com/58xinian/icon/master/ddxw.png enabled=true
-
-================Loon==============
-[Script]
-cron "16 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_small_home.js, tag=东东小窝
-
-===============Surge=================
-东东小窝 = type=cron,cronexp="16 0 * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_small_home.js
-
-============小火箭=========
-东东小窝 = type=cron,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_small_home.js, cronexpr="16 0 * * *", timeout=200, enable=true
- */
-const $ = new Env('东东小窝');
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '', message = '';
-let isPurchaseShops = false;//是否一键加购商品到购物车,默认不加购
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- cookiesArr.push(...[$.getdata('CookieJD'), $.getdata('CookieJD2')]);
-}
-
-const JD_API_HOST = 'https://lkyl.dianpusoft.cn/api';
-
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- message = '';
- await TotalBean();
- console.log(`\n*******开始【京东账号${$.index}】${$.nickName || $.UserName}********\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- await smallHome();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-async function smallHome() {
- await loginHome();
- await ssjjRooms();
- await helpFriends();
- if (!$.isUnLock) return;
- await createInviteUser();
- await queryDraw();
- await lottery();
- await doAllTask();
- await queryByUserId();
- await showMsg();
-}
-function showMsg() {
- return new Promise(resolve => {
- $.msg($.name, '', `【京东账号${$.index}】${$.nickName}\n${message}`);
- resolve()
- })
-}
-async function lottery() {
- if ($.freeDrawCount > 0) {
- await drawRecord($.lotteryId);
- } else {
- console.log(`免费抽奖机会今日已使用\n`)
- }
-}
-//获取详情
-function queryByUserId() {
- return new Promise(resolve => {
- $.get(taskUrl(`ssjj-wo-home-info/queryByUserId/2`), (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.head.code === 200) {
- if (data.body) {
- message += `【小窝名】${data.body.name}\n`;
- message += `【当前WO币】${data.body.woB}\n`;
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-async function doChannelsListTask(taskId, taskType) {
- await queryChannelsList(taskId);
- for (let item of $.queryChannelsList) {
- if (item.showOrder === 1) {
- await $.wait(1000)
- await followChannel(taskId, item.id)
- await queryDoneTaskRecord(taskId, taskType);
- }
- }
-}
-async function helpFriends() {
- await updateInviteCode();
- if (!$.updatePkActivityIdRes) await updateInviteCodeCDN();
- for (let item of $.inviteCodes.inviteCode) {
- if (!item) continue
- await createAssistUser(item, $.createAssistUserID || "1318106976846299138");
- }
-}
-async function doAllTask() {
- await queryAllTaskInfo();//获取任务详情列表$.taskList
- console.log(` 任务名称 完成进度 `)
- for (let item of $.taskList) {
- console.log(`${item.ssjjTaskInfo.name} ${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum || (item.ssjjTaskInfo.type === 1 ? 4: 1)}`)
- }
- for (let item of $.taskList) {
- if (item.ssjjTaskInfo.type === 1) {
- //邀请好友助力自己
- // await createAssistUser('1330186694770339842', item.ssjjTaskInfo.id)
- $.createAssistUserID = item.ssjjTaskInfo.id;
- console.log(`\n\n助力您的好友:${item.doneNum}人`)
- }
- if (item.ssjjTaskInfo.type === 2) {
- //每日打卡
- if (item.doneNum === (item.ssjjTaskInfo.awardOfDayNum || 1)) {
- console.log(`${item.ssjjTaskInfo.name}已完成(${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum || 1})`)
- continue
- }
- await clock(item.ssjjTaskInfo.id, item.ssjjTaskInfo.awardWoB)
- }
- // 限时连连看
- if (item.ssjjTaskInfo.type === 3) {
- if (item.doneNum === item.ssjjTaskInfo.awardOfDayNum) {
- console.log(`${item.ssjjTaskInfo.name}已完成[${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum}]`)
- continue
- }
- for (let i = 0; i < new Array(item.ssjjTaskInfo.awardOfDayNum || 1).fill('').length; i++) {
- await game(item.ssjjTaskInfo.id, item.doneNum);
- }
- }
- if (item.ssjjTaskInfo.type === 4) {
- //关注店铺
- if (item.doneNum === item.ssjjTaskInfo.awardOfDayNum) {
- console.log(`${item.ssjjTaskInfo.name}已完成[${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum}]`)
- continue
- }
- for (let i = 0; i < new Array(item.ssjjTaskInfo.awardOfDayNum).fill('').length; i++) {
- await followShops('followShops', item.ssjjTaskInfo.id);//一键关注店铺
- await queryDoneTaskRecord(item.ssjjTaskInfo.id, item.ssjjTaskInfo.type);
- }
- }
- if (item.ssjjTaskInfo.type === 5) {
- //浏览店铺
- if (item.doneNum === item.ssjjTaskInfo.awardOfDayNum) {
- console.log(`${item.ssjjTaskInfo.name}已完成[${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum}]`)
- continue
- }
- for (let i = 0; i < new Array(item.ssjjTaskInfo.awardOfDayNum).fill('').length; i++) {
- await browseChannels('browseShops', item.ssjjTaskInfo.id, item.browseId);
- }
- }
- if (item.ssjjTaskInfo.type === 6) {
- //关注4个频道
- if (item.doneNum === item.ssjjTaskInfo.awardOfDayNum) {
- console.log(`${item.ssjjTaskInfo.name}已完成[${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum}]`)
- continue
- }
- await doChannelsListTask(item.ssjjTaskInfo.id, item.ssjjTaskInfo.type)
- }
- if (item.ssjjTaskInfo.type === 7) {
- //浏览3个频道
- if (item.doneNum === item.ssjjTaskInfo.awardOfDayNum) {
- console.log(`${item.ssjjTaskInfo.name}已完成[${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum}]`)
- continue
- }
- for (let i = 0; i < new Array(item.ssjjTaskInfo.awardOfDayNum || 1).fill('').length; i++) {
- await browseChannels('browseChannels', item.ssjjTaskInfo.id, item.browseId);
- }
- }
- isPurchaseShops = $.isNode() ? (process.env.PURCHASE_SHOPS ? process.env.PURCHASE_SHOPS : isPurchaseShops) : ($.getdata("isPurchaseShops") ? $.getdata("isPurchaseShops") : isPurchaseShops);
- if (isPurchaseShops && item.ssjjTaskInfo.type === 9) {
- //加购商品
- if (item.doneNum === item.ssjjTaskInfo.awardOfDayNum) {
- console.log(`${item.ssjjTaskInfo.name}已完成[${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum}]`)
- continue
- }
- for (let i = 0; i < new Array(item.ssjjTaskInfo.awardOfDayNum).fill('').length; i++) {
- await followShops('purchaseCommodities', item.ssjjTaskInfo.id);//一键加购商品
- await queryDoneTaskRecord(item.ssjjTaskInfo.id, item.ssjjTaskInfo.type);
- }
- }
- if (item.ssjjTaskInfo.type === 10) {
- //浏览商品
- if (item.doneNum === item.ssjjTaskInfo.awardOfDayNum) {
- console.log(`${item.ssjjTaskInfo.name}已完成[${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum}]`)
- continue
- }
- for (let i = 0; i < new Array(item.ssjjTaskInfo.awardOfDayNum).fill('').length; i++) {
- await browseChannels('browseCommodities', item.ssjjTaskInfo.id, item.browseId);
- }
- }
- if (item.ssjjTaskInfo.type === 11) {
- //浏览会场
- if (item.doneNum === item.ssjjTaskInfo.awardOfDayNum) {
- console.log(`${item.ssjjTaskInfo.name}已完成[${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum}]`)
- continue
- }
- for (let i = 0; i < new Array(item.ssjjTaskInfo.awardOfDayNum || 1).fill('').length; i++) {
- await browseChannels('browseMeetings' ,item.ssjjTaskInfo.id, item.browseId);
- }
- // await browseChannels('browseMeetings' ,item.ssjjTaskInfo.id, item.browseId);
- // await doAllTask();
- }
- }
-}
-//获取需要关注的频道列表
-function queryChannelsList(taskId) {
- return new Promise(resolve => {
- $.get(taskUrl(`ssjj-task-channels/queryChannelsList/${taskId}`), (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.head.code === 200) {
- if (data.body) {
- $.queryChannelsList = data.body;
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-
-//浏览频道,浏览会场,浏览商品,浏览店铺API
-function browseChannels(functionID ,taskId, browseId) {
- return new Promise(resolve => {
- $.get(taskUrl(`/ssjj-task-record/${functionID}/${taskId}/${browseId}`), (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- console.log(`${functionID === 'browseChannels' ? '浏览频道' : functionID === 'browseMeetings' ? '浏览会场' : functionID === 'browseShops' ? '浏览店铺' : '浏览商品'}`, data)
- data = JSON.parse(data);
- if (data.head.code === 200) {
- if (data.body) {
- // message += `【限时连连看】成功,活动${awardWoB}WO币\n`;
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-//记录已关注的频道
-function queryDoneTaskRecord(taskId, taskType) {
- return new Promise(resolve => {
- $.get(taskUrl(`/ssjj-task-record/queryDoneTaskRecord/${taskType}/${taskId}`), (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.head.code === 200) {
- if (data.body) {
- // message += `【限时连连看】成功,活动${awardWoB}WO币\n`;
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-//一键关注店铺,一键加购商品API
-function followShops(functionID, taskId) {
- return new Promise(async resolve => {
- $.get(taskUrl(`/ssjj-task-record/${functionID}/${taskId}`), (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.head.code === 200) {
- if (data.body) {
- console.log(`${functionID === 'followShops'? '一键关注店铺': '一键加购商品'}结果:${data.head.msg}`);
- // message += `【限时连连看】成功,活动${awardWoB}WO币\n`;
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-//关注频道API
-function followChannel(taskId, channelId) {
- return new Promise(async resolve => {
- $.get(taskUrl(`/ssjj-task-record/followChannel/${channelId}/${taskId}`), (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.head.code === 200) {
- if (data.body) {
- // message += `【限时连连看】成功,活动${awardWoB}WO币\n`;
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function createInviteUser() {
- return new Promise(resolve => {
- $.get(taskUrl(`/ssjj-task-record/createInviteUser`), (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.head.code === 200) {
- if (data.body) {
- if (data.body.id) {
- console.log(`\n您的${$.name}shareCode(每天都是变化的):【${data.body.id}】\n`);
- $.shareCode = data.body.id;
- }
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-
-function createAssistUser(inviteId, taskId) {
- return new Promise(resolve => {
- $.get(taskUrl(`/ssjj-task-record/createAssistUser/${inviteId}/${taskId}`), (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.head.code === 200) {
- if (data.body) {
- console.log(`\n给好友${data.body.inviteId}:【${data.head.msg}】\n`)
- }
- } else {
- console.log(`助力失败${JSON.stringify(data)}}`);
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function game(taskId, index, awardWoB = 100) {
- return new Promise(resolve => {
- $.get(taskUrl(`/ssjj-task-record/game/${index}/${taskId}`), (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.head.code === 200) {
- if (data.body) {
- message += `【限时连连看】成功,活动${awardWoB}WO币\n`;
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function clock(taskId, awardWoB) {
- return new Promise(resolve => {
- $.get(taskUrl(`/ssjj-task-record/clock/${taskId}`), (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.head.code === 200) {
- if (data.body) {
- message += `【每日打卡】成功,活动${awardWoB}WO币\n`;
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function queryAllTaskInfo() {
- return new Promise(resolve => {
- $.get(taskUrl(`ssjj-task-info/queryAllTaskInfo/2`), (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.head.code === 200) {
- if (data.body) {
- $.taskList = data.body;
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-//免费抽奖
-function drawRecord(id) {
- return new Promise(resolve => {
- $.get(taskUrl(`ssjj-draw-record/draw/${id}`), (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.head.code === 200) {
- if (data.body) {
- message += `【免费抽奖】获得:${data.body.name}\n`;
- } else {
- message += `【免费抽奖】未中奖\n`;
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-//查询免费抽奖机会
-function queryDraw() {
- return new Promise(resolve => {
- $.get(taskUrl("ssjj-draw-center/queryDraw"), (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.head.code === 200) {
- $.freeDrawCount = data.body.freeDrawCount;//免费抽奖次数
- $.lotteryId = data.body.center.id;
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-//查询是否开启了此活动
-function ssjjRooms() {
- return new Promise(resolve => {
- $.get(taskUrl("ssjj-rooms/info/%E5%AE%A2%E5%8E%85"), (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.head.code === 200) {
- $.isUnLock = data.body.isUnLock;
- if (!$.isUnLock) {
- console.log(`京东账号${$.index}${$.nickName}未开启此活动\n`);
- $.msg($.name, '', `京东账号${$.index}${$.nickName}未开启此活动\n点击弹窗去开启此活动( ̄▽ ̄)"`, {"open-url": "openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/2HFSytEAN99VPmMGZ6V4EYWus1x/index.html%22%20%7D"});
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function loginHome() {
- return new Promise(resolve => {
- const options = {
- "url": "https://jdhome.m.jd.com/saas/framework/encrypt/pin?appId=6d28460967bda11b78e077b66751d2b0",
- "headers": {
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-cn",
- "Connection": "keep-alive",
- "Content-Length": "0",
- "Content-Type": "application/json",
- "Cookie": cookie,
- "Host": "jdhome.m.jd.com",
- "Origin": "https://jdhome.m.jd.com",
- "Referer": "https://jdhome.m.jd.com/dist/taro/index.html/",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- await login(data.data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve()
- }
- })
- })
-}
-function login(userName) {
- return new Promise(resolve => {
- const body = {
- "body": {
- "client": 2,
- userName
- }
- };
- const options = {
- "url": `${JD_API_HOST}/user-info/login`,
- "body": JSON.stringify(body),
- "headers": {
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-cn",
- "Connection": "keep-alive",
- "Content-Type": "application/json",
- "Host": "lkyl.dianpusoft.cn",
- "Origin": "https://lkyl.dianpusoft.cn",
- "Referer": "https://h5.m.jd.com/babelDiy/Zeus/2HFSytEAN99VPmMGZ6V4EYWus1x/index.html",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- data = JSON.parse(data);
- if (data.head.code === 200) {
- $.token = data.head.token;
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function updateInviteCode(url = 'https://raw.githubusercontent.com/lxk0301/updateTeam/master/jd_updateSmallHomeInviteCode.json') {
- return new Promise(resolve => {
- $.get({url}, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- } else {
- $.inviteCodes = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function updateInviteCodeCDN(url = 'https://cdn.jsdelivr.net/gh/lxk0301/updateTeam@master/jd_updateSmallHomeInviteCode.json') {
- return new Promise(resolve => {
- $.get({url}, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- $.inviteCodes = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function taskUrl(url, body = {}) {
- return {
- url: `${JD_API_HOST}/${url}?body=${escape(body)}`,
- headers: {
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-CN,zh;q=0.9",
- "Connection": "keep-alive",
- "content-type": "application/json",
- "Host": "lkyl.dianpusoft.cn",
- "Referer": "https://h5.m.jd.com/babelDiy/Zeus/2HFSytEAN99VPmMGZ6V4EYWus1x/index.html",
- "token": $.token,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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")
- }
- }
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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 (safeGet(data)) {
- data = JSON.parse(data);
- if (data['retcode'] === 13) {
- $.isLogin = false; //cookie过期
- return
- }
- $.nickName = data['base'].nickname;
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function safeGet(data) {
- try {
- if (typeof JSON.parse(data) == "object") {
- return true;
- }
- } catch (e) {
- console.log(e);
- console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
- return false;
- }
-}
-
-// prettier-ignore
-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,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("",`\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 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();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){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="",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}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));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
diff --git a/jd_speed.js b/jd_speed.js
deleted file mode 100644
index 176230f..0000000
--- a/jd_speed.js
+++ /dev/null
@@ -1,517 +0,0 @@
-/*
-京东天天加速链接:https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_speed.js
-更新时间:2020-11-03
-支持京东双账号
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-每天4京豆,再小的苍蝇也是肉
-从 https://github.com/Zero-S1/JD_tools/blob/master/JD_speed.py 改写来的
-建议3小时运行一次,打卡时间间隔是6小时
-注:如果使用Node.js, 需自行安装'crypto-js,got,http-server,tough-cookie'模块. 例: npm install crypto-js http-server tough-cookie got --save
-*/
-// quantumultx
-// [task_local]
-// #天天加速
-// 8 */3 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_speed.js, tag=京东天天加速, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdjs.png, enabled=true
-// Loon
-// [Script]
-// cron "8 */3 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_speed.js,tag=京东天天加速
-// Surge
-//天天加速 = type=cron,cronexp="8 */3 * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_speed.js
-const $ = new Env('✈️天天加速');
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- cookiesArr.push($.getdata('CookieJD'));
- cookiesArr.push($.getdata('CookieJD2'));
-}
-let jdNotify = true;//是否开启静默运行。默认true开启
-let message = '', subTitle = '';
-const JD_API_HOST = 'https://api.m.jd.com/'
-
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- message = '';
- subTitle = '';
- await jDSpeedUp();
- await showMsg();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-function showMsg() {
- jdNotify = $.getdata('jdSpeedNotify') ? $.getdata('jdSpeedNotify') : jdNotify;
- if (!jdNotify || jdNotify === 'false') {
- $.msg($.name, subTitle, `【京东账号${$.index}】${$.nickName}\n` + message);
- } else {
- $.log(`\n${message}\n`);
- }
-}
-function jDSpeedUp(sourceId, doubleKey) {
- return new Promise((resolve) => {
- let body = {"source": "game"};
- if (sourceId) {
- body.source_id = sourceId
- }
- const url = {
- // url: JD_API_HOST + '?appid=memberTaskCenter&functionId=flyTask_' + (sourceId ? 'start&body=%7B%22source%22%3A%22game%22%2C%22source_id%22%3A' + sourceId + '%7D' : 'state&body=%7B%22source%22%3A%22game%22%7D'),
- url: `${JD_API_HOST}?appid=memberTaskCenter&functionId=flyTask_${sourceId ? 'start' : 'state'}&body=${escape(JSON.stringify(body))}`,
- headers: {
- 'Cookie': cookie,
- 'Host': 'api.m.jd.com',
- 'Accept': '*/*',
- 'Connection': 'keep-alive',
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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',
- 'Referer': 'https://h5.m.jd.com/babelDiy/Zeus/6yCQo2eDJPbyPXrC3eMCtMWZ9ey/index.html?lng=116.845095&lat=39.957701&sid=ea687233c5e7d226b30940ed7382c5cw&un_area=5_274_49707_49973',
- 'Accept-Encoding': 'gzip, deflate, br'
- }
- };
- $.get(url, async (err, resp, data) => {
- try {
- if (err) {
- console.log('京东天天-加速: 签到接口请求失败 ‼️‼️');
- } else {
- if (data) {
- let res = JSON.parse(data);
- if (!sourceId) {
- console.log(`\n天天加速任务进行中`);
- } else {
- console.log("\n" + "天天加速-开始本次任务 ");
- }
- if (res.info.isLogin === 1) {
- subTitle = `【奖励】${res.data.beans_num}京豆`;
- if (res.data.task_status === 0) {
- const taskID = res.data.source_id;
- await jDSpeedUp(taskID);
- } else if (res.data.task_status === 1) {
- const EndTime = res.data.end_time ? res.data.end_time : ""
- console.log("\n天天加速进行中-结束时间: \n" + EndTime);
- const space = await spaceEventList()
- const HandleEvent = await spaceEventHandleEvent(space)
- const step1 = await energyPropList();//检查燃料
- const step2 = await receiveEnergyProp(step1);//领取可用的燃料
- const step3 = await energyPropUsaleList(step2)
- const step4 = await useEnergy(step3)
- if (step4) {
- await jDSpeedUp(null);
- } else {
- message += `【空间站】 ${res.data.destination}\n`;
- message += `【结束时间】 ${res.data.end_time}\n`;
- message += `【进度】 ${((res.data['done_distance'] / res.data.distance) * 100).toFixed(2)}%\n`;
- }
- } else if (res.data.task_status === 2) {
- if (data.match(/\"beans_num\":\d+/)) {
- //message += "【上轮奖励】成功领取" + data.match(/\"beans_num\":(\d+)/)[1] + "京豆 🐶";
- if (!jdNotify || jdNotify === 'false') {
- $.msg($.name, '', `【京东账号${$.index}】${$.nickName}\n` + "【上轮太空旅行】成功领取" + data.match(/\"beans_num\":(\d+)/)[1] + "京豆 🐶");
- }
- } else {
- console.log("京东天天-加速: 成功, 明细: 无京豆 🐶")
- }
- console.log("\n天天加速-领取上次奖励成功")
- await jDSpeedUp(null);
- } else {
- console.log("\n" + "天天加速-判断状态码失败")
- }
- } else {
- console.log("\n" + "天天加速-判断状态失败")
- }
- } else {
- console.log(`京豆api返回数据为空,请检查自身原因`)
- }
- }
- } catch (e) {
- $.msg("京东天天-加速" + e.name + "‼️", JSON.stringify(e), e.message)
- } finally {
- resolve()
- }
- })
- })
-}
-
-// 检查太空特殊事件
-function spaceEventList() {
- return new Promise((resolve) => {
- let spaceEvents = [];
- const body = { "source": "game"};
- const spaceEventUrl = {
- url: `${JD_API_HOST}?appid=memberTaskCenter&functionId=spaceEvent_list&body=${escape(JSON.stringify(body))}`,
- headers: {
- Referer: 'https://h5.m.jd.com/babelDiy/Zeus/6yCQo2eDJPbyPXrC3eMCtMWZ9ey/index.html',
- Cookie: cookie
- }
- }
- $.get(spaceEventUrl, async (err, resp, data) => {
- try {
- if (err) {
- console.log("\n京东天天-加速: 查询太空特殊事件请求失败 ‼️‼️")
- } else {
- if (data) {
- const cc = JSON.parse(data);
- if (cc.message === "success" && cc.data.length > 0) {
- for (let item of cc.data) {
- if (item.status === 1) {
- for (let j of item.options) {
- if (j.type === 1) {
- spaceEvents.push({
- "id": item.id,
- "value": j.value
- })
- }
- }
- }
- }
- if (spaceEvents && spaceEvents.length > 0) {
- console.log("\n天天加速-查询到" + spaceEvents.length + "个太空特殊事件")
- } else {
- console.log("\n天天加速-暂无太空特殊事件")
- }
- } else {
- console.log("\n天天加速-查询无太空特殊事件")
- }
- } else {
- console.log(`京豆api返回数据为空,请检查自身原因`)
- }
- }
- } catch (e) {
- $.msg("天天加速-查询太空特殊事件" + e.name + "‼️", JSON.stringify(e), e.message)
- } finally {
- resolve(spaceEvents)
- }
- })
- })
-}
-
-//处理太空特殊事件
-function spaceEventHandleEvent(spaceEventList) {
- return new Promise((resolve) => {
- if (spaceEventList && spaceEventList.length > 0) {
- let spaceEventCount = 0, spaceNumTask = 0;
- for (let item of spaceEventList) {
- let body = {
- "source":"game",
- "eventId": item.id,
- "option": item.value
- }
- const spaceHandleUrl = {
- url: `${JD_API_HOST}?appid=memberTaskCenter&functionId=spaceEvent_handleEvent&body=${escape(JSON.stringify(body))}`,
- headers: {
- Referer: 'https://h5.m.jd.com/babelDiy/Zeus/6yCQo2eDJPbyPXrC3eMCtMWZ9ey/index.html',
- Cookie: cookie
- }
- }
- spaceEventCount += 1
- $.get(spaceHandleUrl, (err, resp, data) => {
- try {
- if (err) {
- console.log("\n京东天天-加速: 处理太空特殊事件请求失败 ‼️‼️")
- } else {
- if (data) {
- const cc = JSON.parse(data);
- // console.log(`处理特殊事件的结果::${JSON.stringify(cc)}`);
- console.log("\n天天加速-尝试处理第" + spaceEventCount + "个太空特殊事件")
- if (cc.message === "success" && cc.success) {
- spaceNumTask += 1;
- } else {
- console.log("\n天天加速-处理太空特殊事件失败")
- }
- } else {
- console.log(`京豆api返回数据为空,请检查自身原因`)
- }
- }
- } catch (e) {
- $.msg("天天加速-查询处理太空特殊事件" + e.name + "‼️", JSON.stringify(e), e.message)
- } finally {
- if (spaceEventList.length === spaceNumTask) {
- console.log("\n天天加速-已成功处理" + spaceNumTask + "个太空特殊事件")
- resolve()
- }
- }
- })
- }
- } else {
- resolve()
- }
- })
-}
-
-//检查燃料
-function energyPropList() {
- return new Promise((resolve) => {
- let TaskID = "";
- const body = { "source": "game"};
- const QueryUrl = {
- // url: JD_API_HOST + '?appid=memberTaskCenter&functionId=energyProp_list&body=%7B%22source%22%3A%22game%22%7D',
- url: `${JD_API_HOST}?appid=memberTaskCenter&functionId=energyProp_list&body=${escape(JSON.stringify(body))}`,
- headers: {
- Referer: 'https://h5.m.jd.com/babelDiy/Zeus/6yCQo2eDJPbyPXrC3eMCtMWZ9ey/index.html',
- Cookie: cookie
- }
- };
- $.get(QueryUrl, async (err, resp, data) => {
- try {
- if (err) {
- console.log("\n京东天天-加速: 查询道具请求失败 ‼️‼️")
- } else {
- if (data) {
- const cc = JSON.parse(data)
- if (cc.message === "success" && cc.data.length > 0) {
- for (let i = 0; i < cc.data.length; i++) {
- if (cc.data[i].thaw_time === 0) {
- TaskID += cc.data[i].id + ",";
- }
- }
- if (TaskID.length > 0) {
- TaskID = TaskID.substr(0, TaskID.length - 1).split(",")
- console.log("\n天天加速-查询到" + TaskID.length + "个可用燃料")
- } else {
- console.log("\n天天加速-检查燃料-暂无可用燃料")
- }
- } else {
- console.log("\n天天加速-查询无燃料")
- }
- } else {
- console.log(`京豆api返回数据为空,请检查自身原因`)
- }
- }
- } catch (eor) {
- $.msg("天天加速-查询燃料" + eor.name + "‼️", JSON.stringify(eor), eor.message)
- } finally {
- resolve(TaskID)
- }
- })
- })
-}
-
-//领取可用的燃料
-function receiveEnergyProp(CID) {
- return new Promise((resolve) => {
- var NumTask = 0;
- if (CID) {
- let count = 0
- for (let i = 0; i < CID.length; i++) {
- let body = {
- "source":"game",
- "energy_id": CID[i]
- }
- const TUrl = {
- // url: JD_API_HOST + '?appid=memberTaskCenter&functionId=energyProp_gain&body=%7B%22source%22%3A%22game%22%2C%22energy_id%22%3A' + CID[i] + '%7D',
- url: `${JD_API_HOST}?appid=memberTaskCenter&functionId=energyProp_gain&body=${escape(JSON.stringify(body))}`,
- headers: {
- Referer: 'https://h5.m.jd.com/babelDiy/Zeus/6yCQo2eDJPbyPXrC3eMCtMWZ9ey/index.html',
- Cookie: cookie
- }
- };
- count += 1
- $.get(TUrl, (error, response, data) => {
- try {
- if (error) {
- console.log("\n天天加速-领取道具请求失败 ‼️‼️")
- } else {
- if (data) {
- const cc = JSON.parse(data)
- console.log("\n天天加速-尝试领取第" + count + "个可用燃料")
- if (cc.message === 'success') {
- NumTask += 1
- }
- } else {
- console.log(`京豆api返回数据为空,请检查自身原因`)
- }
- }
- } catch (eor) {
- $.msg("天天加速-领取可用燃料" + eor.name + "‼️", JSON.stringify(eor), eor.message)
- } finally {
- if (CID.length === count) {
- console.log("\n天天加速-已成功领取" + NumTask + "个可用燃料")
- resolve(NumTask)
- }
- }
- })
- }
- } else {
- resolve(NumTask)
- }
- })
-}
-
-//检查剩余燃料
-function energyPropUsaleList(EID) {
- return new Promise((resolve) => {
- let TaskCID = '';
- const body = { "source": "game"};
- const EUrl = {
- // url: JD_API_HOST + '?appid=memberTaskCenter&functionId=energyProp_usalbeList&body=%7B%22source%22%3A%22game%22%7D',
- url: `${JD_API_HOST}?appid=memberTaskCenter&functionId=energyProp_usalbeList&body=${escape(JSON.stringify(body))}`,
- headers: {
- Referer: 'https://h5.m.jd.com/babelDiy/Zeus/6yCQo2eDJPbyPXrC3eMCtMWZ9ey/index.html',
- Cookie: cookie
- }
- };
- $.get(EUrl, (error, response, data) => {
- try {
- if (error) {
- console.log("\n天天加速-查询道具ID请求失败 ‼️‼️")
- } else {
- if (data) {
- const cc = JSON.parse(data);
- if (cc.data.length > 0) {
- for (let i = 0; i < cc.data.length; i++) {
- if (cc.data[i].id) {
- TaskCID += cc.data[i].id + ",";
- }
- }
- if (TaskCID.length > 0) {
- TaskCID = TaskCID.substr(0, TaskCID.length - 1).split(",")
- console.log("\n天天加速-查询成功" + TaskCID.length + "个燃料ID")
- } else {
- console.log("\n天天加速-暂无有效燃料ID")
- }
- } else {
- console.log("\n天天加速-查询无燃料ID")
- }
- } else {
- console.log(`京豆api返回数据为空,请检查自身原因`)
- }
- }
- } catch (eor) {
- $.msg("天天加速-燃料ID" + eor.name + "‼️", JSON.stringify(eor), eor.message)
- } finally {
- resolve(TaskCID)
- }
- })
- // if (EID) {
- //
- // } else {
- // resolve(TaskCID)
- // }
- })
-}
-
-//使用能源
-function useEnergy(PropID) {
- return new Promise((resolve) => {
- var PropNumTask = 0;
- let PropCount = 0
- if (PropID) {
- for (let i = 0; i < PropID.length; i++) {
- let body = {
- "source":"game",
- "energy_id": PropID[i]
- }
- const PropUrl = {
- // url: JD_API_HOST + '?appid=memberTaskCenter&functionId=energyProp_use&body=%7B%22source%22%3A%22game%22%2C%22energy_id%22%3A%22' + PropID[i] + '%22%7D',
- url: `${JD_API_HOST}?appid=memberTaskCenter&functionId=energyProp_use&body=${escape(JSON.stringify(body))}`,
- headers: {
- Referer: 'https://h5.m.jd.com/babelDiy/Zeus/6yCQo2eDJPbyPXrC3eMCtMWZ9ey/index.html',
- Cookie: cookie
- }
- };
- PropCount += 1;
- $.get(PropUrl, (error, response, data) => {
- try {
- if (error) {
- console.log("\n天天加速-使用燃料请求失败 ‼️‼️")
- } else {
- if (data) {
- const cc = JSON.parse(data);
- console.log("\n天天加速-尝试使用第" + PropCount + "个燃料")
- if (cc.message === 'success' && cc.success === true) {
- PropNumTask += 1
- }
- } else {
- console.log(`京豆api返回数据为空,请检查自身原因`)
- }
- }
- } catch (eor) {
- $.msg("天天加速-使用燃料" + eor.name + "‼️", JSON.stringify(eor), eor.message)
- } finally {
- if (PropID.length === PropCount) {
- console.log("\n天天加速-已成功使用" + PropNumTask + "个燃料")
- resolve(PropNumTask)
- }
- }
- })
- }
- } else {
- resolve(PropNumTask)
- }
- })
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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();
- }
- })
- })
-}
-// prettier-ignore
-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
diff --git a/jd_superMarket.js b/jd_superMarket.js
deleted file mode 100644
index f5a08dc..0000000
--- a/jd_superMarket.js
+++ /dev/null
@@ -1,1443 +0,0 @@
-/*
- * @Author: lxk0301 https://github.com/lxk0301
- * @Date: 2020-08-16 18:54:16
- * @Last Modified by: lxk0301
- * @Last Modified time: 2020-11-24 08:22:37
- */
-/*
-东东超市(活动入口:京东APP-》首页-》京东超市-》底部东东超市)
-Some Functions Modified From https://github.com/Zero-S1/JD_tools/blob/master/JD_superMarket.py
-支持京东双账号
-京小超兑换奖品请使用此脚本 https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_blueCoin.js
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-// QuantumultX
-[task_local]
-#东东超市
-11 1-23/5 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_superMarket.js, tag=东东超市, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jxc.png, enabled=true
-// Loon
-[Script]
-cron "11 1-23/5 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_superMarket.js,tag=东东超市
-// Surge
-东东超市 = type=cron,cronexp="11 1-23/5 * * *",wake-system=1,timeout=320,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_superMarket.js
- */
-const $ = new Env('东东超市');
-//Node.js用户请在jdCookie.js处填写京东ck;
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '', jdSuperMarketShareArr = [], notify, newShareCodes;
-
-let jdNotify = true;//用来是否关闭弹窗通知,true表示关闭,false表示开启。
-let superMarketUpgrade = true;//自动升级,顺序:解锁升级商品、升级货架,true表示自动升级,false表示关闭自动升级
-let businessCircleJump = true;//小于对方300热力值自动更换商圈队伍,true表示运行,false表示禁止
-let drawLotteryFlag = false;//是否用500蓝币去抽奖,true表示开启,false表示关闭。默认关闭
-let message = '', subTitle;
-const JD_API_HOST = 'https://api.m.jd.com/api';
-
-//助力好友分享码
-//此此内容是IOS用户下载脚本到本地使用,填写互助码的地方,同一京东账号的好友互助码请使用@符号隔开。
-//下面给出两个账号的填写示例(iOS只支持2个京东账号)
-let shareCodes = [ // IOS本地脚本用户这个列表填入你要助力的好友的shareCode
- //账号一的好友shareCode,不同好友的shareCode中间用@符号隔开
- '-4msulYas0O2JsRhE-2TA5XZmBQ@eU9Yar_mb_9z92_WmXNG0w@eU9YaejjYv4g8T2EwnsVhQ',
- //账号二的好友shareCode,不同好友的shareCode中间用@符号隔开
- 'aURoM7PtY_Q@eU9Ya-y2N_5z9DvXwyIV0A@eU9YaOnjYK4j-GvWmXIWhA',
-]
-
-!(async () => {
- await requireConfig();
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.coincount = 0;//收取了多少个蓝币
- $.coinerr = "";
- $.blueCionTimes = 0;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- message = '';
- subTitle = '';
- //await shareCodesFormat();//格式化助力码
- await jdSuperMarket();
- await showMsg();
- // await businessCircleActivity();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-async function jdSuperMarket() {
- await receiveGoldCoin();//收金币
- await businessCircleActivity();//商圈活动
- await receiveBlueCoin();//收蓝币(小费)
- await receiveLimitProductBlueCoin();//收限时商品的蓝币
- await smtgSign();//每日签到
- await smtgBeanSign()//
- await doDailyTask();//做日常任务,分享,关注店铺,
- await help();//商圈助力
- //await smtgQueryPkTask();//做商品PK任务
- await myProductList();//货架
- await drawLottery();
- await upgrade();//升级货架和商品
- await manageProduct();
- await limitTimeProduct();
- await smtgHome();
-}
-function showMsg() {
- $.log(`\n${message}\n`);
- jdNotify = $.getdata('jdSuperMarketNotify') ? $.getdata('jdSuperMarketNotify') : jdNotify;
- if (!jdNotify || jdNotify === 'false') {
- $.msg($.name, subTitle ,`【京东账号${$.index}】${$.nickName}\n${message}`);
- }
-}
-//抽奖功能(招财进宝)
-async function drawLottery() {
- console.log(`\n注意⚠:京小超抽奖已改版,花费500蓝币抽奖一次,现在脚本默认已关闭抽奖功能\n`);
- drawLotteryFlag = $.getdata('jdSuperMarketLottery') ? $.getdata('jdSuperMarketLottery') : drawLotteryFlag;
- if ($.isNode() && process.env.SUPERMARKET_LOTTERY) {
- drawLotteryFlag = process.env.SUPERMARKET_LOTTERY;
- }
- if (`${drawLotteryFlag}` === 'true') {
- const smtg_lotteryIndexRes = await smtg_lotteryIndex();
- if (smtg_lotteryIndexRes && smtg_lotteryIndexRes.data.bizCode === 0) {
- const { result } = smtg_lotteryIndexRes.data
- if (result.blueCoins > result.costCoins && result.remainedDrawTimes > 0) {
- const drawLotteryRes = await smtg_drawLottery();
- console.log(`\n花费${result.costCoins}蓝币抽奖结果${JSON.stringify(drawLotteryRes)}`);
- await drawLottery();
- } else {
- console.log(`\n抽奖失败:已抽奖或者蓝币不足`);
- console.log(`失败详情:\n现有蓝币:${result.blueCoins},抽奖次数:${result.remainedDrawTimes}`)
- }
- }
- } else {
- console.log(`设置的为不抽奖`)
- }
-}
-async function help() {
- return
- console.log(`\n开始助力好友`);
- for (let code of newShareCodes) {
- if (!code) continue;
- const res = await smtgDoAssistPkTask(code);
- console.log(`助力好友${JSON.stringify(res)}`);
- }
-}
-async function doDailyTask() {
- const smtgQueryShopTaskRes = await smtgQueryShopTask();
- if (smtgQueryShopTaskRes.code === 0 && smtgQueryShopTaskRes.data.success) {
- const taskList = smtgQueryShopTaskRes.data.result.taskList;
- console.log(`\n日常赚钱任务 完成状态`)
- for (let item of taskList) {
- console.log(` ${item['title'].length < 4 ? item['title']+`\xa0` : item['title'].slice(-4)} ${item['finishNum'] === item['targetNum'] ? '已完成':'未完成'} ${item['finishNum']}/${item['targetNum']}`)
- }
- for (let item of taskList) {
- //领奖
- if (item.taskStatus === 1 && item.prizeStatus === 1) {
- const res = await smtgObtainShopTaskPrize(item.taskId);
- console.log(`\n领取做完任务的奖励${JSON.stringify(res)}\n`)
- }
- if ((item.type === 1 || item.type === 11) && item.taskStatus === 0) {
- // 分享任务
- const res = await smtgDoShopTask(item.taskId);
- console.log(`${item.subTitle}结果${JSON.stringify(res)}`)
-
- }
- if (item.type === 2) {
- //逛会场
- if (item.taskStatus === 0) {
- console.log('开始逛会场')
- const itemId = item.content[item.type].itemId;
- const res = await smtgDoShopTask(item.taskId, itemId);
- console.log(`${item.subTitle}结果${JSON.stringify(res)}`);
- }
- }
- if (item.type === 8) {
- //关注店铺
- if (item.taskStatus === 0) {
- console.log('开始关注店铺')
- const itemId = item.content[item.type].itemId;
- const res = await smtgDoShopTask(item.taskId, itemId);
- console.log(`${item.subTitle}结果${JSON.stringify(res)}`);
- }
- }
- if (item.type === 10) {
- //关注店铺
- if (item.taskStatus === 0) {
- console.log('开始关注店铺')
- const itemId = item.content[item.type].itemId;
- const res = await smtgDoShopTask(item.taskId, itemId);
- console.log(`${item.subTitle}结果${JSON.stringify(res)}`);
- }
- }
- if ((item.type === 8 || item.type === 2 || item.type === 10) && item.taskStatus === 0) {
- await doDailyTask();
- }
- }
- }
-}
-
-async function receiveGoldCoin() {
- $.goldCoinData = await smtgReceiveCoin(0);
- if ($.goldCoinData.data.bizCode === 0) {
- console.log(`领取金币成功${$.goldCoinData.data.result.receivedGold}`)
- message += `【领取金币】${$.goldCoinData.data.result.receivedGold}个\n`;
- } else {
- console.log(`${$.goldCoinData.data.bizMsg}`);
- }
-}
-
-//领限时商品的蓝币
-async function receiveLimitProductBlueCoin() {
- const res = await smtgReceiveCoin(1);
- console.log(`\n限时商品领蓝币结果:[${res.data.bizMsg}]\n`);
- if (res.data.bizCode === 0) {
- message += `【限时商品】获得${res.data.result.receivedBlue}个蓝币\n`;
- }
-}
-//领蓝币
-function receiveBlueCoin(timeout = 0) {
- return new Promise((resolve) => {
- setTimeout( ()=>{
- $.get(taskUrl('smtg_receiveCoin', { type: 2 }), async (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- $.data = data;
- if ($.data.data.bizCode !== 0 && $.data.data.bizCode !== 809) {
- $.coinerr = `${$.data.data.bizMsg}`;
- message += `【收取小费】${$.data.data.bizMsg}\n`;
- console.log(`收取蓝币失败:${$.data.data.bizMsg}`)
- return
- }
- if ($.data.data.bizCode === 0) {
- $.coincount += $.data.data.result.receivedBlue;
- $.blueCionTimes ++;
- console.log(`【京东账号${$.index}】${$.nickName} 第${$.blueCionTimes}次领蓝币成功,获得${$.data.data.result.receivedBlue}个\n`)
- if (!$.data.data.result.isNextReceived) {
- message += `【收取小费】${$.coincount}个\n`;
- return
- }
- }
- await receiveBlueCoin(3000);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve()
- }
- })
- },timeout)
- })
-}
-
-//每日签到
-function smtgSign() {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_sign'), async (err, resp, data) => {
- try {
- // console.log('ddd----ddd', data)
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- // console.log('ddd----ddd', data)
- const signList = await smtgSignList();
- if (signList.data.bizCode === 0) {
- $.todayDay = signList.data.result.todayDay;
- }
- if (data.code === 0 && data.data.success) {
- message += `【第${$.todayDay}日签到】成功,奖励${data.data.result.rewardBlue}蓝币\n`
- } else {
- message += `【第${$.todayDay}日签到】${data.data.bizMsg}\n`
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-
-function smtgBeanSign() {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_sign',{"channel": "1"}), async (err, resp, data) => {
- try {
- // console.log('ddd----ddd', data)
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- //data = JSON.parse(data);
- console.log(data)
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-
-// 商圈活动
-async function businessCircleActivity() {
- // console.log(`\n商圈PK奖励,次日商圈大战开始的时候自动领领取\n`)
- const smtg_getTeamPkDetailInfoRes = await smtg_getTeamPkDetailInfo();
- if (smtg_getTeamPkDetailInfoRes && smtg_getTeamPkDetailInfoRes.data.bizCode === 0) {
- const { joinStatus, pkStatus, inviteCount, inviteCode, currentUserPkInfo, pkUserPkInfo, prizeInfo, pkActivityId, teamId } = smtg_getTeamPkDetailInfoRes.data.result;
- console.log(`\njoinStatus:${joinStatus}`);
- console.log(`pkStatus:${pkStatus}\n`);
- if (joinStatus === 0) {
- await updatePkActivityId();
- if (!$.updatePkActivityIdRes) await updatePkActivityIdCDN();
- console.log(`\nupdatePkActivityId[pkActivityId]:::${$.updatePkActivityIdRes.pkActivityId}`);
- console.log(`\n京东服务器返回的[pkActivityId] ${pkActivityId}`);
- if ($.updatePkActivityIdRes && ($.updatePkActivityIdRes.pkActivityId === pkActivityId)) {
- let Teams = [
- {
- "teamId": "-4msulYas0O2JsRhE-2TA5XZmBQ_1604247312176",
- "inviteCode": "-4msulYas0O2JsRhE-2TA5XZmBQ"
- },
- {
- "teamId": "Ih4-a-mwZPUj9Gy6iw_1604277683224",
- "inviteCode": "eU9Yar_mb_9z92_WmXNG0w"
- },
- {
- "teamId": "eU9Ya77gZK5z-TqHn3UWhQ_1604277779750",
- "inviteCode": "eU9YaOnjYK4j-GvWmXIWhA"
- },
- {
- "teamId": "eU9Ya-y2N_5z9DvXwyIV0A",
- "inviteCode": "eU9YaLm0bq4i-TrUzSUUhA"
- },
- {
- "teamId": "eU9Ya-y2N_5z9DvXwyIV0A",
- "inviteCode": "aURoM7PtY_Q"
- },
- {
- "teamId": "eU9Ya-y2N_5z9DvXwyIV0A",
- "inviteCode": "eU9YaeS3Z6ol8zrRmnMb1Q"
- }
- ]
- Teams = $.updatePkActivityIdRes['Teams'] || Teams;
- const randomNum = randomFriendPin(0, Teams.length - 1);
-
- const res = await smtg_joinPkTeam(Teams[randomNum].teamId, Teams[randomNum].inviteCode, pkActivityId);
- if (res && res.data.bizCode === 0) {
- console.log(`加入战队成功`)
- } else if (res && res.data.bizCode === 229) {
- console.log(`加入战队失败,该战队已满\n无法加入`)
- } else {
- console.log(`加入战队其他未知情况:${JSON.stringify(res)}`)
- }
- } else {
- console.log('\nupdatePkActivityId请求返回的pkActivityId与京东服务器返回不一致,暂时不加入战队')
- }
- } else if (joinStatus === 1) {
- if (teamId) {
- console.log(`inviteCode: [${inviteCode}]`);
- console.log(`PK队伍teamId: [${teamId}]`);
- console.log(`PK队伍名称: [${currentUserPkInfo && currentUserPkInfo.teamName}]`);
- console.log(`我邀请的人数:${inviteCount}\n`)
- console.log(`\n我方战队战队 [${currentUserPkInfo && currentUserPkInfo.teamName}]/【${currentUserPkInfo && currentUserPkInfo.teamCount}】`);
- console.log(`对方战队战队 [${pkUserPkInfo && pkUserPkInfo.teamName}]/【${pkUserPkInfo && pkUserPkInfo.teamCount}】\n`);
- }
- }
- if (pkStatus === 1) {
- console.log(`商圈PK进行中\n`)
- } else if (pkStatus === 2) {
- console.log(`商圈PK结束了`)
- if (prizeInfo.pkPrizeStatus === 2) {
- console.log(`开始领取商圈PK奖励`);
- const receivedPkTeamPrize = await smtg_receivedPkTeamPrize();
- console.log(`商圈PK奖励领取结果:${JSON.stringify(receivedPkTeamPrize)}`)
- if (receivedPkTeamPrize.data.bizCode === 0) {
- if (receivedPkTeamPrize.data.result.pkResult === 1) {
- const { pkTeamPrizeInfoVO } = receivedPkTeamPrize.data.result;
- message += `【商圈PK奖励】${pkTeamPrizeInfoVO.blueCoin}蓝币领取成功\n`;
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}】 ${$.nickName}\n【商圈队伍】PK获胜\n【奖励】${pkTeamPrizeInfoVO.blueCoin}蓝币领取成功`)
- }
- } else if (receivedPkTeamPrize.data.result.pkResult === 2) {
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}】 ${$.nickName}\n【商圈队伍】PK失败`)
- }
- }
- }
- } else if (prizeInfo.pkPrizeStatus === 1) {
- console.log(`商圈PK奖励已经领取\n`)
- }
- } else if (pkStatus === 3) {
- console.log(`商圈PK暂停中\n`)
- }
- } else {
- console.log(`\n${JSON.stringify(smtg_getTeamPkDetailInfoRes)}\n`)
- }
- return
- const businessCirclePKDetailRes = await smtg_businessCirclePKDetail();
- if (businessCirclePKDetailRes && businessCirclePKDetailRes.data.bizCode === 0) {
- const { businessCircleVO, otherBusinessCircleVO, inviteCode, pkSettleTime } = businessCirclePKDetailRes.data.result;
- console.log(`\n【您的商圈inviteCode互助码】:\n${inviteCode}\n\n`);
- const businessCircleIndexRes = await smtg_businessCircleIndex();
- const { result } = businessCircleIndexRes.data;
- const { pkPrizeStatus, pkStatus } = result;
- if (pkPrizeStatus === 2) {
- console.log(`开始领取商圈PK奖励`);
- const getPkPrizeRes = await smtg_getPkPrize();
- console.log(`商圈PK奖励领取结果:${JSON.stringify(getPkPrizeRes)}`)
- if (getPkPrizeRes.data.bizCode === 0) {
- const { pkPersonPrizeInfoVO, pkTeamPrizeInfoVO } = getPkPrizeRes.data.result;
- message += `【商圈PK奖励】${pkPersonPrizeInfoVO.blueCoin + pkTeamPrizeInfoVO.blueCoin}蓝币领取成功\n`;
- }
- }
- console.log(`我方商圈人气值/对方商圈人气值:${businessCircleVO.hotPoint}/${otherBusinessCircleVO.hotPoint}`);
- console.log(`我方商圈成员数量/对方商圈成员数量:${businessCircleVO.memberCount}/${otherBusinessCircleVO.memberCount}`);
- message += `【我方商圈】${businessCircleVO.memberCount}/${businessCircleVO.hotPoint}\n`;
- message += `【对方商圈】${otherBusinessCircleVO.memberCount}/${otherBusinessCircleVO.hotPoint}\n`;
- // message += `【我方商圈人气值】${businessCircleVO.hotPoint}\n`;
- // message += `【对方商圈人气值】${otherBusinessCircleVO.hotPoint}\n`;
- businessCircleJump = $.getdata('jdBusinessCircleJump') ? $.getdata('jdBusinessCircleJump') : businessCircleJump;
- if ($.isNode() && process.env.jdBusinessCircleJump) {
- businessCircleJump = process.env.jdBusinessCircleJump;
- }
- if (`${businessCircleJump}` === 'false') {
- console.log(`\n小于对方300热力值自动更换商圈队伍: 您设置的是禁止自动更换商圈队伍\n`);
- return
- }
- if (otherBusinessCircleVO.hotPoint - businessCircleVO.hotPoint > 300 && (Date.now() > (pkSettleTime - 24 * 60 * 60 * 1000))) {
- //退出该商圈
- if (inviteCode === '-4msulYas0O2JsRhE-2TA5XZmBQ') return;
- console.log(`商圈PK已过1天,对方商圈人气值还大于我方商圈人气值300,退出该商圈重新加入`);
- await smtg_quitBusinessCircle();
- } else if (otherBusinessCircleVO.hotPoint > businessCircleVO.hotPoint && (Date.now() > (pkSettleTime - 24 * 60 * 60 * 1000 * 2))) {
- //退出该商圈
- if (inviteCode === '-4msulYas0O2JsRhE-2TA5XZmBQ') return;
- console.log(`商圈PK已过2天,对方商圈人气值还大于我方商圈人气值,退出该商圈重新加入`);
- await smtg_quitBusinessCircle();
- }
- } else if (businessCirclePKDetailRes && businessCirclePKDetailRes.data.bizCode === 222) {
- console.log(`${businessCirclePKDetailRes.data.bizMsg}`);
- console.log(`开始领取商圈PK奖励`);
- const getPkPrizeRes = await smtg_getPkPrize();
- console.log(`商圈PK奖励领取结果:${JSON.stringify(getPkPrizeRes)}`)
- if (getPkPrizeRes && getPkPrizeRes.data.bizCode === 0) {
- const { pkPersonPrizeInfoVO, pkTeamPrizeInfoVO } = getPkPrizeRes.data.result;
- $.msg($.name, '', `【京东账号${$.index}】 ${$.nickName}\n【商圈PK奖励】${pkPersonPrizeInfoVO.blueCoin + pkTeamPrizeInfoVO.blueCoin}蓝币领取成功`)
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}】 ${$.nickName}\n【商圈PK奖励】${pkPersonPrizeInfoVO.blueCoin + pkTeamPrizeInfoVO.blueCoin}蓝币领取成功`)
- }
- }
- } else if (businessCirclePKDetailRes && businessCirclePKDetailRes.data.bizCode === 206) {
- console.log(`您暂未加入商圈,现在给您加入lxk0301的商圈`);
- const joinBusinessCircleRes = await smtg_joinBusinessCircle(myCircleId);
- console.log(`参加商圈结果:${JSON.stringify(joinBusinessCircleRes)}`)
- if (joinBusinessCircleRes.data.bizCode !== 0) {
- console.log(`您加入lxk0301的商圈失败,现在给您随机加入一个商圈`);
- const BusinessCircleList = await smtg_getBusinessCircleList();
- if (BusinessCircleList.data.bizCode === 0) {
- const { businessCircleVOList } = BusinessCircleList.data.result;
- const { circleId } = businessCircleVOList[randomFriendPin(0, businessCircleVOList.length -1)];
- const joinBusinessCircleRes = await smtg_joinBusinessCircle(circleId);
- console.log(`随机加入商圈结果:${JSON.stringify(joinBusinessCircleRes)}`)
- }
- }
- } else {
- console.log(`访问商圈详情失败:${JSON.stringify(businessCirclePKDetailRes)}`);
- }
-}
-//我的货架
-async function myProductList() {
- const shelfListRes = await smtg_shelfList();
- if (shelfListRes.data.bizCode === 0) {
- const { shelfList } = shelfListRes.data.result;
- console.log(`\n货架数量:${shelfList && shelfList.length}`)
- for (let item of shelfList) {
- console.log(`\nshelfId/name : ${item.shelfId}/${item.name}`);
- console.log(`货架等级 level ${item.level}/${item.maxLevel}`);
- console.log(`上架状态 groundStatus ${item.groundStatus}`);
- console.log(`解锁状态 unlockStatus ${item.unlockStatus}`);
- console.log(`升级状态 upgradeStatus ${item.upgradeStatus}`);
- if (item.unlockStatus === 0) {
- console.log(`${item.name}不可解锁`)
- } else if (item.unlockStatus === 1) {
- console.log(`${item.name}可解锁`);
- await smtg_unlockShelf(item.shelfId);
- } else if (item.unlockStatus === 2) {
- console.log(`${item.name}已经解锁`)
- }
- if (item.groundStatus === 1) {
- console.log(`${item.name}可上架`);
- const productListRes = await smtg_shelfProductList(item.shelfId);
- if (productListRes.data.bizCode === 0) {
- const { productList } = productListRes.data.result;
- if (productList && productList.length > 0) {
- // 此处限时商品未分配才会出现
- let limitTimeProduct = [];
- for (let item of productList) {
- if (item.productType === 2) {
- limitTimeProduct.push(item);
- }
- }
- if (limitTimeProduct && limitTimeProduct.length > 0) {
- //上架限时商品
- await smtg_ground(limitTimeProduct[0].productId, item.shelfId);
- } else {
- await smtg_ground(productList[productList.length - 1].productId, item.shelfId);
- }
- } else {
- console.log("无可上架产品");
- await unlockProductByCategory(item.shelfId.split('-')[item.shelfId.split('-').length - 1])
- }
- }
- } else if (item.groundStatus === 2 || item.groundStatus === 3) {
- if (item.productInfo.productType === 2) {
- console.log(`[${item.name}][限时商品]`)
- } else if (item.productInfo.productType === 1){
- console.log(`[${item.name}]`)
- } else {
- console.log(`[${item.name}][productType:${item.productInfo.productType}]`)
- }
- }
- }
- }
-}
-//根据类型解锁一个商品,货架可上架商品时调用
-async function unlockProductByCategory(category) {
- const smtgProductListRes = await smtg_productList();
- if (smtgProductListRes.data.bizCode === 0) {
- let productListByCategory = [];
- const { productList } = smtgProductListRes.data.result;
- for (let item of productList) {
- if (item['unlockStatus'] === 1 && item['shelfCategory'].toString() === category) {
- productListByCategory.push(item);
- }
- }
- if (productListByCategory && productListByCategory.length > 0) {
- console.log(`待解锁的商品数量:${productListByCategory.length}`);
- await smtg_unlockProduct(productListByCategory[productListByCategory.length - 1]['productId']);
- } else {
- console.log("该类型商品暂时无法解锁");
- }
- }
-}
-//升级货架和商品
-async function upgrade() {
- superMarketUpgrade = $.getdata('jdSuperMarketUpgrade') ? $.getdata('jdSuperMarketUpgrade') : superMarketUpgrade;
- if ($.isNode() && process.env.SUPERMARKET_UPGRADE) {
- superMarketUpgrade = process.env.SUPERMARKET_UPGRADE;
- }
- if (`${superMarketUpgrade}` === 'false') {
- console.log(`\n自动升级: 您设置的是关闭自动升级\n`);
- return
- }
- console.log(`\n*************开始检测升级商品,如遇到商品能解锁,则优先解锁***********`)
- console.log('目前没有平稳升级,只取倒数几个商品进行升级,普通货架取倒数4个商品,冰柜货架取倒数3个商品,水果货架取倒数2个商品')
- const smtgProductListRes = await smtg_productList();
- if (smtgProductListRes.data.bizCode === 0) {
- let productType1 = [], shelfCategory_1 = [], shelfCategory_2 = [], shelfCategory_3 = [];
- const { productList } = smtgProductListRes.data.result;
- for (let item of productList) {
- if (item['productType'] === 1) {
- productType1.push(item);
- }
- }
- for (let item2 of productType1) {
- if (item2['shelfCategory'] === 1) {
- shelfCategory_1.push(item2);
- }
- if (item2['shelfCategory'] === 2) {
- shelfCategory_2.push(item2);
- }
- if (item2['shelfCategory'] === 3) {
- shelfCategory_3.push(item2);
- }
- }
- shelfCategory_1 = shelfCategory_1.slice(-4);
- shelfCategory_2 = shelfCategory_2.slice(-3);
- shelfCategory_3 = shelfCategory_3.slice(-2);
- const shelfCategorys = shelfCategory_1.concat(shelfCategory_2).concat(shelfCategory_3);
- console.log(`\n商品名称 归属货架 目前等级 解锁状态 可升级状态`)
- for (let item of shelfCategorys) {
- console.log(` ${item["name"].length<3?item["name"]+`\xa0`:item["name"]} ${item['shelfCategory'] === 1 ? '普通货架' : item['shelfCategory'] === 2 ? '冰柜货架' : item['shelfCategory'] === 3 ? '水果货架':'未知货架'} ${item["unlockStatus"] === 0 ? '---' : item["level"]+'级'} ${item["unlockStatus"] === 0 ? '未解锁' : '已解锁'} ${item["upgradeStatus"] === 1 ? '可以升级' : item["upgradeStatus"] === 0 ? '不可升级':item["upgradeStatus"]}`)
- }
- shelfCategorys.sort(sortSyData);
- for (let item of shelfCategorys) {
- if (item['unlockStatus'] === 1) {
- console.log(`\n开始解锁商品:${item['name']}`)
- await smtg_unlockProduct(item['productId']);
- break;
- }
- if (item['upgradeStatus'] === 1) {
- console.log(`\n开始升级商品:${item['name']}`)
- await smtg_upgradeProduct(item['productId']);
- break;
- }
- }
- }
- console.log('\n**********开始检查能否升级货架***********');
- const shelfListRes = await smtg_shelfList();
- if (shelfListRes.data.bizCode === 0) {
- const { shelfList } = shelfListRes.data.result;
- let shelfList_upgrade = [];
- for (let item of shelfList) {
- if (item['upgradeStatus'] === 1) {
- shelfList_upgrade.push(item);
- }
- }
- console.log(`待升级货架数量${shelfList_upgrade.length}个`);
- if (shelfList_upgrade && shelfList_upgrade.length > 0) {
- shelfList_upgrade.sort(sortSyData);
- console.log("\n可升级货架名 等级 升级所需金币");
- for (let item of shelfList_upgrade) {
- console.log(` [${item["name"]}] ${item["level"]}/${item["maxLevel"]} ${item["upgradeCostGold"]}`);
- }
- console.log(`开始升级[${shelfList_upgrade[0].name}]货架,当前等级${shelfList_upgrade[0].level},所需金币${shelfList_upgrade[0].upgradeCostGold}\n`);
- await smtg_upgradeShelf(shelfList_upgrade[0].shelfId);
- }
- }
-}
-async function manageProduct() {
- console.log(`安排上货(单价最大商品)`);
- const shelfListRes = await smtg_shelfList();
- if (shelfListRes.data.bizCode === 0) {
- const { shelfList } = shelfListRes.data.result;
- console.log(`我的货架数量:${shelfList && shelfList.length}`);
- let shelfListUnlock = [];//可以上架的货架
- for (let item of shelfList) {
- if (item['groundStatus'] === 1 || item['groundStatus'] === 2) {
- shelfListUnlock.push(item);
- }
- }
- for (let item of shelfListUnlock) {
- const productListRes = await smtg_shelfProductList(item.shelfId);//查询该货架可以上架的商品
- if (productListRes.data.bizCode === 0) {
- const { productList } = productListRes.data.result;
- let productNow = [], productList2 = [];
- for (let item1 of productList) {
- if (item1['groundStatus'] === 2) {
- productNow.push(item1);
- }
- if (item1['productType'] === 1) {
- productList2.push(item1);
- }
- }
- // console.log(`productNow${JSON.stringify(productNow)}`)
- // console.log(`productList2${JSON.stringify(productList2)}`)
- if (productList2 && productList2.length > 0) {
- productList2.sort(sortTotalPriceGold);
- // console.log(productList2)
- if (productNow && productNow.length > 0) {
- if (productList2.slice(-1)[0]['productId'] === productNow[0]['productId']) {
- console.log(`货架[${item.shelfId}]${productNow[0]['name']}已上架\n`)
- continue;
- }
- }
- await smtg_ground(productList2.slice(-1)[0]['productId'], item['shelfId'])
- }
- }
- }
- }
-}
-async function limitTimeProduct() {
- const smtgProductListRes = await smtg_productList();
- if (smtgProductListRes.data.bizCode === 0) {
- const { productList } = smtgProductListRes.data.result;
- let productList2 = [];
- for (let item of productList) {
- if (item['productType'] === 2 && item['groundStatus'] === 1) {
- //未上架并且限时商品
- console.log(`出现限时商品[${item.name}]`)
- productList2.push(item);
- }
- }
- if (productList2 && productList2.length > 0) {
- for (let item2 of productList2) {
- const { shelfCategory } = item2;
- const shelfListRes = await smtg_shelfList();
- if (shelfListRes.data.bizCode === 0) {
- const { shelfList } = shelfListRes.data.result;
- let shelfList2 = [];
- for (let item3 of shelfList) {
- if (item3['shelfCategory'] === shelfCategory && (item3['groundStatus'] === 1 || item3['groundStatus'] === 2)) {
- shelfList2.push(item3['shelfId']);
- }
- }
- if (shelfList2 && shelfList2.length > 0) {
- const groundRes = await smtg_ground(item2['productId'], shelfList2.slice(-1)[0]);
- if (groundRes.data.bizCode === 0) {
- console.log(`限时商品上架成功`);
- message += `【限时商品】上架成功\n`;
- }
- }
- }
- }
- } else {
- console.log(`限时商品已经上架或暂无限时商品`);
- }
- }
-}
-
-//=============================================脚本使用到的京东API=====================================
-function updatePkActivityId(url = 'https://raw.githubusercontent.com/lxk0301/updateTeam/master/jd_updateTeam.json') {
- return new Promise(resolve => {
- //https://cdn.jsdelivr.net/gh/lxk0301/updateTeam@master/jd_updateTeam.json
- //https://raw.githubusercontent.com/lxk0301/updateTeam/master/jd_updateTeam.json
- $.get({url}, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- // console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- $.updatePkActivityIdRes = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function updatePkActivityIdCDN(url = 'https://cdn.jsdelivr.net/gh/lxk0301/updateTeam@master/jd_updateTeam.json') {
- return new Promise(resolve => {
- //https://cdn.jsdelivr.net/gh/lxk0301/updateTeam@master/jd_updateTeam.json
- //https://raw.githubusercontent.com/lxk0301/updateTeam/master/jd_updateTeam.json
- $.get({url}, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- $.updatePkActivityIdRes = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function smtgDoShopTask(taskId, itemId) {
- return new Promise((resolve) => {
- const body = {
- "taskId": taskId
- }
- if (itemId) {
- body.itemId = itemId;
- }
- $.get(taskUrl('smtg_doShopTask', body), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function smtgObtainShopTaskPrize(taskId) {
- return new Promise((resolve) => {
- const body = {
- "taskId": taskId
- }
- $.get(taskUrl('smtg_obtainShopTaskPrize', body), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function smtgQueryShopTask() {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_queryShopTask'), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function smtgSignList() {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_signList'), (err, resp, data) => {
- try {
- // console.log('ddd----ddd', data)
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function smtgHome() {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_home'), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- if (data.code === 0 && data.data.success) {
- const { result } = data.data;
- const { shopName, totalGold, totalBlue } = result;
- $.circleStatus = result.circleStatus;
- subTitle = shopName;
- message += `【总金币】${totalGold}个\n`;
- message += `【总蓝币】${totalBlue}个\n`;
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//查询商圈任务列表
-function smtgQueryPkTask() {
- return new Promise( (resolve) => {
- $.get(taskUrl('smtg_queryPkTask'), async (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- if (data.code === 0) {
- if (data.data.bizCode === 0) {
- const { taskList } = data.data.result;
- console.log(`\n 商圈任务 状态`)
- for (let item of taskList) {
- if (item.taskStatus === 1) {
- if (item.prizeStatus === 1) {
- //任务已做完,但未领取奖励, 现在为您领取奖励
- await smtgObtainPkTaskPrize(item.taskId);
- } else if (item.prizeStatus === 0) {
- console.log(`[${item.title}] 已做完 ${item.finishNum}/${item.targetNum}`);
- }
- } else {
- console.log(`[${item.title}] 未做完 ${item.finishNum}/${item.targetNum}`)
- if (item.content) {
- const { itemId } = item.content[item.type];
- console.log('itemId', itemId)
- await smtgDoPkTask(item.taskId, itemId);
- }
- }
- }
- } else {
- console.log(`${data.data.bizMsg}`)
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//PK邀请好友
-function smtgDoAssistPkTask(code) {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_doAssistPkTask', {"inviteCode": code}), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function smtgReceiveCoin(type) {
- return new Promise((resolve) => {
- const body = {
- "type": type
- }
- $.get(taskUrl('smtg_receiveCoin', body), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//领取PK任务做完后的奖励
-function smtgObtainPkTaskPrize(taskId) {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_obtainPkTaskPrize', {"taskId": taskId}), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function smtgDoPkTask(taskId, itemId) {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_doPkTask', {"taskId": taskId, "itemId": itemId}), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function smtg_joinPkTeam(teamId, inviteCode, sharePkActivityId) {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_joinPkTeam', { teamId, inviteCode, "channel": "3", sharePkActivityId }), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function smtg_getTeamPkDetailInfo() {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_getTeamPkDetailInfo'), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function smtg_businessCirclePKDetail() {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_businessCirclePKDetail'), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function smtg_getBusinessCircleList() {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_getBusinessCircleList'), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//加入商圈API
-function smtg_joinBusinessCircle(circleId) {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_joinBusinessCircle', { circleId }), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function smtg_businessCircleIndex() {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_businessCircleIndex'), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function smtg_receivedPkTeamPrize() {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_receivedPkTeamPrize', {"channel": "1"}), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//领取商圈PK奖励
-function smtg_getPkPrize() {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_getPkPrize'), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function smtg_quitBusinessCircle() {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_quitBusinessCircle'), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//我的货架
-function smtg_shelfList() {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_shelfList'), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//检查某个货架可以上架的商品列表
-function smtg_shelfProductList(shelfId) {
- return new Promise((resolve) => {
- console.log(`开始检查货架[${shelfId}] 可上架产品`)
- $.get(taskUrl('smtg_shelfProductList', { shelfId }), (err, resp, data) => {
- try {
- // console.log(`检查货架[${shelfId}] 可上架产品结果:${data}`)
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//升级商品
-function smtg_upgradeProduct(productId) {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_upgradeProduct', { productId }), (err, resp, data) => {
- try {
- // console.log(`升级商品productId[${productId}]结果:${data}`);
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- console.log(`升级商品结果\n${data}`);
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//解锁商品
-function smtg_unlockProduct(productId) {
- return new Promise((resolve) => {
- console.log(`开始解锁商品`)
- $.get(taskUrl('smtg_unlockProduct', { productId }), (err, resp, data) => {
- try {
- // console.log(`解锁商品productId[${productId}]结果:${data}`);
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//升级货架
-function smtg_upgradeShelf(shelfId) {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_upgradeShelf', { shelfId }), (err, resp, data) => {
- try {
- // console.log(`升级货架shelfId[${shelfId}]结果:${data}`);
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- console.log(`升级货架结果\n${data}`)
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-//解锁货架
-function smtg_unlockShelf(shelfId) {
- return new Promise((resolve) => {
- console.log(`开始解锁货架`)
- $.get(taskUrl('smtg_unlockShelf', { shelfId }), (err, resp, data) => {
- try {
- // console.log(`解锁货架shelfId[${shelfId}]结果:${data}`);
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function smtg_ground(productId, shelfId) {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_ground', { productId, shelfId }), (err, resp, data) => {
- try {
- // console.log(`上架商品结果:${data}`);
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function smtg_productList() {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_productList'), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function smtg_lotteryIndex() {
- return new Promise((resolve) => {
- $.get(taskUrl('smtg_lotteryIndex', {"costType":1,"channel":1}), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function smtg_drawLottery() {
- return new Promise(async (resolve) => {
- await $.wait(1000);
- $.get(taskUrl('smtg_drawLottery', {"costType":1,"channel":1}), (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京小超: API查询请求失败 ‼️‼️')
- console.log(JSON.stringify(err));
- } else {
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function sortSyData(a, b) {
- return a['upgradeCostGold'] - b['upgradeCostGold']
-}
-function sortTotalPriceGold(a, b) {
- return a['previewTotalPriceGold'] - b['previewTotalPriceGold']
-}
-//格式化助力码
-function shareCodesFormat() {
- return new Promise(resolve => {
- console.log(`第${$.index}个京东账号的助力码:::${jdSuperMarketShareArr[$.index - 1]}`)
- if (jdSuperMarketShareArr[$.index - 1]) {
- newShareCodes = jdSuperMarketShareArr[$.index - 1].split('@');
- } else {
- console.log(`由于您未提供与京京东账号相对应的shareCode,下面助力将采纳本脚本自带的助力码\n`)
- const tempIndex = $.index > shareCodes.length ? (shareCodes.length - 1) : ($.index - 1);
- newShareCodes = shareCodes[tempIndex].split('@');
- }
- console.log(`格式化后第${$.index}个京东账号的助力码${JSON.stringify(newShareCodes)}`)
- resolve();
- })
-}
-function requireConfig() {
- return new Promise(resolve => {
- // console.log('\n开始获取京小超配置文件\n')
- notify = $.isNode() ? require('./sendNotify') : '';
- //Node.js用户请在jdCookie.js处填写京东ck;
- const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
- //IOS等用户直接用NobyDa的jd cookie
- if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- if (jdCookieNode[item]) {
- cookiesArr.push(jdCookieNode[item])
- }
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
- } else {
- cookiesArr.push(...[$.getdata('CookieJD'), $.getdata('CookieJD2')])
- }
- console.log(`共${cookiesArr.length}个京东账号\n`);
- console.log(`京小超已改版,目前暂不用助力, 故无助力码`)
- // console.log(`\n京小超商圈助力码::${JSON.stringify(jdSuperMarketShareArr)}`);
- // console.log(`您提供了${jdSuperMarketShareArr.length}个账号的助力码\n`);
- resolve()
- })
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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 taskUrl(function_id, body = {}) {
- return {
- url: `${JD_API_HOST}?functionId=${function_id}&appid=jdsupermarket&clientVersion=8.0.0&client=m&body=${escape(JSON.stringify(body))}&t=${Date.now()}`,
- headers: {
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- 'Host': 'api.m.jd.com',
- 'Cookie': cookie,
- 'Referer': 'https://jdsupermarket.jd.com/game',
- 'Origin': 'https://jdsupermarket.jd.com',
- }
- }
-}
-/**
- * 生成随机数字
- * @param {number} min 最小值(包含)
- * @param {number} max 最大值(包含)
- */
-function randomFriendPin(min, max) {
- return Math.round(Math.random()*(max - min) + min);
-}
-// prettier-ignore
-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)}
diff --git a/jd_syj.js b/jd_syj.js
deleted file mode 100644
index 18fc684..0000000
--- a/jd_syj.js
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * @Author: lxk0301 https://github.com/lxk0301
- * @Date: 2020-11-27 09:19:21
- * @Last Modified by: lxk0301
- * @Last Modified time: 2020-11-27 09:58:02
- */
-/*
-十元街脚本,一周签到下来可获得30京豆,一天任意时刻运行一次即可
-更新地址:https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_syj.js
-参考github@jidesheng6修改而来
-已支持IOS双京东账号, Node.js支持N个京东账号
-脚本兼容: QuantumultX, Surge, Loon, 小火箭,JSBox, Node.js
-============Quantumultx===============
-[task_local]
-#十元街
-10 7 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_syj.js, tag=十元街, enabled=true
-
-================Loon==============
-[Script]
-cron "10 7 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_syj.js, tag=十元街
-
-===============Surge=================
-十元街 = type=cron,cronexp="10 7 * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_syj.js
-
-============小火箭=========
-十元街 = type=cron,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_syj.js, cronexpr="10 7 * * *", timeout=200, enable=true
- */
-const $ = new Env('十元街');
-
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-let jdNotify = true;//是否关闭通知,false打开通知推送,true关闭通知推送
-const randomCount = $.isNode() ? 20 : 5;
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '', message;
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- cookiesArr.push(...[$.getdata('CookieJD'), $.getdata('CookieJD2')]);
-}
-const JD_API_HOST = 'https://api.m.jd.com/api';
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- message = '';
- await TotalBean();
- console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- await userSignIn();
- await showMsg();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-
-function showMsg() {
- return new Promise(resolve => {
- $.msg($.name, '', `【京东账号${$.index}】${$.nickName}\n${message}`);
- resolve()
- })
-}
-function userSignIn() {
- return new Promise(resolve => {
- const body = {"activityId":"8d6845fe2e77425c82d5078d314d33c5","inviterId":"VMIQlLQqjQyjZokQmv5bIDgq011L0Ov8","channel":"MiniProgram"};
- $.get(taskUrl('userSignIn', body), (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) {
- console.log(`今日签到成功`)
- if (data.data) {
- let { alreadySignDays, beanTotalNum, todayPrize, eachDayPrize } = data.data;
- message += `【第${alreadySignDays}日签到】成功,获得${todayPrize.beanAmount}京豆 🐶\n`;
- if (alreadySignDays === 7) alreadySignDays = 0;
- message += `【明日签到】可获得${eachDayPrize[alreadySignDays].beanAmount}京豆 🐶\n`;
- message += `【累计获得】${beanTotalNum}京豆 🐶\n`;
- }
- } else if (data.code === 81) {
- console.log(`今日已签到`)
- message += `【签到】失败,今日已签到`;
- } else {
- console.log(`异常:${JSON.stringify(data)}`)
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function taskUrl(function_id, body = {}) {
- return {
- url: `${JD_API_HOST}?functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=swat_miniprogram&osVersion=5.0.0&clientVersion=3.1.3&fromType=wxapp×tamp=${new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000}`,
- headers: {
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-cn",
- "Connection": "keep-alive",
- "Content-Type": "application/x-www-form-urlencoded",
- "Host": "api.m.jd.com",
- "Referer": "https://servicewechat.com/wxa5bf5ee667d91626/108/page-frame.html",
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- }
- }
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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 safeGet(data) {
- try {
- if (typeof JSON.parse(data) == "object") {
- return true;
- }
- } catch (e) {
- console.log(e);
- console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
- return false;
- }
-}
-// prettier-ignore
-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,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("",`\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 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();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){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="",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}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));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
diff --git a/jd_unsubscribe.js b/jd_unsubscribe.js
deleted file mode 100644
index 7e04f0a..0000000
--- a/jd_unsubscribe.js
+++ /dev/null
@@ -1,336 +0,0 @@
-/*
-脚本:取关京东店铺和商品
-更新时间:2020-11-22
-因种豆得豆和宠汪汪以及NobyDa大佬的京东签到脚本会关注店铺和商品,故此脚本用来取消已关注的店铺和商品
-默认每运行一次脚本取消关注10个商品,10个店铺。可结合boxjs自定义取消多少个(目前测试通过最大数量是一次性取消300个商品无异常,大于300请自行测试,建议尽量不要一次性全部取消以免出现问题)。
-建议此脚本运行时间在 种豆得豆和宠汪汪脚本运行之后 再执行
-现有功能: 1、取关商品。2、取关店铺。3、匹配到boxjs输入的过滤关键词后,不再进行此商品/店铺后面(包含输入的关键词商品/店铺)的取关。4、支持京东双账号
-脚本兼容: Quantumult X, Surge, Loon, JSBox, Node.js
-// Quantumult X
-[task_local]
-#取关京东店铺商品
-55 23 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_unsubscribe.js, tag=取关京东店铺商品, enabled=true
-// Loon
-[Script]
-cron "55 23 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_unsubscribe.js,tag=取关京东店铺商品
-// Surge
-取关京东店铺商品 = type=cron,cronexp="55 23 * * *",wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_unsubscribe.js
- */
-const $ = new Env('取关京东店铺和商品');
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-const notify = $.isNode() ? require('./sendNotify') : '';
-
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- cookiesArr.push($.getdata('CookieJD'));
- cookiesArr.push($.getdata('CookieJD2'));
-}
-const jdNotify = $.getdata('jdUnsubscribeNotify');//是否关闭通知,false打开通知推送,true关闭通知推送
-let goodPageSize = $.getdata('jdUnsubscribePageSize') || 20;// 运行一次取消多少个已关注的商品。数字0表示不取关任何商品
-let shopPageSize = $.getdata('jdUnsubscribeShopPageSize') || 20;// 运行一次取消多少个已关注的店铺。数字0表示不取关任何店铺
-let stopGoods = $.getdata('jdUnsubscribeStopGoods') || '';//遇到此商品不再进行取关,此处内容需去商品详情页(自营处)长按拷贝商品信息
-let stopShop = $.getdata('jdUnsubscribeStopShop') || '';//遇到此店铺不再进行取关,此处内容请尽量从头开始输入店铺名称
-const JD_API_HOST = 'https://wq.jd.com/fav';
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg('【京东账号一】取关京东店铺商品失败', '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- await requireConfig();
- await jdUnsubscribe();
- await showMsg();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-async function jdUnsubscribe(doubleKey) {
- await Promise.all([
- unsubscribeGoods(doubleKey),
- unsubscribeShops()
- ])
- await Promise.all([
- getFollowShops(),
- getFollowGoods()
- ])
-}
-function showMsg() {
- if (!jdNotify || jdNotify === 'false') {
- $.msg($.name, ``, `【京东账号${$.index}】${$.nickName}\n【已取消关注店铺】${$.unsubscribeShopsCount}个\n【已取消关注商品】${$.unsubscribeGoodsCount}个\n【还剩关注店铺】${$.shopsTotalNum}个\n【还剩关注商品】${$.goodsTotalNum}个\n`);
- } else {
- $.log(`\n【京东账号${$.index}】${$.nickName}\n【已取消关注店铺】${$.unsubscribeShopsCount}个\n【已取消关注商品】${$.unsubscribeGoodsCount}个\n【还剩关注店铺】${$.shopsTotalNum}个\n【还剩关注商品】${$.goodsTotalNum}个\n`);
- }
-}
-function unsubscribeGoods() {
- return new Promise(async (resolve) => {
- let followGoods = await getFollowGoods();
- if (followGoods.iRet === '0') {
- let count = 0;
- $.unsubscribeGoodsCount = count;
- if ((goodPageSize * 1) !== 0) {
- if (followGoods.totalNum > 0) {
- for (let item of followGoods.data) {
-
- console.log(`是否匹配::${item.commTitle.indexOf(stopGoods.replace(/\ufffc|\s*/g, ''))}`)
-
- if (stopGoods && item.commTitle.indexOf(stopGoods.replace(/\ufffc|\s*/g, '')) > -1) {
- console.log(`匹配到了您设定的商品--${stopGoods},不在进行取消关注商品`)
- break;
- }
- let res = await unsubscribeGoodsFun(item.commId);
- // console.log('取消关注商品结果', res);
- if (res.iRet === 0 && res.errMsg === 'success') {
- console.log(`取消关注商品---${item.commTitle.substring(0, 20).concat('...')}---成功\n`)
- count ++;
- } else {
- console.log(`取消关注商品---${item.commTitle.substring(0, 20).concat('...')}---失败\n`)
- }
- }
- $.unsubscribeGoodsCount = count;
- resolve(count)
- } else {
- resolve(count)
- }
- } else {
- console.log(`\n您设置的是不取关商品\n`);
- resolve(count);
- }
- }
- })
-}
-function getFollowGoods() {
- return new Promise((resolve) => {
- const option = {
- url: `${JD_API_HOST}/comm/FavCommQueryFilter?cp=1&pageSize=${goodPageSize}&category=0&promote=0&cutPrice=0&coupon=0&stock=0&areaNo=1_72_4139_0&sceneval=2&g_login_type=1&callback=jsonpCBKB&g_ty=ls`,
- headers: {
- "Host": "wq.jd.com",
- "Accept": "*/*",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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",
- "Referer": "https://wqs.jd.com/my/fav/goods_fav.shtml?ptag=37146.4.1&sceneval=2&jxsid=15963530166144677970",
- "Accept-Encoding": "gzip, deflate, br"
- },
- }
- $.get(option, (err, resp, data) => {
- try {
- data = JSON.parse(data.slice(14, -13));
- $.goodsTotalNum = data.totalNum;
- // console.log('data', data.data.length)
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- });
- })
-}
-function unsubscribeGoodsFun(commId) {
- return new Promise(resolve => {
- const option = {
- url: `${JD_API_HOST}/comm/FavCommDel?commId=${commId}&_=${Date.now()}&sceneval=2&g_login_type=1&callback=jsonpCBKP&g_ty=ls`,
- headers: {
- "Host": "wq.jd.com",
- "Accept": "*/*",
- "Connection": "keep-alive",
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- 'Referer': 'https://wqs.jd.com/my/fav/goods_fav.shtml?ptag=37146.4.1&sceneval=2&jxsid=15963530166144677970',
- 'Cookie': cookie,
- "Accept-Language": "zh-cn",
- "Accept-Encoding": "gzip, deflate, br"
- },
- }
- $.get(option, (err, resp, data) => {
- try {
- data = JSON.parse(data.slice(14, -13).replace(',}', '}'));
- // console.log('data', data);
- // console.log('data', data.errMsg);
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- });
- })
-}
-
-function unsubscribeShops() {
- return new Promise(async (resolve) => {
- let followShops = await getFollowShops();
- if (followShops.iRet === '0') {
- let count = 0;
- $.unsubscribeShopsCount = count;
- if ((shopPageSize * 1) !== 0) {
- if (followShops.totalNum > 0) {
- for (let item of followShops.data) {
- if (stopShop && (item.shopName && item.shopName.indexOf(stopShop.replace(/\s*/g, '')) > -1)) {
- console.log(`匹配到了您设定的店铺--${item.shopName},不在进行取消关注店铺`)
- break;
- }
- let res = await unsubscribeShopsFun(item.shopId);
- // console.log('取消关注店铺结果', res);
- if (res.iRet === '0') {
- console.log(`取消已关注店铺---${item.shopName}----成功\n`)
- count ++;
- } else {
- console.log(`取消已关注店铺---${item.shopName}----失败\n`)
- }
- }
- $.unsubscribeShopsCount = count;
- resolve(count)
- } else {
- resolve(count)
- }
- } else {
- console.log(`\n您设置的是不取关店铺\n`);
- resolve(count)
- }
- }
- })
-}
-function getFollowShops() {
- return new Promise((resolve) => {
- const option = {
- url: `${JD_API_HOST}/shop/QueryShopFavList?cp=1&pageSize=${shopPageSize}&sceneval=2&g_login_type=1&callback=jsonpCBKA&g_ty=ls`,
- headers: {
- "Host": "wq.jd.com",
- "Accept": "*/*",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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",
- "Referer": "https://wqs.jd.com/my/fav/shop_fav.shtml?sceneval=2&jxsid=15963530166144677970&ptag=7155.1.9",
- "Accept-Encoding": "gzip, deflate, br"
- },
- }
- $.get(option, (err, resp, data) => {
- try {
- data = JSON.parse(data.slice(14, -13));
- $.shopsTotalNum = data.totalNum;
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- });
- })
-}
-function unsubscribeShopsFun(shopId) {
- return new Promise(resolve => {
- const option = {
- url: `${JD_API_HOST}/shop/DelShopFav?shopId=${shopId}&_=${Date.now()}&sceneval=2&g_login_type=1&callback=jsonpCBKG&g_ty=ls`,
- headers: {
- "Host": "wq.jd.com",
- "Accept": "*/*",
- "Connection": "keep-alive",
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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"),
- 'Referer': 'https://wqs.jd.com/my/fav/shop_fav.shtml?sceneval=2&jxsid=15960121319555534107&ptag=7155.1.9',
- 'Cookie': cookie,
- "Accept-Language": "zh-cn",
- "Accept-Encoding": "gzip, deflate, br"
- },
- }
- $.get(option, (err, resp, data) => {
- try {
- data = JSON.parse(data.slice(14, -13));
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- });
- })
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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 requireConfig() {
- return new Promise(resolve => {
- if ($.isNode() && process.env.UN_SUBSCRIBES) {
- if (process.env.UN_SUBSCRIBES.indexOf('&') > -1) {
- $.UN_SUBSCRIBES = process.env.UN_SUBSCRIBES.split('&');
- } else if (process.env.UN_SUBSCRIBES.indexOf('\n') > -1) {
- $.UN_SUBSCRIBES = process.env.UN_SUBSCRIBES.split('\n');
- } else if (process.env.UN_SUBSCRIBES.indexOf('\\n') > -1) {
- $.UN_SUBSCRIBES = process.env.UN_SUBSCRIBES.split('\\n');
- } else {
- $.UN_SUBSCRIBES = process.env.UN_SUBSCRIBES.split();
- }
- console.log(`您secret设置的取关参数:\n${JSON.stringify($.UN_SUBSCRIBES)}`)
- goodPageSize = $.UN_SUBSCRIBES[0] || goodPageSize;
- shopPageSize = $.UN_SUBSCRIBES[1] || shopPageSize;
- stopGoods = $.UN_SUBSCRIBES[2] || stopGoods;
- stopShop = $.UN_SUBSCRIBES[3] || stopShop;
- }
- resolve()
- })
-}
-// prettier-ignore
-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)}
diff --git a/jd_xtg.js b/jd_xtg.js
deleted file mode 100644
index 4621585..0000000
--- a/jd_xtg.js
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
- * @Author: lxk0301
- * @Date: 2020-10-21 17:04:04
- * @Last Modified by: lxk0301
- * @Last Modified time: 2020-11-05 00:35:04
- */
-/**
- 星推官脚本 https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_xtg.js
- 星推官活动地址:https://prodev.m.jd.com/mall/active/3gSzKSnvrrhYushciUpzHcDnkYE3/index.html
- 活动时间:2020年10月21日 00:00:00-2020年11月11日 23:59:59
- 京豆先到先得!!!!!!!!!!!
- 出现任务做完没领取的情况,就再运行一次脚本
- 能做完所有的任务,包括自动抽奖,脚本会给内置的shareId助力
- 一共23个活动,耗时比较久,surge请加大timeout时间
- 支持京东双账号
- 脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
- // quantumultx
- [task_local]
- #京东星推官
- 2 0 * * * https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_xtg.js, tag=京东星推官, enabled=true
- // Loon
- [Script]
- cron "2 0 * * *" script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_xtg.js,tag=京东星推官
- // Surge
- 京东星推官 = type=cron,cronexp=2 0 * * *,wake-system=1,timeout=320,script-path=https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_xtg.js
- */
-const $ = new Env('京东星推官');
-const activeEndTime = '2020/11/11 23:59:59+08:00';//活动结束时间
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写京东ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
-} else {
- let cookiesData = $.getdata('CookiesJD') || "[]";
- cookiesData = jsonParse(cookiesData);
- cookiesArr = cookiesData.map(item => item.cookie);
- cookiesArr.push($.getdata('CookieJD'));
- cookiesArr.push($.getdata('CookieJD2'));
-}
-const starID = [
- 'bolangwutiaoren',
- 'oulebyangzi',
- 'meiditongliya',
- 'chuangweimaobuyi',
- 'quechaozhuyilong',
- 'haierchenxiao',
- 'feilipulixian',
- 'feilipurenjialun',
- 'feilipuwangziyi',
- 'changhongsongyi',
- 'jiuyangdenglun',
- 'aokesilingengxin',
- 'haixinchengguo',
- 'fangtai',
- 'lgyangzishan',
- 'laobansongweilong',
- 'haiermaoxiaotong',
- "skgwangyibo",
- "kongtiaozhangjike",
- "sanxingningjing",
- "xiaojiadianxiongziqi",
- "heidianliyitong",
- "oulebzhangyixing",
-];
-const shareID = [
- 'e646c144-28a7-4b1b-8145-5b0dbff107ec',
- 'b3fcb734-cbdd-4436-9f92-b13b445fc253',
- 'e2d63b19-19d6-4a20-b2af-74b828e703d0',
- 'a7a3b9b7-2872-4244-a627-3b82c271dee7',
- 'f7b521e7-5306-4908-ba8a-df2d221bdd9d',
- 'd17ec374-70d4-49d5-8673-7093e61f904c',
- '915b9567-dc88-4389-8be9-ecc25588353a',
- '7abdc8f4-d8f4-497f-8daa-cdab01cf645c',
- '50ecc8de-1ee5-4420-bbb8-1136d86d80db',
- 'fd0770e1-5007-45c1-8d69-402e02ff9a52',
- 'cb9e9a59-a86b-4a0d-a308-4503fe5baaa4',
- '93b3afeb-a18c-437c-b5ca-fbd9f389671d',
- '8778793c-e9ad-4339-a709-723ae3ebde8e',
- '921c376e-8cc5-4236-8242-ff8bb1b88a95',
- '8b3ce203-4b10-4c36-a87d-da8c82efe362',
- 'c8e1feb3-6ab1-4410-8444-1de8bd22e041',
- "dd6b5270-3e5e-436d-be0f-295a8604cf47",
- "7aef5700-4fa0-43b8-98fa-3a09f46ea47c",
- "be0ec81c-bf26-4b7b-9527-d02b0286e5af",
- "ecd890e0-db46-46c7-862e-cb9776c207dc",
- "91ceb3eb-df84-471e-ad77-320cd95763ee",
-];
-const JD_API_HOST = 'https://urvsaggpt.m.jd.com/guardianstar';
-!(async () => {
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.beanCount = 0;
- $.jdNum = 0;
- $.isLogin = true;
- $.nickName = '';
- const beforeTotal = await TotalBean();
- console.log(`\n===============开始【京东账号${$.index}】${$.nickName || $.UserName}==================\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, {"open-url": "https://bean.m.jd.com/"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- } else {
- $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。$.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。
- }
- continue
- }
- console.log(`一共${starID.length}个${$.name}任务,耗时会很久,请提前知晓`)
- $.beanCount = beforeTotal && beforeTotal['base'].jdNum;
- for (let index = 0; index < starID.length; index ++) {
- $.activeId = starID[index];
- $.j = index;
- await JD_XTG();
- }
- console.log(`\n等待8秒后,再去领取奖励\n`)
- console.log(`做任务之前京豆总计:${$.beanCount}`)
- await $.wait(8000);
- for (let index = 0; index < starID.length; index ++) {
- $.activeId = starID[index];
- $.j = index;
- await JD_XTG();
- await doSupport(shareID[index]);
- }
- const afterTotal = await TotalBean();
- $.jdNum = afterTotal['base'].jdNum;
- await showMsg();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-async function showMsg() {
- console.log(`\n做任务之前京豆总计:${$.beanCount}`)
- console.log(`做完任务后京豆总计:${$.jdNum}`);
- console.log(`活动活动京豆数量:${$.jdNum - $.beanCount}`);
- let nowTime = new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000;
- if (nowTime > new Date(activeEndTime).getTime()) {
- $.msg($.name, '活动已结束', `请删除或禁用此脚本\n如果帮助到您可以点下🌟STAR鼓励我一下,谢谢\n咱江湖再见\nhttps://github.com/lxk0301/jd_scripts`, {"open-url": "https://github.com/lxk0301/jd_scripts"});
- if ($.isNode()) await notify.sendNotify($.name + '活动已结束', `请删除此脚本\n如果帮助到您可以点下🌟STAR鼓励我一下,谢谢\n咱江湖再见\nhttps://github.com/lxk0301/jd_scripts`)
- } else {
- $.msg($.name, `账号${$.index} ${$.nickName || $.UserName}`, `做任务之前京豆总计:${$.beanCount}\n做完任务后京豆总计:${$.jdNum}\n${($.jdNum - $.beanCount) > 0 ? `获得京豆:${$.jdNum - $.beanCount}京豆 🐶(仅供参考)\n` : ''}京豆先到先得\n活动地址点击弹窗跳转后即可查看\n注:如未获得京豆就是已被分完`, {"open-url": "https://prodev.m.jd.com/mall/active/3gSzKSnvrrhYushciUpzHcDnkYE3/index.html"})
- if ($.isNode()) await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}`, `账号${$.index} ${$.nickName || $.UserName}\n做任务之前京豆总计:${$.beanCount}\n做完任务后京豆总计:${$.jdNum}\n${($.jdNum - $.beanCount) > 0 ? `获得京豆:${$.jdNum - $.beanCount}京豆 🐶(仅供参考)\n` : ''}京豆先到先得\n注:如未获得京豆就是已被分完\n活动结束时间:2020年11月12日 23:59:59\n活动地址:https://prodev.m.jd.com/mall/active/3gSzKSnvrrhYushciUpzHcDnkYE3/index.html`)
- }
-}
-async function JD_XTG() {
- await getHomePage();
- if ($.homeData && $.homeData.code === 200) {
- const { shopList, venueList, productList, orderSkuList, shareId } = $.homeData.data[0];
- console.log(`\n===========活动${$.j + 1}-[${starID[$.j]}] 助力码==========\n${shareId}\n`);
- for (let item of shopList) {
- console.log(`\n任务一:关注${item['shopName']}`)
- if (item['shopStatus'] === 4) {
- console.log(`入会任务,假入会`);
- await doTask('shop', item['shopId'], 0)
- continue
- }
- if (item['shopStatus'] === 3) {
- console.log(`此任务已做完,跳过`);
- continue
- }
- console.log(`shopStatus:::${item['shopStatus']}`)
- if (item['shopStatus'] !== 3 && item['shopStatus'] !== 4) {
- await doTask('shop', item['shopId'], item['shopStatus'])
- }
- // if (item['shopStatus'] === 2) {
- // await doTask('shop', item['shopId'], 2)
- // }
- // if (item['shopStatus'] === 4) {
- // await doTask('shop', item['shopId'], 4)
- // }
- }
- for (let item1 of venueList) {
- console.log(`\n任务二:逛逛[${item1['venueName']}]-${item1['venueStatus'] !== 3 ? '' : '已做完'}`)
- if (item1['venueStatus'] === 1) {
- await doTask('venue', item1['venueId'], 1);
- }
- if (item1['venueStatus'] === 2) {
- await doTask('venue', item1['venueId'], 2);
- }
- }
- for (let item2 of productList) {
- console.log(`\n任务三:逛逛[${item2['productName']}]-${item2['productStatus'] !== 3 ? '' : '已做完'}`)
- if (item2['productStatus'] === 1) {
- await doTask('product', item2['productId'], 1);
- }
- if (item2['productStatus'] === 2) {
- await doTask('product', item2['productId'], 2);
- }
- }
- //付定金 TODO
- // for (let item3 of orderSkuList) {
- // await doTask('order', item3['skuId'], 1);
- // await doTask('order', item3['skuId'], 2);
- // await doTask('order', item3['skuId'], 3);
- // await doTask('order', item3['skuId'], 0);
- //
- // await doTask('order', item3['skuId'], 2);
- // await doTask('order', item3['skuId'], 1);
- // }
- console.log(`\n开始抽奖\n`)
- await getDayPrizeStatus(4, `${$.activeId}#1`, 3);
- await getDayPrizeStatus(1, `${$.activeId}#2`, 3);
- } else {
- console.log(`京东服务器返回无数据!`)
- }
-}
-function getHomePage() {
- return new Promise(resolve => {
- $.get(taskUrl('getHomePage'), async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- $.homeData = JSON.parse(data);
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function doTask(type, id, status) {
- return new Promise(async resolve => {
- $.post(taskPostUrl(type, id, status), (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- console.log(`做任务结果:${data}`);
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-
-function doSupport(shareId) {
- return new Promise(async resolve => {
- const options = {
- "url": `${JD_API_HOST}/doSupport`,
- "body": `starId=${$.activeId}&shareId=${shareId}`,
- "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,
- "Host": "urvsaggpt.m.jd.com",
- "Referer": "https://urvsaggpt.m.jd.com/static/index.html",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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 {
- // console.log(`\n助力结果:${data}`);
- // data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-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 : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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(data);
- }
- })
- })
-}
-function getDayPrizeStatus(prizeType, prizeId, status) {
- return new Promise(async resolve => {
- const options = {
- "url": `${JD_API_HOST}/getDayPrizeStatus`,
- "body": `starId=${$.activeId}&status=${status}&prizeType=${prizeType}&prizeId=${prizeId}`,
- "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,
- "Host": "urvsaggpt.m.jd.com",
- "Referer": "https://urvsaggpt.m.jd.com/static/index.html",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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 {
- console.log(`抽奖结果:${data}`);
- // data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function taskPostUrl(type, id, status) {
- return {
- url: `${JD_API_HOST}/doTask`,
- body: `starId=${$.activeId}&type=${type}&id=${id}&status=${status}`,
- 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,
- "Host": "urvsaggpt.m.jd.com",
- "Referer": "https://urvsaggpt.m.jd.com/static/index.html",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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")
- }
- }
-}
-function jsonParse(str) {
- if (typeof str == "string") {
- try {
- return JSON.parse(str);
- } catch (e) {
- console.log(e);
- $.msg($.name, '', '不要在BoxJS手动复制粘贴修改cookie')
- return [];
- }
- }
-}
-function taskUrl(function_id) {
- return {
- url: `${JD_API_HOST}/${function_id}?t=${Date.now()}&starId=${$.activeId}`,
- headers: {
- "Accept": "application/json,text/plain, */*",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-cn",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "Host": "urvsaggpt.m.jd.com",
- "Referer": "https://urvsaggpt.m.jd.com/static/index.html",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0") : ($.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")
- }
- }
-}
-// prettier-ignore
-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,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("",`\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 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();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){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="",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}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));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)}
diff --git a/lxk0301.boxjs.json b/lxk0301.boxjs.json
deleted file mode 100644
index 81aa844..0000000
--- a/lxk0301.boxjs.json
+++ /dev/null
@@ -1,846 +0,0 @@
-{
- "id": "lxk0301.app.sub",
- "name": "lxk0301脚本订阅",
- "author": "@lxk0301",
- "icon": "https://avatars0.githubusercontent.com/u/21308593?s=52&v=4",
- "repo": "https://github.com/lxk0301/jd_scripts/",
- "apps": [
- {
- "id": "JD_Cookies",
- "name": "京东多账号 Ck 管理",
- "keys": ["CookiesJD"],
- "descs_html": [
- "请勿随意在输入框修改内容,建议通过脚本去获取cookie,若要修改,请按照JSON 格式修改。",
- "脚本地址【京东多 CK获取】,并按照此脚本注释进行配置",
- "使用方式【个人中心】获取对应的数据Code"
- ],
- "settings": [
- {
- "id": "CookiesJD",
- "name": "CK 列表",
- "val": "",
- "type": "textarea",
- "autoGrow": true,
- "rows": 8,
- "desc": "CK 列表 (JSON 格式)"
- }
- ],
- "icons": [
- "https://raw.githubusercontent.com/Orz-3/mini/master/jd.png",
- "https://raw.githubusercontent.com/Orz-3/task/master/jd.png"
- ],
- "author": "@dompling",
- "repo": "https://github.com/dompling/Script",
- "script": "https://raw.githubusercontent.com/dompling/Script/master/jd/JD_extra.js"
- },
- {
- "id": "JD_UA",
- "name": "自定义京东脚本的UserAgent",
- "keys": [
- "JDUA"
- ],
- "settings": [
- {
- "id": "JDUA",
- "name": "自定义京东脚本的UserAgent",
- "val": "",
- "type": "text",
- "desc": "不懂不知不会UserAgent的请不要随意填写内容"
- }
- ],
- "author": "@lxk0301",
- "repo": "https://github.com/lxk0301/jd_scripts",
- "icons": [
- "https://raw.githubusercontent.com/Orz-3/mini/master/jd.png",
- "https://raw.githubusercontent.com/Orz-3/task/master/jd.png"
- ]
- },
- {
- "id": "jd_fruit",
- "name": "东东农场",
- "keys": [
- "jd_fruit_name",
- "jd_fruit1",
- "jd_fruit2",
- "jd_fruit3",
- "jd_fruit4",
- "jd2_fruit_name",
- "jd2_fruit1",
- "jd2_fruit2",
- "jd2_fruit3",
- "jd2_fruit4"
- ],
- "descs_html": [
- "获取Cookie请查看NobyDa京东签到脚本说明脚本注释
"
- ],
- "settings": [
- {
- "id": "jdFruitNotify",
- "name": "静默运行",
- "val": false,
- "type": "boolean",
- "desc": "运行东东农场脚本时不发出系统通知"
- },
- {
- "id": "jdFruitBeanCard",
- "name": "使用水滴换豆卡",
- "val": false,
- "type": "boolean",
- "desc": "使用水滴换豆卡(如果出现限时活动是100g水换20豆,此时比浇水划算,推荐换豆)"
- },
- {
- "id": "jd_fruit_name",
- "name": "京东账号一昵称",
- "val": "",
- "type": "text",
- "desc": "京东账号昵称,用于区分自己的京东账号(非必填,建议多个京东账号使用)"
- },
- {
- "id": "jd_fruit1",
- "name": "账号一的互助码1",
- "val": "",
- "type": "text",
- "desc": "京东水果互助码.这是别人的shareCode,你帮别人助力."
- },
- {
- "id": "jd_fruit2",
- "name": "账号一的互助码2",
- "val": "",
- "type": "text",
- "desc": "京东水果互助码."
- },
- {
- "id": "jd_fruit3",
- "name": "账号一的互助码3",
- "val": "",
- "type": "text",
- "desc": "京东水果互助码.这是别人的shareCode,你帮别人助力."
- },
- {
- "id": "jd_fruit4",
- "name": "账号一的互助码4",
- "val": "",
- "type": "text",
- "desc": "京东水果互助码.这是别人的shareCode,你帮别人助力."
- },
- {
- "id": "jd2_fruit_name",
- "name": "京东账号二昵称",
- "val": "",
- "type": "text",
- "desc": "京东账号昵称,用于区分自己的京东账号(非必填,建议多个京东账号使用)"
- },
- {
- "id": "jd2_fruit1",
- "name": "账号二的互助码1",
- "val": "",
- "type": "text",
- "desc": "京东水果互助码.这是别人的shareCode,你帮别人助力."
- },
- {
- "id": "jd2_fruit2",
- "name": "账号二的互助码2",
- "val": "",
- "type": "text",
- "desc": "京东水果互助码."
- },
- {
- "id": "jd2_fruit3",
- "name": "账号二的互助码3",
- "val": "",
- "type": "text",
- "desc": "京东水果互助码.这是别人的shareCode,你帮别人助力."
- },
- {
- "id": "jd2_fruit4",
- "name": "账号二的互助码4",
- "val": "",
- "type": "text",
- "desc": "京东水果互助码.这是别人的shareCode,你帮别人助力."
- }
- ],
- "author": "@lxk0301",
- "repo": "https://github.com/lxk0301/jd_scripts",
- "script": "https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_fruit.js",
- "icons": [
- "https://raw.githubusercontent.com/58xinian/icon/master/jdnc_mini.png",
- "https://raw.githubusercontent.com/58xinian/icon/master/jdnc.png"
- ]
- },
- {
- "id": "jd_pet",
- "name": "东东萌宠",
- "keys": [
- "jd_pet_name",
- "jd_pet1",
- "jd_pet2",
- "jd_pet3",
- "jd_pet4",
- "jd_pet5",
- "jd2_pet_name",
- "jd2_pet1",
- "jd2_pet2",
- "jd2_pet3",
- "jd2_pet4",
- "jd2_pet5"
- ],
- "settings": [
- {
- "id": "jdPetNotify",
- "name": "静默运行",
- "val": false,
- "type": "boolean",
- "desc": "运行东东萌宠脚本时不发出系统通知"
- },
- {
- "id": "jd_pet_name",
- "name": "京东账号昵称",
- "val": "",
- "type": "text",
- "desc": "京东账号昵称,用于区分自己的京东账号(非必填,建议多个京东账号使用)"
- },
- {
- "id": "jd_pet1",
- "name": "互助码1",
- "val": "",
- "type": "text",
- "desc": "东东萌宠互助码.这是别人的shareCode,你帮别人助力."
- },
- {
- "id": "jd_pet2",
- "name": "互助码2",
- "val": "",
- "type": "text",
- "desc": "东东萌宠互助码.这是别人的shareCode,你帮别人助力."
- },
- {
- "id": "jd_pet3",
- "name": "互助码3",
- "val": "",
- "type": "text",
- "desc": "东东萌宠互助码.这是别人的shareCode,你帮别人助力."
- },
- {
- "id": "jd_pet4",
- "name": "互助码4",
- "val": "",
- "type": "text",
- "desc": "东东萌宠互助码.这是别人的shareCode,你帮别人助力."
- },
- {
- "id": "jd_pet5",
- "name": "互助码5",
- "val": "",
- "type": "text",
- "desc": "东东萌宠互助码.这是别人的shareCode,你帮别人助力."
- },
- {
- "id": "jd2_pet_name",
- "name": "京东账号2昵称",
- "val": "",
- "type": "text",
- "desc": "京东账号2昵称,用于区分自己的京东账号(非必填,建议多个京东账号使用)"
- },
- {
- "id": "jd2_pet1",
- "name": "账号二互助码1",
- "val": "",
- "type": "text",
- "desc": "东东萌宠互助码.这是别人的shareCode,你帮别人助力."
- },
- {
- "id": "jd2_pet2",
- "name": "账号二互助码2",
- "val": "",
- "type": "text",
- "desc": "东东萌宠互助码.这是别人的shareCode,你帮别人助力."
- },
- {
- "id": "jd2_pet3",
- "name": "账号二互助码3",
- "val": "",
- "type": "text",
- "desc": "东东萌宠互助码.这是别人的shareCode,你帮别人助力."
- },
- {
- "id": "jd2_pet4",
- "name": "账号二互助码4",
- "val": "",
- "type": "text",
- "desc": "东东萌宠互助码.这是别人的shareCode,你帮别人助力."
- },
- {
- "id": "jd2_pet5",
- "name": "账号二互助码5",
- "val": "",
- "type": "text",
- "desc": "东东萌宠互助码.这是别人的shareCode,你帮别人助力."
- }
- ],
- "author": "@lxk0301",
- "repo": "https://github.com/lxk0301/jd_scripts",
- "script": "https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_pet.js",
- "icons": [
- "https://raw.githubusercontent.com/58xinian/icon/master/jdmc_mini.png",
- "https://raw.githubusercontent.com/58xinian/icon/master/jdmc.png"
- ]
- },
- {
- "id": "jd_plantBean",
- "name": "京东种豆",
- "keys": [
- "jd_plant_bean_name",
- "jd_plantBean1",
- "jd_plantBean2",
- "jd_plantBean3",
- "jd2_plant_bean_name",
- "jd2_plantBean1",
- "jd2_plantBean2",
- "jd2_plantBean3"
- ],
- "settings": [
- {
- "id": "jdPlantBeanNotify",
- "name": "静默运行",
- "val": true,
- "type": "boolean",
- "desc": "运行种豆脚本时不发出系统通知"
- },
- {
- "id": "jd_plant_bean_name",
- "name": "京东账号一昵称",
- "val": "",
- "type": "text",
- "desc": "京东账号昵称,用于区分自己的京东账号(非必填,建议多个京东账号使用)"
- },
- {
- "id": "jd_plantBean1",
- "name": "京东账号一互助码1",
- "val": "",
- "type": "text",
- "desc": "种豆得豆互助码.这是别人的助力码,你帮别人助力."
- },
- {
- "id": "jd_plantBean2",
- "name": "京东账号一互助码2",
- "val": "",
- "type": "text",
- "desc": "种豆得豆互助码.这是别人的助力码,你帮别人助力."
- },
- {
- "id": "jd_plantBean3",
- "name": "京东账号一互助码3",
- "val": "",
- "type": "text",
- "desc": "种豆得豆互助码.这是别人的助力码,你帮别人助力."
- },
- {
- "id": "jd2_plant_bean_name",
- "name": "京东账号二昵称",
- "val": "",
- "type": "text",
- "desc": "京东账号二昵称,用于区分自己的京东账号(非必填,建议多个京东账号使用)"
- },
- {
- "id": "jd2_plantBean1",
- "name": "京东账号二互助码1",
- "val": "",
- "type": "text",
- "desc": "种豆得豆互助码.这是别人的助力码,你帮别人助力."
- },
- {
- "id": "jd2_plantBean2",
- "name": "京东账号二互助码2",
- "val": "",
- "type": "text",
- "desc": "种豆得豆互助码.这是别人的助力码,你帮别人助力."
- },
- {
- "id": "jd2_plantBean3",
- "name": "京东账号二互助码3",
- "val": "",
- "type": "text",
- "desc": "种豆得豆互助码.这是别人的助力码,你帮别人助力."
- }
- ],
- "author": "@lxk0301",
- "repo": "https://github.com/lxk0301/jd_scripts",
- "script": "https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_plantBean.js",
- "icons": [
- "https://raw.githubusercontent.com/58xinian/icon/master/jdzd_mini.png",
- "https://raw.githubusercontent.com/58xinian/icon/master/jdzd.png"
- ]
- },
- {
- "id": "jd_Joy",
- "name": "宠汪汪",
- "keys": [],
- "settings": [
- {
- "id": "jdJoyNotify",
- "name": "静默运行",
- "val": true,
- "type": "boolean",
- "desc": "运行宠汪汪(jd_joy.js)脚本时不发出系统弹窗通知"
- },
- {
- "id": "jdJoyStealNotify",
- "name": "静默运行",
- "val": false,
- "type": "boolean",
- "desc": "运行宠汪汪(jd_joy_steal.js)脚本时不发出系统弹窗通知"
- },
- {
- "id": "jdJoyHelpFeed",
- "name": "是否给好友喂食(默认不帮好友喂食)",
- "val": false,
- "type": "boolean",
- "desc": "给好友喂食可得积分,但会消耗自己狗粮"
- },
- {
- "id": "jdJoyStealCoin",
- "name": "是否偷好友积分与狗粮(默认是)",
- "val": true,
- "type": "boolean",
- "desc": "偷好友积分与狗粮"
- },
- {
- "id": "joyRunFlag",
- "name": "是否参加双人赛跑(默认参加)",
- "val": true,
- "type": "boolean",
- "desc": "开启脚本将会为您自动参加双人赛跑"
- },
- {
- "id": "joyFeedCount",
- "name": "每次喂养数量(默认10g)",
- "val": "10",
- "type": "radios",
- "desc": "每次喂养狗粮克数(默认10g)",
- "items": [
- {
- "key": "10",
- "label": "消耗10g"
- },
- {
- "key": "20",
- "label": "消耗20g"
- },
- {
- "key": "40",
- "label": "消耗40g"
- },
- {
- "key": "80",
- "label": "消耗80g"
- }
- ]
- }
- ],
- "author": "@lxk0301",
- "repo": "https://github.com/lxk0301/jd_scripts",
- "script": "https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy.js",
- "icons": [
- "https://raw.githubusercontent.com/58xinian/icon/master/jdcww_mini.png",
- "https://raw.githubusercontent.com/58xinian/icon/master/jdcww.png"
- ]
- },
- {
- "id": "jd_Joy_Reawrd",
- "name": "宠汪汪积分兑换京豆",
- "keys": [],
- "settings": [
- {
- "id": "jdJoyRewardNotify",
- "name": "静默运行",
- "val": false,
- "type": "boolean",
- "desc": "开启后成功兑换到京豆也不发出系统弹窗通知"
- },
- {
- "id": "joyRewardName",
- "name": "是否兑换京豆",
- "val": "1",
- "type": "radios",
- "desc": "默认开启兑换,如不想兑换可选择不兑换",
- "items": [
- {
- "key": "0",
- "label": "不兑换奖品(选择此项将不兑换奖品)"
- },
- {
- "key": "1",
- "label": "兑换20京豆"
- },
- {
- "key": "500",
- "label": "兑换500京豆"
- },
- {
- "key": "1000",
- "label": "兑换1000京豆"
- }
- ]
- }
- ],
- "author": "@lxk0301",
- "repo": "https://github.com/lxk0301/jd_scripts",
- "script": "https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_reward.js",
- "icons": [
- "https://raw.githubusercontent.com/58xinian/icon/master/jdcww_mini.png",
- "https://raw.githubusercontent.com/58xinian/icon/master/jdcww.png"
- ]
- },
- {
- "id": "jd_Joy_Run",
- "name": "宠汪汪邀请助力与赛跑助力",
- "keys": [
- "jdJoyRunToken",
- "jd_joy_run_name",
- "jd_joy_invite_pin",
- "jd_joy_run_pin",
- "jd2_joy_run_name",
- "jd2_joy_invite_pin",
- "jd2_joy_run_pin"
- ],
- "desc": "宠汪汪的互助码friendPin是京东用户名,不是昵称(可在京东APP->我的->设置查看)。互助码之间用英文逗号隔开,下面给出具体示例,使用时可自行清空重新按格式填写你自己的",
- "settings": [
- {
- "id": "jd_joy_run_name",
- "name": "京东账号一昵称",
- "val": "",
- "type": "text",
- "desc": "京东账号昵称,用于区分自己的京东账号(非必填,建议多个京东账号使用)"
- },
- {
- "id": "jd_joy_invite_pin",
- "name": "账号一邀请助力friendPin名单",
- "val": "jd_6cd93e613b0e5,被折叠的记忆33",
- "type": "text",
- "desc": "多个账号使用英文逗号','隔开,最多3个"
- },
- {
- "id": "jd_joy_run_pin",
- "name": "账号一赛跑助力friendPin名单",
- "val": "jd_6cd93e613b0e5,被折叠的记忆33",
- "type": "text",
- "desc": "多个账号使用英文逗号','隔开,最多6个"
- },
- {
- "id": "jd2_joy_run_name",
- "name": "京东账号二昵称",
- "val": "",
- "type": "text",
- "desc": "京东账号昵称,用于区分自己的京东账号(非必填,建议多个京东账号使用)"
- },
- {
- "id": "jd2_joy_invite_pin",
- "name": "账号二邀请助力friendPin名单",
- "val": "jd_6cd93e613b0e5,被折叠的记忆33",
- "type": "text",
- "desc": "多个账号使用英文逗号','隔开,最多3个"
- },
- {
- "id": "jd2_joy_run_pin",
- "name": "账号二赛跑助力friendPin名单",
- "val": "jd_6cd93e613b0e5,被折叠的记忆33",
- "type": "text",
- "desc": "多个账号使用英文逗号','隔开,最多6个"
- }
- ],
- "author": "@lxk0301",
- "repo": "https://github.com/lxk0301/jd_scripts",
- "script": "https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_joy_run.js",
- "icons": [
- "https://raw.githubusercontent.com/58xinian/icon/master/jdcww_mini.png",
- "https://raw.githubusercontent.com/58xinian/icon/master/jdcww.png"
- ]
- },
- {
- "id": "jd_MoneyTree",
- "name": "京东摇钱树",
- "keys": [],
- "settings": [
- {
- "id": "jdMoneyTreeNotify",
- "name": "静默运行",
- "val": true,
- "type": "boolean",
- "desc": "运行京东摇钱树脚本时不发出系统弹窗通知"
- }
- ],
- "author": "@lxk0301",
- "repo": "https://github.com/lxk0301/jd_scripts",
- "script": "https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_moneyTree.js",
- "icons": [
- "https://raw.githubusercontent.com/58xinian/icon/master/jdyqs_mini.png",
- "https://raw.githubusercontent.com/58xinian/icon/master/jdyqs.png"
- ]
- },
- {
- "id": "jd_Speed",
- "name": "京东天天加速",
- "keys": [],
- "settings": [
- {
- "id": "jdSpeedNotify",
- "name": "静默运行",
- "val": true,
- "type": "boolean",
- "desc": "运行京东天天加速脚本时不发出系统弹窗通知"
- }
- ],
- "author": "@lxk0301",
- "repo": "https://github.com/lxk0301/jd_scripts",
- "script": "https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_speed.js",
- "icons": [
- "https://raw.githubusercontent.com/58xinian/icon/master/jdjs_mini.png",
- "https://raw.githubusercontent.com/58xinian/icon/master/jdjs.png"
- ]
- },
- {
- "id": "jdUnsubscribe",
- "name": "取关京东店铺和商品",
- "keys": [
- "jdUnsubscribeStopGoods",
- "jdUnsubscribeStopShop"
- ],
- "settings": [
- {
- "id": "jdUnsubscribeNotify",
- "name": "静默运行",
- "val": false,
- "type": "boolean",
- "desc": "运行脚本时不发出系统弹窗通知"
- },
- {
- "id": "jdUnsubscribePageSize",
- "name": "取消已关注商品的数量",
- "val": 10,
- "type": "number",
- "desc": "运行一次脚本取消多少个已关注的商品(默认10个,输入0表示不取关)"
- },
- {
- "id": "jdUnsubscribeShopPageSize",
- "name": "取消已关注店铺的数量",
- "val": 10,
- "type": "number",
- "desc": "运行一次脚本取消多少个已关注的店铺(默认10个,输入0表示不取关)"
- },
- {
- "id": "jdUnsubscribeStopGoods",
- "name": "遇到此商品不再进行取关",
- "val": "",
- "type": "text",
- "desc": "匹配到此处商品后面(包括此商品)不再进行取关(此处内容需去商品详情页长按(自营处)文字拷贝商品信息)"
- },
- {
- "id": "jdUnsubscribeStopShop",
- "name": "遇到此店铺不再进行取关",
- "val": "",
- "type": "text",
- "desc": "匹配到此处店铺后面(包括此店铺)的不再进行取关(此处内容请尽量从头开始输入店铺名称)"
- }
- ],
- "author": "@lxk0301",
- "repo": "https://github.com/lxk0301/jd_scripts",
- "script": "https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_unsubscribe.js",
- "icons": [
- "https://raw.githubusercontent.com/Orz-3/mini/master/jd.png",
- "https://raw.githubusercontent.com/Orz-3/task/master/jd.png"
- ]
- },
- {
- "id": "jd_SuperMarket",
- "name": "京小超",
- "keys": [],
- "settings": [
- {
- "id": "jdSuperMarketNotify",
- "name": "静默运行",
- "val": true,
- "type": "boolean",
- "desc": "运行此脚本时不发出系统弹窗通知"
- },
- {
- "id": "jdSuperMarketUpgrade",
- "name": "自动升级(商品/货架)",
- "val": true,
- "type": "boolean",
- "desc": "自动升级,顺序:解锁升级商品、升级货架"
- },
- {
- "id": "jdBusinessCircleJump",
- "name": "自动更换商圈",
- "val": true,
- "type": "boolean",
- "desc": "小于对方300热力值自动更换商圈队伍"
- },
- {
- "id": "jdSuperMarketLottery",
- "name": "抽奖(招财进宝)",
- "val": false,
- "type": "boolean",
- "desc": "运行脚本消耗金币进行抽奖,默认抽奖"
- }
- ],
- "author": "@lxk0301",
- "repo": "https://github.com/lxk0301/jd_scripts",
- "scripts":[
- {
- "name" : "京小超",
- "script" : "https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_superMarket.js"
- }
- ],
- "icons": [
- "https://raw.githubusercontent.com/58xinian/icon/master/jxc_mini.png",
- "https://raw.githubusercontent.com/58xinian/icon/master/jxc.png"
- ]
- },
- {
- "id": "jd_SuperMarket_Reawrd",
- "name": "京小超兑换奖品",
- "keys": [
- "coinToBeans"
- ],
- "desc": "默认不兑换奖品,例如:兑换20京豆输入20,兑换1000京豆输入1000,兑换 柠檬果香洗手液, 输入 柠檬果香洗手液。其他详细的奖品名称去京小超活动页面查看",
- "settings": [
- {
- "id": "jdSuperMarketRewardNotify",
- "name": "静默运行",
- "val": false,
- "type": "boolean",
- "desc": "开启后成功兑换到奖品不发出系统弹窗通知"
- },
- {
- "id": "coinToBeans",
- "name": "兑换奖品(默认不兑换)",
- "val": "0",
- "type": "text",
- "desc": "输入兑换奖品名称(默认不兑换奖品)"
- }
- ],
- "author": "@lxk0301",
- "repo": "https://github.com/lxk0301/jd_scripts",
- "scripts": [
- {
- "name" : "京小超兑换奖品",
- "script" : "https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_blueCoin.js"
- }
- ],
- "icons": [
- "https://raw.githubusercontent.com/58xinian/icon/master/jxc_mini.png",
- "https://raw.githubusercontent.com/58xinian/icon/master/jxc.png"
- ]
- },
- {
- "id": "lxk0301Webhook",
- "name": "Webhook",
- "keys": [
- "ACTIONS_TRIGGER_TOKEN",
- "githubUser",
- "repo",
- "TRIGGER_KEYWORDS"
- ],
- "settings": [
- {
- "id": "ACTIONS_TRIGGER_TOKEN",
- "name": "github token",
- "val": "",
- "type": "text",
- "desc": "申请教程:https://www.jianshu.com/p/bb82b3ad1d11 记得勾选repo权限就行"
- },
- {
- "id": "githubUser",
- "name": "github 用户名",
- "val": "",
- "type": "text",
- "desc": "例如:lxk0301"
- },
- {
- "id": "repo",
- "name": "仓库名称",
- "val": "",
- "type": "text",
- "desc": "例如:scripts"
- },
- {
- "id": "TRIGGER_KEYWORDS",
- "name": "触发关键词",
- "val": "",
- "type": "text",
- "desc": ".github/workflows/路径里面yml文件repository_dispatch项目的types值,例如jd_fruit.yml里面的值为fruit,多个使用英文逗号','隔开"
- }
- ],
- "author": "@lxk0301",
- "repo": "https://github.com/lxk0301/jd_scripts",
- "script": "https://raw.githubusercontent.com/lxk0301/jd_scripts/master/backUp/webhook.js",
- "icons": [
- "https://raw.githubusercontent.com/58xinian/icon/master/webhooks_mini.png",
- "https://raw.githubusercontent.com/58xinian/icon/master/webhooks.png"
- ]
- },
- {
- "id": "xmSports",
- "name": "小米运动",
- "keys": [
- "xmSportsToken",
- "xmMinStep",
- "xmMaxStep"
- ],
- "settings": [
- {
- "id": "xmSportsToken",
- "name": "小米运动Token",
- "val": "",
- "type": "text",
- "desc": "小米运动登录时获取的token"
- },
- {
- "id": "xmMinStep",
- "name": "最小运动步数",
- "val": "19000",
- "type": "text",
- "desc": "需要修改最小的运动步数的数字,例如:19000"
- },
- {
- "id": "xmMaxStep",
- "name": "最大运动步数",
- "val": "25000",
- "type": "text",
- "desc": "需要修改最小的运动步数的数字,例如:25000"
- }
- ],
- "author": "@lxk0301",
- "repo": "https://github.com/lxk0301/jd_scripts",
- "script": "https://raw.githubusercontent.com/lxk0301/jd_scripts/master/backUp/xmSports.js",
- "icons": [
- "https://raw.githubusercontent.com/58xinian/icon/master/xmyd_mini.png",
- "https://raw.githubusercontent.com/58xinian/icon/master/xmyd.png"
- ]
- },
- {
- "id": "lxk_jdfactory",
- "name": "东东工厂",
- "keys": [
- "FACTORAY_WANTPRODUCT_NAME"
- ],
- "settings": [
- {
- "id": "FACTORAY_WANTPRODUCT_NAME",
- "name": "心仪商品名称",
- "val": "",
- "type": "text",
- "desc": "请尽量填写完整和别的商品有区分度"
- }
- ],
- "author": "@lxk0301",
- "repo": "https://github.com/lxk0301/jd_scripts",
- "script": "https://raw.githubusercontent.com/lxk0301/jd_scripts/master/jd_jdfactory.js",
- "icons": [
- "https://raw.githubusercontent.com/58xinian/icon/master/jd_factory_mini.png",
- "https://raw.githubusercontent.com/58xinian/icon/master/jd_factory.png"
- ]
- }
- ]
-}
diff --git a/package-lock.json b/package-lock.json
deleted file mode 100644
index e8928fd..0000000
--- a/package-lock.json
+++ /dev/null
@@ -1,1480 +0,0 @@
-{
- "name": "lxk0301",
- "version": "1.0.0",
- "lockfileVersion": 1,
- "requires": true,
- "dependencies": {
- "@sindresorhus/is": {
- "version": "0.7.0",
- "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz",
- "integrity": "sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow=="
- },
- "@szmarczak/http-timer": {
- "version": "4.0.5",
- "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.5.tgz",
- "integrity": "sha512-PyRA9sm1Yayuj5OIoJ1hGt2YISX45w9WcFbh6ddT0Z/0yaFxOtGLInr4jUfU1EAFVs0Yfyfev4RNwBlUaHdlDQ==",
- "requires": {
- "defer-to-connect": "^2.0.0"
- }
- },
- "@types/cacheable-request": {
- "version": "6.0.1",
- "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.1.tgz",
- "integrity": "sha512-ykFq2zmBGOCbpIXtoVbz4SKY5QriWPh3AjyU4G74RYbtt5yOc5OfaY75ftjg7mikMOla1CTGpX3lLbuJh8DTrQ==",
- "requires": {
- "@types/http-cache-semantics": "*",
- "@types/keyv": "*",
- "@types/node": "*",
- "@types/responselike": "*"
- }
- },
- "@types/http-cache-semantics": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.0.tgz",
- "integrity": "sha512-c3Xy026kOF7QOTn00hbIllV1dLR9hG9NkSrLQgCVs8NF6sBU+VGWjD3wLPhmh1TYAc7ugCFsvHYMN4VcBN1U1A=="
- },
- "@types/keyv": {
- "version": "3.1.1",
- "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.1.tgz",
- "integrity": "sha512-MPtoySlAZQ37VoLaPcTHCu1RWJ4llDkULYZIzOYxlhxBqYPB0RsRlmMU0R6tahtFe27mIdkHV+551ZWV4PLmVw==",
- "requires": {
- "@types/node": "*"
- }
- },
- "@types/node": {
- "version": "14.14.6",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.6.tgz",
- "integrity": "sha512-6QlRuqsQ/Ox/aJEQWBEJG7A9+u7oSYl3mem/K8IzxXG/kAGbV1YPD9Bg9Zw3vyxC/YP+zONKwy8hGkSt1jxFMw=="
- },
- "@types/responselike": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz",
- "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==",
- "requires": {
- "@types/node": "*"
- }
- },
- "ajv": {
- "version": "6.12.6",
- "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
- "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
- "requires": {
- "fast-deep-equal": "^3.1.1",
- "fast-json-stable-stringify": "^2.0.0",
- "json-schema-traverse": "^0.4.1",
- "uri-js": "^4.2.2"
- }
- },
- "archive-type": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/archive-type/-/archive-type-4.0.0.tgz",
- "integrity": "sha1-+S5yIzBW38aWlHJ0nCZ72wRrHXA=",
- "requires": {
- "file-type": "^4.2.0"
- },
- "dependencies": {
- "file-type": {
- "version": "4.4.0",
- "resolved": "https://registry.npmjs.org/file-type/-/file-type-4.4.0.tgz",
- "integrity": "sha1-G2AOX8ofvcboDApwxxyNul95BsU="
- }
- }
- },
- "asn1": {
- "version": "0.2.4",
- "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
- "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==",
- "requires": {
- "safer-buffer": "~2.1.0"
- }
- },
- "assert-plus": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
- "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU="
- },
- "async": {
- "version": "2.6.3",
- "resolved": "https://registry.npmjs.org/async/-/async-2.6.3.tgz",
- "integrity": "sha512-zflvls11DCy+dQWzTW2dzuilv8Z5X/pjfmZOWba6TNIVDm+2UDaJmXSOXlasHKfNBs8oo3M0aT50fDEWfKZjXg==",
- "requires": {
- "lodash": "^4.17.14"
- }
- },
- "asynckit": {
- "version": "0.4.0",
- "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
- "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
- },
- "aws-sign2": {
- "version": "0.7.0",
- "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
- "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg="
- },
- "aws4": {
- "version": "1.11.0",
- "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz",
- "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA=="
- },
- "base64-js": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz",
- "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g=="
- },
- "basic-auth": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-1.1.0.tgz",
- "integrity": "sha1-RSIe5Cn37h5QNb4/UVM/HN/SmIQ="
- },
- "bcrypt-pbkdf": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
- "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=",
- "requires": {
- "tweetnacl": "^0.14.3"
- }
- },
- "bl": {
- "version": "1.2.3",
- "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz",
- "integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==",
- "requires": {
- "readable-stream": "^2.3.5",
- "safe-buffer": "^5.1.1"
- }
- },
- "buffer": {
- "version": "5.7.1",
- "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
- "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
- "requires": {
- "base64-js": "^1.3.1",
- "ieee754": "^1.1.13"
- }
- },
- "buffer-alloc": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz",
- "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==",
- "requires": {
- "buffer-alloc-unsafe": "^1.1.0",
- "buffer-fill": "^1.0.0"
- }
- },
- "buffer-alloc-unsafe": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz",
- "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg=="
- },
- "buffer-crc32": {
- "version": "0.2.13",
- "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
- "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI="
- },
- "buffer-fill": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz",
- "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw="
- },
- "cacheable-lookup": {
- "version": "5.0.3",
- "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.3.tgz",
- "integrity": "sha512-W+JBqF9SWe18A72XFzN/V/CULFzPm7sBXzzR6ekkE+3tLG72wFZrBiBZhrZuDoYexop4PHJVdFAKb/Nj9+tm9w=="
- },
- "cacheable-request": {
- "version": "2.1.4",
- "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-2.1.4.tgz",
- "integrity": "sha1-DYCIAbY0KtM8kd+dC0TcCbkeXD0=",
- "requires": {
- "clone-response": "1.0.2",
- "get-stream": "3.0.0",
- "http-cache-semantics": "3.8.1",
- "keyv": "3.0.0",
- "lowercase-keys": "1.0.0",
- "normalize-url": "2.0.1",
- "responselike": "1.0.2"
- },
- "dependencies": {
- "get-stream": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
- "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ="
- },
- "lowercase-keys": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz",
- "integrity": "sha1-TjNms55/VFfjXxMkvfb4jQv8cwY="
- }
- }
- },
- "caseless": {
- "version": "0.12.0",
- "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
- "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
- },
- "clone-response": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz",
- "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=",
- "requires": {
- "mimic-response": "^1.0.0"
- }
- },
- "colors": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
- "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA=="
- },
- "combined-stream": {
- "version": "1.0.8",
- "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
- "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
- "requires": {
- "delayed-stream": "~1.0.0"
- }
- },
- "commander": {
- "version": "2.20.3",
- "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
- "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="
- },
- "content-disposition": {
- "version": "0.5.3",
- "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz",
- "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
- "requires": {
- "safe-buffer": "5.1.2"
- }
- },
- "core-util-is": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
- "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
- },
- "corser": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/corser/-/corser-2.0.1.tgz",
- "integrity": "sha1-jtolLsqrWEDc2XXOuQ2TcMgZ/4c="
- },
- "crypto-js": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.0.0.tgz",
- "integrity": "sha512-bzHZN8Pn+gS7DQA6n+iUmBfl0hO5DJq++QP3U6uTucDtk/0iGpXd/Gg7CGR0p8tJhofJyaKoWBuJI4eAO00BBg=="
- },
- "dashdash": {
- "version": "1.14.1",
- "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
- "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
- "requires": {
- "assert-plus": "^1.0.0"
- }
- },
- "debug": {
- "version": "3.2.6",
- "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
- "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
- "requires": {
- "ms": "^2.1.1"
- }
- },
- "decode-uri-component": {
- "version": "0.2.0",
- "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
- "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU="
- },
- "decompress": {
- "version": "4.2.1",
- "resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.1.tgz",
- "integrity": "sha512-e48kc2IjU+2Zw8cTb6VZcJQ3lgVbS4uuB1TfCHbiZIP/haNXm+SVyhu+87jts5/3ROpd82GSVCoNs/z8l4ZOaQ==",
- "requires": {
- "decompress-tar": "^4.0.0",
- "decompress-tarbz2": "^4.0.0",
- "decompress-targz": "^4.0.0",
- "decompress-unzip": "^4.0.1",
- "graceful-fs": "^4.1.10",
- "make-dir": "^1.0.0",
- "pify": "^2.3.0",
- "strip-dirs": "^2.0.0"
- },
- "dependencies": {
- "make-dir": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz",
- "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==",
- "requires": {
- "pify": "^3.0.0"
- },
- "dependencies": {
- "pify": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
- "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY="
- }
- }
- },
- "pify": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
- "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
- }
- }
- },
- "decompress-response": {
- "version": "3.3.0",
- "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz",
- "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=",
- "requires": {
- "mimic-response": "^1.0.0"
- }
- },
- "decompress-tar": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-4.1.1.tgz",
- "integrity": "sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==",
- "requires": {
- "file-type": "^5.2.0",
- "is-stream": "^1.1.0",
- "tar-stream": "^1.5.2"
- },
- "dependencies": {
- "file-type": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz",
- "integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY="
- }
- }
- },
- "decompress-tarbz2": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz",
- "integrity": "sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==",
- "requires": {
- "decompress-tar": "^4.1.0",
- "file-type": "^6.1.0",
- "is-stream": "^1.1.0",
- "seek-bzip": "^1.0.5",
- "unbzip2-stream": "^1.0.9"
- },
- "dependencies": {
- "file-type": {
- "version": "6.2.0",
- "resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz",
- "integrity": "sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg=="
- }
- }
- },
- "decompress-targz": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/decompress-targz/-/decompress-targz-4.1.1.tgz",
- "integrity": "sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==",
- "requires": {
- "decompress-tar": "^4.1.1",
- "file-type": "^5.2.0",
- "is-stream": "^1.1.0"
- },
- "dependencies": {
- "file-type": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz",
- "integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY="
- }
- }
- },
- "decompress-unzip": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/decompress-unzip/-/decompress-unzip-4.0.1.tgz",
- "integrity": "sha1-3qrM39FK6vhVePczroIQ+bSEj2k=",
- "requires": {
- "file-type": "^3.8.0",
- "get-stream": "^2.2.0",
- "pify": "^2.3.0",
- "yauzl": "^2.4.2"
- },
- "dependencies": {
- "file-type": {
- "version": "3.9.0",
- "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz",
- "integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek="
- },
- "get-stream": {
- "version": "2.3.1",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz",
- "integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=",
- "requires": {
- "object-assign": "^4.0.1",
- "pinkie-promise": "^2.0.0"
- }
- },
- "pify": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
- "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="
- }
- }
- },
- "defer-to-connect": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.0.tgz",
- "integrity": "sha512-bYL2d05vOSf1JEZNx5vSAtPuBMkX8K9EUutg7zlKvTqKXHt7RhWJFbmd7qakVuf13i+IkGmp6FwSsONOf6VYIg=="
- },
- "delayed-stream": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
- "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
- },
- "download": {
- "version": "8.0.0",
- "resolved": "https://registry.npmjs.org/download/-/download-8.0.0.tgz",
- "integrity": "sha512-ASRY5QhDk7FK+XrQtQyvhpDKanLluEEQtWl/J7Lxuf/b+i8RYh997QeXvL85xitrmRKVlx9c7eTrcRdq2GS4eA==",
- "requires": {
- "archive-type": "^4.0.0",
- "content-disposition": "^0.5.2",
- "decompress": "^4.2.1",
- "ext-name": "^5.0.0",
- "file-type": "^11.1.0",
- "filenamify": "^3.0.0",
- "get-stream": "^4.1.0",
- "got": "^8.3.1",
- "make-dir": "^2.1.0",
- "p-event": "^2.1.0",
- "pify": "^4.0.1"
- },
- "dependencies": {
- "got": {
- "version": "8.3.2",
- "resolved": "https://registry.npmjs.org/got/-/got-8.3.2.tgz",
- "integrity": "sha512-qjUJ5U/hawxosMryILofZCkm3C84PLJS/0grRIpjAwu+Lkxxj5cxeCU25BG0/3mDSpXKTyZr8oh8wIgLaH0QCw==",
- "requires": {
- "@sindresorhus/is": "^0.7.0",
- "cacheable-request": "^2.1.1",
- "decompress-response": "^3.3.0",
- "duplexer3": "^0.1.4",
- "get-stream": "^3.0.0",
- "into-stream": "^3.1.0",
- "is-retry-allowed": "^1.1.0",
- "isurl": "^1.0.0-alpha5",
- "lowercase-keys": "^1.0.0",
- "mimic-response": "^1.0.0",
- "p-cancelable": "^0.4.0",
- "p-timeout": "^2.0.1",
- "pify": "^3.0.0",
- "safe-buffer": "^5.1.1",
- "timed-out": "^4.0.1",
- "url-parse-lax": "^3.0.0",
- "url-to-options": "^1.0.1"
- },
- "dependencies": {
- "get-stream": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
- "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ="
- },
- "pify": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
- "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY="
- }
- }
- }
- }
- },
- "duplexer3": {
- "version": "0.1.4",
- "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz",
- "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI="
- },
- "ecc-jsbn": {
- "version": "0.1.2",
- "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
- "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=",
- "requires": {
- "jsbn": "~0.1.0",
- "safer-buffer": "^2.1.0"
- }
- },
- "ecstatic": {
- "version": "3.3.2",
- "resolved": "https://registry.npmjs.org/ecstatic/-/ecstatic-3.3.2.tgz",
- "integrity": "sha512-fLf9l1hnwrHI2xn9mEDT7KIi22UDqA2jaCwyCbSUJh9a1V+LEUSL/JO/6TIz/QyuBURWUHrFL5Kg2TtO1bkkog==",
- "requires": {
- "he": "^1.1.1",
- "mime": "^1.6.0",
- "minimist": "^1.1.0",
- "url-join": "^2.0.5"
- }
- },
- "end-of-stream": {
- "version": "1.4.4",
- "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
- "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
- "requires": {
- "once": "^1.4.0"
- }
- },
- "escape-string-regexp": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
- "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
- },
- "eventemitter3": {
- "version": "4.0.7",
- "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
- "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="
- },
- "ext-list": {
- "version": "2.2.2",
- "resolved": "https://registry.npmjs.org/ext-list/-/ext-list-2.2.2.tgz",
- "integrity": "sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA==",
- "requires": {
- "mime-db": "^1.28.0"
- }
- },
- "ext-name": {
- "version": "5.0.0",
- "resolved": "https://registry.npmjs.org/ext-name/-/ext-name-5.0.0.tgz",
- "integrity": "sha512-yblEwXAbGv1VQDmow7s38W77hzAgJAO50ztBLMcUyUBfxv1HC+LGwtiEN+Co6LtlqT/5uwVOxsD4TNIilWhwdQ==",
- "requires": {
- "ext-list": "^2.0.0",
- "sort-keys-length": "^1.0.0"
- }
- },
- "extend": {
- "version": "3.0.2",
- "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
- "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="
- },
- "extsprintf": {
- "version": "1.3.0",
- "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
- "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU="
- },
- "fast-deep-equal": {
- "version": "3.1.3",
- "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
- "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
- },
- "fast-json-stable-stringify": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
- "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="
- },
- "fd-slicer": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
- "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=",
- "requires": {
- "pend": "~1.2.0"
- }
- },
- "file-type": {
- "version": "11.1.0",
- "resolved": "https://registry.npmjs.org/file-type/-/file-type-11.1.0.tgz",
- "integrity": "sha512-rM0UO7Qm9K7TWTtA6AShI/t7H5BPjDeGVDaNyg9BjHAj3PysKy7+8C8D137R88jnR3rFJZQB/tFgydl5sN5m7g=="
- },
- "filename-reserved-regex": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz",
- "integrity": "sha1-q/c9+rc10EVECr/qLZHzieu/oik="
- },
- "filenamify": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-3.0.0.tgz",
- "integrity": "sha512-5EFZ//MsvJgXjBAFJ+Bh2YaCTRF/VP1YOmGrgt+KJ4SFRLjI87EIdwLLuT6wQX0I4F9W41xutobzczjsOKlI/g==",
- "requires": {
- "filename-reserved-regex": "^2.0.0",
- "strip-outer": "^1.0.0",
- "trim-repeated": "^1.0.0"
- }
- },
- "follow-redirects": {
- "version": "1.13.0",
- "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz",
- "integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA=="
- },
- "forever-agent": {
- "version": "0.6.1",
- "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
- "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE="
- },
- "form-data": {
- "version": "2.3.3",
- "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
- "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
- "requires": {
- "asynckit": "^0.4.0",
- "combined-stream": "^1.0.6",
- "mime-types": "^2.1.12"
- }
- },
- "from2": {
- "version": "2.3.0",
- "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz",
- "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=",
- "requires": {
- "inherits": "^2.0.1",
- "readable-stream": "^2.0.0"
- }
- },
- "fs-constants": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
- "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="
- },
- "get-stream": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
- "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
- "requires": {
- "pump": "^3.0.0"
- }
- },
- "getpass": {
- "version": "0.1.7",
- "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
- "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
- "requires": {
- "assert-plus": "^1.0.0"
- }
- },
- "got": {
- "version": "11.8.0",
- "resolved": "https://registry.npmjs.org/got/-/got-11.8.0.tgz",
- "integrity": "sha512-k9noyoIIY9EejuhaBNLyZ31D5328LeqnyPNXJQb2XlJZcKakLqN5m6O/ikhq/0lw56kUYS54fVm+D1x57YC9oQ==",
- "requires": {
- "@sindresorhus/is": "^4.0.0",
- "@szmarczak/http-timer": "^4.0.5",
- "@types/cacheable-request": "^6.0.1",
- "@types/responselike": "^1.0.0",
- "cacheable-lookup": "^5.0.3",
- "cacheable-request": "^7.0.1",
- "decompress-response": "^6.0.0",
- "http2-wrapper": "^1.0.0-beta.5.2",
- "lowercase-keys": "^2.0.0",
- "p-cancelable": "^2.0.0",
- "responselike": "^2.0.0"
- },
- "dependencies": {
- "@sindresorhus/is": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.0.0.tgz",
- "integrity": "sha512-FyD2meJpDPjyNQejSjvnhpgI/azsQkA4lGbuu5BQZfjvJ9cbRZXzeWL2HceCekW4lixO9JPesIIQkSoLjeJHNQ=="
- },
- "cacheable-request": {
- "version": "7.0.1",
- "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.1.tgz",
- "integrity": "sha512-lt0mJ6YAnsrBErpTMWeu5kl/tg9xMAWjavYTN6VQXM1A/teBITuNcccXsCxF0tDQQJf9DfAaX5O4e0zp0KlfZw==",
- "requires": {
- "clone-response": "^1.0.2",
- "get-stream": "^5.1.0",
- "http-cache-semantics": "^4.0.0",
- "keyv": "^4.0.0",
- "lowercase-keys": "^2.0.0",
- "normalize-url": "^4.1.0",
- "responselike": "^2.0.0"
- }
- },
- "decompress-response": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
- "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
- "requires": {
- "mimic-response": "^3.1.0"
- }
- },
- "get-stream": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
- "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
- "requires": {
- "pump": "^3.0.0"
- }
- },
- "http-cache-semantics": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
- "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ=="
- },
- "json-buffer": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
- "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ=="
- },
- "keyv": {
- "version": "4.0.3",
- "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.0.3.tgz",
- "integrity": "sha512-zdGa2TOpSZPq5mU6iowDARnMBZgtCqJ11dJROFi6tg6kTn4nuUdU09lFyLFSaHrWqpIJ+EBq4E8/Dc0Vx5vLdA==",
- "requires": {
- "json-buffer": "3.0.1"
- }
- },
- "lowercase-keys": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz",
- "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA=="
- },
- "mimic-response": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
- "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ=="
- },
- "normalize-url": {
- "version": "4.5.0",
- "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz",
- "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ=="
- },
- "p-cancelable": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.0.0.tgz",
- "integrity": "sha512-wvPXDmbMmu2ksjkB4Z3nZWTSkJEb9lqVdMaCKpZUGJG9TMiNp9XcbG3fn9fPKjem04fJMJnXoyFPk2FmgiaiNg=="
- },
- "responselike": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.0.tgz",
- "integrity": "sha512-xH48u3FTB9VsZw7R+vvgaKeLKzT6jOogbQhEe/jewwnZgzPcnyWui2Av6JpoYZF/91uueC+lqhWqeURw5/qhCw==",
- "requires": {
- "lowercase-keys": "^2.0.0"
- }
- }
- }
- },
- "graceful-fs": {
- "version": "4.2.4",
- "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz",
- "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw=="
- },
- "har-schema": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
- "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI="
- },
- "har-validator": {
- "version": "5.1.5",
- "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz",
- "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==",
- "requires": {
- "ajv": "^6.12.3",
- "har-schema": "^2.0.0"
- }
- },
- "has-symbol-support-x": {
- "version": "1.4.2",
- "resolved": "https://registry.npmjs.org/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz",
- "integrity": "sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw=="
- },
- "has-to-string-tag-x": {
- "version": "1.4.1",
- "resolved": "https://registry.npmjs.org/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz",
- "integrity": "sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw==",
- "requires": {
- "has-symbol-support-x": "^1.4.1"
- }
- },
- "he": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
- "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="
- },
- "http-cache-semantics": {
- "version": "3.8.1",
- "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz",
- "integrity": "sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w=="
- },
- "http-proxy": {
- "version": "1.18.1",
- "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz",
- "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==",
- "requires": {
- "eventemitter3": "^4.0.0",
- "follow-redirects": "^1.0.0",
- "requires-port": "^1.0.0"
- }
- },
- "http-server": {
- "version": "0.12.3",
- "resolved": "https://registry.npmjs.org/http-server/-/http-server-0.12.3.tgz",
- "integrity": "sha512-be0dKG6pni92bRjq0kvExtj/NrrAd28/8fCXkaI/4piTwQMSDSLMhWyW0NI1V+DBI3aa1HMlQu46/HjVLfmugA==",
- "requires": {
- "basic-auth": "^1.0.3",
- "colors": "^1.4.0",
- "corser": "^2.0.1",
- "ecstatic": "^3.3.2",
- "http-proxy": "^1.18.0",
- "minimist": "^1.2.5",
- "opener": "^1.5.1",
- "portfinder": "^1.0.25",
- "secure-compare": "3.0.1",
- "union": "~0.5.0"
- }
- },
- "http-signature": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
- "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
- "requires": {
- "assert-plus": "^1.0.0",
- "jsprim": "^1.2.2",
- "sshpk": "^1.7.0"
- }
- },
- "http2-wrapper": {
- "version": "1.0.0-beta.5.2",
- "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.0-beta.5.2.tgz",
- "integrity": "sha512-xYz9goEyBnC8XwXDTuC/MZ6t+MrKVQZOk4s7+PaDkwIsQd8IwqvM+0M6bA/2lvG8GHXcPdf+MejTUeO2LCPCeQ==",
- "requires": {
- "quick-lru": "^5.1.1",
- "resolve-alpn": "^1.0.0"
- }
- },
- "ieee754": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
- "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="
- },
- "inherits": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
- "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
- },
- "into-stream": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz",
- "integrity": "sha1-lvsKk2wSur1v8XUqF9BWFqvQlMY=",
- "requires": {
- "from2": "^2.1.1",
- "p-is-promise": "^1.1.0"
- }
- },
- "is-natural-number": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz",
- "integrity": "sha1-q5124dtM7VHjXeDHLr7PCfc0zeg="
- },
- "is-object": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz",
- "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA="
- },
- "is-plain-obj": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
- "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4="
- },
- "is-retry-allowed": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz",
- "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg=="
- },
- "is-stream": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz",
- "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ="
- },
- "is-typedarray": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
- "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
- },
- "isarray": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
- "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
- },
- "isstream": {
- "version": "0.1.2",
- "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
- "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
- },
- "isurl": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz",
- "integrity": "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==",
- "requires": {
- "has-to-string-tag-x": "^1.2.0",
- "is-object": "^1.0.1"
- }
- },
- "jsbn": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
- "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM="
- },
- "json-buffer": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz",
- "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg="
- },
- "json-schema": {
- "version": "0.2.3",
- "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
- "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM="
- },
- "json-schema-traverse": {
- "version": "0.4.1",
- "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
- "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
- },
- "json-stringify-safe": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
- "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
- },
- "jsprim": {
- "version": "1.4.1",
- "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
- "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
- "requires": {
- "assert-plus": "1.0.0",
- "extsprintf": "1.3.0",
- "json-schema": "0.2.3",
- "verror": "1.10.0"
- }
- },
- "keyv": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.0.0.tgz",
- "integrity": "sha512-eguHnq22OE3uVoSYG0LVWNP+4ppamWr9+zWBe1bsNcovIMy6huUJFPgy4mGwCd/rnl3vOLGW1MTlu4c57CT1xA==",
- "requires": {
- "json-buffer": "3.0.0"
- }
- },
- "lodash": {
- "version": "4.17.20",
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
- "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
- },
- "lowercase-keys": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz",
- "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA=="
- },
- "make-dir": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz",
- "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==",
- "requires": {
- "pify": "^4.0.1",
- "semver": "^5.6.0"
- }
- },
- "mime": {
- "version": "1.6.0",
- "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
- "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
- },
- "mime-db": {
- "version": "1.45.0",
- "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.45.0.tgz",
- "integrity": "sha512-CkqLUxUk15hofLoLyljJSrukZi8mAtgd+yE5uO4tqRZsdsAJKv0O+rFMhVDRJgozy+yG6md5KwuXhD4ocIoP+w=="
- },
- "mime-types": {
- "version": "2.1.27",
- "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
- "integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
- "requires": {
- "mime-db": "1.44.0"
- },
- "dependencies": {
- "mime-db": {
- "version": "1.44.0",
- "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
- "integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg=="
- }
- }
- },
- "mimic-response": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz",
- "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ=="
- },
- "minimist": {
- "version": "1.2.5",
- "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
- "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
- },
- "mkdirp": {
- "version": "0.5.5",
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
- "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
- "requires": {
- "minimist": "^1.2.5"
- }
- },
- "ms": {
- "version": "2.1.2",
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
- "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
- },
- "normalize-url": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-2.0.1.tgz",
- "integrity": "sha512-D6MUW4K/VzoJ4rJ01JFKxDrtY1v9wrgzCX5f2qj/lzH1m/lW6MhUZFKerVsnyjOhOsYzI9Kqqak+10l4LvLpMw==",
- "requires": {
- "prepend-http": "^2.0.0",
- "query-string": "^5.0.1",
- "sort-keys": "^2.0.0"
- },
- "dependencies": {
- "sort-keys": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-2.0.0.tgz",
- "integrity": "sha1-ZYU1WEhh7JfXMNbPQYIuH1ZoQSg=",
- "requires": {
- "is-plain-obj": "^1.0.0"
- }
- }
- }
- },
- "oauth-sign": {
- "version": "0.9.0",
- "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
- "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ=="
- },
- "object-assign": {
- "version": "4.1.1",
- "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
- "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
- },
- "once": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
- "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
- "requires": {
- "wrappy": "1"
- }
- },
- "opener": {
- "version": "1.5.2",
- "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.2.tgz",
- "integrity": "sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A=="
- },
- "p-cancelable": {
- "version": "0.4.1",
- "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.4.1.tgz",
- "integrity": "sha512-HNa1A8LvB1kie7cERyy21VNeHb2CWJJYqyyC2o3klWFfMGlFmWv2Z7sFgZH8ZiaYL95ydToKTFVXgMV/Os0bBQ=="
- },
- "p-event": {
- "version": "2.3.1",
- "resolved": "https://registry.npmjs.org/p-event/-/p-event-2.3.1.tgz",
- "integrity": "sha512-NQCqOFhbpVTMX4qMe8PF8lbGtzZ+LCiN7pcNrb/413Na7+TRoe1xkKUzuWa/YEJdGQ0FvKtj35EEbDoVPO2kbA==",
- "requires": {
- "p-timeout": "^2.0.1"
- }
- },
- "p-finally": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
- "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4="
- },
- "p-is-promise": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz",
- "integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4="
- },
- "p-timeout": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-2.0.1.tgz",
- "integrity": "sha512-88em58dDVB/KzPEx1X0N3LwFfYZPyDc4B6eF38M1rk9VTZMbxXXgjugz8mmwpS9Ox4BDZ+t6t3QP5+/gazweIA==",
- "requires": {
- "p-finally": "^1.0.0"
- }
- },
- "pend": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
- "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA="
- },
- "performance-now": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
- "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
- },
- "pify": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
- "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g=="
- },
- "pinkie": {
- "version": "2.0.4",
- "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz",
- "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA="
- },
- "pinkie-promise": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz",
- "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=",
- "requires": {
- "pinkie": "^2.0.0"
- }
- },
- "portfinder": {
- "version": "1.0.28",
- "resolved": "https://registry.npmjs.org/portfinder/-/portfinder-1.0.28.tgz",
- "integrity": "sha512-Se+2isanIcEqf2XMHjyUKskczxbPH7dQnlMjXX6+dybayyHvAf/TCgyMRlzf/B6QDhAEFOGes0pzRo3by4AbMA==",
- "requires": {
- "async": "^2.6.2",
- "debug": "^3.1.1",
- "mkdirp": "^0.5.5"
- }
- },
- "prepend-http": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz",
- "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc="
- },
- "process-nextick-args": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
- "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
- },
- "psl": {
- "version": "1.8.0",
- "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz",
- "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ=="
- },
- "pump": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
- "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
- "requires": {
- "end-of-stream": "^1.1.0",
- "once": "^1.3.1"
- }
- },
- "punycode": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
- "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
- },
- "qs": {
- "version": "6.9.4",
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.4.tgz",
- "integrity": "sha512-A1kFqHekCTM7cz0udomYUoYNWjBebHm/5wzU/XqrBRBNWectVH0QIiN+NEcZ0Dte5hvzHwbr8+XQmguPhJ6WdQ=="
- },
- "query-string": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz",
- "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==",
- "requires": {
- "decode-uri-component": "^0.2.0",
- "object-assign": "^4.1.0",
- "strict-uri-encode": "^1.0.0"
- }
- },
- "quick-lru": {
- "version": "5.1.1",
- "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz",
- "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA=="
- },
- "readable-stream": {
- "version": "2.3.7",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
- "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
- "requires": {
- "core-util-is": "~1.0.0",
- "inherits": "~2.0.3",
- "isarray": "~1.0.0",
- "process-nextick-args": "~2.0.0",
- "safe-buffer": "~5.1.1",
- "string_decoder": "~1.1.1",
- "util-deprecate": "~1.0.1"
- }
- },
- "request": {
- "version": "2.88.2",
- "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
- "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==",
- "requires": {
- "aws-sign2": "~0.7.0",
- "aws4": "^1.8.0",
- "caseless": "~0.12.0",
- "combined-stream": "~1.0.6",
- "extend": "~3.0.2",
- "forever-agent": "~0.6.1",
- "form-data": "~2.3.2",
- "har-validator": "~5.1.3",
- "http-signature": "~1.2.0",
- "is-typedarray": "~1.0.0",
- "isstream": "~0.1.2",
- "json-stringify-safe": "~5.0.1",
- "mime-types": "~2.1.19",
- "oauth-sign": "~0.9.0",
- "performance-now": "^2.1.0",
- "qs": "~6.5.2",
- "safe-buffer": "^5.1.2",
- "tough-cookie": "~2.5.0",
- "tunnel-agent": "^0.6.0",
- "uuid": "^3.3.2"
- },
- "dependencies": {
- "qs": {
- "version": "6.5.2",
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
- "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
- },
- "tough-cookie": {
- "version": "2.5.0",
- "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
- "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
- "requires": {
- "psl": "^1.1.28",
- "punycode": "^2.1.1"
- }
- }
- }
- },
- "requires-port": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
- "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8="
- },
- "resolve-alpn": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.0.0.tgz",
- "integrity": "sha512-rTuiIEqFmGxne4IovivKSDzld2lWW9QCjqv80SYjPgf+gS35eaCAjaP54CCwGAwBtnCsvNLYtqxe1Nw+i6JEmA=="
- },
- "responselike": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz",
- "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=",
- "requires": {
- "lowercase-keys": "^1.0.0"
- }
- },
- "safe-buffer": {
- "version": "5.1.2",
- "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
- "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
- },
- "safer-buffer": {
- "version": "2.1.2",
- "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
- "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
- },
- "secure-compare": {
- "version": "3.0.1",
- "resolved": "https://registry.npmjs.org/secure-compare/-/secure-compare-3.0.1.tgz",
- "integrity": "sha1-8aAymzCLIh+uN7mXTz1XjQypmeM="
- },
- "seek-bzip": {
- "version": "1.0.6",
- "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.6.tgz",
- "integrity": "sha512-e1QtP3YL5tWww8uKaOCQ18UxIT2laNBXHjV/S2WYCiK4udiv8lkG89KRIoCjUagnAmCBurjF4zEVX2ByBbnCjQ==",
- "requires": {
- "commander": "^2.8.1"
- }
- },
- "semver": {
- "version": "5.7.1",
- "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
- "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
- },
- "sort-keys": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz",
- "integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=",
- "requires": {
- "is-plain-obj": "^1.0.0"
- }
- },
- "sort-keys-length": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/sort-keys-length/-/sort-keys-length-1.0.1.tgz",
- "integrity": "sha1-nLb09OnkgVWmqgZx7dM2/xR5oYg=",
- "requires": {
- "sort-keys": "^1.0.0"
- }
- },
- "sshpk": {
- "version": "1.16.1",
- "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
- "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==",
- "requires": {
- "asn1": "~0.2.3",
- "assert-plus": "^1.0.0",
- "bcrypt-pbkdf": "^1.0.0",
- "dashdash": "^1.12.0",
- "ecc-jsbn": "~0.1.1",
- "getpass": "^0.1.1",
- "jsbn": "~0.1.0",
- "safer-buffer": "^2.0.2",
- "tweetnacl": "~0.14.0"
- }
- },
- "strict-uri-encode": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz",
- "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM="
- },
- "string_decoder": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
- "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
- "requires": {
- "safe-buffer": "~5.1.0"
- }
- },
- "strip-dirs": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz",
- "integrity": "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==",
- "requires": {
- "is-natural-number": "^4.0.1"
- }
- },
- "strip-outer": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz",
- "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==",
- "requires": {
- "escape-string-regexp": "^1.0.2"
- }
- },
- "tar-stream": {
- "version": "1.6.2",
- "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz",
- "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==",
- "requires": {
- "bl": "^1.0.0",
- "buffer-alloc": "^1.2.0",
- "end-of-stream": "^1.0.0",
- "fs-constants": "^1.0.0",
- "readable-stream": "^2.3.0",
- "to-buffer": "^1.1.1",
- "xtend": "^4.0.0"
- }
- },
- "through": {
- "version": "2.3.8",
- "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
- "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
- },
- "timed-out": {
- "version": "4.0.1",
- "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz",
- "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8="
- },
- "to-buffer": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz",
- "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg=="
- },
- "tough-cookie": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz",
- "integrity": "sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==",
- "requires": {
- "psl": "^1.1.33",
- "punycode": "^2.1.1",
- "universalify": "^0.1.2"
- }
- },
- "trim-repeated": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz",
- "integrity": "sha1-42RqLqTokTEr9+rObPsFOAvAHCE=",
- "requires": {
- "escape-string-regexp": "^1.0.2"
- }
- },
- "tunnel-agent": {
- "version": "0.6.0",
- "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
- "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
- "requires": {
- "safe-buffer": "^5.0.1"
- }
- },
- "tweetnacl": {
- "version": "0.14.5",
- "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
- "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q="
- },
- "unbzip2-stream": {
- "version": "1.4.3",
- "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz",
- "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==",
- "requires": {
- "buffer": "^5.2.1",
- "through": "^2.3.8"
- }
- },
- "union": {
- "version": "0.5.0",
- "resolved": "https://registry.npmjs.org/union/-/union-0.5.0.tgz",
- "integrity": "sha512-N6uOhuW6zO95P3Mel2I2zMsbsanvvtgn6jVqJv4vbVcz/JN0OkL9suomjQGmWtxJQXOCqUJvquc1sMeNz/IwlA==",
- "requires": {
- "qs": "^6.4.0"
- }
- },
- "universalify": {
- "version": "0.1.2",
- "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
- "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="
- },
- "uri-js": {
- "version": "4.4.0",
- "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz",
- "integrity": "sha512-B0yRTzYdUCCn9n+F4+Gh4yIDtMQcaJsmYBDsTSG8g/OejKBodLQ2IHfN3bM7jUsRXndopT7OIXWdYqc1fjmV6g==",
- "requires": {
- "punycode": "^2.1.0"
- }
- },
- "url-join": {
- "version": "2.0.5",
- "resolved": "https://registry.npmjs.org/url-join/-/url-join-2.0.5.tgz",
- "integrity": "sha1-WvIvGMBSoACkjXuCxenC4v7tpyg="
- },
- "url-parse-lax": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz",
- "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=",
- "requires": {
- "prepend-http": "^2.0.0"
- }
- },
- "url-to-options": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz",
- "integrity": "sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k="
- },
- "util-deprecate": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
- "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
- },
- "uuid": {
- "version": "3.4.0",
- "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
- "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="
- },
- "verror": {
- "version": "1.10.0",
- "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
- "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
- "requires": {
- "assert-plus": "^1.0.0",
- "core-util-is": "1.0.2",
- "extsprintf": "^1.2.0"
- }
- },
- "wrappy": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
- "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
- },
- "xtend": {
- "version": "4.0.2",
- "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
- "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ=="
- },
- "yauzl": {
- "version": "2.10.0",
- "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
- "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=",
- "requires": {
- "buffer-crc32": "~0.2.3",
- "fd-slicer": "~1.1.0"
- }
- }
- }
-}
diff --git a/package.json b/package.json
deleted file mode 100644
index ae74360..0000000
--- a/package.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "name": "lxk0301",
- "version": "1.0.0",
- "description": "{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}",
- "main": "AlipayManor.js",
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/lxk0301/jd_scripts.git"
- },
- "keywords": [
- "京东薅羊毛工具, 京东水果、宠物、种豆等等"
- ],
- "author": "lxk0301",
- "license": "ISC",
- "dependencies": {
- "crypto-js": "^4.0.0",
- "got": "^11.5.1",
- "http-server": "^0.12.3",
- "tough-cookie": "^4.0.0",
- "download": "^8.0.0",
- "request": "^2.88.2",
- "tunnel": "0.0.6"
- }
-}
diff --git a/sendNotify.js b/sendNotify.js
deleted file mode 100644
index 99c30e1..0000000
--- a/sendNotify.js
+++ /dev/null
@@ -1,330 +0,0 @@
-const querystring = require("querystring");
-const $ = new Env();
-// =======================================微信server酱通知设置区域===========================================
-//此处填你申请的SCKEY.
-//注:此处设置github action用户填写到Settings-Secrets里面(Name输入PUSH_KEY)
-let SCKEY = '';
-
-// =======================================Bark App通知设置区域===========================================
-//此处填你BarkAPP的信息(IP/设备码,例如:https://api.day.app/XXXXXXXX)
-//注:此处设置github action用户填写到Settings-Secrets里面(Name输入BARK_PUSH)
-let BARK_PUSH = '';
-//BARK app推送铃声,铃声列表去APP查看复制填写
-//注:此处设置github action用户填写到Settings-Secrets里面(Name输入BARK_SOUND , Value输入app提供的铃声名称,例如:birdsong)
-let BARK_SOUND = '';
-
-
-// =======================================telegram机器人通知设置区域===========================================
-//此处填你telegram bot 的Token,例如:1077xxx4424:AAFjv0FcqxxxxxxgEMGfi22B4yh15R5uw
-//注:此处设置github action用户填写到Settings-Secrets里面(Name输入TG_BOT_TOKEN)
-let TG_BOT_TOKEN = '';
-//此处填你接收通知消息的telegram用户的id,例如:129xxx206
-//注:此处设置github action用户填写到Settings-Secrets里面(Name输入TG_USER_ID)
-let TG_USER_ID = '';
-
-// =======================================钉钉机器人通知设置区域===========================================
-//此处填你钉钉 bot 的webhook,例如:5a544165465465645d0f31dca676e7bd07415asdasd
-//注:此处设置github action用户填写到Settings-Secrets里面(Name输入DD_BOT_TOKEN)
-let DD_BOT_TOKEN = '';
-//密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的字符串
-let DD_BOT_SECRET = '';
-
-// =======================================iGot聚合推送通知设置区域===========================================
-//此处填您iGot的信息(推送key,例如:https://push.hellyw.com/XXXXXXXX)
-//注:此处设置github action用户填写到Settings-Secrets里面(Name输入IGOT_PUSH_KEY)
-let IGOT_PUSH_KEY = '';
-
-if (process.env.PUSH_KEY) {
- SCKEY = process.env.PUSH_KEY;
-}
-if (process.env.BARK_PUSH) {
- if(process.env.BARK_PUSH.indexOf('https') > -1 || process.env.BARK_PUSH.indexOf('http') > -1) {
- //兼容BARK自建用户
- BARK_PUSH = process.env.BARK_PUSH
- } else {
- BARK_PUSH = `https://api.day.app/${process.env.BARK_PUSH}`
- }
- if (process.env.BARK_SOUND) {
- BARK_SOUND = process.env.BARK_SOUND
- }
-} else {
- if(BARK_PUSH && BARK_PUSH.indexOf('https') === -1 && BARK_PUSH.indexOf('http') === -1) {
- //兼容BARK本地用户只填写设备码的情况
- BARK_PUSH = `https://api.day.app/${BARK_PUSH}`
- }
-}
-if (process.env.TG_BOT_TOKEN) {
- TG_BOT_TOKEN = process.env.TG_BOT_TOKEN;
-}
-if (process.env.TG_USER_ID) {
- TG_USER_ID = process.env.TG_USER_ID;
-}
-
-if (process.env.DD_BOT_TOKEN) {
- DD_BOT_TOKEN = process.env.DD_BOT_TOKEN;
- if (process.env.DD_BOT_SECRET) {
- DD_BOT_SECRET = process.env.DD_BOT_SECRET;
- }
-}
-
-if (process.env.IGOT_PUSH_KEY) {
- IGOT_PUSH_KEY = process.env.IGOT_PUSH_KEY
-}
-
-async function sendNotify(text, desp, params = {}) {
- //提供五种通知
- await serverNotify(text, desp);
- text = text.match(/.*?(?=\s?-)/g) ? text.match(/.*?(?=\s?-)/g)[0] : text;
- await BarkNotify(text, desp, params);
- await tgBotNotify(text, desp);
- await ddBotNotify(text, desp);
- await iGotNotify(text, desp, params);
-}
-
-function serverNotify(text, desp, timeout = 2100) {
- return new Promise(resolve => {
- if (SCKEY) {
- //微信server酱推送通知一个\n不会换行,需要两个\n才能换行,故做此替换
- desp = desp.replace(/[\n\r]/g, '\n\n');
- const options = {
- url: `https://sc.ftqq.com/${SCKEY}.send`,
- body: `text=${text}&desp=${desp}`,
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded'
- }
- }
- setTimeout(() => {
- $.post(options, (err, resp, data) => {
- try {
- if (err) {
- console.log('\n发送通知调用API失败!!\n')
- console.log(err);
- } else {
- data = JSON.parse(data);
- if (data.errno === 0) {
- console.log('\nserver酱发送通知消息成功\n')
- } else if (data.errno === 1024) {
- console.log('\nPUSH_KEY 错误\n')
- } else {
- console.log(`server酱发送通知消息异常\n${JSON.stringify(data)}`)
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- }, timeout)
- } else {
- console.log('\n您未提供server酱的SCKEY,取消微信推送消息通知\n');
- resolve()
- }
- })
-}
-
-function BarkNotify(text, desp, params={}) {
- return new Promise(resolve => {
- if (BARK_PUSH) {
- const options = {
- url: `${BARK_PUSH}/${encodeURIComponent(text)}/${encodeURIComponent(desp)}?sound=${BARK_SOUND}&${querystring.stringify(params)}`,
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded'
- }
- }
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- console.log('\nBark APP发送通知调用API失败!!\n')
- console.log(err);
- } else {
- data = JSON.parse(data);
- if (data.code === 200) {
- console.log('\nBark APP发送通知消息成功\n')
- } else {
- console.log(`\n${data.message}\n`);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve();
- }
- })
- } else {
- console.log('\n您未提供Bark的APP推送BARK_PUSH,取消Bark推送消息通知\n');
- resolve()
- }
- })
-}
-
-function tgBotNotify(text, desp) {
- return new Promise(resolve => {
- if (TG_BOT_TOKEN && TG_USER_ID) {
- const options = {
- url: `https://api.telegram.org/bot${TG_BOT_TOKEN}/sendMessage`,
- body: `chat_id=${TG_USER_ID}&text=${text}\n\n${desp}&disable_web_page_preview=true`,
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded'
- }
- }
- 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 })
- }
- $.post(options, (err, resp, data) => {
- try {
- if (err) {
- console.log('\ntelegram发送通知消息失败!!\n')
- console.log(err);
- } else {
- data = JSON.parse(data);
- if (data.ok) {
- console.log('\nTelegram发送通知消息完成。\n')
- } else if (data.error_code === 400) {
- console.log('\n请主动给bot发送一条消息并检查接收用户ID是否正确。\n')
- } else if (data.error_code === 401){
- console.log('\nTelegram bot token 填写错误。\n')
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- } else {
- console.log('\n您未提供telegram机器人推送所需的TG_BOT_TOKEN和TG_USER_ID,取消telegram推送消息通知\n');
- resolve()
- }
- })
-}
-function ddBotNotify(text, desp) {
- return new Promise(resolve => {
- const options = {
- url: `https://oapi.dingtalk.com/robot/send?access_token=${DD_BOT_TOKEN}`,
- json: {
- "msgtype": "text",
- "text": {
- "content": ` ${text}\n\n${desp}`
- }
- },
- headers: {
- 'Content-Type': 'application/json'
- }
- }
- if (DD_BOT_TOKEN && DD_BOT_SECRET) {
- const crypto = require('crypto');
- const dateNow = Date.now();
- const hmac = crypto.createHmac('sha256', DD_BOT_SECRET);
- hmac.update(`${dateNow}\n${DD_BOT_SECRET}`);
- const result = encodeURIComponent(hmac.digest('base64'));
- options.url = `${options.url}×tamp=${dateNow}&sign=${result}`;
- $.post(options, (err, resp, data) => {
- try {
- if (err) {
- console.log('\n钉钉发送通知消息失败!!\n')
- console.log(err);
- } else {
- data = JSON.parse(data);
- if (data.errcode === 0) {
- console.log('\n钉钉发送通知消息完成。\n')
- } else {
- console.log(`\n${data.errmsg}\n`)
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- } else if (DD_BOT_TOKEN) {
- $.post(options, (err, resp, data) => {
- try {
- if (err) {
- console.log('\n钉钉发送通知消息失败!!\n')
- console.log(err);
- } else {
- data = JSON.parse(data);
- if (data.errcode === 0) {
- console.log('\n钉钉发送通知消息完成。\n')
- } else {
- console.log(`\n${data.errmsg}\n`)
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- } else {
- console.log('\n您未提供钉钉机器人推送所需的DD_BOT_TOKEN或者DD_BOT_SECRET,取消钉钉推送消息通知\n');
- resolve()
- }
- })
-}
-
-function iGotNotify(text, desp, params={}){
- return new Promise(resolve => {
- if (IGOT_PUSH_KEY) {
- // 校验传入的IGOT_PUSH_KEY是否有效
- const IGOT_PUSH_KEY_REGX = new RegExp("^[a-zA-Z0-9]{24}$")
- if(!IGOT_PUSH_KEY_REGX.test(IGOT_PUSH_KEY)) {
- console.log('\n您所提供的IGOT_PUSH_KEY无效\n')
- resolve()
- return
- }
- const options = {
- url: `https://push.hellyw.com/${IGOT_PUSH_KEY.toLowerCase()}`,
- body: `title=${text}&content=${desp}&${querystring.stringify(params)}`,
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded'
- }
- }
- $.post(options, (err, resp, data) => {
- try {
- if (err) {
- console.log('\n发送通知调用API失败!!\n')
- console.log(err);
- } else {
- if(typeof data === 'string') data = JSON.parse(data);
- if (data.ret === 0) {
- console.log('\niGot发送通知消息成功\n')
- } else {
- console.log(`\niGot发送通知消息失败:${data.errMsg}\n`)
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- } else {
- console.log('\n您未提供iGot的推送IGOT_PUSH_KEY,取消iGot推送消息通知\n');
- resolve()
- }
- })
-}
-
-module.exports = {
- sendNotify,
- SCKEY,
- BARK_PUSH,
- TG_BOT_TOKEN,
- TG_USER_ID,
- DD_BOT_TOKEN,
- IGOT_PUSH_KEY
-}//这里导出SCKEY,BARK_PUSH等通知参数是jd_bean_sign.js处需要
-// prettier-ignore
-function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{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=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"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 e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;$.isMute||(this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o))),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)}
\ No newline at end of file
diff --git a/serverless.yml b/serverless.yml
deleted file mode 100644
index 332cf3d..0000000
--- a/serverless.yml
+++ /dev/null
@@ -1,81 +0,0 @@
-# serverless.yml
-
-#组件信息
-component: scf # (必选) 组件名称,在该实例中为scf
-name: jdscript # (必选) 组件实例名称。
-
-#组件参数配置
-inputs:
- name: scf-${name} # 云函数名称,默认为 ${name}-${stage}-${app}
- enableRoleAuth: true # 默认会尝试创建 SCF_QcsRole 角色,如果不需要配置成 false 即可
- src: ./
- handler: index.main_handler #入口
- runtime: Nodejs12.16 # 运行环境 默认 Nodejs10.15
- region: ap-hongkong # 函数所在区域
- description: This is a function in ${app} application.
- memorySize: 128 # 内存大小,单位MB
- timeout: 900 # 超时时间,单位秒
- events: # 触发器
- - timer: # 签到
- parameters:
- name: jd_bean_sign
- cronExpression: "0 0 0,3 * * * *"
- enable: true
- argument: jd_bean_sign
- - timer: # 京小超兑换奖品# 摇京豆
- parameters:
- name: jd_blueCoin_jd_club_lottery
- cronExpression: "0 0 0 * * * *"
- enable: true
- argument: jd_blueCoin&jd_club_lottery
- - timer: # 东东农场# 东东萌宠
- parameters:
- name: jd_fruit_jd_pet
- cronExpression: "0 5 6-18/6 * * * *"
- enable: true
- argument: jd_fruit&jd_pet
- - timer: # 宠汪汪喂食# 宠汪汪# 摇钱树# 京东种豆得豆# 京喜工厂 #东东工厂
- parameters:
- name: joy_feedPets_joy_moneyTree_plantBean_dreamFactory_jdfactory
- cronExpression: "0 3 */1 * * * *"
- enable: true
- argument: jd_joy_feedPets&jd_joy&jd_moneyTree&jd_plantBean&jd_dreamFactory&jd_jdfactory
- - timer: # 宠汪汪积分兑换奖品# 宠汪汪偷好友积分与狗# 点点券
- parameters:
- name: jd_joy_reward_jd_joy_steal_jd_necklace
- cronExpression: "0 0 0-16/8 * * * *"
- enable: true
- argument: jd_joy_reward&jd_joy_steal&jd_necklace
- - timer: # 京东全民开红包 # 进店领豆 # 取关京东店铺商品# 京东抽奖机# 东东小窝
- parameters:
- name: redPacket_shop_unsubscribe_lotteryMachine_small_home
- cronExpression: "0 10 0 * * * *"
- enable: true
- argument: jd_redPacket&jd_shop&jd_unsubscribe&jd_lotteryMachine&jd_small_home
- - timer: # 京东天天加速# 天天提鹅
- parameters:
- name: jd_speed_jd_daily_egg
- cronExpression: "0 8 */3 * * * *"
- enable: true
- argument: jd_speed&jd_daily_egg
- - timer: # 东东超市
- parameters:
- name: jd_superMarket
- cronExpression: "0 11 1-23/5 * * * *"
- enable: true
- argument: jd_superMarket
- - timer: # 京豆变动通知 # 京东排行榜
- parameters:
- name: jd_bean_change_jd_rankingList
- cronExpression: "0 0 10 * * * *"
- enable: true
- argument: jd_bean_change&jd_rankingList
- - timer: # 金融养猪#十元街
- parameters:
- name: jd_pigPet_jd_syj
- cronExpression: "0 12 13 * * * *"
- enable: true
- argument: jd_pigPet&jd_syj
- environment: # 环境变量
- variables: # 环境变量对象
- AAA: BBB # 不要删除,用来格式化对齐追加的变量的
diff --git a/tencentscf.md b/tencentscf.md
deleted file mode 100644
index 30c04ca..0000000
--- a/tencentscf.md
+++ /dev/null
@@ -1,128 +0,0 @@
-
-# 云函数快速部署京东脚本
->
-> - 本地安装依赖使用serverless部署,[点这里](tencentscf.md#1-安装-nodejs-环境)
-> - Github Action 部署[点这里](tencentscf.md#github-action-部署)
-
-## 1. 安装 Node.js 环境
-
-Node.js 环境 [下载地址](https://nodejs.org/zh-tw/download/) ,根据自己的操作系统下载和安装。
-
-## 2. 下载代码
-
-点击红框处下载压缩包
-
-
-## 3. 安装依赖,配置 cookie
-
-### 3.1 安装依赖
-
-压缩包解压后进入项目文件夹
-
-- Windows 用户按住 **shift** 点击右键,点击 **在此处打开命令窗口**
-- Mac 用户通过终端,自行进入该文件夹
-
-在命令行内输入 `npm i `,等待运行完成。
-
-此时,项目文件夹内会多出一个 `node_modules`文件夹
-
-### 3.2 配置 cookie
-
-打开项目文件内的 `jdCookie.js`
-
-在最上面的 `CookieJDs`里写入 cookie ,多个账号以逗号分隔
-
-例如
-
-```javascript
-let CookieJDs = [
- 'pt_key=xxx;pt_pin=xxx;',
- 'pt_key=zzz;pt_pin=zzz;',
- 'pt_key=aaa;pt_pin=xxxaaa'
-]
-```
-
-> 注:获取京东 cookie 教程参考 [浏览器获取京东cookie教程](https://github.com/lxk0301/jd_scripts/blob/master/backUp/GetJdCookie.md) , [插件获取京东cookie教程](https://github.com/lxk0301/jd_scripts/blob/master/backUp/GetJdCookie2.md)
-
-
-## 4. 部署到云函数
-
-### 4.1 开通服务
-
-依次登录 [SCF 云函数控制台](https://console.cloud.tencent.com/scf) 和 [SLS 控制台](https://console.cloud.tencent.com/sls) 开通相关服务,确保账户下已开通服务并创建相应[服务角色](https://console.cloud.tencent.com/cam/role) **SCF_QcsRole、SLS_QcsRole**
-
-> 注意!为了确保权限足够,获取这两个参数时不要使用子账户!此外,腾讯云账户需要[实名认证](https://console.cloud.tencent.com/developer/auth)。
-
-### 4.2 工具部署
-
-下载 Serverless 工具,快速部署函数
-```
-npm install -g serverless
-```
-
-执行部署命令
-```
-serverless deploy
-```
-
-如果已经配置了永久秘钥,则可以直接部署,如果没有,可以直接**微信扫码**登录腾讯云,并且授权部署。
-
-过几秒后,查看输出,可以看到函数和定时触发器都已经配置完成。
-```
-serverless ⚡framework
-Action: "deploy" - Stage: "dev" - App: "jdscript" - Instance: "jdscript"
-
-functionName: scf-jdscript
-description: This is a function in jdscript application.
-namespace: default
-runtime: Nodejs12.16
-handler: index.main_handler
-memorySize: 64
-lastVersion: $LATEST
-traffic: 1
-triggers:
- timer:
- - timer-jdscript-dev
-
-36s › jdscript › Success
-```
-
-## 5. 查看和测试
-
-登录后,在 [腾讯云函数地址](https://console.cloud.tencent.com/scf/index) 点击管理控制台,查看最新部署的函数。
-
-在左侧栏的日志查询中,可以查看到触发的日志,包括是否打卡成功等。
-
-
-
-> 如果需要配置永久秘钥,则可以在[访问秘钥页面](https://console.cloud.tencent.com/cam/capi)获取账号的 TENCENT_SECRET_ID,TENCENT_SECRET_KEY,并配置在代码根目录 .env 文件中。
-
-
-# Github Action 部署
-## 1. 开通服务
-
-依次登录 [SCF 云函数控制台](https://console.cloud.tencent.com/scf) 和 [SLS 控制台](https://console.cloud.tencent.com/sls) 开通相关服务,确保账户下已开通服务并创建相应[服务角色](https://console.cloud.tencent.com/cam/role) **SCF_QcsRole、SLS_QcsRole**
-
-> 注意!为了确保权限足够,获取这两个参数时不要使用子账户!此外,腾讯云账户需要[实名认证](https://console.cloud.tencent.com/developer/auth)。
-
-## 2. 在这里新建一个访问密钥[新建密钥](https://console.cloud.tencent.com/cam/capi)
-> 将SecretId和SecretKey分别配置在仓库的secrets变量里面, TENCENT_SECRET_ID对应你的SecretId的值,TENCENT_SECRET_KEY对应你的SecretKey的值
-
-## 3. 配置自己需要secrets变量[参考这里](githubAction.md#下方提供使用到的-secrets全集合)
-### __重要的说三遍__
-### 如果涉及一个变量配置多个值,如多个cookie,多个取消订阅关键字,去掉里面的 *__[空格]()__* 和 __*[换行]()*__ 使用 `&` 连接
-### 如果涉及一个变量配置多个值,如多个cookie,多个取消订阅关键字,去掉里面的 *__[空格]()__* 和 __*[换行]()*__ 使用 `&` 连接
-### 如果涉及一个变量配置多个值,如多个cookie,多个取消订阅关键字,去掉里面的 *__[空格]()__* 和 __*[换行]()*__ 使用 `&` 连接
-> 排查问题第一步先看自己[腾讯云函数](https://console.cloud.tencent.com/scf/list-detail?rid=5&ns=default&id=scf-jdscript)那边的环境变量跟自己在仓库配置的 `secrets` 是否一致
-
-
-
-## 4.执行action workflow进行部署,workflow未报错即部署成功
-
-## 5. 查看和测试
-登录后,在 [腾讯云函数地址](https://console.cloud.tencent.com/scf/index) 点击管理控制台,查看最新部署的函数。
-
-在左侧栏的日志查询中,可以查看到触发的日志,包括是否打卡成功等。
-
-
-## 6. 设置触发器[看这里](iCloud.md#5设置触发器) 或者看这里的[注释说明](https://github.com/iouAkira/jd_scripts/blob/patch-1/index.js#L4)
diff --git a/test2.js b/test2.js
deleted file mode 100644
index d8f4903..0000000
--- a/test2.js
+++ /dev/null
@@ -1,104 +0,0 @@
-const jdCookieNode = require('./jdCookie.js');
-console.log('github action test', jdCookieNode);
-console.log('ACCESS_TOKEN', process.env.ACCESS_TOKEN);
-console.log('JD_COOKIE', process.env.JD_COOKIE);
-console.log('github action test');
-
-const $ = new Env('京东宠汪汪test');
-//Node.js用户请在jdCookie.js处填写京东ck;
-// const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
-//直接用NobyDa的jd cookie
-let cookie = process.env.JD_COOKIE;
-// const cookie2 = jdCookieNode.CookieJD2 ? jdCookieNode.CookieJD2 : $.getdata('CookieJD2');
-!(async () => {
- // if (!cookie) {
- // $.msg('【京东账号一】', '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
- // }
- // await jdUnsubscribe();
- await receivePetTreasureBoxReward();
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- $.done();
- })
-function jdUnsubscribe() {
- return new Promise(resolve => {
- const option = {
- url: `https://api.m.jd.com/client.action?functionId=initForFarm`,
- body: `body=${escape({"version":4})}&appid=wh5&clientVersion=9.1.0`,
- headers: {
- "accept": "*/*",
- "accept-encoding": "gzip, deflate, br",
- "accept-language": "zh-CN,zh;q=0.9",
- "cache-control": "no-cache",
- "cookie": "pt_key=AAJfKpaxAEBdRN4DgKrh9lhxAp2lqzyZY2hipLPYCe-mISz4Nyq14IoNCVBXhUEhEuPVJ9D0KkfDjqln4heol2dt6cdt7efp;pt_pin=%E8%A2%AB%E6%8A%98%E5%8F%A0%E7%9A%84%E8%AE%B0%E5%BF%8633;",
- "origin": "https://home.m.jd.com",
- "pragma": "no-cache",
- "referer": "https://home.m.jd.com/myJd/newhome.action",
- "sec-fetch-dest": "empty",
- "sec-fetch-mode": "cors",
- "sec-fetch-site": "same-site",
- "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1",
- "Content-Type": "application/x-www-form-urlencoded"
- }
- };
- $.post(option, (err, resp, data) => {
- console.log('err', err);
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- // console.log('--data--', data);
- // console.log(`--data--${JSON.stringify(data)}`);
- data = JSON.parse(data);
- console.log('--data--', data);
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-//领取聚宝盆积分API
-function receivePetTreasureBoxReward() {
- return new Promise(resolve => {
- const options = {
- url: `https://jdjoy.jd.com/pet/receivePetTreasureBoxReward?type=hour`,
- headers: {
- "Accept": "*/*",
- "Cookie": `pt_key=AAJfM3LVADDm6sKvImWEGiLbVEOzQPT1X73ZFH2CaSGl0byvAkdqPQAZ7LHvvHZUbaZfwCwvJWo;pt_pin=jd_704a2e5e28a66;`,
- "Content-Type": "application/json",
- "Referer": "https://jdjoy.jd.com/pet/index",
- "Host": "jdjoy.jd.com",
- "User-Agent": "jdapp;iPhone;9.1.0;13.5.1;1449975c49aad55bdeea32b71707a3729ed650fb;network/4g;ADID/1C353379-6987-438A-92AD-C93A5F986DB4;supportApplePay/1;hasUPPay/1;pushNoticeIsOpen/0;model/iPhone8,1;addressid/138571211;hasOCPay/0;appBuild/167348;supportBestPay/0;jdSupportDarkMode/0;pv/1042.4;apprpd/MyJD_GameMain;ref/MyJdGameEnterPageController;psq/3;ads/;psn/1449975c49aad55bdeea32b71707a3729ed650fb|1709;jdv/0|kong|t_1001777500_|jingfen|f88dd5fd72814b40b85b3438f7ebe256|1598494505889|1598494511;adk/;app_device/IOS;pap/JA2015_311210|9.1.0|IOS 13.5.1;Mozilla/5.0 (iPhone; CPU iPhone OS 13_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
- "reqSource": "h5",
- "Accept-Language": "zh-cn",
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- console.log('\n京东宠汪汪: API查询请求失败 ‼️‼️')
- } else {
- // console.log('JSON.parse(data)', JSON.parse(data))
- data = JSON.parse(data);
- if (data.success) {
- console.log('积分领取成功')
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve();
- }
- })
- })
-}
-// prettier-ignore
-function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{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=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"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 e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)}
\ No newline at end of file