diff --git a/.github/workflows/deploy_tencent_scf.yml b/.github/workflows/deploy_tencent_scf.yml index 70d6d17e..04d1a3df 100644 --- a/.github/workflows/deploy_tencent_scf.yml +++ b/.github/workflows/deploy_tencent_scf.yml @@ -22,6 +22,7 @@ jobs: run: | npm install npm install tencentcloud-sdk-nodejs + npm install js-yaml - name: "将Secrets里面配置的变量添加到severless.yml里面作为环境变量" run: | @@ -166,3 +167,5 @@ jobs: SERVERLESS_PLATFORM_VENDOR: tencent TENCENT_SECRET_ID: ${{ secrets.TENCENT_SECRET_ID }} TENCENT_SECRET_KEY: ${{ secrets.TENCENT_SECRET_KEY }} + TENCENT_REGION: ${{ secrets.SCF_REGION }} + TENCENT_FUNCTION_NAME: ${{ secrets.TENCENT_FUNCTION_NAME }} diff --git a/Loon/lxk0301_LoonTask.conf b/Loon/lxk0301_LoonTask.conf index ff4ad413..a419403d 100644 --- a/Loon/lxk0301_LoonTask.conf +++ b/Loon/lxk0301_LoonTask.conf @@ -5,7 +5,7 @@ # Loon的Task&Cookies脚本订阅链接: https://raw.githubusercontent.com/LXK9301/jd_scripts/master/Loon/lxk0301_LoonTask.conf # 使用方法:打开APP,顶部的配置 -> 脚本 -> 订阅脚本- > 点击右上角+号 -> 添加url链接 (https://raw.githubusercontent.com/LXK9301/jd_scripts/master/Loon/lxk0301_LoonTask.conf) -hostname = api.m.jd.com, draw.jdfcloud.com, jdjoy.jd.com, account.huami.com +hostname = api.m.jd.com, wq.jd.com, draw.jdfcloud.com, jdjoy.jd.com, account.huami.com # 获取多账号京东Cookie http-request https:\/\/wq\.jd\.com\/user_new\/info\/GetJDUserInfoUnion script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/JD_extra_cookie.js, tag=获取多账号京东Cookie @@ -107,10 +107,7 @@ cron "10 0,20 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_sc cron "1 7 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nh.js,tag=京东年货节 # 京东炸年兽🧨 -cron "10 * * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js,tag=京东炸年兽🧨 - -# 京东炸年兽领爆竹🧨 -cron "50 * * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nianCollect.js,tag=京东收🧨 +cron "0 9,12,20 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js,tag=京东炸年兽🧨 # 京东炸年兽AR cron "0 9 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian_ar.js,tag=京东炸年兽AR @@ -121,6 +118,9 @@ cron "30 8 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scrip # 京东炸年兽小程序🧨 cron "50 8 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian_wechat.js,tag=京东炸年兽小程序🧨 +# 京东炸年兽领爆竹🧨 +cron "50 * * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nianCollect.js,tag=京东收🧨 + # 东东萌宠 cron "15 6-18/6 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_pet.js,tag=东东萌宠 diff --git a/QuantumultX/lxk0301_cookies.conf b/QuantumultX/lxk0301_cookies.conf index 31a3b77a..c5f36e8f 100644 --- a/QuantumultX/lxk0301_cookies.conf +++ b/QuantumultX/lxk0301_cookies.conf @@ -1,4 +1,4 @@ -hostname = api.m.jd.com, draw.jdfcloud.com, jdjoy.jd.com, account.huami.com +hostname = api.m.jd.com, draw.jdfcloud.com, jdjoy.jd.com, account.huami.com, wq.jd.com # 获取多账号京东Cookie https:\/\/wq\.jd\.com\/user_new\/info\/GetJDUserInfoUnion url script-request-header https://raw.githubusercontent.com/LXK9301/jd_scripts/master/JD_extra_cookie.js diff --git a/QuantumultX/lxk0301_gallery.json b/QuantumultX/lxk0301_gallery.json index 47692b0e..ad35480f 100644 --- a/QuantumultX/lxk0301_gallery.json +++ b/QuantumultX/lxk0301_gallery.json @@ -30,16 +30,16 @@ "3 0-23/2 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_moneyTree.js, tag=京东摇钱树, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdyqs.png, enabled=true", "10 0,20 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_necklace.js, tag=点点券, img-url=https://raw.githubusercontent.com/Orz-3/task/master/jd.png, enabled=true", "1 7 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nh.js, tag=京东年货节, img-url=https://raw.githubusercontent.com/Orz-3/task/master/jd.png, enabled=true", - "10 * * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js, tag=京东炸年兽🧨, img-url=https://raw.githubusercontent.com/yogayyy/Scripts/main/Icon/lxk0301/jd_nian.png, enabled=true", - "50 * * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nianCollect.js, tag=京东收🧨, img-url=https://raw.githubusercontent.com/yogayyy/Scripts/main/Icon/lxk0301/jd_nianCollect.png, enabled=true", + "0 9,12,20 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js, tag=京东炸年兽🧨, img-url=https://raw.githubusercontent.com/yogayyy/Scripts/main/Icon/lxk0301/jd_nian.png, enabled=true", "0 9 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian_ar.js, tag=京东炸年兽AR, img-url=https://raw.githubusercontent.com/yogayyy/Scripts/main/Icon/lxk0301/jd_nian.png, enabled=true", "30 8 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian_sign.js, tag=京东炸年兽签到任务🧨, img-url=https://raw.githubusercontent.com/yogayyy/Scripts/main/Icon/lxk0301/jd_nian.png, enabled=true", "50 8 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian_wechat.js, tag=京东炸年兽小程序🧨, img-url=https://raw.githubusercontent.com/yogayyy/Scripts/main/Icon/lxk0301/jd_nian.png, enabled=true", + "50 * * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nianCollect.js, tag=京东收🧨, img-url=https://raw.githubusercontent.com/yogayyy/Scripts/main/Icon/lxk0301/jd_nianCollect.png, enabled=true", "15 6-18/6 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_pet.js, tag=东东萌宠, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdmc.png, enabled=true", "12 * * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_pigPet.js, tag=京东金融养猪猪, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdyz.png, enabled=true", "1 7-21/2 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_plantBean.js, tag=种豆得豆, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdzd.png, enabled=true", "1 1 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_redPacket.js, tag=京东全民开红包, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_redPacket.png, enabled=true", - "20 8 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_sgmh.js, tag=闪购盲盒, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_sgmh.png, enabled=true", + "20 8 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_sgmh.js, tag=闪购盲盒, img-url=https://raw.githubusercontent.com/Orz-3/task/master/jd.png, enabled=true", "10 0 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_shop.js, tag=进店领豆, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_shop.png, enabled=true", "16 22 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_small_home.js, tag=东东小窝, img-url=https://raw.githubusercontent.com/58xinian/icon/master/ddxw.png, enabled=true", "8 0-23/3 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_speed.js, tag=京东天天加速, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdjs.png, enabled=true", diff --git a/Surge/lxk0301_Task.sgmodule.sgmodule b/Surge/lxk0301_Task.sgmodule.sgmodule index dd18bfb1..af1bd196 100644 --- a/Surge/lxk0301_Task.sgmodule.sgmodule +++ b/Surge/lxk0301_Task.sgmodule.sgmodule @@ -41,7 +41,7 @@ crazyJoy任务 = type=cron,cronexp="10 7 * * *",wake-system=1,timeout=3600,scrip 京东摇钱树 = type=cron,cronexp="3 0-23/2 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_moneyTree.js 点点券 = type=cron,cronexp="10 0,20 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_necklace.js 京东年货节 = type=cron,cronexp="1 7 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nh.js -京东炸年兽🧨 = type=cron,cronexp="10 * * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js +京东炸年兽🧨 = type=cron,cronexp="0 9,12,20 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js 京东收🧨 = type=cron,cronexp="50 * * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nianCollect.js 京东炸年兽AR = type=cron,cronexp="0 9 * * *",wake-system=1,timeout=36000,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian_ar.js 京东炸年兽签到任务🧨 = type=cron,cronexp="30 8 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian_sign.js @@ -64,4 +64,4 @@ crazyJoy任务 = type=cron,cronexp="10 7 * * *",wake-system=1,timeout=3600,scrip 小米运动获取Token = type=http-response,pattern=^https:\/\/account\.huami\.com\/v2\/client\/login, requires-body=1, max-size=0, script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/backUp/xmSports.js [MITM] -hostname = %APPEND% wq.jd.com, draw.jdfcloud.com, jdjoy.jd.com, account.huami.com +hostname = %APPEND% wq.jd.com, draw.jdfcloud.com, jdjoy.jd.com, account.huami.com, wq.jd.com diff --git a/USER_AGENTS.js b/USER_AGENTS.js index f229320c..ef57c28e 100644 --- a/USER_AGENTS.js +++ b/USER_AGENTS.js @@ -20,7 +20,22 @@ const USER_AGENTS = [ "jdapp;iPhone;4.0.0;11.4;9ed0d69aaf190b5b4277868d2c0470fe1f787080;network/wifi;model/iPhone8,1;appBuild/100401;ADID/64199E21-4ECD-4217-BD79-0C4D82033FD8;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/1;hasOCPay/0;supportBestPay/0;session/73;pap/JA2019_3111789;brand/apple;supportJDSHWK/1;Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15F79", "jdapp;android;9.3.0;10;3b78ecc3f490c7ba;network/wifi;model/M2006J10C;addressid/138543439;aid/3b78ecc3f490c7ba;oaid/7d5870c5a1696881;osVer/29;appBuild/85770;psn/3b78ecc3f490c7ba|599;psq/2;uid/3b78ecc3f490c7ba;adk/;ads/;pap/JA2015_311210|9.3.0|ANDROID 10;osv/10;pv/580.2;jdv/0|kong|t_1000089893_|tuiguang|e21138bd89c445d98a2cc2e375c37b4f|1606572739;ref/com.jd.lib.personal.view.fragment.JDPersonalFragment;partner/jingdong;apprpd/MyJD_Main;Mozilla/5.0 (Linux; Android 10; M2006J10C Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", "jdapp;android;9.3.5;10;3326738356363633-6643930336732616;network/wifi;model/M2006J10C;addressid/138543439;aid/3b78ecc3f490c7ba;oaid/7d5870c5a1696881;osVer/29;appBuild/86390;psn/+pXCRL9fJyKJUUyy3COtPXYNfar5tX5i|2154;psq/2;adk/;ads/;pap/JA2015_311210|9.3.5|ANDROID 10;osv/10;pv/1473.2;jdv/0|kong|t_1000170135|tuiguang|notset|1607913972208|1607913972;ref/com.jingdong.app.mall.home.JDHomeFragment;partner/jingdong;apprpd/Home_Main;eufv/1;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 10; M2006J10C Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", - "jdapp;android;9.1.4;10;f0798926f10dc8d8;network/wifi;model/ONEPLUS A6000;addressid/2082421393;aid/f0798926f10dc8d8;oaid/;osVer/29;appBuild/84555;partner/oppo;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 10; ONEPLUS A6000 Build/QKQ1.190716.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045224 Mobile Safari/537.36" + "jdapp;android;9.1.4;10;f0798926f10dc8d8;network/wifi;model/ONEPLUS A6000;addressid/2082421393;aid/f0798926f10dc8d8;oaid/;osVer/29;appBuild/84555;partner/oppo;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 10; ONEPLUS A6000 Build/QKQ1.190716.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045224 Mobile Safari/537.36", + "jdapp;android;9.1.0;9;864360034117260-18d276c8a45f;network/wifi;model/MHA-AL00;addressid/2013852661;aid/6edf28a51a564bc7;oaid/7efede7f-7ffb-839d-d58f-7f7b7ff9c1ee;osVer/28;appBuild/83789;partner/jingdong;Mozilla/5.0 (Linux; Android 9; MHA-AL00 Build/HUAWEIMHA-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", + "jdapp;android;8.5.2;8.1.0;865664032788249-90f05250a015;network/wifi;model/16 X;addressid/137581227;aid/99e3cd08cf5f0a2c;oaid/;osVer/27;appBuild/71869;partner/meizu;Mozilla/5.0 (Linux; Android 8.1.0; 16 X Build/OPM1.171019.026; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", + "jdapp;android;9.3.6;8.0.0;3353936343830383030333835333-53D2430343563363237316933336;network/wifi;model/HTC U-3w;addressid/1077019363;aid/c62026bb64774879;oaid/;osVer/26;appBuild/86560;partner/jingdong;eufv/1;Mozilla/5.0 (Linux; Android 8.0.0; HTC U-3w Build/OPR6.170623.013; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", + "jdapp;iPhone;9.3.5;14.0.1;f467d6c04cd809e79dc000c574f8f79f00948dbc;network/wifi;ADID/60D6729F-9462-416A-84BA-087DE63342EA;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone10,2;addressid/138086175;supportBestPay/0;appBuild/167515;jdSupportDarkMode/0;pv/1122.25;apprpd/Babel_Native;ref/https%3A%2F%2Fwbbny.m.jd.com%2FbabelDiy%2FZeus%2F2cKMj86srRdhgWcKonfExzK4ZMBy%2Findex.html%3FbabelChannel%3Djx%26lng%3D118.734885%26lat%3D31.980189%26sid%3D5ac4902e0d1350a80f8127f88cc27c3w%26un_area%3D12_904_3379_62183%23%2Fhome;psq/0;ads/;psn/f467d6c04cd809e79dc000c574f8f79f00948dbc|3145;jdv/0|kong|t_1001597287_27078064|jingfen|ba710561492a446da2815e561082c75b|1611304510000|1611367639|1611367690;adk/;app_device/IOS;pap/JA2015_311210|9.3.5|IOS 14.0.1;Mozilla/5.0 (iPhone; CPU iPhone OS 14_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", + "jdapp;android;9.3.6;10;8363434323030343235333838383-93D2134346136393268356361326;network/wifi;model/LYA-AL00;addressid/514336649;aid/4566072c8d9c08ac;oaid/00000000-0000-0000-0000-000000000000;osVer/29;appBuild/86560;partner/huawei;eufv/1;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 10; LYA-AL00 Build/HUAWEILYA-AL00L; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", + "jdapp;iPhone;9.3.5;14.2;075879f1ae1f0fede61c030eb6b3e7b1b0ce9ae2;network/wifi;ADID/88BBE341-AE7D-4789-B7D9-B5EBBFF413A5;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone10,3;addressid/138021169;supportBestPay/0;appBuild/167515;jdSupportDarkMode/0;pv/980.15;apprpd/MyCalendar_ActivityCalendar;ref/;psq/4;ads/;psn/075879f1ae1f0fede61c030eb6b3e7b1b0ce9ae2|3781;jdv/0|direct|-|none|-|1611189859248|1611189890;adk/;app_device/IOS;pap/JA2015_311210|9.3.5|IOS 14.2;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", + "jdapp;iPhone;9.3.5;14.3;f43410af69a81012383ca839707069b2a4c68e27;network/wifi;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone11,8;addressid/3064531114;supportBestPay/0;appBuild/167515;jdSupportDarkMode/0;pv/481.19;apprpd/Home_Main;ref/JDMainPageViewController;psq/1;ads/;psn/f43410af69a81012383ca839707069b2a4c68e27|1274;jdv/0|kong|t_1000170136|tuiguang|notset|1611275169877|1611280752;adk/;app_device/IOS;pap/JA2015_311210|9.3.5|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", + "jdapp;iPhone;9.3.4;14.2;be1acbcd17e4c25aeb5bc17c7567a8fa44ce9cab;network/wifi;ADID/04974BAF-2BED-45AC-A0AE-2242820A3C4F;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone13,4;addressid/1083782522;supportBestPay/0;appBuild/167502;jdSupportDarkMode/0;pv/1548.4;apprpd/Home_Main;ref/JDMainPageViewController;psq/1;ads/;psn/be1acbcd17e4c25aeb5bc17c7567a8fa44ce9cab|2101;jdv/0|kong|t_1000170135|tuiguang|notset|1611232250866|1611232250;adk/;app_device/IOS;pap/JA2015_311210|9.3.4|IOS 14.2;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", + "jdapp;android;9.2.2;8.1.0;869071037529592-9487e01e7f2d;network/wifi;model/MI 8;addressid/2769817385;aid/f4ed3e79ab29f481;oaid/;osVer/27;appBuild/85371;partner/xiaomi001;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 8.1.0; MI 8 Build/OPM1.171019.026; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045131 Mobile Safari/537.36", + "jdapp;android;9.3.4;10;9356665333362626-4603362346333356;network/UNKNOWN;model/Redmi K20 Pro Premium Edition;addressid/137826363;aid/9ef53cbbd0c2d33e;oaid/ec7c5827275510c6;osVer/29;appBuild/86388;psn/DlHZjadWfe77DEYHrpjFjvKonV0SSFdy|921;psq/2;adk/;ads/;pap/JA2015_311210|9.3.4|ANDROID 10;osv/10;pv/793.2;jdv/0|kong|t_1000089893_|tuiguang|7459d8cb7c8f4f9f8e6e87751f61bd18|1611236364;ref/com.jd.lib.personal.view.fragment.JDPersonalFragment;partner/xiaomi001;apprpd/MyJD_Main;eufv/1;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 10; Redmi K20 Pro Premium Edition Build/QKQ1.190825.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36", + "jdapp;iPhone;9.3.5;14.3;244bd50c51f0b198dd8733afe89cdec4b09df713;network/wifi;JDEbook/openapp.jdreader;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone8,2;addressid/0;supportBestPay/0;appBuild/167515;jdSupportDarkMode/0;pv/2.2;apprpd/Home_Main;ref/JDMainPageViewController;psq/1;ads/;psn/244bd50c51f0b198dd8733afe89cdec4b09df713|2;jdv/0|;adk/;app_device/IOS;pap/JA2015_311210|9.3.5|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", + "jdapp;iPhone;9.3.5;14.3;85ce08e05756b547e15f0b637cc99addd96b3345;network/4g;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone12,1;addressid/138116050;supportBestPay/0;appBuild/167515;jdSupportDarkMode/0;pv/524.2;apprpd/Home_Main;ref/JDMainPageViewController;psq/1;ads/;psn/85ce08e05756b547e15f0b637cc99addd96b3345|1591;jdv/0|kong|t_1000170136|tuiguang|notset|1609480641159|1609480641;adk/;app_device/IOS;pap/JA2015_311210|9.3.5|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", + "jdapp;android;9.3.6;11;2643139303035683-6326533623539333;network/UNKNOWN;model/Redmi K20 Pro Premium Edition;addressid/0;aid/b41900e86b5c2593;oaid/a1ae016fae05d3c8;osVer/30;appBuild/86560;partner/xiaomi001;eufv/1;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 11; Redmi K20 Pro Premium Edition Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045513 Mobile Safari/537.36", + "jdapp;android;9.3.6;10;8363037353830343533303236333-73D2438323361603735616833316;network/UNKNOWN;model/MI 8;addressid/2532472939;aid/b5de2a5d9ce280f6;oaid/867c11ae16e94d11;osVer/29;appBuild/86560;partner/xiaomi001;eufv/1;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36", + "jdapp;iPhone;9.2.4;14.1;b9d474077232e439a03d610bc11e3861a0296b67;network/wifi;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone11,8;addressid/13377806;supportBestPay/0;appBuild/167432;pushNoticeIsOpen/0;jdSupportDarkMode/0;pv/259.20;apprpd/Home_Main;ref/JDMainPageViewController;psq/17;ads/;psn/b9d474077232e439a03d610bc11e3861a0296b67|675;jdv/0|kong|t_1000089893_|tuiguang|c37639dcb10b43c0a4ceb54b19be50cf|1610978908;adk/;app_device/IOS;pap/JA2015_311210|9.2.4|IOS 14.1;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", ] /** * 生成随机数字 diff --git a/backUp/tencentscf.md b/backUp/tencentscf.md index 20701a5c..d9bee915 100644 --- a/backUp/tencentscf.md +++ b/backUp/tencentscf.md @@ -1,5 +1,5 @@ -# 云函数快速部署京东脚本 +# 云函数快速部署京东脚本(由于云函数官方升级此方法暂时失效) > > - 本地安装依赖使用serverless部署,[点这里](tencentscf.md#1-安装-nodejs-环境) > - Github Action 部署[点这里](tencentscf.md#github-action-部署) @@ -109,6 +109,9 @@ triggers: > 将SecretId和SecretKey分别配置在仓库的secrets变量里面, TENCENT_SECRET_ID对应你的SecretId的值,TENCENT_SECRET_KEY对应你的SecretKey的值 ## 3. 配置自己需要secrets变量[参考这里](githubAction.md#下方提供使用到的-secrets全集合) + +目前因为云函数改版升级,原GitHub Action部署云函数方案需要作出相应调整,secret变量新增`SCF_REGION`和`TENCENT_FUNCTION_NAME`。`SCF_REGION`用于控制部署区域的选择,具体参数代码填写可以自行查找官方说明 [地域和可用区](https://cloud.tencent.com/document/product/213/6091) `TENCENT_FUNCTION_NAME`用于控制部署到云函数后函数名的命名。
+ ### __重要的说三遍__ ### 如果涉及一个变量配置多个值,如多个cookie,多个取消订阅关键字,去掉里面的 *__[空格]()__* 和 __*[换行]()*__ 使用 `&` 连接 ### 如果涉及一个变量配置多个值,如多个cookie,多个取消订阅关键字,去掉里面的 *__[空格]()__* 和 __*[换行]()*__ 使用 `&` 连接 @@ -118,6 +121,9 @@ triggers: ## 4.执行action workflow进行部署,workflow未报错即部署成功 + +**在执行action workflow进行部署前,先在需要部署的区域下新建一个空函数,名称可以任意,比如:`jd`,此时secret中`TENCENT_FUNCTION_NAME`值也必须是`jd`,保持与云函数的函数名一致,目前部署云函数的策略是覆盖的方式,故而此步骤至关重要。**
+ ![image](https://user-images.githubusercontent.com/6993269/99513289-6a152980-29c5-11eb-9266-3f56ba13d3b2.png) ## 5. 查看和测试 登录后,在 [腾讯云函数地址](https://console.cloud.tencent.com/scf/index) 点击管理控制台,查看最新部署的函数。 diff --git a/githubAction.md b/githubAction.md index 3d6d675d..2036b252 100644 --- a/githubAction.md +++ b/githubAction.md @@ -48,6 +48,7 @@ | `BOOKSHOP_SHARECODES` | 京东书店互助码 | 非必须 | 10/ | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) | | `JD_CASH_SHARECODES` | 签到领现金互助码 | 非必须 | 10/ | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) | | `JXNC_SHARECODES` | 京喜农场互助码 | 非必须 | / | 注意:京喜农场 种植种子发生变化的时候,互助码也会变!!
每个账号 shareCode 是一个 json,json 需要用单引号包裹且是一行字符串,
否则设置环境变量时会出错,示例:'{"smp":"22bdadsfaadsfadse8a","active":"jdnc_1_btorange210113_2","joinnum":"1"}',多账单间使用`&`或换行分开。详细说明参见[#Pr202](https://github.com/LXK9301/jd_scripts/pull/202) | +| `JDSGMH_SHARECODES` | 闪购盲盒互助码 | 非必须 | 10/ | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) | | `JDNIAN_SHARECODES` | 炸年兽互助码 | 非必须 | 10/ | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) | | `JDSXSY_SHARECODES` | 京东神仙书院
互助码 | 非必须 | 20/5 | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) | @@ -86,6 +87,7 @@ | `JD_WECHAT_USER_AGENT` | 京东炸年兽
小程序
自定义UA | 非必须 | 强烈推荐使用自定义的小程序UA防止黑号,UA示例:
Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15A148 MicroMessenger/7.0.20(0x17001320) NetType/WIFI Language/zh_CN | | `DREAMFACTORY_FORBID_ACCOUNT`| 京喜工厂
控制哪个京东账号不运行此脚本 | 非必须 | 输入`1`代表第一个京东账号不运行,多个使用`&`连接,例:`1&3`代表账号1和账号3不运行京喜工厂脚本,注:输入`0`,代表全部账号不运行京喜工厂脚本 | | `JDFACTORY_FORBID_ACCOUNT`| 东东工厂
控制哪个京东账号不运行此脚本 | 非必须 | 输入`1`代表第一个京东账号不运行,多个使用`&`连接,例:`1&3`代表账号1和账号3不运行东东工厂脚本,注:输入`0`,代表全部账号不运行东东工厂脚本 | +| `FIRECRACKERS_NOTITY_BEAN`| 集鞭炮赢京豆
满足兑换 X 个京豆通知开关 | 非必须 | 默认 0 不通知,输入 120 表示满足兑换 120 个京豆时通知 | ##### 互助码的填写规则 diff --git a/jd_bean_sign.js b/jd_bean_sign.js index 4a061fd8..c8cd63bb 100644 --- a/jd_bean_sign.js +++ b/jd_bean_sign.js @@ -147,7 +147,7 @@ async function changeFile (content) { let newContent = content.replace(/var Key = ''/, `var Key = '${cookie}'`); newContent = newContent.replace(/const NodeSet = 'CookieSet.json'/, `const NodeSet = '${NodeSet}'`) 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}`); + newContent = newContent.replace(/var stop = '0'/, `var stop = '${process.env.JD_BEAN_STOP}'`); } const zone = new Date().getTimezoneOffset(); if (zone === 0) { @@ -262,4 +262,4 @@ function timeFormat(time) { } return date.getFullYear() + '-' + ((date.getMonth() + 1) >= 10 ? (date.getMonth() + 1) : '0' + (date.getMonth() + 1)) + '-' + (date.getDate() >= 10 ? date.getDate() : '0' + date.getDate()); } -function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(n,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file +function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(n,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} diff --git a/jd_crazy_joy.js b/jd_crazy_joy.js index 2169ebc3..06041638 100644 --- a/jd_crazy_joy.js +++ b/jd_crazy_joy.js @@ -34,7 +34,7 @@ let applyJdBean = 0; //疯狂的JOY京豆兑换,目前最小值为2000京豆 let cookiesArr = [], cookie = '', message = ''; const inviteCodes = [ 'EdLPh8A6X5G1iWXu-uPYfA==@0gUO7F7N-4HVDh9mdQC2hg==@fUJTgR9z26fXdQgTvt_bgqt9zd5YaBeE@nCQQXQHKGjPCb7jkd8q2U-aCTjZMxL3s@2boGLV7TonMex8-nrT6EGat9zd5YaBeE@KTZmB4gV4zirfc3eWGgXhA==@dtTXFsCQ3tCWnXkLY8gyL6t9zd5YaBeE@-c4jG-fMiNon5YWAJsFHL6t9zd5YaBeE@hxG_ozzxvNjPuPCbly1WtA==', - 'EdLPh8A6X5G1iWXu-uPYfA==@0gUO7F7N-4HVDh9mdQC2hg==@fUJTgR9z26fXdQgTvt_bgqt9zd5YaBeE@nCQQXQHKGjPCb7jkd8q2U-aCTjZMxL3s@2boGLV7TonMex8-nrT6EGat9zd5YaBeE' + 'EdLPh8A6X5G1iWXu-uPYfA==@0gUO7F7N-4HVDh9mdQC2hg==@fUJTgR9z26fXdQgTvt_bgqt9zd5YaBeE@nCQQXQHKGjPCb7jkd8q2U-aCTjZMxL3s@2boGLV7TonMex8-nrT6EGat9zd5YaBeE@EyZA15nkwWscm7frOkjZTat9zd5YaBeE' ]; const randomCount = $.isNode() ? 10 : 5; const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; @@ -175,10 +175,12 @@ if ($.isNode()) { return; } await requireConfig(); - $.nextCode = ["EdLPh8A6X5G1iWXu-uPYfA==", "nCQQXQHKGjPCb7jkd8q2U-aCTjZMxL3s"]; - $.nextCode = $.nextCode[randomNumber(0, $.nextCode.length)]; $.selfCodes = [] for (let i = 0; i < cookiesArr.length; i++) { + if (i%2===0) { + $.nextCode = ["EdLPh8A6X5G1iWXu-uPYfA==", "nCQQXQHKGjPCb7jkd8q2U-aCTjZMxL3s"]; + $.nextCode = $.nextCode[randomNumber(0, $.nextCode.length)]; + } if (cookiesArr[i]) { cookie = cookiesArr[i]; $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1]) @@ -808,4 +810,4 @@ function randomNumber(min = 0, max = 100) { return Math.min(Math.floor(min + Math.random() * (max - min)), max); } // prettier-ignore -function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(n,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file +function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(n,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} diff --git a/jd_dreamFactory.js b/jd_dreamFactory.js index b76591d6..eb1e1072 100644 --- a/jd_dreamFactory.js +++ b/jd_dreamFactory.js @@ -36,7 +36,7 @@ const jxOpenUrl = `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%2 let cookiesArr = [], cookie = '', message = ''; const inviteCodes = [ 'V5LkjP4WRyjeCKR9VRwcRX0bBuTz7MEK0-E99EJ7u0k=@0WtCMPNq7jekehT6d3AbFw==', - "gB99tYLjvPcEFloDgamoBw==", + "gB99tYLjvPcEFloDgamoBw==@7dluIKQMp0bySgcr8AqFgw==", '-OvElMzqeyeGBWazWYjI1Q==', 'GFwo6PntxDHH95ZRzZ5uAg==' ]; diff --git a/jd_firecrackers.js b/jd_firecrackers.js index d5a67b79..634c49ba 100644 --- a/jd_firecrackers.js +++ b/jd_firecrackers.js @@ -26,6 +26,7 @@ cron "10 8,21 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_sc */ const $ = new Env('集鞭炮赢京豆'); const notify = $.isNode() ? require('./sendNotify') : ''; +let notifyBean = $.isNode() ? process.env.FIRECRACKERS_NOTITY_BEAN || 0 : 0; // 账号满足兑换多少京豆时提示 默认 0 不提示,格式:120 表示能兑换 120 豆子发出通知; const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; //Node.js用户请在jdCookie.js处填写京东ck; //IOS等用户直接用NobyDa的jd cookie @@ -92,9 +93,25 @@ async function jdFamily() { } function showMsg() { - return new Promise(resolve => { - message += `本次运行获得鞭炮${$.earn},共计${$.total}🧨` - $.log($.name, '', `京东账号${$.index}${$.nickName}\n${message}`); + return new Promise(async resolve => { + subTitle = `【京东账号${$.index}】${$.nickName}`; + message += `【鞭炮🧨】本次获得 ${$.earn},共计${$.total}\n` + if ($.total && notifyBean) { + for (let item of $.prize) { + if (notifyBean <= item.beansPerNum) { // 符合预定的京豆档位 + if ($.total >= item.prizerank) { // 当前鞭炮满足兑换 + message += `【京豆】请手动兑换 ${item.beansPerNum} 个京豆,需消耗花费🧨 ${item.prizerank}` + $.msg($.name, subTitle, message); + if ($.isNode()) { + await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `${subTitle}\n${message}`); + resolve(); + return; + } + } + } + } + } + $.log(`${$.name}\n\n账号${$.index} - ${$.nickName}\n${subTitle}\n${message}`); resolve() }) } @@ -130,17 +147,22 @@ function getUserInfo(info = false) { $.userInfo = JSON.parse(data.match(/query\((.*)\n/)[1]) if (info) { $.earn = $.userInfo.tatalprofits - $.total - } else for (let task of $.info.config.tasks) { - let vo = $.userInfo.tasklist.filter(vo => vo.taskid === task['_id']) - if (vo.length > 0) { - vo = vo[0] - if (vo['isdo'] === 1) { - if (vo['times'] === 0) { - console.log(`去做任务${task['_id']}`) - await doTask(task['_id']) - await $.wait(3000) - } else { - console.log(`${Math.trunc(vo['times'] / 60)}分钟可后做任务${task['_id']}`) + } else { + for (let task of $.info.config.tasks) { + let vo = $.userInfo.tasklist.filter(vo => vo.taskid === task['_id']) + if (vo.length > 0) { + vo = vo[0] + if (vo['isdo'] === 1) { + if (vo['times'] === 0) { + console.log(`去做任务${task['_id']}`) + let res = await doTask(task['_id']) + if (!res) { // 黑号,不再继续执行任务 + break; + } + await $.wait(3000) + } else { + console.log(`${Math.trunc(vo['times'] / 60)}分钟可后做任务${task['_id']}`) + } } } } @@ -165,9 +187,14 @@ function doTask(taskId) { console.log(`${err},${jsonParse(resp.body)['message']}`) console.log(`${$.name} API请求失败,请检查网路重试`) } else { - data = JSON.parse(data.match(/query\((.*)\n/)[1]) + let res = data.match(/query\((.*)\n/)[1]; + data = JSON.parse(res); if (data.ret === 0) { console.log(`任务完成成功`) + } else if (data.ret === 1001) { + console.log(`任务完成失败,原因:这个账号黑号了!!!`) + resolve(false); + return; } else { console.log(`任务完成失败,原因未知`) } diff --git a/jd_fruit.js b/jd_fruit.js index e4d4ea82..cf7b9840 100644 --- a/jd_fruit.js +++ b/jd_fruit.js @@ -31,7 +31,7 @@ let shareCodes = [ // 这个列表填入你要助力的好友的shareCode //账号一的好友shareCode,不同好友的shareCode中间用@符号隔开 '0a74407df5df4fa99672a037eec61f7e@dbb21614667246fabcfd9685b6f448f3@6fbd26cc27ac44d6a7fed34092453f77@61ff5c624949454aa88561f2cd721bf6@56db8e7bc5874668ba7d5195230d067a@b9d287c974cc498d94112f1b064cf934', //账号二的好友shareCode,不同好友的shareCode中间用@符号隔开 - 'b1638a774d054a05a30a17d3b4d364b8@f92cb56c6a1349f5a35f0372aa041ea0@9c52670d52ad4e1a812f894563c746ea@8175509d82504e96828afc8b1bbb9cb3@2673c3777d4443829b2a635059953a28', + 'b1638a774d054a05a30a17d3b4d364b8@f92cb56c6a1349f5a35f0372aa041ea0@9c52670d52ad4e1a812f894563c746ea@8175509d82504e96828afc8b1bbb9cb3@2673c3777d4443829b2a635059953a28@d2d5d435675544679413cb9145577e0f', ] let message = '', subTitle = '', option = {}, isFruitFinished = false; const retainWater = 100;//保留水滴大于多少g,默认100g; diff --git a/jd_jdzz.js b/jd_jdzz.js index 1d87f7e5..12e72249 100644 --- a/jd_jdzz.js +++ b/jd_jdzz.js @@ -47,7 +47,7 @@ if ($.isNode()) { const JD_API_HOST = 'https://api.m.jd.com/client.action'; const inviteCodes = [ `ATGEC3-fsrn13aiaEqiM@AUWE5maSSnzFeDmH4iH0elA@ATGEC3-fsrn13aiaEqiM@AUWE5m6WUmDdZC2mr1XhJlQ@AUWE5m_jEzjJZDTKr3nwfkg@A06fNSRc4GIqY38pMBeLKQE2InZA@AUWE5mf7ExDZdDmH7j3wfkA@AUWE5m6jBy2cNAWX7j31Pxw@AUWE5mK2UnDddDTX61S1Mkw@AUWE5mavGyGZdWzP5iCoZwQ`, - `ATGEC3-fsrn13aiaEqiM@AUWE5maSSnzFeDmH4iH0elA@ATGEC3-fsrn13aiaEqiM@AUWE5m6WUmDdZC2mr1XhJlQ@AUWE5m_jEzjJZDTKr3nwfkg@A06fNSRc4GIqY38pMBeLKQE2InZA@AUWE5m6_BmTUPAGH42SpOkg@AUWE53NTIs3V8YBqthQMI` + `ATGEC3-fsrn13aiaEqiM@AUWE5maSSnzFeDmH4iH0elA@ATGEC3-fsrn13aiaEqiM@AUWE5m6WUmDdZC2mr1XhJlQ@AUWE5m_jEzjJZDTKr3nwfkg@A06fNSRc4GIqY38pMBeLKQE2InZA@AUWE5m6_BmTUPAGH42SpOkg@AUWE53NTIs3V8YBqthQMI@AUWE5m6yVxTJcWjWr3nRIlw` ] !(async () => { $.tuanList = [] diff --git a/jd_nian.js b/jd_nian.js index 9d20c5ce..bbd80cd2 100644 --- a/jd_nian.js +++ b/jd_nian.js @@ -9,17 +9,17 @@ ============Quantumultx=============== [task_local] #京东炸年兽🧨 -10 * * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js, tag=京东炸年兽🧨, img-url=https://raw.githubusercontent.com/yogayyy/Scripts/main/Icon/lxk0301/jd_nian.png, enabled=true +0 9,12,20 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js, tag=京东炸年兽🧨, img-url=https://raw.githubusercontent.com/yogayyy/Scripts/main/Icon/lxk0301/jd_nian.png, enabled=true ================Loon============== [Script] -cron "10 * * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js,tag=京东炸年兽🧨 +cron "0 9,12,20 * * *" script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js,tag=京东炸年兽🧨 ===============Surge================= -京东炸年兽🧨 = type=cron,cronexp="10 * * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js +京东炸年兽🧨 = type=cron,cronexp="0 9,12,20 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js ============小火箭========= -京东炸年兽🧨 = type=cron,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js, cronexpr="10 * * * *", timeout=3600, enable=true +京东炸年兽🧨 = type=cron,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_nian.js, cronexpr="0 9,12,20 * * *", timeout=3600, enable=true */ const $ = new Env('京东炸年兽🧨'); @@ -50,8 +50,8 @@ const inviteCodes = [ `cgxZaDXWZPCmiUa2akPVmFMI27K6antJzucULQPYNim_BPEW1Dwd@cgxZdTXtIrPYuAqfDgSpusxr97nagU6hwFa3TXxnqM95u3ib-xt4nWqZdz8@cgxZdTXtIO-O6QmYDVf67KCEJ19JcybuMB2_hYu8NSNQg0oS2Z_FpMce45g@cgxZdTXtILiLvg7OAASp61meehou4OeZvqbjghsZlc3rI5SBk7b3InUqSQ0@cgxZdTXtIumO4w2cDgSqvYcqHwjaAzLxu0S371Dh_fctFJtN0tXYzdR7JaY` ]; const pkInviteCodes = [ - 'IgNWdiLGaPadvlqJQnnKp27-YpAvKvSYNTSkTGvZylf_0wcvqD9EMkohEd8@IgNWdiLGaPaZskfACQyhgLSpZWps-WtQEW3McifV@IgNWdiLGaPaAvmHPAQf769XqjJjMyRirPzN9-AS-WHY9Y_G7t9Cwe5gdiI2qEvHZ', - 'IgNWdiLGaPadvlqJQnnKp27-YpAvKvSYNTSkTGvZylf_0wcvqD9EMkohEd8@IgNWdiLGaPaZskfACQyhgLSpZWps-WtQEW3McifV@IgNWdiLGaPaAvmHPAQf769XqjJjMyRirPzN9-AS-WHY9Y_G7t9Cwe5gdiI2qEvHZ' + 'IgNWdiLGaPadvlqJQnnKp27-YpAvKvSYNTSkTGvZylf_0wcvqD9EMkohEdw@IgNWdiLGaPaZskfACQyhgLSpZWps-WtQEW3McifW@IgNWdiLGaPYCeJUfsq18UNi5ln9xEZSPRdOue8Wl3hJTS2SQzU0vulL0fHeULJaIfgqHFd7f_Kg', + 'IgNWdiLGaPadvlqJQnnKp27-YpAvKvSYNTSkTGvZylf_0wcvqD9EMkohEdw@IgNWdiLGaPaAvmHPAQf769XqjJjMyRirPzN9-AS-WHY9Y_G7t9Cwe5gdiI2qEvHa' ] !(async () => { await requireConfig(); @@ -78,28 +78,35 @@ const pkInviteCodes = [ continue } await shareCodesFormat(); - // await shareCodesFormatPk() + await shareCodesFormatPk() await jdNian() } } })() - .catch((e) => { - $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') - }) - .finally(() => { - $.done(); - }) + .catch((e) => { + $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') + }) + .finally(() => { + $.done(); + }) + async function jdNian() { try { await getHomeData() - if(!$.secretp) return + if (!$.secretp) return let hour = new Date().getUTCHours() - if (1<=hour && hour<=14) { - // 北京时间9点-22点做pk任务 + if (1 <= hour && hour < 12) { + // 北京时间9点-20点 $.hasGroup = false await pkTaskDetail() if ($.hasGroup) await pkInfo() - // await helpFriendsPK() + await helpFriendsPK() + } + if (12 <= hour && hour < 14) { + // 北京时间20点-22点 + $.hasGroup = false + await pkTaskStealDetail() + if ($.hasGroup) await pkInfo() } await $.wait(2000) await killCouponList() @@ -119,17 +126,20 @@ async function jdNian() { $.logErr(e) } } + function encode(data, aa, extraData) { const temp = { "extraData": JSON.stringify(extraData), "businessData": JSON.stringify(data), "secretp": aa, } - return { "ss": (JSON.stringify(temp)) }; + return {"ss": (JSON.stringify(temp))}; } + function getRnd() { return Math.floor(1e6 * Math.random()).toString(); } + function showMsg() { return new Promise(resolve => { console.log('任务已做完!\n如有未完成的任务,请多执行几次。注:目前入会任务不会做') @@ -145,6 +155,7 @@ function showMsg() { resolve() }) } + async function helpFriends() { for (let code of $.newShareCodes) { if (!code) continue @@ -152,6 +163,7 @@ async function helpFriends() { await $.wait(1000) } } + async function helpFriendsPK() { for (let code of $.newShareCodesPk) { if (!code) continue @@ -160,22 +172,22 @@ async function helpFriendsPK() { await $.wait(1000) } } + async function doTask() { for (let item of $.taskVos) { if (item.taskType === 14) { //好友助力任务 //console.log(`您的好友助力码为${item.assistTaskDetailVo.taskToken}`) } - if(item.taskType===2){ + if (item.taskType === 2) { if (item.status === 1) { console.log(`准备做此任务:${item.taskName}`) - await getFeedDetail({"taskId":item.taskId},item.taskId) - } else if(item.status===2){ + await getFeedDetail({"taskId": item.taskId}, item.taskId) + } else if (item.status === 2) { console.log(`${item.taskName}已做完`) } - } - else if (item.taskType === 3 || item.taskType === 26) { - if(item.shoppingActivityVos) { + } else if (item.taskType === 3 || item.taskType === 26) { + if (item.shoppingActivityVos) { if (item.status === 1) { console.log(`准备做此任务:${item.taskName}`) for (let task of item.shoppingActivityVos) { @@ -188,8 +200,7 @@ async function doTask() { console.log(`${item.taskName}已做完`) } } - } - else if (item.taskType === 9) { + } else if (item.taskType === 9) { if (item.status === 1) { console.log(`准备做此任务:${item.taskName}`) for (let task of item.shoppingActivityVos) { @@ -198,11 +209,10 @@ async function doTask() { } await $.wait(3000) } - } else if(item.status===2){ + } else if (item.status === 2) { console.log(`${item.taskName}已做完`) } - } - else if (item.taskType === 7) { + } else if (item.taskType === 7) { if (item.status === 1) { console.log(`准备做此任务:${item.taskName}`) for (let task of item.browseShopVo) { @@ -210,14 +220,14 @@ async function doTask() { await collectScore(item.taskId, task.itemId, 1); } } - } else if(item.status===2){ + } else if (item.status === 2) { console.log(`${item.taskName}已做完`) } - }else if (item.taskType === 13) { + } else if (item.taskType === 13) { if (item.status === 1) { console.log(`准备做此任务:${item.taskName}`) await collectScore(item.taskId, "1"); - } else if(item.status===2){ + } else if (item.status === 2) { console.log(`${item.taskName}已做完`) } } else if (item.taskType === 21) { @@ -229,14 +239,14 @@ async function doTask() { } await $.wait(3000) } - } else if(item.status===2){ + } else if (item.status === 2) { console.log(`${item.taskName}已做完`) } } } } -function getFeedDetail(body={}) { +function getFeedDetail(body = {}) { return new Promise(resolve => { $.post(taskPostUrl("nian_getFeedDetail", body, "nian_getFeedDetail"), async (err, resp, data) => { try { @@ -247,25 +257,23 @@ function getFeedDetail(body={}) { if (safeGet(data)) { data = JSON.parse(data); if (data.data.bizCode === 0) { - if(data.data.result.addProductVos){ - for(let vo of data.data.result.addProductVos){ - if(vo['status']===1){ - for(let i=0;i { $.post(taskPostUrl('nian_getHomeData'), async (err, resp, data) => { try { @@ -295,29 +304,28 @@ function getHomeData(info=false) { if (data && data.data['bizCode'] === 0) { $.userInfo = data.data.result.homeMainInfo $.secretp = $.userInfo.secretp; - if(!$.secretp){ + if (!$.secretp) { console.log(`账号被风控`) message += `账号被风控,无法参与活动\n` $.secretp = null return } - console.log(`当前爆竹${$.userInfo.raiseInfo.remainScore}🧨,下一关需要${$.userInfo.raiseInfo.nextLevelScore-$.userInfo.raiseInfo.curLevelStartScore}🧨`) + console.log(`当前爆竹${$.userInfo.raiseInfo.remainScore}🧨,下一关需要${$.userInfo.raiseInfo.nextLevelScore - $.userInfo.raiseInfo.curLevelStartScore}🧨`) - if(info) { + if (info) { message += `当前爆竹${$.userInfo.raiseInfo.remainScore}🧨\n` return } - if($.userInfo.raiseInfo.produceScore > 0){ + if ($.userInfo.raiseInfo.produceScore > 0) { console.log(`可收取的爆竹大于0,去收取爆竹`) await collectProduceScore() } - if(parseInt($.userInfo.raiseInfo.remainScore) >= parseInt($.userInfo.raiseInfo.nextLevelScore-$.userInfo.raiseInfo.curLevelStartScore)){ + if (parseInt($.userInfo.raiseInfo.remainScore) >= parseInt($.userInfo.raiseInfo.nextLevelScore - $.userInfo.raiseInfo.curLevelStartScore)) { console.log(`当前爆竹🧨大于升级所需爆竹🧨,去升级`) await $.wait(2000) await raise() } - } - else{ + } else { $.secretp = null console.log(`账号被风控,无法参与活动`) message += `账号被风控,无法参与活动\n` @@ -331,7 +339,8 @@ function getHomeData(info=false) { }) }) } -function collectProduceScore(taskId= "collectProducedCoin") { + +function collectProduceScore(taskId = "collectProducedCoin") { let temp = { "taskId": taskId, "rnd": getRnd(), @@ -355,7 +364,7 @@ function collectProduceScore(taskId= "collectProducedCoin") { if (safeGet(data)) { data = JSON.parse(data); if (data.data.bizCode === 0) { - console.log(`收取成功,获得${data.data.result.produceScore}爆竹🧨`) + console.log(`收取成功,获得${data.data.result.produceScore}爆竹🧨`) // $.userInfo = data.data.result.userInfo; } } @@ -368,17 +377,18 @@ function collectProduceScore(taskId= "collectProducedCoin") { }) }) } -function collectScore(taskId,itemId,actionType=null,inviteId=null,shopSign=null) { + +function collectScore(taskId, itemId, actionType = null, inviteId = null, shopSign = null) { let temp = { "taskId": taskId, "rnd": getRnd(), "inviteId": "-1", "stealId": "-1" } - if(itemId) temp['itemId'] = itemId - if(actionType) temp['actionType'] = actionType - if(inviteId) temp['inviteId'] = inviteId - if(shopSign) temp['shopSign'] = shopSign + if (itemId) temp['itemId'] = itemId + if (actionType) temp['actionType'] = actionType + if (inviteId) temp['inviteId'] = inviteId + if (shopSign) temp['shopSign'] = shopSign const extraData = { "jj": 6, "buttonid": "jmdd-react-smash_0", @@ -387,12 +397,12 @@ function collectScore(taskId,itemId,actionType=null,inviteId=null,shopSign=null) } let body = { ...encode(temp, $.secretp, extraData), - taskId:taskId, - itemId:itemId + taskId: taskId, + itemId: itemId } - if(actionType) body['actionType'] = actionType - if(inviteId) body['inviteId'] = inviteId - if(shopSign) body['shopSign'] = shopSign + if (actionType) body['actionType'] = actionType + if (inviteId) body['inviteId'] = inviteId + if (shopSign) body['shopSign'] = shopSign return new Promise(resolve => { $.post(taskPostUrl("nian_collectScore", body, "nian_collectScore"), async (err, resp, data) => { try { @@ -404,20 +414,19 @@ function collectScore(taskId,itemId,actionType=null,inviteId=null,shopSign=null) data = JSON.parse(data); if (data.code === 0) { if (data.data && data.data.bizCode === 0) { - if(data.data.result.score) + if (data.data.result.score) console.log(`任务完成,获得${data.data.result.score}爆竹🧨`) - else if(data.data.result.maxAssistTimes) { + else if (data.data.result.maxAssistTimes) { console.log(`助力好友成功`) - } else{ + } else { console.log(`任务上报成功`) - await $.wait(10*1000) - if(data.data.result.taskToken){ + await $.wait(10 * 1000) + if (data.data.result.taskToken) { await doTask2(data.data.result.taskToken) } } // $.userInfo = data.data.result.userInfo; - } - else{ + } else { console.log(data.data.bizMsg) } } @@ -431,17 +440,18 @@ function collectScore(taskId,itemId,actionType=null,inviteId=null,shopSign=null) }) }) } -function pkCollectScore(taskId,itemId,actionType=null,inviteId=null,shopSign=null) { + +function pkCollectScore(taskId, itemId, actionType = null, inviteId = null, shopSign = null) { let temp = { "taskId": taskId, "rnd": getRnd(), "inviteId": "-1", "stealId": "-1" } - if(itemId) temp['itemId'] = itemId - if(actionType) temp['actionType'] = actionType - if(inviteId) temp['inviteId'] = inviteId - if(shopSign) temp['shopSign'] = shopSign + if (itemId) temp['itemId'] = itemId + if (actionType) temp['actionType'] = actionType + if (inviteId) temp['inviteId'] = inviteId + if (shopSign) temp['shopSign'] = shopSign const extraData = { "jj": 6, "buttonid": "jmdd-react-smash_0", @@ -450,12 +460,12 @@ function pkCollectScore(taskId,itemId,actionType=null,inviteId=null,shopSign=nul } let body = { ...encode(temp, $.secretp, extraData), - taskId:taskId, - itemId:itemId + taskId: taskId, + itemId: itemId } - if(actionType) body['actionType'] = actionType - if(inviteId) body['inviteId'] = inviteId - if(shopSign) body['shopSign'] = shopSign + if (actionType) body['actionType'] = actionType + if (inviteId) body['inviteId'] = inviteId + if (shopSign) body['shopSign'] = shopSign return new Promise(resolve => { $.post(taskPostUrl("nian_pk_collectScore", body, "nian_pk_collectScore"), async (err, resp, data) => { try { @@ -467,20 +477,19 @@ function pkCollectScore(taskId,itemId,actionType=null,inviteId=null,shopSign=nul data = JSON.parse(data); if (data.code === 0) { if (data.data && data.data.bizCode === 0) { - if(data.data.result.score) + if (data.data.result.score) console.log(`任务完成,获得${data.data.result.score}积分`) - else if(data.data.result.maxAssistTimes) { + else if (data.data.result.maxAssistTimes) { console.log(`助力好友成功`) - } else{ + } else { console.log(`任务上报成功`) - await $.wait(10*1000) - if(data.data.result.taskToken){ + await $.wait(10 * 1000) + if (data.data.result.taskToken) { await doTask2(data.data.result.taskToken) } } // $.userInfo = data.data.result.userInfo; - } - else{ + } else { console.log(data.data.bizMsg) } } @@ -494,14 +503,15 @@ function pkCollectScore(taskId,itemId,actionType=null,inviteId=null,shopSign=nul }) }) } + function doTask2(taskToken) { let body = { - "dataSource":"newshortAward", - "method":"getTaskAward", - "reqParams":`{\"taskToken\":\"${taskToken}\"}` + "dataSource": "newshortAward", + "method": "getTaskAward", + "reqParams": `{\"taskToken\":\"${taskToken}\"}` } return new Promise(resolve => { - $.post(taskPostUrl("qryViewkitCallbackResult", body, ), async (err, resp, data) => { + $.post(taskPostUrl("qryViewkitCallbackResult", body,), async (err, resp, data) => { try { if (err) { console.log(`${JSON.stringify(err)}`) @@ -523,7 +533,8 @@ function doTask2(taskToken) { }) }) } -function raise(taskId= "nian_raise") { + +function raise(taskId = "nian_raise") { let temp = { "taskId": taskId, "rnd": getRnd(), @@ -560,7 +571,8 @@ function raise(taskId= "nian_raise") { }) }) } -function getTaskList(body={}) { + +function getTaskList(body = {}) { return new Promise(resolve => { $.post(taskPostUrl("nian_getTaskDetail", body, "nian_getTaskDetail"), async (err, resp, data) => { try { @@ -571,10 +583,10 @@ function getTaskList(body={}) { if (safeGet(data)) { data = JSON.parse(data); if (data.data.bizCode === 0) { - if(JSON.stringify(body)==="{}") { + if (JSON.stringify(body) === "{}") { $.taskVos = data.data.result.taskVos;//任务列表 console.log(`您的好友助力码为${data.data.result.inviteId}`) - } + } // $.userInfo = data.data.result.userInfo; } } @@ -587,9 +599,10 @@ function getTaskList(body={}) { }) }) } + function getFriendData(inviteId) { return new Promise((resolve) => { - $.post(taskPostUrl('nian_getHomeData',{"inviteId":inviteId}), async (err, resp, data) => { + $.post(taskPostUrl('nian_getHomeData', {"inviteId": inviteId}), async (err, resp, data) => { try { if (err) { console.log(`${JSON.stringify(err)}`) @@ -598,7 +611,7 @@ function getFriendData(inviteId) { data = JSON.parse(data); if (data.data && data.data['bizCode'] === 0) { $.itemId = data.data.result.homeMainInfo.guestInfo.itemId - await collectScore('2',$.itemId,null,inviteId) + await collectScore('2', $.itemId, null, inviteId) } } } catch (e) { @@ -609,6 +622,7 @@ function getFriendData(inviteId) { }) }) } + function map() { return new Promise(resolve => { $.post(taskPostUrl("nian_myMap", {}, "nian_myMap"), async (err, resp, data) => { @@ -621,8 +635,8 @@ function map() { data = JSON.parse(data); if (data.data.bizCode === 0) { let msg = '当前已开启的地图:' - for(let vo of data.data.result.monsterInfoList){ - if(vo.curLevel) msg+= vo.name +' ' + for (let vo of data.data.result.monsterInfoList) { + if (vo.curLevel) msg += vo.name + ' ' } console.log(msg) // $.userInfo = data.data.result.userInfo; @@ -637,8 +651,15 @@ function map() { }) }) } + function queryMaterials() { - let body = {"qryParam":"[{\"type\":\"advertGroup\",\"mapTo\":\"viewLogo\",\"id\":\"05149412\"},{\"type\":\"advertGroup\",\"mapTo\":\"bottomLogo\",\"id\":\"05149413\"}]","activityId":"2cKMj86srRdhgWcKonfExzK4ZMBy","pageId":"","reqSrc":"","applyKey":"21beast"} + let body = { + "qryParam": "[{\"type\":\"advertGroup\",\"mapTo\":\"viewLogo\",\"id\":\"05149412\"},{\"type\":\"advertGroup\",\"mapTo\":\"bottomLogo\",\"id\":\"05149413\"}]", + "activityId": "2cKMj86srRdhgWcKonfExzK4ZMBy", + "pageId": "", + "reqSrc": "", + "applyKey": "21beast" + } return new Promise(resolve => { $.post(taskPostUrl("qryCompositeMaterials", body, "qryCompositeMaterials"), async (err, resp, data) => { try { @@ -648,11 +669,11 @@ function queryMaterials() { } else { if (safeGet(data)) { data = JSON.parse(data); - if(data.code==='0') { + if (data.code === '0') { let shopList = data.data.viewLogo.list.concat(data.data.bottomLogo.list) let nameList = [] - for(let vo of shopList){ - if(nameList.includes(vo.name)) continue + for (let vo of shopList) { + if (nameList.includes(vo.name)) continue nameList.push(vo.name) console.log(`去做${vo.name}店铺任务`) await shopLotteryInfo(vo.desc) @@ -671,7 +692,7 @@ function queryMaterials() { } function shopLotteryInfo(shopSign) { - let body = {"shopSign":shopSign} + let body = {"shopSign": shopSign} return new Promise(resolve => { $.post(taskPostUrl("nian_shopLotteryInfo", body, "nian_shopLotteryInfo"), async (err, resp, data) => { try { @@ -681,22 +702,21 @@ function shopLotteryInfo(shopSign) { } else { if (safeGet(data)) { data = JSON.parse(data); - if(data.code===0) { - for(let vo of data.data.result.taskVos){ - if(vo.status===1){ - if(vo.taskType===12){ + if (data.code === 0) { + for (let vo of data.data.result.taskVos) { + if (vo.status === 1) { + if (vo.taskType === 12) { console.log(`去做${vo.taskName}任务`) await $.wait(2000) - await collectScore(vo.taskId,vo.simpleRecordInfoVo.itemId,null,null,shopSign) - } - else if (vo.taskType === 3 || vo.taskType === 26) { - if(vo.shoppingActivityVos) { + await collectScore(vo.taskId, vo.simpleRecordInfoVo.itemId, null, null, shopSign) + } else if (vo.taskType === 3 || vo.taskType === 26) { + if (vo.shoppingActivityVos) { if (vo.status === 1) { console.log(`准备做此任务:${vo.taskName}`) for (let task of vo.shoppingActivityVos) { if (task.status === 1) { await $.wait(2000) - await collectScore(vo.taskId, task.advId,null,null,shopSign); + await collectScore(vo.taskId, task.advId, null, null, shopSign); } } } else if (vo.status === 2) { @@ -706,8 +726,8 @@ function shopLotteryInfo(shopSign) { } } } - for(let i=0;i { $.post(taskPostUrl("nian_doShopLottery", body, "nian_doShopLottery"), async (err, resp, data) => { try { @@ -733,15 +754,15 @@ function doShopLottery(shopSign) { } else { if (safeGet(data)) { data = JSON.parse(data); - if(data.code===0 && data.data && data.data.result) { + if (data.code === 0 && data.data && data.data.result) { let result = data.data.result - if(result.awardType===4) + if (result.awardType === 4) console.log(`抽奖成功,获得${result.score}爆竹🧨`) - else if(result.awardType===2 || result.awardType===3) + else if (result.awardType === 2 || result.awardType === 3) console.log(`抽奖成功,获得优惠卷`) else console.log(`抽奖成功,获得${JSON.stringify(result)}`) - }else{ + } else { console.log(`抽奖失败`) } } @@ -766,12 +787,22 @@ function pkInfo() { $.group = true if (safeGet(data)) { data = JSON.parse(data); - if(data.code===0 && data.data && data.data.bizCode===0){ + if (data.code === 0 && data.data && data.data.bizCode === 0) { console.log(`\n您的好友PK助力码为${data.data.result.groupInfo.groupAssistInviteId}\n`) let info = data.data.result.groupPkInfo - console.log(`当前关卡:${info.dayAward}元红包,完成进度 ${info.dayTotalValue}/${info.dayTargetSell}`) - } - else{ + if (info.dayAward) + console.log(`白天关卡:${info.dayAward}元红包,完成进度 ${info.dayTotalValue}/${info.dayTargetSell}`) + else { + function secondToDate(result) { + var h = Math.floor(result / 3600); + var m = Math.floor((result / 60 % 60)); + var s = Math.floor((result % 60)); + return h + "小时" + m + "分钟" + s + "秒"; + } + + console.log(`守护关卡:${info.guardAward}元红包,剩余守护时间:${secondToDate(info.guardTime / 5)}`) + } + } else { $.group = false console.log(`获取组队信息失败,请检查`) } @@ -785,6 +816,42 @@ function pkInfo() { }) }) } + +function pkTaskStealDetail() { + return new Promise(resolve => { + $.post(taskPostUrl("nian_pk_getStealForms", {}, "nian_pk_getStealForms"), async (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} API请求失败,请检查网路重试`) + } else { + if (safeGet(data)) { + data = JSON.parse(data); + if (data.code === 0 && data.data && data.data.bizCode === 0) { + $.hasGroup = true + await $.wait(2000) + for (let i = 1; i < data.data.result.stealGroups.length; ++i) { + let item = data.data.result.stealGroups[i] + if (item.stolen === 0) { + console.log(`去偷${item.name}的红包`) + await pkStealGroup(item.id) + await $.wait(2000) + } + } + } else { + console.log(`组队尚未开启,请先去开启组队或是加入队伍!`) + } + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} + function pkTaskDetail() { return new Promise(resolve => { $.post(taskPostUrl("nian_pk_getTaskDetail", {}, "nian_pk_getTaskDetail"), async (err, resp, data) => { @@ -795,12 +862,12 @@ function pkTaskDetail() { } else { if (safeGet(data)) { data = JSON.parse(data); - if(data.code===0 && data.data && data.data.bizCode===0){ + if (data.code === 0 && data.data && data.data.bizCode === 0) { await $.wait(2000) $.hasGroup = true - for(let item of data.data.result.taskVos){ + for (let item of data.data.result.taskVos) { if (item.taskType === 3 || item.taskType === 26) { - if(item.shoppingActivityVos) { + if (item.shoppingActivityVos) { if (item.status === 1) { console.log(`准备做此任务:${item.taskName}`) for (let task of item.shoppingActivityVos) { @@ -815,8 +882,7 @@ function pkTaskDetail() { } } } - } - else{ + } else { console.log(`组队尚未开启,请先去开启组队或是加入队伍!`) } } @@ -829,6 +895,7 @@ function pkTaskDetail() { }) }) } + function pkAssignGroup(inviteId) { let temp = { "confirmFlag": 1, @@ -842,7 +909,7 @@ function pkAssignGroup(inviteId) { } let body = { ...encode(temp, $.secretp, extraData), - inviteId:inviteId + inviteId: inviteId } return new Promise(resolve => { $.post(taskPostUrl("nian_pk_assistGroup", body, "nian_pk_assistGroup"), async (err, resp, data) => { @@ -853,10 +920,9 @@ function pkAssignGroup(inviteId) { } else { if (safeGet(data)) { data = JSON.parse(data); - if(data.data && data.data.bizMsg) { + if (data.data && data.data.bizMsg) { console.log(data.data.bizMsg) - } - else { + } else { console.log(`助力失败,未知错误:${JSON.stringify(data)}`) $.canhelp = false } @@ -870,6 +936,46 @@ function pkAssignGroup(inviteId) { }) }) } + +function pkStealGroup(stealId) { + let temp = { + "stealId": stealId, + } + const extraData = { + "jj": 6, + "buttonid": "jmdd-react-smash_0", + "sceneid": "homePageh5", + "appid": '50073' + } + let body = { + ...encode(temp, $.secretp, extraData), + stealId: stealId + } + return new Promise(resolve => { + $.post(taskPostUrl("nian_pk_doSteal", body, "nian_pk_doSteal"), async (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + console.log(`${$.name} API请求失败,请检查网路重试`) + } else { + if (safeGet(data)) { + data = JSON.parse(data); + if (data.data && data.data.bizMsg) { + console.log(data.data.bizMsg) + } else { + console.log(`偷取失败,未知错误:${JSON.stringify(data)}`) + } + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} + function killCouponList() { return new Promise(resolve => { $.post(taskPostUrl("nian_killCouponList", {}, "nian_killCouponList"), async (err, resp, data) => { @@ -882,8 +988,8 @@ function killCouponList() { data = JSON.parse(data); if (data.data && data.data.bizCode === 0) { await $.wait(2000) - for(let vo of data.data.result){ - if(!vo.status){ + for (let vo of data.data.result) { + if (!vo.status) { console.log(`去领取${vo['productName']}优惠券`) await killCoupon(vo['skuId']) await $.wait(2000) @@ -900,6 +1006,7 @@ function killCouponList() { }) }) } + function killCoupon(skuId) { let temp = { "skuId": skuId, @@ -926,7 +1033,7 @@ function killCoupon(skuId) { data = JSON.parse(data); if (data.data && data.data.bizCode === 0) { console.log(`领取成功,获得${data.data.result.score}爆竹🧨`) - }else{ + } else { console.log(data.data.bizMsg) } } @@ -939,10 +1046,14 @@ function killCoupon(skuId) { }) }) } + function readShareCode() { console.log(`开始`) return new Promise(async resolve => { - $.get({url: `https://code.chiang.fun/api/v1/jd/jdnian/read/${randomCount}/`, 'timeout': 10000}, (err, resp, data) => { + $.get({ + url: `https://code.chiang.fun/api/v1/jd/jdnian/read/${randomCount}/`, + 'timeout': 10000 + }, (err, resp, data) => { try { if (err) { console.log(`${JSON.stringify(err)}`) @@ -963,10 +1074,14 @@ function readShareCode() { resolve() }) } + function readShareCodePk() { console.log(`开始`) return new Promise(async resolve => { - $.get({url: `http://jd.turinglabs.net/api/v2/jd/nian_pk/read/${randomCount}/`, 'timeout': 10000}, (err, resp, data) => { + $.get({ + url: `http://jd.turinglabs.net/api/v2/jd/nian_pk/read/${randomCount}/`, + 'timeout': 10000 + }, (err, resp, data) => { try { if (err) { console.log(`${JSON.stringify(err)}`) @@ -987,6 +1102,7 @@ function readShareCodePk() { resolve() }) } + //格式化助力码 function shareCodesFormat() { return new Promise(async resolve => { @@ -1027,6 +1143,7 @@ function shareCodesFormatPk() { resolve(); }) } + function requireConfig() { return new Promise(resolve => { console.log(`开始获取${$.name}配置文件\n`); @@ -1087,6 +1204,7 @@ function taskPostUrl(function_id, body = {}, function_id2) { } } } + function TotalBean() { return new Promise(async resolve => { const options = { @@ -1127,6 +1245,7 @@ function TotalBean() { }) }) } + function safeGet(data) { try { if (typeof JSON.parse(data) == "object") { @@ -1138,6 +1257,7 @@ function safeGet(data) { return false; } } + function jsonParse(str) { if (typeof str == "string") { try { diff --git a/jd_pet.js b/jd_pet.js index d523a9cb..73b7914e 100644 --- a/jd_pet.js +++ b/jd_pet.js @@ -32,7 +32,7 @@ let shareCodes = [ // IOS本地脚本用户这个列表填入你要助力的好 //账号一的好友shareCode,不同好友的shareCode中间用@符号隔开 'MTAxODc2NTEzNTAwMDAwMDAwMjg3MDg2MA==@MTAxODc2NTEzMzAwMDAwMDAyNzUwMDA4MQ==@MTAxODc2NTEzMjAwMDAwMDAzMDI3MTMyOQ==@MTAxODc2NTEzNDAwMDAwMDAzMDI2MDI4MQ==@MTAxODcxOTI2NTAwMDAwMDAxOTQ3MjkzMw==', //账号二的好友shareCode,不同好友的shareCode中间用@符号隔开 - 'MTAxODc2NTEzMjAwMDAwMDAzMDI3MTMyOQ==@MTAxODcxOTI2NTAwMDAwMDAyNjA4ODQyMQ==@MTAxODc2NTEzOTAwMDAwMDAyNzE2MDY2NQ==@MTE1NDUyMjEwMDAwMDAwNDI0MDM2MDc=', + 'MTAxODc2NTEzMjAwMDAwMDAzMDI3MTMyOQ==@MTAxODcxOTI2NTAwMDAwMDAyNjA4ODQyMQ==@MTAxODc2NTEzOTAwMDAwMDAyNzE2MDY2NQ==@MTE1NDUyMjEwMDAwMDAwNDI0MDM2MDc=@MTAxODc2NTEzMjAwMDAwMDAwNDA5MzAzMw==', ] let message = '', subTitle = '', option = {}; let jdNotify = false;//是否关闭通知,false打开通知推送,true关闭通知推送 diff --git a/jd_plantBean.js b/jd_plantBean.js index 3ae02c8f..1d128de1 100644 --- a/jd_plantBean.js +++ b/jd_plantBean.js @@ -36,7 +36,7 @@ let shareCodes = [ // IOS本地脚本用户这个列表填入你要助力的好 //账号一的好友shareCode,不同好友的shareCode中间用@符号隔开 '66j4yt3ebl5ierjljoszp7e4izzbzaqhi5k2unz2afwlyqsgnasq@olmijoxgmjutyrsovl2xalt2tbtfmg6sqldcb3q@e7lhibzb3zek27amgsvywffxx7hxgtzstrk2lba@e7lhibzb3zek32e72n4xesxmgc2m76eju62zk3y', //账号二的好友shareCode,不同好友的shareCode中间用@符号隔开 - 'olmijoxgmjutyx55upqaqxrblt7f3h26dgj2riy@mlrdw3aw26j3wgzjipsxgonaoyr2evrdsifsziyvnsb2r54jq34s64sc4it3jlfnejwmtmsuadax2i@eeexxudqtlampbpvmceutaaht5tcftvr6kohuny', + 'olmijoxgmjutyx55upqaqxrblt7f3h26dgj2riy@mlrdw3aw26j3wgzjipsxgonaoyr2evrdsifsziyvnsb2r54jq34s64sc4it3jlfnejwmtmsuadax2i@eeexxudqtlampbpvmceutaaht5tcftvr6kohuny@e7lhibzb3zek27gfeceqb6wwm45gshcaroxg5ka', ] let currentRoundId = null;//本期活动id let lastRoundId = null;//上期id diff --git a/jd_sgmh.js b/jd_sgmh.js index 0db1876f..9f8aa1dd 100644 --- a/jd_sgmh.js +++ b/jd_sgmh.js @@ -3,13 +3,14 @@ 长期活动,一人每天5次助力机会,10次被助机会,被助力一次获得一次抽奖机会,前几次必中京豆 修改自 @yangtingxiao 抽奖机脚本 入口:首页-闪购-闪购盲盒 +网页地址:https://h5.m.jd.com/babelDiy/Zeus/3vzA7uGuWL2QeJ5UeecbbAVKXftQ/index.html 更新地址:https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_sgmh.js 已支持IOS双京东账号, Node.js支持N个京东账号 脚本兼容: QuantumultX, Surge, Loon, 小火箭,JSBox, Node.js ============Quantumultx=============== [task_local] #闪购盲盒 -20 8 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_sgmh.js, tag=闪购盲盒, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jd_sgmh.png, enabled=true +20 8 * * * https://raw.githubusercontent.com/LXK9301/jd_scripts/master/jd_sgmh.js, tag=闪购盲盒, img-url=https://raw.githubusercontent.com/Orz-3/task/master/jd.png, enabled=true ================Loon============== [Script] @@ -28,8 +29,8 @@ const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; let appId = '1EFRRxA' , homeDataFunPrefix = 'interact_template', collectScoreFunPrefix = 'harmony', message = '' let lotteryResultFunPrefix = homeDataFunPrefix, browseTime = 6 const inviteCodes = [ - 'T019-aknAFRllhyoQlyI46gCjVWmIaW5kRrbA', - 'T019-aknAFRllhyoQlyI46gCjVWmIaW5kRrbA' + 'T019-aknAFRllhyoQlyI46gCjVWmIaW5kRrbA@T027Zm_olqSxIOtH97BATGmKoWraLawCjVWmIaW5kRrbA', + 'T019-aknAFRllhyoQlyI46gCjVWmIaW5kRrbA@T0225KkcRk1N_FeCJhv3xvdfcQCjVWmIaW5kRrbA' ]; const randomCount = $.isNode() ? 20 : 5; const notify = $.isNode() ? require('./sendNotify') : ''; diff --git a/tencentscf.js b/tencentscf.js index ca20172c..ba6a9bab 100644 --- a/tencentscf.js +++ b/tencentscf.js @@ -11,7 +11,7 @@ const clientConfig = { secretId: process.env.TENCENT_SECRET_ID, secretKey: process.env.TENCENT_SECRET_KEY, }, - region: "ap-hongkong", + region: process.env.TENCENT_REGION, // 区域参考,https://cloud.tencent.com/document/product/213/6091 profile: { httpProfile: { endpoint: "scf.tencentcloudapi.com", @@ -20,9 +20,9 @@ const clientConfig = { }; const client = new ScfClient(clientConfig); -const params = { +let params = { "Handler": "index.main_handler", - "FunctionName": "jd", + "FunctionName": process.env.TENCENT_FUNCTION_NAME, // 云函数程序名,例如 jd_scripts "ZipFile": contents_in_base64 }; client.UpdateFunctionCode(params).then( @@ -33,3 +33,47 @@ client.UpdateFunctionCode(params).then( console.error("error", err); } ); + +// 更新环境变量 +let vars = [] +for(let key in process.env){ + vars.push({ + "Key": key, + "Value": process.env[key] + }) +} + +params = { + "Environment": { + "Variables": vars + } +}; +client.UpdateFunctionConfiguration(params).then( + (data) => { + console.log(data); + }, + (err) => { + console.error("error", err); + } +); + +// 更新触发器 +const inputYML = 'serverless.yml'; +const yaml = require('js-yaml'); +const obj = yaml.load(fs.readFileSync(inputYML, {encoding: 'utf-8'})) +for(let vo of obj.inputs.events){ + let param = { + 'Type' : "timer", + 'TriggerDesc' : vo.timer.parameters.cronExpression, + 'CustomArgument' : vo.timer.parameters.argument, + 'Enable' : "true" + } + client.CreateTrigger(param).then( + (data) => { + console.log(data); + }, + (err) => { + console.error("error", err); + } + ); +} diff --git a/update_task.sh b/update_task.sh index d808d2a4..73353e9c 100644 --- a/update_task.sh +++ b/update_task.sh @@ -14,12 +14,12 @@ FileQxRe=$WorkDir/QuantumultX/lxk0301_cookies.conf FileSurge=$WorkDir/Surge/lxk0301_Task.sgmodule.sgmodule ## task清单顶部内容 -CommentsLoon="# IOS Loon Task&Cookies配置 By LXK9301\n# GitHub主页(https://github.com/LXK9301/jd_scripts)\n# TG讨论组 (https://t.me/JD_fruit_pet)\n# TG通知频道 (https://t.me/jdfruit)\n# Loon的Task&Cookies脚本订阅链接: https://raw.githubusercontent.com/LXK9301/jd_scripts/master/Loon/lxk0301_LoonTask.conf\n# 使用方法:打开APP,顶部的配置 -> 脚本 -> 订阅脚本- > 点击右上角+号 -> 添加url链接 (https://raw.githubusercontent.com/LXK9301/jd_scripts/master/Loon/lxk0301_LoonTask.conf)\n\nhostname = api.m.jd.com, draw.jdfcloud.com, jdjoy.jd.com, account.huami.com" +CommentsLoon="# IOS Loon Task&Cookies配置 By LXK9301\n# GitHub主页(https://github.com/LXK9301/jd_scripts)\n# TG讨论组 (https://t.me/JD_fruit_pet)\n# TG通知频道 (https://t.me/jdfruit)\n# Loon的Task&Cookies脚本订阅链接: https://raw.githubusercontent.com/LXK9301/jd_scripts/master/Loon/lxk0301_LoonTask.conf\n# 使用方法:打开APP,顶部的配置 -> 脚本 -> 订阅脚本- > 点击右上角+号 -> 添加url链接 (https://raw.githubusercontent.com/LXK9301/jd_scripts/master/Loon/lxk0301_LoonTask.conf)\n\nhostname = api.m.jd.com, wq.jd.com, draw.jdfcloud.com, jdjoy.jd.com, account.huami.com" CommentsQx='{\n "name": "LXK9301 task gallery",\n "description": "https://github.com/LXK9301/jd_scripts",\n "task": [' -CommentsQxRe="hostname = api.m.jd.com, draw.jdfcloud.com, jdjoy.jd.com, account.huami.com" +CommentsQxRe="hostname = api.m.jd.com, draw.jdfcloud.com, jdjoy.jd.com, account.huami.com, wq.jd.com" CommentsSurgeHead="#!name=LXK9301 iOS Tasks&Cookies Module\n#!desc=iOS Tasks&Cookies 模块配置\n\n# Task&Cookies模块配置 By LXK9301\n# GitHub主页(https://github.com/LXK9301/jd_scripts)\n# TG讨论组 (https://t.me/JD_fruit_pet)\n# TG通知频道 (https://t.me/jdfruit)\n# Surge的Task&Cookies脚本模块地址: https://raw.githubusercontent.com/LXK9301/jd_scripts/master/Surge/lxk0301_Task.sgmodule.sgmodule\n\n[Script]" -CommentsSurgeTail="\n[MITM]\nhostname = %APPEND% wq.jd.com, draw.jdfcloud.com, jdjoy.jd.com, account.huami.com" +CommentsSurgeTail="\n[MITM]\nhostname = %APPEND% wq.jd.com, draw.jdfcloud.com, jdjoy.jd.com, account.huami.com, wq.jd.com" ## 执行写入