├── README.md ├── bhxcy.js ├── dongdongFarm.js ├── dongdongFarm2.js ├── ele.js ├── jd_bean_info.js ├── jd_comment.js ├── jd_try.js ├── jdhealth_collectProduceScore.js ├── meituan.js ├── meituanV3.js ├── mt3015.js ├── mt_coupons.js ├── mt_test.js ├── node_module └── Dev.md ├── package-lock.json ├── package.json ├── scripts └── config.json ├── sendNotify.js ├── thank.js └── xj.js /README.md: -------------------------------------------------------------------------------- 1 | # 脚本执行管理 2 | ---- 3 | # 感谢猫猫提供技术支持 4 | ---- 5 | 6 | ## 开发须知 7 | 8 | ###### `如何在自己的脚本中引用软件获取的Cookie?` 9 | 10 | ```js 11 | console.log(process.env.APP_COOKIE) 12 | ``` 13 | 14 | ###### 在开发中你也要避免变量重复 15 | ###### APP_COOKIE 这是默认必传的 也是系统级的 16 | 17 | ---- 18 | 19 | #### 需要安装Node js 20 | 21 | https://baidu.com 22 | 23 | #### 切换 npm 源 24 | 25 | `npm config set registry https://registry.npm.taobao.org/` 26 | 27 | #### 需要执行 28 | 29 | `npm install` 30 | 31 | #### 运行 32 | 33 | `node file.js` 34 | 35 | ---- 36 | 37 | ## 软件配置 38 | 39 | ### *关于软件你可以在 release 找到答案* 40 | 41 | ##### 库中的 config.json 文件是脚本的配置文件 42 | 43 | ``` js 44 | { 45 | "name": "测试脚本", // 脚本的名称(随便写 给展示的) 46 | "file": "test", // 对应仓库中的文件名不包含后缀 (test.js) 47 | "version": "1", // 这是版本 更新后改动这里 48 | "cron": "0 */2 * * * *", // 定时任务默认的配置 49 | "env": [ 50 | { 51 | "envName": "xjhd", // 环境变量 比如你脚本中是 process.env.xjhd 52 | "envHint": "习酒Token多个用@隔开" // 变量描述 53 | } 54 | ], 55 | "scope": "" // 如果是空就 京 了 美 三个都显示 如果跟包名 则对应显示 详情参考模板库 56 | } 57 | ``` 58 | 59 | 60 | 61 | #### 仓库配置 62 | 63 | ![image](https://m.360buyimg.com/babel/jfs/t1/211099/2/29105/154108/63863510E74633584/c80a350901a54c39.png) 64 | 65 | #### 效果图 66 | 67 | ![image](https://m.360buyimg.com/babel/jfs/t1/75794/34/22715/137844/636d9bf6Eee52ad72/c02b0754a3b4ae95.jpg) 68 | ![image](https://m.360buyimg.com/babel/jfs/t1/91605/37/32751/122090/636d9beeE2224ba57/9c4ca62297ba7d2e.jpg) 69 | -------------------------------------------------------------------------------- /dongdongFarm2.js: -------------------------------------------------------------------------------- 1 | console.log('运行成功') 2 | 3 | console.log('下载的配置文件') 4 | 5 | console.log(process.env.JD_KEY_CK) 6 | 7 | console.log(process.env.JD_KEY_CK2) 8 | 9 | console.log('运行结束') 10 | -------------------------------------------------------------------------------- /jd_bean_info.js: -------------------------------------------------------------------------------- 1 | const USER_AGENTS = [ 2 | "jdapp;android;11.2.8;;;Mozilla/5.0 (Linux; Android 10; ONEPLUS A5010 Build/QKQ1.191014.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 3 | "jdapp;iPhone;11.2.6;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 4 | "jdapp;android;11.2.5;;;Mozilla/5.0 (Linux; Android 9; Mi Note 3 Build/PKQ1.181007.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/045131 Mobile Safari/537.36", 5 | "jdapp;android;11.2.4;;;Mozilla/5.0 (Linux; Android 10; GM1910 Build/QKQ1.190716.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 6 | "jdapp;android;11.2.2;;;Mozilla/5.0 (Linux; Android 9; 16T Build/PKQ1.190616.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 7 | "jdapp;iPhone;11.2.0;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 8 | "jdapp;iPhone;11.1.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 9 | "jdapp;iPhone;11.1.2;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 10 | "jdapp;iPhone;11.1.0;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 11 | "jdapp;iPhone;11.0.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 12 | "jdapp;iPhone;11.0.2;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 13 | "jdapp;iPhone;11.0.0;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 14 | "jdapp;iPhone;10.5.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 15 | "jdapp;iPhone;10.5.2;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 16 | "jdapp;iPhone;10.5.0;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 17 | "jdapp;android;11.2.8;;;Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 18 | "jdapp;android;11.2.6;;;Mozilla/5.0 (Linux; Android 11; Redmi K30 5G Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045511 Mobile Safari/537.36", 19 | "jdapp;iPhone;11.2.5;;;Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15F79", 20 | "jdapp;android;11.2.4;;;Mozilla/5.0 (Linux; Android 10; M2006J10C Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 21 | "jdapp;android;11.2.2;;;Mozilla/5.0 (Linux; Android 10; M2006J10C Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 22 | "jdapp;android;11.2.0;;;Mozilla/5.0 (Linux; Android 10; ONEPLUS A6000 Build/QKQ1.190716.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045224 Mobile Safari/537.36", 23 | "jdapp;android;11.1.4;;;Mozilla/5.0 (Linux; Android 9; MHA-AL00 Build/HUAWEIMHA-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 24 | "jdapp;android;11.1.2;;;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/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 25 | "jdapp;android;11.1.0;;;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/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 26 | "jdapp;iPhone;11.0.4;;;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", 27 | "jdapp;android;11.0.2;;;Mozilla/5.0 (Linux; Android 10; LYA-AL00 Build/HUAWEILYA-AL00L; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 28 | "jdapp;iPhone;11.0.0;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 29 | "jdapp;iPhone;10.5.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 30 | "jdapp;iPhone;10.5.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", 31 | "jdapp;android;10.5.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/78.0.3904.108 MQQBrowser/6.2 TBS/045131 Mobile Safari/537.36", 32 | "jdapp;android;11.2.8;;;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/76.0.3809.89 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36", 33 | "jdapp;iPhone;11.2.5;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 34 | "jdapp;iPhone;11.2.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 35 | "jdapp;android;11.2.2;;;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/76.0.3809.89 MQQBrowser/6.2 TBS/045513 Mobile Safari/537.36", 36 | "jdapp;android;11.2.0;;;Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36", 37 | "jdapp;iPhone;11.1.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 38 | "jdapp;android;11.0.1;;;Mozilla/5.0 (Linux; Android 10; ONEPLUS A5010 Build/QKQ1.191014.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 39 | "jdapp;iPhone;11.1.2;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 40 | "jdapp;android;11.1.0;;;Mozilla/5.0 (Linux; Android 10; Mi Note 5 Build/PKQ1.181007.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/045131 Mobile Safari/537.36", 41 | "jdapp;android;11.0.4;;;Mozilla/5.0 (Linux; Android 11; LIO-AN00 Build/HUAWEILIO-AN00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 42 | "jdapp;android;11.0.2;;;Mozilla/5.0 (Linux; Android 10; SKW-A0 Build/SKYW2001202CN00MQ0; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 43 | "jdapp;iPhone;11.0.0;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 44 | "jdapp;iPhone;10.5.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 45 | "jdapp;iPhone;10.5.2;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 46 | "jdapp;iPhone;10.5.0;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 47 | "jdapp;iPhone;11.2.8;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 48 | "jdapp;iPhone;11.2.5;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 49 | "jdapp;iPhone;11.2.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 50 | "jdapp;iPhone;11.2.2;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 51 | "jdapp;iPhone;11.2.0;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 52 | "jdapp;iPhone;11.1.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 53 | "jdapp;android;11.1.2;;;Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 54 | "jdapp;android;11.1.0;;;Mozilla/5.0 (Linux; Android 12; Redmi K30 5G Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045511 Mobile Safari/537.36", 55 | "jdapp;iPhone;11.0.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15F79", 56 | "jdapp;android;11.0.2;;;Mozilla/5.0 (Linux; Android 10; M2006J10C Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 57 | "jdapp;android;11.0.0;;;Mozilla/5.0 (Linux; Android 12; HWI-AL00 Build/HUAWEIHWI-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 58 | "jdapp;android;10.5.4;;;Mozilla/5.0 (Linux; Android 10; ANE-AL00 Build/HUAWEIANE-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045224 Mobile Safari/537.36", 59 | "jdapp;android;10.5.2;;;Mozilla/5.0 (Linux; Android 9; ELE-AL00 Build/HUAWEIELE-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 60 | "jdapp;android;10.5.0;;;Mozilla/5.0 (Linux; Android 10; LIO-AL00 Build/HUAWEILIO-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 61 | "jdapp;android;11.2.8;;;Mozilla/5.0 (Linux; Android 10; SM-G9750 Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 62 | "jdapp;iPhone;11.2.5;;;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", 63 | "jdapp;android;11.2.4;;;Mozilla/5.0 (Linux; Android 12; EVR-AL00 Build/HUAWEIEVR-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 64 | "jdapp;iPhone;11.2.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", 65 | "jdapp;iPhone;11.2.0;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 66 | "jdapp;iPhone;11.1.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 67 | "jdapp;android;11.1.2;;;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/78.0.3904.108 MQQBrowser/6.2 TBS/045131 Mobile Safari/537.36", 68 | "jdapp;android;11.1.0;;;Mozilla/5.0 (Linux; Android 9; HLK-AL00 Build/HONORHLK-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36", 69 | "jdapp;iPhone;11.0.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 70 | "jdapp;iPhone;11.0.2;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 71 | "jdapp;android;11.0.0;;;Mozilla/5.0 (Linux; Android 10; LYA-AL10 Build/HUAWEILYA-AL10; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045513 Mobile Safari/537.36", 72 | "jdapp;android;10.5.4;;;Mozilla/5.0 (Linux; Android 10; MI 9 Build/QKQ1.190825.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36", 73 | "jdapp;iPhone;10.5.2;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 74 | ] 75 | /** 76 | * 生成随机数字 77 | * @param {number} min 最小值(包含) 78 | * @param {number} max 最大值(不包含) 79 | */ 80 | function randomNumber(min = 0, max = 80) { 81 | return Math.min(Math.floor(min + Math.random() * (max - min)), max); 82 | } 83 | const USER_AGENT = USER_AGENTS[randomNumber(0, USER_AGENTS.length)]; 84 | 85 | function UARAM() { 86 | return USER_AGENTS[randomNumber(0, USER_AGENTS.length)]; 87 | } 88 | 89 | 90 | 91 | const $ = new Env('京豆详情统计'); 92 | const notify = ''; 93 | let allMessage = ''; 94 | let myMap = new Map(); 95 | let allBean = 0; 96 | let cookiesArr = [], cookie = ''; 97 | !(async () => { 98 | cookiesArr[0] = process.env.APP_COOKIE 99 | if (!cookiesArr[0]) { 100 | $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"}); 101 | return; 102 | } 103 | console.log(`\n正在查询今天所有账号的京豆收入......`); 104 | for (let i = 0; i < cookiesArr.length; i++) { 105 | if (cookiesArr[i]) { 106 | cookie = cookiesArr[i]; 107 | $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]) 108 | $.index = i + 1; 109 | $.beanCount = 0; 110 | $.incomeBean = 0; 111 | $.expenseBean = 0; 112 | $.todayIncomeBean = 0; 113 | $.errorMsg = ''; 114 | $.isLogin = true; 115 | $.nickName = ''; 116 | $.message = ''; 117 | $.balance = 0; 118 | $.expiredBalance = 0; 119 | //await TotalBean(); 120 | //console.log(`\n********开始【京东账号${$.index}】${$.nickName || $.UserName}******\n`); 121 | if (!$.isLogin) { 122 | $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"}); 123 | 124 | if ($.isNode()) { 125 | await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`); 126 | } 127 | continue 128 | } 129 | await bean(); 130 | await showMsg(); 131 | await $.wait(10*2000); 132 | } 133 | } 134 | allMessage += `\n今日全部账号收入:${allBean}个京豆 🐶\n` 135 | console.log(`${allMessage}`) 136 | if ($.isNode() && allMessage) { 137 | //await notify.sendNotify(`${$.name}`, `${allMessage}`, { url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean` }) 138 | } 139 | })() 140 | .catch((e) => { 141 | 142 | }) 143 | .finally(() => { 144 | $.done(); 145 | }) 146 | async function showMsg() { 147 | if ($.errorMsg) return 148 | allMessage += `\n【账号${$.index}:${$.nickName || $.UserName} 京豆详情统计】\n\n`; 149 | allMessage += `今日收入总计:${$.todayIncomeBean}京豆 🐶\n` 150 | allBean = allBean + parseInt($.todayIncomeBean) 151 | for (let key of myMap.keys()) { 152 | allMessage += key + ' ---> ' +myMap.get(key)+'京豆 🐶\n' 153 | } 154 | myMap = new Map() 155 | 156 | 157 | 158 | 159 | } 160 | async function bean() { 161 | 162 | 163 | 164 | 165 | //前一天的0:0:0时间戳 166 | const tm = parseInt((Date.now() + 28800000) / 86400000) * 86400000 - 28800000 - (24 * 60 * 60 * 1000); 167 | 168 | const tm1 = parseInt((Date.now() + 28800000) / 86400000) * 86400000 - 28800000; 169 | let page = 1, t = 0, yesterdayArr = [], todayArr = []; 170 | do { 171 | let response = await getJingBeanBalanceDetail(page); 172 | 173 | await $.wait(1000); 174 | if (response && response.code === "0") { 175 | page++; 176 | let detailList = response.detailList; 177 | if (detailList && detailList.length > 0) { 178 | for (let item of detailList) { 179 | const date = item.date.replace(/-/g, '/') + "+08:00"; 180 | if (new Date(date).getTime() >= tm1 && (!item['eventMassage'].includes("退还") && !item['eventMassage'].includes("物流") && !item['eventMassage'].includes('扣赠'))) { 181 | todayArr.push(item); 182 | } else if (tm <= new Date(date).getTime() && new Date(date).getTime() < tm1 && (!item['eventMassage'].includes("退还") && !item['eventMassage'].includes('扣赠'))) { 183 | //昨日的 184 | yesterdayArr.push(item); 185 | } else if (tm > new Date(date).getTime()) { 186 | //前天的 187 | t = 1; 188 | break; 189 | } 190 | } 191 | } else { 192 | $.errorMsg = `数据异常`; 193 | 194 | t = 1; 195 | } 196 | } else if (response && response.code === "3") { 197 | 198 | t = 1; 199 | } else { 200 | 201 | 202 | t = 1; 203 | } 204 | } while (t === 0); 205 | for (let item of yesterdayArr) { 206 | if (Number(item.amount) > 0) { 207 | $.incomeBean += Number(item.amount); 208 | } else if (Number(item.amount) < 0) { 209 | $.expenseBean += Number(item.amount); 210 | } 211 | } 212 | for (let item of todayArr) { 213 | if (Number(item.amount) > 0) { 214 | $.todayIncomeBean += Number(item.amount); 215 | myMap.set(item.eventMassage,0) 216 | } 217 | } 218 | for (let item of todayArr) { 219 | if (Number(item.amount) > 0) { 220 | myMap.set(item.eventMassage,parseInt(myMap.get(item.eventMassage))+parseInt(item.amount)) 221 | } 222 | } 223 | 224 | 225 | 226 | 227 | 228 | } 229 | function TotalBean() { 230 | return new Promise(async resolve => { 231 | const options = { 232 | url: "https://me-api.jd.com/user_new/info/GetJDUserInfoUnion", 233 | headers: { 234 | Host: "me-api.jd.com", 235 | Accept: "*/*", 236 | Connection: "keep-alive", 237 | Cookie: cookie, 238 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"), 239 | "Accept-Language": "zh-cn", 240 | "Referer": "https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&", 241 | "Accept-Encoding": "gzip, deflate, br" 242 | } 243 | } 244 | $.get(options, (err, resp, data) => { 245 | try { 246 | if (err) { 247 | 248 | } else { 249 | if (data) { 250 | data = JSON.parse(data); 251 | if (data['retcode'] === "1001") { 252 | $.isLogin = false; //cookie过期 253 | return; 254 | } 255 | if (data['retcode'] === "0" && data.data && data.data.hasOwnProperty("userInfo")) { 256 | $.nickName = data.data.userInfo.baseInfo.nickname; 257 | } 258 | if (data['retcode'] === '0' && data.data && data.data['assetInfo']) { 259 | $.beanCount = data.data && data.data['assetInfo']['beanNum']; 260 | } 261 | } else { 262 | $.log('京东服务器返回空数据'); 263 | } 264 | } 265 | } catch (e) { 266 | 267 | } finally { 268 | resolve(); 269 | } 270 | }) 271 | }) 272 | } 273 | function getJingBeanBalanceDetail(page) { 274 | return new Promise(async resolve => { 275 | const options = { 276 | "url": `https://api.m.jd.com/client.action?functionId=getJingBeanBalanceDetail`, 277 | "body": `body=${escape(JSON.stringify({"pageSize": "20", "page": page.toString()}))}&appid=ld`, 278 | "headers": { 279 | 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"), 280 | 'Host': 'api.m.jd.com', 281 | 'Content-Type': 'application/x-www-form-urlencoded', 282 | 'Cookie': cookie, 283 | } 284 | } 285 | $.post(options, (err, resp, data) => { 286 | try { 287 | if (err) { 288 | 289 | 290 | } else { 291 | if (data) { 292 | data = JSON.parse(data); 293 | 294 | } else { 295 | 296 | } 297 | } 298 | } catch (e) { 299 | 300 | } finally { 301 | resolve(data); 302 | } 303 | }) 304 | }) 305 | } 306 | function queryexpirejingdou() { 307 | return new Promise(async resolve => { 308 | const options = { 309 | "url": `https://wq.jd.com/activep3/singjd/queryexpirejingdou?_=${Date.now()}&g_login_type=1&sceneval=2`, 310 | "headers": { 311 | "Accept": "*/*", 312 | "Accept-Encoding": "gzip, deflate, br", 313 | "Accept-Language": "zh-cn", 314 | "Connection": "keep-alive", 315 | "Cookie": cookie, 316 | "Host": "wq.jd.com", 317 | "Referer": "https://wqs.jd.com/promote/201801/bean/mybean.html", 318 | "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.1 Mobile/15E148 Safari/604.1" 319 | } 320 | } 321 | $.expirejingdou = 0; 322 | $.get(options, (err, resp, data) => { 323 | try { 324 | if (err) { 325 | 326 | 327 | } else { 328 | if (data) { 329 | 330 | data = JSON.parse(data.slice(23, -13)); 331 | 332 | if (data.ret === 0) { 333 | data['expirejingdou'].map(item => { 334 | 335 | $.expirejingdou += item['expireamount']; 336 | }) 337 | 338 | 339 | 340 | } 341 | } else { 342 | 343 | } 344 | } 345 | } catch (e) { 346 | 347 | } finally { 348 | resolve(); 349 | } 350 | }) 351 | }) 352 | } 353 | function jsonParse(str) { 354 | if (typeof str == "string") { 355 | try { 356 | return JSON.parse(str); 357 | } catch (e) { 358 | 359 | 360 | return []; 361 | } 362 | } 363 | } 364 | 365 | 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) } 366 | -------------------------------------------------------------------------------- /jd_comment.js: -------------------------------------------------------------------------------- 1 | // auther 烟花小神 killall-love 2 | const $ = new Env('带图评价-解密版-自定义Sign'); 3 | // 你的Cookie 4 | cookiesArr = [] 5 | // 兼容Xposed 脚本执行 6 | cookiesArr[cookiesArr.length] = process.env.APP_COOKIE; 7 | //用户过滤关键字环境变量! 8 | let userKeyWords = process.env.userKeyWords && process.env.userKeyWords.split('@') || []; 9 | //获取评论内容的最少字数环境变量,默认6! 10 | let wordcount = process.env.wordcount ?? 6; 11 | 12 | // 提供一个sign地址 13 | // https://wwi.lanzoup.com/i4Hji05phv5e 14 | // 京东sign地址 15 | let jdSignUrl = 'https://video.app.9x6.cn/jd/sign' 16 | // 是否执行 默认不执行 17 | let isComment = true; 18 | 19 | let defKeyWords = ['质量差', '此用户未填写评价内容']; 20 | let defcommentlist = ['网上购物这么激烈,没想到店家的服务这么好,商品质量好而价低廉,我太感谢你了。', '质量非常好,真出乎我的意料,包装非常仔细,非常感谢,祝生意兴隆。', '这家店还好吧,来买过几次了,服务老客户非常周到,以后还常来。', '卖家的服务态度真好,发货很快。商品质量也相当不错。太喜欢了,谢谢。', '几以前几乎从未认真评价过,也不知道浪费了多少分。我听说评价中有100多个单词,基本上是每周访问一次。在京东购物太方便了,根本停不下来。从那时起,购买日用品时首先想到的就是京东,它是真正的。起初我很担心。现在我习惯了,这真的很好。现在我必须给更多的折扣。我下次会再来。我一直在购物。它仍然是一个非常好的宝贝。真的很好。这是值得的。网上买一次也没用。它还没有安装。我一次买了两个。大品牌值得信赖。', '我真的非常喜欢它,非常支持它,质量非常好,和卖家描述的一模一样,我非常满意。我真的很喜欢它,它完全超出了预期的价值,交货速度非常快,包装非常仔细和紧凑,物流公司有一个良好的服务态度,交货速度非常快,我非常满意购物', '质量非常好,与卖家描述的完全一致,非常满意,真 的很喜欢,完全超出期望值,发货速度非常快,包 装非常仔细、严实,物流公司服务态度很好,运送 速度很快,很满意的一次购质量很好,希望更多的 朋友信赖.店主态度特好,我会再次光顾的,可不 可以再便宜点,我带朋友来你家', '东西收到,很满意!!京东平台真的是超级好的卖家,解答疑问不厌其烦,细致认真,关键是东西好,而且货物发得超快,包装仔细,值得信赖!', '这个价格仍然很划算。经济、便宜、质量非常好,与卖方描述的完全一样。非常满意,完全出乎意料,超划算,划算,购物比实体店便宜多了,非常满意网上购物。我希望卖家的生意会越来越红火,物流会越来越快,包装会越来越结实。六星表扬,多一星不怕你骄傲,犹豫不决的朋友会很快下单,这是良心的推荐。它真的很好,而且价格也很高,所以你将来可以在这里买。给三个好评就满足了!满意了!满意了', '让我们先说说商品的质量:产品总体上是好的,包装很紧。让我们来谈谈商家服务:喜欢它。最后,快递:快递非常快。毕竟,廉价商品更真实。我希望商店能提供更多的折扣,及时通知老客户,并促进回购。祝你生意兴隆。']; 21 | !(async () => { 22 | var dmaya = { 23 | iBARi: function (marshal, kellisa) { 24 | return marshal(kellisa); 25 | }, sKxSN: function (charlette, shaeli) { 26 | return charlette || shaeli; 27 | }, kAweH: function (leoria, diena) { 28 | return leoria * diena; 29 | }, pAEvC: function (aliecia, deltina) { 30 | return aliecia === deltina; 31 | }, SjSdY: 'gSbIT', PynrT: '【提示】请先获取京东账号一cookie直接使用NobyDa的京东签到获取', EcXhI: 'https://bean.m.jd.com/bean/signIndex.action', eoUnk: 'oarRv', eOgpm: '默认不执行, 需要执行请环境变量设置 isCommentPic 为 true', flKHH: function (angelyce, ellamarie) { 32 | return angelyce > ellamarie; 33 | }, viyfP: function (emmi, juli) { 34 | return emmi !== juli; 35 | }, MMzvN: 'PctYq', pYVUu: 'DrLiQ', kQCxE: function (mahadev, nobuyoshi) { 36 | return mahadev < nobuyoshi; 37 | }, sPxrN: function (stazia, diep) { 38 | return stazia(diep); 39 | }, lAwUF: function (mounir, teshon) { 40 | return mounir + teshon; 41 | }, kWTWb: function (shonett) { 42 | return shonett(); 43 | }, sCeyD: 'jPRlD', UTVdW: function (alyka) { 44 | return alyka(); 45 | } 46 | }; 47 | if (!cookiesArr[0]) { 48 | if (dmaya['pAEvC'](dmaya['SjSdY'], dmaya['SjSdY'])) { 49 | $['msg']($['name'], dmaya['PynrT'], dmaya['EcXhI'], { "open-url": dmaya['EcXhI'] }); 50 | return; 51 | } else { 52 | dmaya['iBARi'](n, dmaya['sKxSN'](o, "")); 53 | } 54 | } 55 | if (dmaya['pAEvC'](isComment, false)) { 56 | if (dmaya['eoUnk'] !== 'iyrbc') { 57 | console['log'](dmaya['eOgpm']); 58 | return; 59 | } else { 60 | picURL = t['picURL']['replace'](/s[0-9]{3}x[0-9]{3}_(.*).dpg/g, "$1"); 61 | } 62 | } 63 | let brandasia = 0; 64 | if (dmaya['flKHH'](cookiesArr['length'], 10)) { 65 | if (dmaya['viyfP']('vwKkw', 'CnBsL')) { 66 | brandasia = 10; 67 | } else { 68 | $['log']("", "❌ " + $['name'] + ', 失败! 原因: ' + e + "!", ""); 69 | } 70 | } else { 71 | if (dmaya['MMzvN'] !== dmaya['pYVUu']) { 72 | brandasia = cookiesArr['length']; 73 | } else { 74 | return arr[Math['floor'](dmaya['kAweH'](Math['random'](), arr['length']))]; 75 | } 76 | } 77 | for (let rashidah = 0; dmaya['kQCxE'](rashidah, brandasia); rashidah++) { 78 | UA = 'jdapp;iPhone;10.0.8;14.6;' + uuidRandom() + ';network/wifi;JDEbook/openapp.jdreader;model/iPhone9,2;addressid/2214222493;appBuild/168841;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/16E158;supportJDSHWK/1'; 79 | if (cookiesArr[rashidah]) { 80 | cookie = cookiesArr[rashidah]; 81 | $['UserName'] = dmaya['sPxrN'](decodeURIComponent, cookie['match'](/pt_pin=([^; ]+)(?=;?)/) && cookie['match'](/pt_pin=([^; ]+)(?=;?)/)[1]); 82 | $['index'] = dmaya['lAwUF'](rashidah, 1); 83 | $['isLogin'] = true; 84 | $['nickName'] = ""; 85 | $['commentWareList'] = ""; 86 | $['commentInfoList'] = ""; 87 | await dmaya['kWTWb'](TotalBean); 88 | console['log']('******开始【京东账号' + $['index'] + "】" + ($['nickName'] || $['UserName']) + '*********'); 89 | if (!$['isLogin']) { 90 | $['msg']($['name'], '【提示】cookie已失效', '京东账号' + $['index'] + " " + ($['nickName'] || $['UserName']) + '请重新登录获取https://bean.m.jd.com/bean/signIndex.action', { "open-url": dmaya['EcXhI'] }); 91 | if ($['isNode']()) { 92 | if (dmaya['pAEvC'](dmaya['sCeyD'], 'jPRlD')) { 93 | await notify['sendNotify']($['name'] + 'cookie已失效 - ' + $['UserName'], '京东账号' + $['index'] + " " + $['UserName'] + '请重新登录获取cookie'); 94 | } else { 95 | console['log'](e); 96 | } 97 | } 98 | continue; 99 | } 100 | await dmaya['UTVdW'](main); 101 | console['log']('等待...'); 102 | await $['wait'](2e4); 103 | } 104 | } 105 | })()['catch'](donnae => { 106 | $['log']("", "❌ " + $['name'] + ', 失败! 原因: ' + donnae + "!", ""); 107 | })['finally'](() => { 108 | $['done'](); 109 | }); 110 | async function main() { 111 | var rishik = { 112 | yaKhM: '没有待评价!!', sfbKm: function (selden, maddock) { 113 | return selden === maddock; 114 | }, Pjcxq: 'userInfo', oYPLZ: 'assetInfo', XjOOq: 'beanNum', AZYsb: '京东服务器返回空数据', otNmV: function (laliana, meridee) { 115 | return laliana === meridee; 116 | }, KmUrp: function (haneef) { 117 | return haneef(); 118 | }, hsnIL: function (kamora, jakyia) { 119 | return kamora(jakyia); 120 | }, xxHbo: function (tayshon, ater) { 121 | return tayshon !== ater; 122 | }, nhwev: 'cWwhj', sYEBT: function (gaege, tanyla) { 123 | return gaege(tanyla); 124 | }, DGqzN: 'fmxaa', ZvCnl: function (elmerine, verva) { 125 | return elmerine !== verva; 126 | }, veaKu: 'dpg', ruyYK: function (christiaan, elysha) { 127 | return christiaan !== elysha; 128 | }, GMWcG: 'webp', seAkx: 'avif', xrlPB: function (maretha, marcellyn) { 129 | return maretha === marcellyn; 130 | }, dCdbX: 'mYdhY', TfjLG: 'ZADpW', TCtht: function (onesha, taeven) { 131 | return onesha >= taeven; 132 | }, PaYix: 'pubComment', VLtwA: '1699', FXQho: function (jaielle, germayne) { 133 | return jaielle >= germayne; 134 | }, nHHsn: function (raheel, alhena) { 135 | return raheel < alhena; 136 | }, YGpAY: function (lavert, brehea, raland) { 137 | return lavert(brehea, raland); 138 | }, RVJSm: '[{"VideoIsEditCover":"0","ImagePropId":"0","ImageTakePhotoFilterId":"0","ImageIsCrop":"0","VideoIsEditCrop":"0","VideoEditFilterId":"0","VideoMusicId":"0","ImageEditFilterId":"0","VideoPropId":"0","TakeRate":"0","VideoRecordIsMakup":"0","ImageTakePhotoIsMakup":"0","VideoRecordFilterId":"0","ImageFontId":"0","FromType":"1","ImageStrickId":"0"},{"VideoIsEditCover":"0","ImagePropId":"0","ImageTakePhotoFilterId":"0","ImageIsCrop":"0","VideoIsEditCrop":"0","VideoEditFilterId":"0","VideoMusicId":"0","ImageEditFilterId":"0","VideoPropId":"0","TakeRate":"0","VideoRecordIsMakup":"0","ImageTakePhotoIsMakup":"0","VideoRecordFilterId":"0","ImageFontId":"0","FromType":"1","ImageStrickId":"0"}]', iGyNo: function (kennidi, lashundra, daundra) { 139 | return kennidi(lashundra, daundra); 140 | }, MCNNs: 'gsVDp', BYzyy: 'SKVOq' 141 | }; 142 | let franka = []; 143 | let sarika = []; 144 | let audreigh = []; 145 | await rishik['KmUrp'](getCommentWareList); 146 | await $['wait'](2e3); 147 | await rishik['hsnIL'](getCommentWareList, $['maxPage']); 148 | let jacqlene = $['commentWareList']; 149 | if (jacqlene) { 150 | if (rishik['xxHbo'](rishik['nhwev'], 'WnBtw')) { 151 | await rishik['sYEBT'](getCommentListWithCard, jacqlene['wareId']); 152 | await $['wait'](2e3); 153 | let christopherryan = $['commentInfoList']; 154 | for (const abduljaleel of christopherryan) { 155 | if (rishik['xxHbo']('fmxaa', rishik['DGqzN'])) { 156 | console['log'](rishik['yaKhM']); 157 | } else { 158 | if (abduljaleel['commentInfo']['pictureInfoList']) { 159 | for (const chaneta of abduljaleel['commentInfo']['pictureInfoList'] || {}) { 160 | if (chaneta['mediaType'] != "2") { 161 | if (rishik['ZvCnl'](chaneta['picURL']['indexOf'](rishik['veaKu']), -1)) { 162 | picURL = chaneta['picURL']['replace'](/s[0-9]{3}x[0-9]{3}_(.*).dpg/g, "$1"); 163 | } else if (rishik['ruyYK'](chaneta['picURL']['indexOf'](rishik['GMWcG']), -1)) { 164 | picURL = chaneta['picURL']['replace'](/s[0-9]{3}x[0-9]{3}_(.*).webp/g, "$1"); 165 | } else if (rishik['ruyYK'](chaneta['picURL']['indexOf'](rishik['seAkx']), -1)) { 166 | if (rishik['xrlPB'](rishik['dCdbX'], 'kRkjT')) { 167 | if (n) $['logErr'](n); else if (a) { 168 | if (rishik['sfbKm'](1001, (a = JSON['parse'](a))['retcode'])) return void ($['isLogin'] = false); 169 | 0 === a['retcode'] && a['data'] && a['data']['hasOwnProperty'](rishik['Pjcxq']) && ($['nickName'] = a['data']['userInfo']['baseInfo']['nickname']), rishik['sfbKm'](0, a['retcode']) && a['data'] && a['data'][rishik['oYPLZ']] && ($['beanCount'] = a['data'] && a['data']['assetInfo'][rishik['XjOOq']]); 170 | } else console['log'](rishik['AZYsb']); 171 | } else { 172 | picURL = chaneta['picURL']['replace'](/s[0-9]{3}x[0-9]{3}_(.*).avif/g, "$1"); 173 | } 174 | } 175 | franka['push'](picURL); 176 | } 177 | ; 178 | } 179 | ; 180 | } 181 | ; 182 | if (rishik['xrlPB'](abduljaleel['commentInfo']['commentScore'], "5") && abduljaleel['commentInfo']['commentData']['length'] > wordcount) { 183 | sarika['push'](abduljaleel['commentInfo']['commentData']); 184 | } 185 | ; 186 | } 187 | } 188 | ; 189 | nullKeyword = ""; 190 | for (let kyliyah of defKeyWords) userKeyWords['push'](kyliyah); 191 | for (let aliezah of sarika) { 192 | if (userKeyWords['some'](aishwarya => aliezah['includes'](aishwarya) ? nullKeyword = aishwarya : "")) { 193 | if (rishik['xrlPB'](rishik['TfjLG'], rishik['TfjLG'])) { 194 | console['log']('评价内容被过滤,含有关键词-【' + nullKeyword + "】"); 195 | } else { 196 | cklen = 10; 197 | } 198 | } else { 199 | audreigh['push'](aliezah); 200 | } 201 | ; 202 | } 203 | ; 204 | let yaquelin = rishik['sYEBT'](random, audreigh); 205 | let waylen = [{ picUrl: franka[0] }, { picUrl: franka[1] }]; 206 | let lesly = rishik['sYEBT'](random, defcommentlist); 207 | if (franka['length'] >= 2 && rishik['TCtht'](audreigh['length'], 2)) { 208 | console['log']('去评价 ---> ' + jacqlene['wname'] + '成功获取到图片,去带图评价!'); 209 | await task(rishik['PaYix'], { productId: jacqlene['wareId'], kocSynFlag: "0", categoryList: jacqlene['categoryList'], voucherStatus: "0", extInfo: { mediasExt: '[{"VideoIsEditCover":"0","ImagePropId":"0","ImageTakePhotoFilterId":"0","ImageIsCrop":"0","VideoIsEditCrop":"0","VideoEditFilterId":"0","VideoMusicId":"0","ImageEditFilterId":"0","VideoPropId":"0","TakeRate":"0","VideoRecordIsMakup":"0","ImageTakePhotoIsMakup":"0","VideoRecordFilterId":"0","ImageFontId":"0","FromType":"1","ImageStrickId":"0"},{"VideoIsEditCover":"0","ImagePropId":"0","ImageTakePhotoFilterId":"0","ImageIsCrop":"0","VideoIsEditCrop":"0","VideoEditFilterId":"0","VideoMusicId":"0","ImageEditFilterId":"0","VideoPropId":"0","TakeRate":"0","VideoRecordIsMakup":"0","ImageTakePhotoIsMakup":"0","VideoRecordFilterId":"0","ImageFontId":"0","FromType":"1","ImageStrickId":"0"}]' }, officerScore: rishik['VLtwA'], anonymousFlag: "1", commentScore: "5", shopType: "0", orderId: jacqlene['orderId'], shopId: jacqlene['shopId'], addPictureFlag: "0", commentData: lesly, pictureInfoList: waylen, officerLevel: "3", isCommentTagContent: "0" }); 210 | } else if (rishik['FXQho'](franka['length'], 2) && rishik['nHHsn'](audreigh['length'], 2)) { 211 | console['log']('去评价 ---> ' + jacqlene['wname'] + '成功获取到图片,且没有获取到评价内容,采用脚本自带评价,去带图评价!'); 212 | await rishik['YGpAY'](task, 'pubComment', { productId: jacqlene['wareId'], kocSynFlag: "0", categoryList: jacqlene['categoryList'], voucherStatus: "0", extInfo: { mediasExt: rishik['RVJSm'] }, officerScore: '1699', anonymousFlag: "1", commentScore: "5", shopType: "0", orderId: jacqlene['orderId'], shopId: jacqlene['shopId'], addPictureFlag: "0", commentData: lesly, pictureInfoList: waylen, officerLevel: "3", isCommentTagContent: "0" }); 213 | } else if (franka['length'] < 2 && rishik['FXQho'](audreigh['length'], 2)) { 214 | console['log']('去评价 ---> ' + jacqlene['wname'] + '没有获取到图片,且获取到评价,去评价!'); 215 | await rishik['iGyNo'](task, rishik['PaYix'], { productId: jacqlene['wareId'], kocSynFlag: "0", categoryList: jacqlene['ategoryList'], voucherStatus: "0", officerScore: rishik['VLtwA'], anonymousFlag: "1", commentScore: "5", shopType: "0", orderId: jacqlene['orderId'], shopId: jacqlene['shopId'], addPictureFlag: "0", commentData: lesly, pictureInfoList: "", officerLevel: "3", isCommentTagContent: "0" }); 216 | } else if (christopherryan['length'] <= 1) { 217 | if (rishik['xrlPB'](rishik['MCNNs'], 'gsVDp')) { 218 | console['log']('去评价 ---> ' + jacqlene['wname'] + '没有获取到评价内容,采用脚本自带评价'); 219 | await task(rishik['PaYix'], { productId: jacqlene['wareId'], kocSynFlag: "0", categoryList: jacqlene['ategoryList'], voucherStatus: "0", officerScore: rishik['VLtwA'], anonymousFlag: "1", commentScore: "5", shopType: "0", orderId: jacqlene['orderId'], shopId: jacqlene['shopId'], addPictureFlag: "0", commentData: lesly, pictureInfoList: "", officerLevel: "3", isCommentTagContent: "0" }); 220 | } else { 221 | picURL = t['picURL']['replace'](/s[0-9]{3}x[0-9]{3}_(.*).webp/g, "$1"); 222 | } 223 | } 224 | ; 225 | } else { 226 | if (userKeyWords['some'](trashawn => e['includes'](trashawn) ? nullKeyword = trashawn : "")) { 227 | console['log']('评价内容被过滤,含有关键词-【' + nullKeyword + "】"); 228 | } else { 229 | audreigh['push'](e); 230 | } 231 | ; 232 | } 233 | } else { 234 | if (rishik['xrlPB'](rishik['BYzyy'], rishik['BYzyy'])) { 235 | console['log'](rishik['yaKhM']); 236 | } else { 237 | if (rishik['sfbKm'](1001, (a = JSON['parse'](a))['retcode'])) return void ($['isLogin'] = false); 238 | rishik['sfbKm'](0, a['retcode']) && a['data'] && a['data']['hasOwnProperty'](rishik['Pjcxq']) && ($['nickName'] = a['data']['userInfo']['baseInfo']['nickname']), rishik['otNmV'](0, a['retcode']) && a['data'] && a['data']['assetInfo'] && ($['beanCount'] = a['data'] && a['data'][rishik['oYPLZ']][rishik['XjOOq']]); 239 | } 240 | } 241 | } 242 | async function getCommentListWithCard(reyon) { 243 | s = await task('getCommentListWithCard', { sortType: "5", isCurrentSku: false, sku: reyon, pictureCommentType: "A", shieldCurrentComment: "1", shopType: "0", type: "4", shadowMainSku: "0", offset: "1", num: "10" }); 244 | $['commentInfoList'] = s['commentInfoList']; 245 | console['log']('准备获取评价...'); 246 | } 247 | async function getCommentWareList(_0x1fd34f = "1") { 248 | var burnice = { 249 | PImfL: function (alleyah, sharonn, nerida) { 250 | return alleyah(sharonn, nerida); 251 | } 252 | }; 253 | s = await burnice['PImfL'](task, 'getCommentWareList', { status: "1", planType: "1", pageIndex: _0x1fd34f, pageSize: "10" }); 254 | if(s['commentWareListInfo'] == undefined){ 255 | return 256 | } 257 | $['maxPage'] = s['commentWareListInfo']['maxPage']; 258 | $['commentWareList'] = s['commentWareListInfo']['commentWareList']['reverse']()[0]; 259 | } 260 | async function task(olisaemeka, miryah) { 261 | var kulsum = { 262 | HfqED: 'pubComment', XzsDG: function (ahliana, kyrion) { 263 | return ahliana(kyrion); 264 | }, JWpiv: function (bernadine, shiah) { 265 | return bernadine !== shiah; 266 | }, udEvC: async function (tammis, mrinalini, shervon) { 267 | a = await tammis(mrinalini, shervon) 268 | console.log(a) 269 | return { 270 | "body": a['data']['convertUrlNew'] 271 | }; 272 | }, oweAb: 'api.m.jd.com', Cdwkk: 'application/x-www-form-urlencoded', VHjEZ: '*/*' 273 | }; 274 | return s = await kulsum['udEvC'](getSign, olisaemeka, miryah), opt = { url: 'https://api.m.jd.com/client.action?functionId=' + olisaemeka, body: s['body'], headers: { Host: kulsum['oweAb'], "content-type": kulsum['Cdwkk'], accept: kulsum['VHjEZ'], "user-agent": UA, "accept-language": 'zh-Hans-JP;q=1, en-JP;q=0.9, zh-Hant-TW;q=0.8, ja-JP;q=0.7, en-US;q=0.6', Cookie: cookie } }, new Promise(tonetta => { 275 | var niaya = { 276 | ZJeSF: kulsum['HfqED'], aNuUq: function (tajsa, eldrich) { 277 | return kulsum['XzsDG'](tajsa, eldrich); 278 | } 279 | }; 280 | if (kulsum['JWpiv']('quhDL', 'quhDL')) { 281 | cklen = cookiesArr['length']; 282 | } else { 283 | $['post'](opt, (kenlyn, lovick, parvaneh) => { 284 | try { 285 | kenlyn ? console['log'](kenlyn) : parvaneh = JSON['parse'](parvaneh); 286 | switch (olisaemeka) { 287 | case niaya['ZJeSF']: 288 | if (parvaneh['message']) { 289 | console['log'](parvaneh['message']); 290 | } 291 | break; 292 | default: 293 | break; 294 | } 295 | } catch (klowi) { 296 | console['log'](klowi); 297 | } finally { 298 | niaya['aNuUq'](tonetta, parvaneh); 299 | } 300 | }); 301 | } 302 | }); 303 | } 304 | function uuidRandom() { 305 | var traylen = { 306 | QZRDH: function (yunuen, laureano) { 307 | return yunuen + laureano; 308 | } 309 | }; 310 | return traylen['QZRDH'](traylen['QZRDH'](Math['random']()['toString'](16)['slice'](2, 10), Math['random']()['toString'](16)['slice'](2, 10)) + Math['random']()['toString'](16)['slice'](2, 10) + Math['random']()['toString'](16)['slice'](2, 10), Math['random']()['toString'](16)['slice'](2, 10)); 311 | } 312 | function random(kiryn) { 313 | var byrant = { 314 | fLFJL: function (bryce, zaleah) { 315 | return bryce * zaleah; 316 | } 317 | }; 318 | return kiryn[Math['floor'](byrant['fLFJL'](Math['random'](), kiryn['length']))]; 319 | } 320 | function getSign(emerito, reshmi) { 321 | var malayla = { 322 | toCTY: function (ladreama, skii) { 323 | return ladreama + skii; 324 | }, ecSCV: 'tAfyV', Ggpcp: function (anaylah, daylynn) { 325 | return anaylah !== daylynn; 326 | }, kLTrc: 'Izfft', Tvnnn: function (kinnidi, marsalis) { 327 | return kinnidi(marsalis); 328 | }, yroou: "", Sruwe: 'application/x-www-form-urlencoded' 329 | }; 330 | const leighanne = { url: jdSignUrl, body: `functionId=${emerito}&body=${JSON.stringify(reshmi)}`, headers: { "Content-Type": malayla['Sruwe'] } }; 331 | return new Promise(tykeyah => { 332 | var reynoldo = { 333 | oyeAX: function (jaycek, izrael) { 334 | return jaycek + izrael; 335 | }, qLmne: function (theodric, tsega) { 336 | return malayla['toCTY'](theodric, tsega); 337 | }, IBiXP: malayla['ecSCV'], qGNAl: function (lynk, safeya) { 338 | return malayla['Ggpcp'](lynk, safeya); 339 | }, nJsaa: malayla['kLTrc'], pInvh: function (wintress, kaydrian) { 340 | return malayla['Tvnnn'](wintress, kaydrian); 341 | }, FpxRo: function (samarrah, knolyn) { 342 | return samarrah || knolyn; 343 | } 344 | }; 345 | $['post'](leighanne, async (zavery, pedrojose, ila) => { 346 | try { 347 | zavery ? console['log'](zavery) : ila = JSON['parse'](ila); 348 | } catch (aryela) { 349 | if (reynoldo['IBiXP'] === reynoldo['IBiXP']) { 350 | $['logErr'](aryela, pedrojose); 351 | } else { 352 | try { 353 | zavery ? console['log'](zavery) : ila = JSON['parse'](ila); 354 | } catch (guinn) { 355 | $['logErr'](guinn, pedrojose); 356 | } finally { 357 | aryela(ila || ""); 358 | } 359 | } 360 | } finally { 361 | if (reynoldo['qGNAl'](reynoldo['nJsaa'], reynoldo['nJsaa'])) { 362 | return reynoldo['oyeAX'](reynoldo['qLmne'](Math['random']()['toString'](16)['slice'](2, 10) + Math['random']()['toString'](16)['slice'](2, 10) + Math['random']()['toString'](16)['slice'](2, 10), Math['random']()['toString'](16)['slice'](2, 10)), Math['random']()['toString'](16)['slice'](2, 10)); 363 | } else { 364 | reynoldo['pInvh'](tykeyah, reynoldo['FpxRo'](ila, "")); 365 | } 366 | } 367 | }); 368 | }); 369 | } 370 | function TotalBean() { 371 | var khleo = { 372 | dyqrV: function (camecia, alieah) { 373 | return camecia === alieah; 374 | }, AWZZp: 'retcode', hexrP: 'beanNum', haxnd: 'sHjVE', sigGd: function (rade) { 375 | return rade(); 376 | }, cZLsf: 'https://wq.jd.com/user_new/info/GetJDUserInfoUnion?sceneval=2', YJbys: '*/*', MVZHt: 'keep-alive', CHndV: 'gzip, deflate, br' 377 | }; 378 | return new Promise(async rudell => { 379 | var ilda = { 380 | IQsSc: function (syiah, taleyah) { 381 | return khleo['dyqrV'](syiah, taleyah); 382 | }, idXbN: khleo['AWZZp'], bOGMJ: 'assetInfo', NOQPE: khleo['hexrP'], fURBp: '京东服务器返回空数据', DPrhB: khleo['haxnd'], VXKlD: function (daxston) { 383 | return khleo['sigGd'](daxston); 384 | } 385 | }; 386 | const melvonia = { url: khleo['cZLsf'], headers: { Host: 'wq.jd.com', Accept: khleo['YJbys'], Connection: khleo['MVZHt'], Cookie: cookie, "User-Agent": UA, "Accept-Language": 'zh-cn', Referer: 'https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&', "Accept-Encoding": khleo['CHndV'] } }; 387 | $['get'](melvonia, (oreatha, nathaya, ginell) => { 388 | try { 389 | if (oreatha) $['logErr'](oreatha); else if (ginell) { 390 | if (ilda['IQsSc'](1001, (ginell = JSON['parse'](ginell))[ilda['idXbN']])) return void ($['isLogin'] = false); 391 | ilda['IQsSc'](0, ginell[ilda['idXbN']]) && ginell['data'] && ginell['data']['hasOwnProperty']('userInfo') && ($['nickName'] = ginell['data']['userInfo']['baseInfo']['nickname']), ilda['IQsSc'](0, ginell['retcode']) && ginell['data'] && ginell['data'][ilda['bOGMJ']] && ($['beanCount'] = ginell['data'] && ginell['data'][ilda['bOGMJ']][ilda['NOQPE']]); 392 | } else console['log'](ilda['fURBp']); 393 | } catch (iszac) { 394 | if (ilda['DPrhB'] !== ilda['DPrhB']) { 395 | defcommentInfolist['push'](vo['commentInfo']['commentData']); 396 | } else { 397 | $['logErr'](iszac); 398 | } 399 | } finally { 400 | ilda['VXKlD'](rudell); 401 | } 402 | }); 403 | }); 404 | } 405 | ; 406 | 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) } -------------------------------------------------------------------------------- /jd_try.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 2022-08-12 修复申请试用风控,更换nolan接口 3 | * 2022-05-27 修复优化版 By https://github.com/6dylan6/jdpro/ 4 | * 如需运行请自行添加环境变量:JD_TRY,值填 true 即可运行 5 | * X1a0He by 6dylan6/jdpro/ 6 | * 脚本是否耗时只看args_xh.maxLength的大小 7 | * 上一作者说了每天最多300个商店,总上限为500个,jd_unsubscribe.js我已更新为批量取关版 8 | * 请提前取关至少250个商店确保京东试用脚本正常运行 9 | * @Address: https://github.com/X1a0He/jd_scripts_fixed/blob/main/jd_try_xh.js 10 | 11 | 如需运行请自行添加环境变量:JD_TRY="true" 即可运行 12 | 脚本是否耗时只看args_xh.maxLength的大小(申请数量),默认50个,申请100个差不多15分钟 13 | 上一作者说每天申请上限300个(自测,没有申请过上限),关注店铺上限500个 14 | 关注店铺满了就无法继续申请,可用批量取关店铺取消关注 15 | 16 | 部分环境变量说明,详细请参考58行往下: 17 | export JD_TRY="true"是否允许,默认false 18 | export JD_TRY_PASSZC="false" #不过滤种草官类试用,默认true过滤 19 | export JD_TRY_MAXLENGTH="50" #商品数组的最大长度,默认50个 20 | export JD_TRY_PRICE="XX"#商品原价格,大于XX才申请,默认20 21 | export JD_TRY_APPLYINTERVAL="6000" #商品试用之间和获取商品之间的间隔ms 22 | export JD_TRY_APPLYNUMFILTER="10000" #过滤大于设定值的已申请人数 23 | export JD_TRY_MINSUPPLYNUM="1" #最小提供数量 24 | export JD_TRY_SENDNUM="10" #每隔多少账号发送一次通知,默认为4 25 | export JD_TRY_UNIFIED="false" 默认采用不同试用组 26 | export JD_TRY_NUM="7" 最多跑多少个CK,默认10 27 | 28 | 定时自定义,能用多久随缘了!!! 29 | */ 30 | process.env.JD_TRY = "true" 31 | 32 | const $ = new Env('京东试用') 33 | const URL = 'https://api.m.jd.com/client.action' 34 | let trialActivityIdList = [] 35 | let trialActivityTitleList = [] 36 | let notifyMsg = '' 37 | let size = 1; 38 | $.isPush = true; 39 | $.isLimit = false; 40 | $.isForbidden = false; 41 | $.wrong = false; 42 | $.giveupNum = 0; 43 | $.successNum = 0; 44 | $.completeNum = 0; 45 | $.getNum = 0; 46 | $.try = true; 47 | $.sentNum = 0; 48 | $.cookiesArr = [] 49 | $.innerKeyWords = 50 | [ 51 | "幼儿园", "教程", "英语", "辅导", "培训", 52 | "孩子", "小学", "成人用品", "套套", "情趣", 53 | "自慰", "阳具", "飞机杯", "男士用品", "女士用品", 54 | "内衣", "高潮", "避孕", "乳腺", "肛塞", "肛门", 55 | "宝宝", "玩具", "芭比", "娃娃", "男用", 56 | "女用", "神油", "足力健", "老年", "老人", 57 | "宠物", "饲料", "丝袜", "黑丝", "磨脚", 58 | "脚皮", "除臭", "性感", "内裤", "跳蛋", 59 | "安全套", "龟头", "阴道", "阴部", "手机卡", "电话卡", "流量卡", 60 | "玉坠","和田玉","习题","试卷","手机壳","钢化膜" 61 | ] 62 | //下面很重要,遇到问题请把下面注释看一遍再来问 63 | let args_xh = { 64 | /* 65 | * 控制一次最多跑几个号,默认10个 66 | */ 67 | try_num: process.env.JD_TRY_NUM * 1 || 10, 68 | /* 69 | * 控制是否输出当前环境变量设置,默认为false 70 | * 环境变量名称:XH_TRY_ENV 71 | */ 72 | env: process.env.XH_TRY_ENV === 'true' || false, 73 | /* 74 | * 跳过某个指定账号,默认为全部账号清空 75 | * 填写规则:例如当前Cookie1为pt_key=key; pt_pin=pin1;则环境变量填写pin1即可,此时pin1的购物车将不会被清空 76 | * 若有更多,则按照pin1@pin2@pin3进行填写 77 | * 环境变量名称:XH_TRY_EXCEPT 78 | */ 79 | except: process.env.XH_TRY_EXCEPT && process.env.XH_TRY_EXCEPT.split('@') || [], 80 | //以上环境变量新增于2022.01.30 81 | /* 82 | * 每个Tab页要便遍历的申请页数,由于京东试用又改了,获取不到每一个Tab页的总页数了(显示null),所以特定增加一个环境变了以控制申请页数 83 | * 例如设置 JD_TRY_PRICE 为 30,假如现在正在遍历tab1,那tab1就会被遍历到30页,到31页就会跳到tab2,或下一个预设的tab页继续遍历到30页 84 | * 默认为20 85 | */ 86 | totalPages: process.env.JD_TRY_TOTALPAGES * 1 || 20, 87 | /* 88 | * 由于每个账号每次获取的试用产品都不一样,所以为了保证每个账号都能试用到不同的商品,之前的脚本都不支持采用统一试用组的 89 | * 以下环境变量是用于指定是否采用统一试用组的 90 | * 例如当 JD_TRY_UNIFIED 为 true时,有3个账号,第一个账号跑脚本的时候,试用组是空的 91 | * 而当第一个账号跑完试用组后,第二个,第三个账号所采用的试用组默认采用的第一个账号的试用组 92 | * 优点:减少除第一个账号外的所有账号遍历,以减少每个账号的遍历时间 93 | * 缺点:A账号能申请的东西,B账号不一定有 94 | * 提示:想每个账号独立不同的试用产品的,请设置为false,想减少脚本运行时间的,请设置为true 95 | * 默认为false 96 | */ 97 | unified: process.env.JD_TRY_UNIFIED === 'true' || false, 98 | //以上环境变量新增于2022.01.25 99 | /* 100 | * 商品原价,低于这个价格都不会试用,意思是 101 | * A商品原价49元,试用价1元,如果下面设置为50,那么A商品不会被加入到待提交的试用组 102 | * B商品原价99元,试用价0元,如果下面设置为50,那么B商品将会被加入到待提交的试用组 103 | * C商品原价99元,试用价1元,如果下面设置为50,那么C商品将会被加入到待提交的试用组 104 | * 默认为0 105 | * */ 106 | jdPrice: process.env.JD_TRY_PRICE * 1 || 20, 107 | /* 108 | * 下面有一个function是可以获取tabId列表,名为try_tabList 109 | * 可设置环境变量:JD_TRY_TABID,用@进行分隔 110 | * tabId不定期会变,获取不到商品,自行获取并修改tabId 111 | * */ 112 | tabId: process.env.JD_TRY_TABID && process.env.JD_TRY_TABID.split('@').map(Number) || [200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212], 113 | /* 114 | * 试用商品标题过滤,黑名单,当标题存在关键词时,则不加入试用组 115 | * 当白名单和黑名单共存时,黑名单会自动失效,优先匹配白名单,匹配完白名单后不会再匹配黑名单,望周知 116 | * 例如A商品的名称为『旺仔牛奶48瓶特价』,设置了匹配白名单,白名单关键词为『牛奶』,但黑名单关键词存在『旺仔』 117 | * 这时,A商品还是会被添加到待提交试用组,白名单优先于黑名单 118 | * 已内置对应的 成人类 幼儿类 宠物 老年人类关键词,请勿重复添加 119 | * 可设置环境变量:JD_TRY_TITLEFILTERS,关键词与关键词之间用@分隔 120 | * */ 121 | titleFilters: process.env.JD_TRY_TITLEFILTERS && process.env.JD_TRY_TITLEFILTERS.split('@') || [], 122 | /* 123 | * 试用价格(中了要花多少钱),高于这个价格都不会试用,小于等于才会试用,意思就是 124 | * A商品原价49元,现在试用价1元,如果下面设置为10,那A商品将会被添加到待提交试用组,因为1 < 10 125 | * B商品原价49元,现在试用价2元,如果下面设置为1,那B商品将不会被添加到待提交试用组,因为2 > 1 126 | * C商品原价49元,现在试用价1元,如果下面设置为1,那C商品也会被添加到带提交试用组,因为1 = 1 127 | * 可设置环境变量:JD_TRY_TRIALPRICE,默认为0 128 | * */ 129 | trialPrice: process.env.JD_TRY_TRIALPRICE * 1 || 0, 130 | /* 131 | * 最小提供数量,例如试用商品只提供2份试用资格,当前设置为1,则会进行申请 132 | * 若只提供5分试用资格,当前设置为10,则不会申请 133 | * 可设置环境变量:JD_TRY_MINSUPPLYNUM 134 | * */ 135 | minSupplyNum: process.env.JD_TRY_MINSUPPLYNUM * 1 || 1, 136 | /* 137 | * 过滤大于设定值的已申请人数,例如下面设置的10000,A商品已经有10001人申请了,则A商品不会进行申请,会被跳过 138 | * 可设置环境变量:JD_TRY_APPLYNUMFILTER 139 | * */ 140 | applyNumFilter: process.env.JD_TRY_APPLYNUMFILTER * 1 || 10000, 141 | /* 142 | * 商品试用之间和获取商品之间的间隔, 单位:毫秒(1秒=1000毫秒) 143 | * 可设置环境变量:JD_TRY_APPLYINTERVAL 144 | * 默认为6000-9000随机 145 | * */ 146 | applyInterval: process.env.JD_TRY_APPLYINTERVAL * 1 || 6000, 147 | /* 148 | * 商品数组的最大长度,通俗来说就是即将申请的商品队列长度 149 | * 例如设置为20,当第一次获取后获得12件,过滤后剩下5件,将会进行第二次获取,过滤后加上第一次剩余件数 150 | * 例如是18件,将会进行第三次获取,直到过滤完毕后为20件才会停止,不建议设置太大 151 | * 可设置环境变量:JD_TRY_MAXLENGTH 152 | * */ 153 | maxLength: process.env.JD_TRY_MAXLENGTH * 1 || 50, 154 | /* 155 | * 过滤种草官类试用,某些试用商品是专属官专属,考虑到部分账号不是种草官账号 156 | * 例如A商品是种草官专属试用商品,下面设置为true,而你又不是种草官账号,那A商品将不会被添加到待提交试用组 157 | * 例如B商品是种草官专属试用商品,下面设置为false,而你是种草官账号,那A商品将会被添加到待提交试用组 158 | * 例如B商品是种草官专属试用商品,下面设置为true,即使你是种草官账号,A商品也不会被添加到待提交试用组 159 | * 可设置环境变量:JD_TRY_PASSZC,默认为true 160 | * */ 161 | passZhongCao: process.env.JD_TRY_PASSZC === 'false' ? false : true, 162 | /* 163 | * 是否打印输出到日志,考虑到如果试用组长度过大,例如100以上,如果每个商品检测都打印一遍,日志长度会非常长 164 | * 打印的优点:清晰知道每个商品为什么会被过滤,哪个商品被添加到了待提交试用组 165 | * 打印的缺点:会使日志变得很长 166 | * 167 | * 不打印的优点:简短日志长度 168 | * 不打印的缺点:无法清晰知道每个商品为什么会被过滤,哪个商品被添加到了待提交试用组 169 | * 可设置环境变量:JD_TRY_PLOG,默认为true 170 | * */ 171 | printLog: process.env.JD_TRY_PLOG === 'false' ? false : true, 172 | /* 173 | * 白名单,是否打开,如果下面为true,那么黑名单会自动失效 174 | * 白名单和黑名单无法共存,白名单永远优先于黑名单 175 | * 可通过环境变量控制:JD_TRY_WHITELIST,默认为false 176 | * */ 177 | whiteList: process.env.JD_TRY_WHITELIST === 'true' || false, 178 | /* 179 | * 白名单关键词,当标题存在关键词时,加入到试用组 180 | * 例如A商品的名字为『旺仔牛奶48瓶特价』,白名单其中一个关键词是『牛奶』,那么A将会直接被添加到待提交试用组,不再进行另外判断 181 | * 就算设置了黑名单也不会判断,希望这种写得那么清楚的脑瘫问题就别提issues了 182 | * 可通过环境变量控制:JD_TRY_WHITELIST,用@分隔 183 | * */ 184 | whiteListKeywords: process.env.JD_TRY_WHITELISTKEYWORDS && process.env.JD_TRY_WHITELISTKEYWORDS.split('@') || [], 185 | /* 186 | * 每多少个账号发送一次通知,默认为4 187 | * 可通过环境变量控制 JD_TRY_SENDNUM 188 | * */ 189 | sendNum: process.env.JD_TRY_SENDNUM * 1 || 4, 190 | } 191 | //上面很重要,遇到问题请把上面注释看一遍再来问 192 | !(async () => { 193 | await $.wait(500) 194 | // 如果你要运行京东试用这个脚本,麻烦你把环境变量 JD_TRY 设置为 true 195 | if (1) { 196 | await requireConfig() 197 | $.cookiesArr[0] = process.env.APP_COOKIE 198 | if (!$.cookiesArr[0]) { 199 | $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', { 200 | "open-url": "https://bean.m.jd.com/" 201 | }) 202 | return 203 | } 204 | args_xh.tabId = args_xh.tabId.sort(() => 0.5 - Math.random()) 205 | for (let i = 0; i < args_xh.try_num; i++) { 206 | if ($.cookiesArr[i]) { 207 | $.cookie = $.cookiesArr[i]; 208 | $.UserName = decodeURIComponent($.cookie.match(/pt_pin=(.+?);/) && $.cookie.match(/pt_pin=(.+?);/)[1]) 209 | $.index = i + 1; 210 | $.isLogin = true; 211 | $.nickName = ''; 212 | //await totalBean(); 213 | console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`); 214 | $.except = false; 215 | if(args_xh.except.includes($.UserName)){ 216 | console.log(`跳过账号:${$.nickName || $.UserName}`) 217 | $.except = true; 218 | continue 219 | } 220 | if(!$.isLogin){ 221 | $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, { 222 | "open-url": "https://bean.m.jd.com/bean/signIndex.action" 223 | }); 224 | 225 | console.log(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`); 226 | continue 227 | } 228 | $.totalTry = 0 229 | $.totalSuccess = 0 230 | $.nowTabIdIndex = 0; 231 | $.nowPage = 1; 232 | $.nowItem = 1; 233 | $.retrynum = 0 234 | $.jda='__jda='+_jda('1xxxxxxxx.164xxxxxxxxxxxxxxxxxxx.164xxxxxxx.165xxxxxx.165xxxxxx.1xx') 235 | if (!args_xh.unified) { 236 | trialActivityIdList = [] 237 | trialActivityTitleList = [] 238 | } 239 | $.isLimit = false; 240 | // 获取tabList的,不知道有哪些的把这里的注释解开跑一遍就行了 241 | //await try_tabList(); 242 | // return; 243 | $.isForbidden = false 244 | $.wrong = false 245 | size = 1 246 | 247 | while (trialActivityIdList.length < args_xh.maxLength && $.retrynum < 3) { 248 | if ($.nowTabIdIndex === args_xh.tabId.length) { 249 | console.log(`tabId组已遍历完毕,不在获取商品\n`); 250 | break; 251 | } else { 252 | await try_feedsList(args_xh.tabId[$.nowTabIdIndex], $.nowPage) //获取对应tabId的试用页面 253 | } 254 | if (trialActivityIdList.length < args_xh.maxLength) { 255 | console.log(`间隔等待中,请等待3秒 \n`) 256 | await $.wait(3000); 257 | } 258 | } 259 | if ($.isForbidden === false && $.isLimit === false) { 260 | console.log(`稍后将执行试用申请,请等待 2 秒\n`) 261 | await $.wait(2000); 262 | for (let i = 0; i < trialActivityIdList.length && $.isLimit === false; i++) { 263 | if ($.isLimit) { 264 | console.log("试用上限") 265 | break 266 | } 267 | if ($.isForbidden) { console.log('403了,跳出'); break } 268 | await try_apply(trialActivityTitleList[i], trialActivityIdList[i]) 269 | //console.log(`间隔等待中,请等待 ${args_xh.applyInterval} ms\n`) 270 | const waitTime = generateRandomInteger(args_xh.applyInterval, 9000); 271 | console.log(`随机等待${waitTime}ms后继续`); 272 | await $.wait(waitTime); 273 | } 274 | console.log("试用申请执行完毕...") 275 | // await try_MyTrials(1, 1) //申请中的商品 276 | $.giveupNum = 0; 277 | $.successNum = 0; 278 | $.getNum = 0; 279 | $.completeNum = 0; 280 | await try_MyTrials(1, 2) //申请成功的商品 281 | // await try_MyTrials(1, 3) //申请失败的商品 282 | await showMsg() 283 | } 284 | } 285 | if ($.isNode()) { 286 | if ($.index % args_xh.sendNum === 0) { 287 | $.sentNum++; 288 | console.log(`正在进行第 ${$.sentNum} 次发送通知,发送数量:${args_xh.sendNum}`) 289 | console.log(`${$.name}`, `${notifyMsg}`) 290 | notifyMsg = ""; 291 | } 292 | } 293 | } 294 | if ($.isNode() && $.except === false) { 295 | if (($.cookiesArr.length - ($.sentNum * args_xh.sendNum)) < args_xh.sendNum && notifyMsg.length != 0) { 296 | console.log(`正在进行最后一次发送通知,发送数量:${($.cookiesArr.length - ($.sentNum * args_xh.sendNum))}`) 297 | console.log(`${$.name}`, `${notifyMsg}`) 298 | notifyMsg = ""; 299 | } 300 | } 301 | } else { 302 | console.log(`\n您未设置变量export JD_TRY="true"运行【京东试用】脚本, 结束运行!\n`) 303 | } 304 | })().catch((e) => { 305 | console.error(`❗️ ${$.name} 运行错误!\n${e}`) 306 | }).finally(() => $.done()) 307 | 308 | function requireConfig() { 309 | return new Promise(resolve => { 310 | $.notify = { sendNotify: async () => { } } 311 | //获取 Cookies 312 | $.cookiesArr = [] 313 | $.cookiesArr[0] = process.env.APP_COOKIE 314 | for (let keyWord of $.innerKeyWords) args_xh.titleFilters.push(keyWord) 315 | console.log(`共${$.cookiesArr.length}个京东账号\n`) 316 | if (args_xh.env) { 317 | console.log('=========环境变量配置如下=========') 318 | console.log(`env: ${typeof args_xh.env}, ${args_xh.env}`) 319 | console.log(`try_num: ${typeof args_xh.try_num}, ${args_xh.try_num}`) 320 | console.log(`except: ${typeof args_xh.except}, ${args_xh.except}`) 321 | console.log(`totalPages: ${typeof args_xh.totalPages}, ${args_xh.totalPages}`) 322 | console.log(`unified: ${typeof args_xh.unified}, ${args_xh.unified}`) 323 | console.log(`jdPrice: ${typeof args_xh.jdPrice}, ${args_xh.jdPrice}`) 324 | console.log(`tabId: ${typeof args_xh.tabId}, ${args_xh.tabId}`) 325 | console.log(`titleFilters: ${typeof args_xh.titleFilters}, ${args_xh.titleFilters}`) 326 | console.log(`trialPrice: ${typeof args_xh.trialPrice}, ${args_xh.trialPrice}`) 327 | console.log(`minSupplyNum: ${typeof args_xh.minSupplyNum}, ${args_xh.minSupplyNum}`) 328 | console.log(`applyNumFilter: ${typeof args_xh.applyNumFilter}, ${args_xh.applyNumFilter}`) 329 | console.log(`applyInterval: ${typeof args_xh.applyInterval}, ${args_xh.applyInterval}`) 330 | console.log(`maxLength: ${typeof args_xh.maxLength}, ${args_xh.maxLength}`) 331 | console.log(`passZhongCao: ${typeof args_xh.passZhongCao}, ${args_xh.passZhongCao}`) 332 | console.log(`printLog: ${typeof args_xh.printLog}, ${args_xh.printLog}`) 333 | console.log(`whiteList: ${typeof args_xh.whiteList}, ${args_xh.whiteList}`) 334 | console.log(`whiteListKeywords: ${typeof args_xh.whiteListKeywords}, ${args_xh.whiteListKeywords}`) 335 | console.log('===============================') 336 | } 337 | resolve() 338 | }) 339 | } 340 | 341 | //获取tabList的,如果不知道tabList有哪些,跑一遍这个function就行了 342 | function try_tabList() { 343 | return new Promise((resolve, reject) => { 344 | console.log(`获取tabList中...`) 345 | const body = JSON.stringify({ 346 | "version": 2, 347 | "previewTime": "" 348 | }); 349 | let option = taskurl_xh('newtry', 'try_tabList', body) 350 | $.post(option, (err, resp, data) => { 351 | try { 352 | if (err) { 353 | if (JSON.stringify(err) === `\"Response code 403 (Forbidden)\"`) { 354 | $.isForbidden = true 355 | console.log('账号被京东服务器风控,不再请求该帐号') 356 | } else { 357 | console.log(JSON.stringify(err)) 358 | console.log(`${$.name} API请求失败,请检查网路重试`) 359 | } 360 | } else { 361 | data = JSON.parse(data) 362 | if (data.success) { 363 | for (let tabId of data.data.tabList) console.log(`${tabId.tabName} - ${tabId.tabId}`) 364 | } else { 365 | console.log("获取失败", data) 366 | } 367 | } 368 | } catch (e) { 369 | reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`) 370 | } finally { 371 | resolve() 372 | } 373 | }) 374 | }) 375 | } 376 | 377 | //获取商品列表并且过滤 By X1a0He 378 | function try_feedsList(tabId, page) { 379 | return new Promise((resolve, reject) => { 380 | const body = JSON.stringify({ 381 | "tabId": `${tabId}`, 382 | "page": page, 383 | "version": 2, 384 | "source": "default", 385 | "client": "app", 386 | //"previewTime": "" 387 | }); 388 | let option = taskurl_xh('newtry', 'try_feedsList', body) 389 | $.post(option, (err, resp, data) => { 390 | try { 391 | if (err) { 392 | if (JSON.stringify(err) === `\"Response code 403 (Forbidden)\"`) { 393 | console.log(`请求失败,第 ${$.retrynum + 1} 次重试`) 394 | $.retrynum++ 395 | if ($.retrynum === 3) { $.isForbidden = true; $.log('多次尝试失败,换个时间再试!') } 396 | } else { 397 | console.log(JSON.stringify(err)) 398 | console.log(`${$.name} API请求失败,请检查网路重试`) 399 | } 400 | } else { 401 | data = JSON.parse(data) 402 | let tempKeyword = ``; 403 | if (data.data) { 404 | $.nowPage === args_xh.totalPages ? $.nowPage = 1 : $.nowPage++; 405 | console.log(`第 ${size++} 次获取试用商品成功,tabId:${args_xh.tabId[$.nowTabIdIndex]} 的 第 ${page}/${args_xh.totalPages} 页`) 406 | console.log(`获取到商品 ${data.data.feedList.length} 条`) 407 | for (let item of data.data.feedList) { 408 | if (item.applyNum === null) { 409 | args_xh.printLog ? console.log(`商品未到申请时间:${item.skuTitle}\n`) : '' 410 | continue 411 | } 412 | if (trialActivityIdList.length >= args_xh.maxLength) { 413 | console.log('商品列表长度已满.结束获取') 414 | break 415 | } 416 | if (item.applyState === 1) { 417 | args_xh.printLog ? console.log(`商品已申请试用:${item.skuTitle}\n`) : '' 418 | continue 419 | } 420 | if (item.applyState !== null) { 421 | args_xh.printLog ? console.log(`商品状态异常,未找到skuTitle\n`) : '' 422 | continue 423 | } 424 | if (args_xh.passZhongCao) { 425 | $.isPush = true; 426 | if (item.tagList.length !== 0) { 427 | for (let itemTag of item.tagList) { 428 | if (itemTag.tagType === 3) { 429 | args_xh.printLog ? console.log('商品被过滤,该商品是种草官专属') : '' 430 | $.isPush = false; 431 | break; 432 | } else if (itemTag.tagType === 5) { 433 | args_xh.printLog ? console.log('商品被跳过,该商品是付费试用!') : '' 434 | $.isPush = false; 435 | break; 436 | } 437 | } 438 | } 439 | } 440 | if (item.skuTitle && $.isPush) { 441 | args_xh.printLog ? console.log(`检测 tabId:${args_xh.tabId[$.nowTabIdIndex]} 的 第 ${page}/${args_xh.totalPages} 页 第 ${$.nowItem++ + 1} 个商品\n${item.skuTitle}`) : '' 442 | if (args_xh.whiteList) { 443 | if (args_xh.whiteListKeywords.some(fileter_word => item.skuTitle.includes(fileter_word))) { 444 | args_xh.printLog ? console.log(`商品白名单通过,将加入试用组,trialActivityId为${item.trialActivityId}\n`) : '' 445 | trialActivityIdList.push(item.trialActivityId) 446 | trialActivityTitleList.push(item.skuTitle) 447 | } 448 | } else { 449 | tempKeyword = ``; 450 | if (parseFloat(item.jdPrice) <= args_xh.jdPrice) { 451 | args_xh.printLog ? console.log(`商品被过滤,商品价格 ${item.jdPrice} < ${args_xh.jdPrice} \n`) : '' 452 | } else if (parseFloat(item.supplyNum) < args_xh.minSupplyNum && item.supplyNum !== null) { 453 | args_xh.printLog ? console.log(`商品被过滤,提供申请的份数小于预设申请的份数 \n`) : '' 454 | } else if (parseFloat(item.applyNum) > args_xh.applyNumFilter && item.applyNum !== null) { 455 | args_xh.printLog ? console.log(`商品被过滤,已申请人数大于预设的${args_xh.applyNumFilter}人 \n`) : '' 456 | } else if (item.jdPrice === null) { 457 | args_xh.printLog ? console.log(`商品被过滤,商品无价,不能申请 \n`) : '' 458 | } else if (parseFloat(item.trialPrice) > args_xh.trialPrice) { 459 | args_xh.printLog ? console.log(`商品被过滤,商品试用价大于预设试用价 \n`) : '' 460 | } else if (args_xh.titleFilters.some(fileter_word => item.skuTitle.includes(fileter_word) ? tempKeyword = fileter_word : '')) { 461 | args_xh.printLog ? console.log(`商品被过滤,含有关键词 ${tempKeyword}\n`) : '' 462 | } else { 463 | args_xh.printLog ? console.log(`商品通过,加入试用组,trialActivityId为${item.trialActivityId}\n`) : '' 464 | if (trialActivityIdList.indexOf(item.trialActivityId) === -1) { 465 | trialActivityIdList.push(item.trialActivityId) 466 | trialActivityTitleList.push(item.skuTitle) 467 | } 468 | } 469 | } 470 | } else if ($.isPush !== false) { 471 | console.error('skuTitle解析异常') 472 | return 473 | } 474 | } 475 | console.log(`当前试用组长度为:${trialActivityIdList.length}`) 476 | //args_xh.printLog ? console.log(`${trialActivityIdList}`) : '' 477 | if (page >= args_xh.totalPages && $.nowTabIdIndex < args_xh.tabId.length) { 478 | //这个是因为每一个tab都会有对应的页数,获取完如果还不够的话,就获取下一个tab 479 | $.nowTabIdIndex++; 480 | $.nowPage = 1; 481 | $.nowItem = 1; 482 | } 483 | $.retrynum = 0 484 | } else { 485 | console.log(`💩 获得试用列表失败: ${data.message}`) 486 | } 487 | } 488 | } catch (e) { 489 | reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`) 490 | } finally { 491 | resolve() 492 | } 493 | }) 494 | }) 495 | } 496 | 497 | function try_apply(title, activityId) { 498 | return new Promise(async (resolve, reject) => { 499 | console.log(`申请试用商品提交中...`) 500 | args_xh.printLog ? console.log(`商品:${title}`) : '' 501 | args_xh.printLog ? console.log(`id为:${activityId}`) : '' 502 | let body = JSON.stringify({ 503 | "activityId": activityId, 504 | "previewTime": "" 505 | }); 506 | body = await geth5st(body); 507 | if(!body) return; 508 | let opt = 509 | { 510 | "url": `${URL}?${body}}`, 511 | 'headers': { 512 | 'Cookie': $.cookie + $.jda, 513 | 'user-agent': 'jdapp;iPhone;10.1.2;15.0;ff2caa92a8529e4788a34b3d8d4df66d9573f499;network/wifi;model/iPhone13,4;addressid/2074196292;appBuild/167802;jdSupportDarkMode/1;Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1', 514 | 'Referer': 'https://prodev.m.jd.com/', 515 | 'origin': 'https://prodev.m.jd.com/', 516 | 'Accept': 'application/json,text/plain,*/*', 517 | 'Accept-Encoding': 'gzip, deflate, br', 518 | 'Accept-Language': 'zh-cn', 519 | 'Content-Type': 'application/x-www-form-urlencoded', 520 | }, 521 | } 522 | $.get(opt, (err, resp, data) => { 523 | try { 524 | if (err) { 525 | if (JSON.stringify(err) === `\"Response code 403 (Forbidden)\"`) { 526 | $.isForbidden = true 527 | console.log('账号被京东服务器风控,不再请求该帐号') 528 | } else { 529 | console.log(JSON.stringify(err)) 530 | console.log(`${$.name} API请求失败,请检查网路重试`) 531 | } 532 | } else { 533 | $.totalTry++ 534 | data = JSON.parse(data) 535 | if (data.success && data.code === "1") { // 申请成功 536 | console.log("申请提交成功") 537 | $.totalSuccess++ 538 | } else if (data.code === "-106") { 539 | console.log(data.message) // 未在申请时间内! 540 | } else if (data.code === "-110") { 541 | console.log(data.message) // 您的申请已成功提交,请勿重复申请… 542 | } else if (data.code === "-120") { 543 | console.log(data.message) // 您还不是会员,本品只限会员申请试用,请注册会员后申请! 544 | } else if (data.code === "-167") { 545 | console.log(data.message) // 抱歉,此试用需为种草官才能申请。查看下方详情了解更多。 546 | } else if (data.code === "-131") { 547 | console.log(data.message) // 申请次数上限。 548 | $.isLimit = true; 549 | } else if (data.code === "-113") { 550 | console.log(data.message) // 操作不要太快哦! 551 | } else { 552 | console.log("申请失败", data) 553 | } 554 | } 555 | } catch (e) { 556 | reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`) 557 | } finally { 558 | resolve() 559 | } 560 | }) 561 | }) 562 | } 563 | 564 | function try_MyTrials(page, selected) { 565 | 566 | return new Promise((resolve, reject) => { 567 | switch (selected) { 568 | case 1: 569 | console.log('正在获取已申请的商品...') 570 | break; 571 | case 2: 572 | console.log('正在获取申请成功的商品...') 573 | break; 574 | case 3: 575 | console.log('正在获取申请失败的商品...') 576 | break; 577 | default: 578 | console.log('selected错误') 579 | } 580 | let options = { 581 | url: URL, 582 | body: `appid=newtry&functionId=try_MyTrials&clientVersion=10.3.4&client=wh5&body=%7B%22page%22%3A${page}%2C%22selected%22%3A${selected}%2C%22previewTime%22%3A%22%22%7D`, 583 | headers: { 584 | 'origin': 'https://prodev.m.jd.com', 585 | 'User-Agent': 'jdapp;iPhone;10.3.4;;;M/5.0;appBuild/167945;jdSupportDarkMode/1;;;Mozilla/5.0 (iPhone; CPU iPhone OS 15_2_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1;', 586 | 'referer': 'https://prodev.m.jd.com/', 587 | 'cookie': $.cookie + $.jda 588 | }, 589 | } 590 | $.post(options, (err, resp, data) => { 591 | try { 592 | if (err) { 593 | console.log(`🚫 ${arguments.callee.name.toString()} API请求失败,请检查网路\n${JSON.stringify(err)}`) 594 | } else { 595 | data = JSON.parse(data) 596 | if (data.success) { 597 | //temp adjustment 598 | if (selected === 2) { 599 | if (data.success && data.data) { 600 | for (let item of data.data.list) { 601 | item.status === 4 || item.text.text.includes('试用资格已过期') ? $.giveupNum += 1 : '' 602 | item.status === 2 && item.text.text.includes('试用资格将保留') ? $.successNum += 1 : '' 603 | item.status === 2 && item.text.text.includes('请收货后尽快提交报告') ? $.getNum += 1 : '' 604 | item.status === 2 && item.text.text.includes('试用已完成') ? $.completeNum += 1 : '' 605 | } 606 | console.log(`待领取 | 已领取 | 已完成 | 已放弃:${$.successNum} | ${$.getNum} | ${$.completeNum} | ${$.giveupNum}`) 607 | } else { 608 | console.log(`获得成功列表失败: ${data.message}`) 609 | } 610 | } 611 | } else { 612 | console.error(`ERROR:try_MyTrials`) 613 | } 614 | } 615 | } catch (e) { 616 | reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`) 617 | } finally { 618 | resolve() 619 | } 620 | }) 621 | }) 622 | } 623 | 624 | function taskurl_xh(appid, functionId, body = JSON.stringify({})) { 625 | 626 | return { 627 | "url": `${URL}?appid=${appid}&functionId=${functionId}&clientVersion=11.0.2&client=wh5&body=${encodeURIComponent(body)}&h5st=${$.h5st}`, 628 | 'headers': { 629 | 'Cookie': $.cookie + $.jda, 630 | 'user-agent': 'jdapp;iPhone;10.1.2;15.0;ff2caa92a8529e4788a34b3d8d4df66d9573f499;network/wifi;model/iPhone13,4;addressid/2074196292;appBuild/167802;jdSupportDarkMode/1;Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1', 631 | 'Referer': 'https://prodev.m.jd.com/', 632 | 'origin': 'https://prodev.m.jd.com/', 633 | 'Accept': 'application/json,text/plain,*/*', 634 | 'Accept-Encoding': 'gzip, deflate, br', 635 | 'Accept-Language': 'zh-cn', 636 | 'Content-Type': 'application/x-www-form-urlencoded', 637 | }, 638 | } 639 | 640 | } 641 | 642 | async function showMsg() { 643 | let message = ``; 644 | message += `👤 京东账号${$.index} ${$.nickName || $.UserName}\n`; 645 | if ($.totalSuccess !== 0 && $.totalTry !== 0) { 646 | message += `🎉 本次提交申请:${$.totalSuccess}/${$.totalTry}个商品🛒\n`; 647 | message += `🎉 ${$.successNum}个商品待领取\n`; 648 | message += `🎉 ${$.getNum}个商品已领取\n`; 649 | message += `🎉 ${$.completeNum}个商品已完成\n`; 650 | message += `🗑 ${$.giveupNum}个商品已放弃\n\n`; 651 | } else { 652 | message += `⚠️ 本次执行没有申请试用商品\n`; 653 | message += `🎉 ${$.successNum}个商品待领取\n`; 654 | message += `🎉 ${$.getNum}个商品已领取\n`; 655 | message += `🎉 ${$.completeNum}个商品已完成\n`; 656 | message += `🗑 ${$.giveupNum}个商品已放弃\n\n`; 657 | } 658 | if (!args_xh.jdNotify || args_xh.jdNotify === 'false') { 659 | $.msg($.name, ``, message, { 660 | "open-url": 'https://try.m.jd.com/user' 661 | }) 662 | if ($.isNode()) 663 | notifyMsg += `${message}` 664 | } else { 665 | console.log(message) 666 | } 667 | } 668 | 669 | function totalBean() { 670 | return new Promise(async resolve => { 671 | const options = { 672 | "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`, 673 | "headers": { 674 | "Accept": "application/json,text/plain, */*", 675 | "Content-Type": "application/x-www-form-urlencoded", 676 | "Accept-Encoding": "gzip, deflate, br", 677 | "Accept-Language": "zh-cn", 678 | "Connection": "keep-alive", 679 | "Cookie": $.cookie, 680 | "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2", 681 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1") 682 | }, 683 | "timeout": 10000, 684 | } 685 | $.post(options, (err, resp, data) => { 686 | try { 687 | if (err) { 688 | console.log(`${JSON.stringify(err)}`) 689 | console.log(`${$.name} API请求失败,请检查网路重试`) 690 | } else { 691 | if (data) { 692 | data = JSON.parse(data); 693 | if (data['retcode'] === 13) { 694 | $.isLogin = false; //cookie过期 695 | return 696 | } 697 | if (data['retcode'] === 0) { 698 | $.nickName = (data['base'] && data['base'].nickname) || $.UserName; 699 | } else { 700 | $.nickName = $.UserName 701 | } 702 | } else { 703 | console.log(`京东服务器返回空数据`) 704 | } 705 | } 706 | } catch (e) { 707 | $.logErr(e, resp) 708 | } finally { 709 | resolve(); 710 | } 711 | }) 712 | }) 713 | } 714 | function geth5st(body) { 715 | let opt = { 716 | url: `https://api.nolanstore.top/h5st`, 717 | body: JSON.stringify({ 718 | "appId": "a8ade", 719 | "functionId": "try_apply", 720 | "body": body, 721 | "appid": "newtry", 722 | "client": "wh5", 723 | "clientVersion": "11.0.2", 724 | "ua": 'jdapp;iPhone;10.1.2;15.0;ff2caa92a8529e4788a34b3d8d4df66d9573f499;network/wifi;model/iPhone13,4;addressid/2074196292;appBuild/167802;jdSupportDarkMode/1;Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1', 725 | "pin": encodeURIComponent($.UserName) 726 | }), 727 | headers: { 728 | "Content-Type": "application/json" 729 | }, 730 | timeout: 30000, 731 | },str=''; 732 | return new Promise((resolve) => { 733 | $.post(opt, (err, resp, data) => { 734 | try { 735 | if (err) { 736 | console.log(JSON.stringify(err)); 737 | } else { 738 | data = JSON.parse(data); 739 | if (data.code == 200) { 740 | str = data.body; 741 | } else { 742 | $.log('连接服务失败',data.msg); 743 | } 744 | } 745 | } catch (e) { 746 | console.log(e, resp); 747 | } finally { 748 | resolve(str); 749 | } 750 | }) 751 | }) 752 | } 753 | 754 | function jsonParse(str) { 755 | if (typeof str == "string") { 756 | try { 757 | return JSON.parse(str); 758 | } catch (e) { 759 | console.log(e); 760 | $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie') 761 | return []; 762 | } 763 | } 764 | } 765 | 766 | function _jda(format = 'xxxxxxxxxxxxxxxxxxxx') { 767 | return format.replace(/[xy]/g, function (c) { 768 | var r = Math.random() * 10 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); 769 | jdaid = v.toString() 770 | return jdaid; 771 | }); 772 | } 773 | const generateRandomInteger = (min, max = 0) => { 774 | if (min > max) { 775 | let temp = min; 776 | min = max; 777 | max = temp; 778 | } 779 | var Range = max - min; 780 | var Rand = Math.random(); 781 | return min + Math.round(Rand * Range); 782 | }; 783 | 784 | function getExtract(array) { 785 | const random = (min, max) => Math.floor(Math.random() * (max - min) + min); 786 | let index = random(0, array.length); 787 | return array.splice(index, 1); 788 | } 789 | 790 | function Env(name, opts) { 791 | class Http { 792 | constructor(env) { 793 | this.env = env 794 | } 795 | 796 | send(opts, method = 'GET') { 797 | opts = typeof opts === 'string' ? { 798 | url: opts 799 | } : opts 800 | let sender = this.get 801 | if (method === 'POST') { 802 | sender = this.post 803 | } 804 | return new Promise((resolve, reject) => { 805 | sender.call(this, opts, (err, resp, body) => { 806 | if (err) reject(err) 807 | else resolve(resp) 808 | }) 809 | }) 810 | } 811 | 812 | get(opts) { 813 | return this.send.call(this.env, opts) 814 | } 815 | 816 | post(opts) { 817 | return this.send.call(this.env, opts, 'POST') 818 | } 819 | } 820 | 821 | return new (class { 822 | constructor(name, opts) { 823 | this.name = name 824 | this.http = new Http(this) 825 | this.data = null 826 | this.dataFile = 'box.dat' 827 | this.logs = [] 828 | this.isMute = false 829 | this.isNeedRewrite = false 830 | this.logSeparator = '\n' 831 | this.startTime = new Date().getTime() 832 | Object.assign(this, opts) 833 | this.log('', `🔔${this.name}, 开始!`) 834 | } 835 | 836 | isNode() { 837 | return 'undefined' !== typeof module && !!module.exports 838 | } 839 | 840 | isQuanX() { 841 | return 'undefined' !== typeof $task 842 | } 843 | 844 | isSurge() { 845 | return 'undefined' !== typeof $httpClient && 'undefined' === typeof $loon 846 | } 847 | 848 | isLoon() { 849 | return 'undefined' !== typeof $loon 850 | } 851 | 852 | toObj(str, defaultValue = null) { 853 | try { 854 | return JSON.parse(str) 855 | } catch { 856 | return defaultValue 857 | } 858 | } 859 | 860 | toStr(obj, defaultValue = null) { 861 | try { 862 | return JSON.stringify(obj) 863 | } catch { 864 | return defaultValue 865 | } 866 | } 867 | 868 | getjson(key, defaultValue) { 869 | let json = defaultValue 870 | const val = this.getdata(key) 871 | if (val) { 872 | try { 873 | json = JSON.parse(this.getdata(key)) 874 | } catch { } 875 | } 876 | return json 877 | } 878 | 879 | setjson(val, key) { 880 | try { 881 | return this.setdata(JSON.stringify(val), key) 882 | } catch { 883 | return false 884 | } 885 | } 886 | 887 | getScript(url) { 888 | return new Promise((resolve) => { 889 | this.get({ 890 | url 891 | }, (err, resp, body) => resolve(body)) 892 | }) 893 | } 894 | 895 | runScript(script, runOpts) { 896 | return new Promise((resolve) => { 897 | let httpapi = this.getdata('@chavy_boxjs_userCfgs.httpapi') 898 | httpapi = httpapi ? httpapi.replace(/\n/g, '').trim() : httpapi 899 | let httpapi_timeout = this.getdata('@chavy_boxjs_userCfgs.httpapi_timeout') 900 | httpapi_timeout = httpapi_timeout ? httpapi_timeout * 1 : 20 901 | httpapi_timeout = runOpts && runOpts.timeout ? runOpts.timeout : httpapi_timeout 902 | const [key, addr] = httpapi.split('@') 903 | const opts = { 904 | url: `http://${addr}/v1/scripting/evaluate`, 905 | body: { 906 | script_text: script, 907 | mock_type: 'cron', 908 | timeout: httpapi_timeout 909 | }, 910 | headers: { 911 | 'X-Key': key, 912 | 'Accept': '*/*' 913 | } 914 | } 915 | this.post(opts, (err, resp, body) => resolve(body)) 916 | }).catch((e) => this.logErr(e)) 917 | } 918 | 919 | loaddata() { 920 | if (this.isNode()) { 921 | this.fs = this.fs ? this.fs : require('fs') 922 | this.path = this.path ? this.path : require('path') 923 | const curDirDataFilePath = this.path.resolve(this.dataFile) 924 | const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile) 925 | const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath) 926 | const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath) 927 | if (isCurDirDataFile || isRootDirDataFile) { 928 | const datPath = isCurDirDataFile ? curDirDataFilePath : rootDirDataFilePath 929 | try { 930 | return JSON.parse(this.fs.readFileSync(datPath)) 931 | } catch (e) { 932 | return {} 933 | } 934 | } else return {} 935 | } else return {} 936 | } 937 | 938 | writedata() { 939 | if (this.isNode()) { 940 | this.fs = this.fs ? this.fs : require('fs') 941 | this.path = this.path ? this.path : require('path') 942 | const curDirDataFilePath = this.path.resolve(this.dataFile) 943 | const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile) 944 | const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath) 945 | const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath) 946 | const jsondata = JSON.stringify(this.data) 947 | if (isCurDirDataFile) { 948 | this.fs.writeFileSync(curDirDataFilePath, jsondata) 949 | } else if (isRootDirDataFile) { 950 | this.fs.writeFileSync(rootDirDataFilePath, jsondata) 951 | } else { 952 | this.fs.writeFileSync(curDirDataFilePath, jsondata) 953 | } 954 | } 955 | } 956 | 957 | lodash_get(source, path, defaultValue = undefined) { 958 | const paths = path.replace(/\[(\d+)\]/g, '.$1').split('.') 959 | let result = source 960 | for (const p of paths) { 961 | result = Object(result)[p] 962 | if (result === undefined) { 963 | return defaultValue 964 | } 965 | } 966 | return result 967 | } 968 | 969 | lodash_set(obj, path, value) { 970 | if (Object(obj) !== obj) return obj 971 | if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || [] 972 | path.slice(0, -1).reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[ 973 | path[path.length - 1] 974 | ] = value 975 | return obj 976 | } 977 | 978 | getdata(key) { 979 | let val = this.getval(key) 980 | // 如果以 @ 981 | if (/^@/.test(key)) { 982 | const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key) 983 | const objval = objkey ? this.getval(objkey) : '' 984 | if (objval) { 985 | try { 986 | const objedval = JSON.parse(objval) 987 | val = objedval ? this.lodash_get(objedval, paths, '') : val 988 | } catch (e) { 989 | val = '' 990 | } 991 | } 992 | } 993 | return val 994 | } 995 | 996 | setdata(val, key) { 997 | let issuc = false 998 | if (/^@/.test(key)) { 999 | const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key) 1000 | const objdat = this.getval(objkey) 1001 | const objval = objkey ? (objdat === 'null' ? null : objdat || '{}') : '{}' 1002 | try { 1003 | const objedval = JSON.parse(objval) 1004 | this.lodash_set(objedval, paths, val) 1005 | issuc = this.setval(JSON.stringify(objedval), objkey) 1006 | } catch (e) { 1007 | const objedval = {} 1008 | this.lodash_set(objedval, paths, val) 1009 | issuc = this.setval(JSON.stringify(objedval), objkey) 1010 | } 1011 | } else { 1012 | issuc = this.setval(val, key) 1013 | } 1014 | return issuc 1015 | } 1016 | 1017 | getval(key) { 1018 | if (this.isSurge() || this.isLoon()) { 1019 | return $persistentStore.read(key) 1020 | } else if (this.isQuanX()) { 1021 | return $prefs.valueForKey(key) 1022 | } else if (this.isNode()) { 1023 | this.data = this.loaddata() 1024 | return this.data[key] 1025 | } else { 1026 | return (this.data && this.data[key]) || null 1027 | } 1028 | } 1029 | 1030 | setval(val, key) { 1031 | if (this.isSurge() || this.isLoon()) { 1032 | return $persistentStore.write(val, key) 1033 | } else if (this.isQuanX()) { 1034 | return $prefs.setValueForKey(val, key) 1035 | } else if (this.isNode()) { 1036 | this.data = this.loaddata() 1037 | this.data[key] = val 1038 | this.writedata() 1039 | return true 1040 | } else { 1041 | return (this.data && this.data[key]) || null 1042 | } 1043 | } 1044 | 1045 | initGotEnv(opts) { 1046 | this.got = this.got ? this.got : require('got') 1047 | this.cktough = this.cktough ? this.cktough : require('tough-cookie') 1048 | this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar() 1049 | if (opts) { 1050 | opts.headers = opts.headers ? opts.headers : {} 1051 | if (undefined === opts.headers.Cookie && undefined === opts.cookieJar) { 1052 | opts.cookieJar = this.ckjar 1053 | } 1054 | } 1055 | } 1056 | 1057 | get(opts, callback = () => { }) { 1058 | if (opts.headers) { 1059 | delete opts.headers['Content-Type'] 1060 | delete opts.headers['Content-Length'] 1061 | } 1062 | if (this.isSurge() || this.isLoon()) { 1063 | if (this.isSurge() && this.isNeedRewrite) { 1064 | opts.headers = opts.headers || {} 1065 | Object.assign(opts.headers, { 1066 | 'X-Surge-Skip-Scripting': false 1067 | }) 1068 | } 1069 | $httpClient.get(opts, (err, resp, body) => { 1070 | if (!err && resp) { 1071 | resp.body = body 1072 | resp.statusCode = resp.status 1073 | } 1074 | callback(err, resp, body) 1075 | }) 1076 | } else if (this.isQuanX()) { 1077 | if (this.isNeedRewrite) { 1078 | opts.opts = opts.opts || {} 1079 | Object.assign(opts.opts, { 1080 | hints: false 1081 | }) 1082 | } 1083 | $task.fetch(opts).then( 1084 | (resp) => { 1085 | const { 1086 | statusCode: status, 1087 | statusCode, 1088 | headers, 1089 | body 1090 | } = resp 1091 | callback(null, { 1092 | status, 1093 | statusCode, 1094 | headers, 1095 | body 1096 | }, body) 1097 | }, 1098 | (err) => callback(err) 1099 | ) 1100 | } else if (this.isNode()) { 1101 | this.initGotEnv(opts) 1102 | this.got(opts).on('redirect', (resp, nextOpts) => { 1103 | try { 1104 | if (resp.headers['set-cookie']) { 1105 | const ck = resp.headers['set-cookie'].map(this.cktough.Cookie.parse).toString() 1106 | if (ck) { 1107 | this.ckjar.setCookieSync(ck, null) 1108 | } 1109 | nextOpts.cookieJar = this.ckjar 1110 | } 1111 | } catch (e) { 1112 | this.logErr(e) 1113 | } 1114 | // this.ckjar.setCookieSync(resp.headers['set-cookie'].map(Cookie.parse).toString()) 1115 | }).then( 1116 | (resp) => { 1117 | const { 1118 | statusCode: status, 1119 | statusCode, 1120 | headers, 1121 | body 1122 | } = resp 1123 | callback(null, { 1124 | status, 1125 | statusCode, 1126 | headers, 1127 | body 1128 | }, body) 1129 | }, 1130 | (err) => { 1131 | const { 1132 | message: error, 1133 | response: resp 1134 | } = err 1135 | callback(error, resp, resp && resp.body) 1136 | } 1137 | ) 1138 | } 1139 | } 1140 | 1141 | post(opts, callback = () => { }) { 1142 | // 如果指定了请求体, 但没指定`Content-Type`, 则自动生成 1143 | if (opts.body && opts.headers && !opts.headers['Content-Type']) { 1144 | opts.headers['Content-Type'] = 'application/x-www-form-urlencoded' 1145 | } 1146 | if (opts.headers) delete opts.headers['Content-Length'] 1147 | if (this.isSurge() || this.isLoon()) { 1148 | if (this.isSurge() && this.isNeedRewrite) { 1149 | opts.headers = opts.headers || {} 1150 | Object.assign(opts.headers, { 1151 | 'X-Surge-Skip-Scripting': false 1152 | }) 1153 | } 1154 | $httpClient.post(opts, (err, resp, body) => { 1155 | if (!err && resp) { 1156 | resp.body = body 1157 | resp.statusCode = resp.status 1158 | } 1159 | callback(err, resp, body) 1160 | }) 1161 | } else if (this.isQuanX()) { 1162 | opts.method = 'POST' 1163 | if (this.isNeedRewrite) { 1164 | opts.opts = opts.opts || {} 1165 | Object.assign(opts.opts, { 1166 | hints: false 1167 | }) 1168 | } 1169 | $task.fetch(opts).then( 1170 | (resp) => { 1171 | const { 1172 | statusCode: status, 1173 | statusCode, 1174 | headers, 1175 | body 1176 | } = resp 1177 | callback(null, { 1178 | status, 1179 | statusCode, 1180 | headers, 1181 | body 1182 | }, body) 1183 | }, 1184 | (err) => callback(err) 1185 | ) 1186 | } else if (this.isNode()) { 1187 | this.initGotEnv(opts) 1188 | const { 1189 | url, 1190 | ..._opts 1191 | } = opts 1192 | this.got.post(url, _opts).then( 1193 | (resp) => { 1194 | const { 1195 | statusCode: status, 1196 | statusCode, 1197 | headers, 1198 | body 1199 | } = resp 1200 | callback(null, { 1201 | status, 1202 | statusCode, 1203 | headers, 1204 | body 1205 | }, body) 1206 | }, 1207 | (err) => { 1208 | const { 1209 | message: error, 1210 | response: resp 1211 | } = err 1212 | callback(error, resp, resp && resp.body) 1213 | } 1214 | ) 1215 | } 1216 | } 1217 | 1218 | /** 1219 | * 1220 | * 示例:$.time('yyyy-MM-dd qq HH:mm:ss.S') 1221 | * :$.time('yyyyMMddHHmmssS') 1222 | * y:年 M:月 d:日 q:季 H:时 m:分 s:秒 S:毫秒 1223 | * 其中y可选0-4位占位符、S可选0-1位占位符,其余可选0-2位占位符 1224 | * @param {*} fmt 格式化参数 1225 | * 1226 | */ 1227 | time(fmt) { 1228 | let o = { 1229 | 'M+': new Date().getMonth() + 1, 1230 | 'd+': new Date().getDate(), 1231 | 'H+': new Date().getHours(), 1232 | 'm+': new Date().getMinutes(), 1233 | 's+': new Date().getSeconds(), 1234 | 'q+': Math.floor((new Date().getMonth() + 3) / 3), 1235 | 'S': new Date().getMilliseconds() 1236 | } 1237 | if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (new Date().getFullYear() + '').substr(4 - RegExp.$1.length)) 1238 | for (let k in o) 1239 | if (new RegExp('(' + k + ')').test(fmt)) 1240 | fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)) 1241 | return fmt 1242 | } 1243 | 1244 | /** 1245 | * 系统通知 1246 | * 1247 | * > 通知参数: 同时支持 QuanX 和 Loon 两种格式, EnvJs根据运行环境自动转换, Surge 环境不支持多媒体通知 1248 | * 1249 | * 示例: 1250 | * $.msg(title, subt, desc, 'twitter://') 1251 | * $.msg(title, subt, desc, { 'open-url': 'twitter://', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' }) 1252 | * $.msg(title, subt, desc, { 'open-url': 'https://bing.com', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' }) 1253 | * 1254 | * @param {*} title 标题 1255 | * @param {*} subt 副标题 1256 | * @param {*} desc 通知详情 1257 | * @param {*} opts 通知参数 1258 | * 1259 | */ 1260 | msg(title = name, subt = '', desc = '', opts) { 1261 | const toEnvOpts = (rawopts) => { 1262 | if (!rawopts) return rawopts 1263 | if (typeof rawopts === 'string') { 1264 | if (this.isLoon()) return rawopts 1265 | else if (this.isQuanX()) return { 1266 | 'open-url': rawopts 1267 | } 1268 | else if (this.isSurge()) return { 1269 | url: rawopts 1270 | } 1271 | else return undefined 1272 | } else if (typeof rawopts === 'object') { 1273 | if (this.isLoon()) { 1274 | let openUrl = rawopts.openUrl || rawopts.url || rawopts['open-url'] 1275 | let mediaUrl = rawopts.mediaUrl || rawopts['media-url'] 1276 | return { 1277 | openUrl, 1278 | mediaUrl 1279 | } 1280 | } else if (this.isQuanX()) { 1281 | let openUrl = rawopts['open-url'] || rawopts.url || rawopts.openUrl 1282 | let mediaUrl = rawopts['media-url'] || rawopts.mediaUrl 1283 | return { 1284 | 'open-url': openUrl, 1285 | 'media-url': mediaUrl 1286 | } 1287 | } else if (this.isSurge()) { 1288 | let openUrl = rawopts.url || rawopts.openUrl || rawopts['open-url'] 1289 | return { 1290 | url: openUrl 1291 | } 1292 | } 1293 | } else { 1294 | return undefined 1295 | } 1296 | } 1297 | if (!this.isMute) { 1298 | if (this.isSurge() || this.isLoon()) { 1299 | $notification.post(title, subt, desc, toEnvOpts(opts)) 1300 | } else if (this.isQuanX()) { 1301 | $notify(title, subt, desc, toEnvOpts(opts)) 1302 | } 1303 | } 1304 | if (!this.isMuteLog) { 1305 | let logs = ['', '==============📣系统通知📣=============='] 1306 | logs.push(title) 1307 | subt ? logs.push(subt) : '' 1308 | desc ? logs.push(desc) : '' 1309 | console.log(logs.join('\n')) 1310 | this.logs = this.logs.concat(logs) 1311 | } 1312 | } 1313 | 1314 | log(...logs) { 1315 | if (logs.length > 0) { 1316 | this.logs = [...this.logs, ...logs] 1317 | } 1318 | console.log(logs.join(this.logSeparator)) 1319 | } 1320 | 1321 | logErr(err, msg) { 1322 | const isPrintSack = !this.isSurge() && !this.isQuanX() && !this.isLoon() 1323 | if (!isPrintSack) { 1324 | this.log('', `❗️${this.name}, 错误!`, err) 1325 | } else { 1326 | this.log('', `❗️${this.name}, 错误!`, err.stack) 1327 | } 1328 | } 1329 | 1330 | wait(time) { 1331 | return new Promise((resolve) => setTimeout(resolve, time)) 1332 | } 1333 | 1334 | done(val = {}) { 1335 | const endTime = new Date().getTime() 1336 | const costTime = (endTime - this.startTime) / 1000 1337 | this.log('', `🔔${this.name}, 结束! 🕛 ${costTime} 秒`) 1338 | this.log() 1339 | if (this.isSurge() || this.isQuanX() || this.isLoon()) { 1340 | $done(val) 1341 | } 1342 | } 1343 | })(name, opts) 1344 | } 1345 | -------------------------------------------------------------------------------- /jdhealth_collectProduceScore.js: -------------------------------------------------------------------------------- 1 | const USER_AGENTS = [ 2 | "jdapp;android;11.2.8;;;Mozilla/5.0 (Linux; Android 10; ONEPLUS A5010 Build/QKQ1.191014.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 3 | "jdapp;iPhone;11.2.6;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 4 | "jdapp;android;11.2.5;;;Mozilla/5.0 (Linux; Android 9; Mi Note 3 Build/PKQ1.181007.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/045131 Mobile Safari/537.36", 5 | "jdapp;android;11.2.4;;;Mozilla/5.0 (Linux; Android 10; GM1910 Build/QKQ1.190716.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 6 | "jdapp;android;11.2.2;;;Mozilla/5.0 (Linux; Android 9; 16T Build/PKQ1.190616.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 7 | "jdapp;iPhone;11.2.0;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 8 | "jdapp;iPhone;11.1.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 9 | "jdapp;iPhone;11.1.2;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 10 | "jdapp;iPhone;11.1.0;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 11 | "jdapp;iPhone;11.0.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 12 | "jdapp;iPhone;11.0.2;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 13 | "jdapp;iPhone;11.0.0;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 14 | "jdapp;iPhone;10.5.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 15 | "jdapp;iPhone;10.5.2;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 16 | "jdapp;iPhone;10.5.0;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 17 | "jdapp;android;11.2.8;;;Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 18 | "jdapp;android;11.2.6;;;Mozilla/5.0 (Linux; Android 11; Redmi K30 5G Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045511 Mobile Safari/537.36", 19 | "jdapp;iPhone;11.2.5;;;Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15F79", 20 | "jdapp;android;11.2.4;;;Mozilla/5.0 (Linux; Android 10; M2006J10C Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 21 | "jdapp;android;11.2.2;;;Mozilla/5.0 (Linux; Android 10; M2006J10C Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 22 | "jdapp;android;11.2.0;;;Mozilla/5.0 (Linux; Android 10; ONEPLUS A6000 Build/QKQ1.190716.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045224 Mobile Safari/537.36", 23 | "jdapp;android;11.1.4;;;Mozilla/5.0 (Linux; Android 9; MHA-AL00 Build/HUAWEIMHA-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 24 | "jdapp;android;11.1.2;;;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/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 25 | "jdapp;android;11.1.0;;;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/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 26 | "jdapp;iPhone;11.0.4;;;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", 27 | "jdapp;android;11.0.2;;;Mozilla/5.0 (Linux; Android 10; LYA-AL00 Build/HUAWEILYA-AL00L; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 28 | "jdapp;iPhone;11.0.0;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 29 | "jdapp;iPhone;10.5.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 30 | "jdapp;iPhone;10.5.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", 31 | "jdapp;android;10.5.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/78.0.3904.108 MQQBrowser/6.2 TBS/045131 Mobile Safari/537.36", 32 | "jdapp;android;11.2.8;;;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/76.0.3809.89 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36", 33 | "jdapp;iPhone;11.2.5;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 34 | "jdapp;iPhone;11.2.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 35 | "jdapp;android;11.2.2;;;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/76.0.3809.89 MQQBrowser/6.2 TBS/045513 Mobile Safari/537.36", 36 | "jdapp;android;11.2.0;;;Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36", 37 | "jdapp;iPhone;11.1.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 38 | "jdapp;android;11.0.1;;;Mozilla/5.0 (Linux; Android 10; ONEPLUS A5010 Build/QKQ1.191014.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 39 | "jdapp;iPhone;11.1.2;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 40 | "jdapp;android;11.1.0;;;Mozilla/5.0 (Linux; Android 10; Mi Note 5 Build/PKQ1.181007.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/045131 Mobile Safari/537.36", 41 | "jdapp;android;11.0.4;;;Mozilla/5.0 (Linux; Android 11; LIO-AN00 Build/HUAWEILIO-AN00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 42 | "jdapp;android;11.0.2;;;Mozilla/5.0 (Linux; Android 10; SKW-A0 Build/SKYW2001202CN00MQ0; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 43 | "jdapp;iPhone;11.0.0;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 44 | "jdapp;iPhone;10.5.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 45 | "jdapp;iPhone;10.5.2;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 46 | "jdapp;iPhone;10.5.0;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 47 | "jdapp;iPhone;11.2.8;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 48 | "jdapp;iPhone;11.2.5;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 49 | "jdapp;iPhone;11.2.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 50 | "jdapp;iPhone;11.2.2;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 51 | "jdapp;iPhone;11.2.0;;;Mozilla/5.0 (iPhone; CPU iPhone OS 13_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 52 | "jdapp;iPhone;11.1.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 53 | "jdapp;android;11.1.2;;;Mozilla/5.0 (Linux; Android 9; MI 6 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 54 | "jdapp;android;11.1.0;;;Mozilla/5.0 (Linux; Android 12; Redmi K30 5G Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045511 Mobile Safari/537.36", 55 | "jdapp;iPhone;11.0.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15F79", 56 | "jdapp;android;11.0.2;;;Mozilla/5.0 (Linux; Android 10; M2006J10C Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 57 | "jdapp;android;11.0.0;;;Mozilla/5.0 (Linux; Android 12; HWI-AL00 Build/HUAWEIHWI-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 58 | "jdapp;android;10.5.4;;;Mozilla/5.0 (Linux; Android 10; ANE-AL00 Build/HUAWEIANE-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045224 Mobile Safari/537.36", 59 | "jdapp;android;10.5.2;;;Mozilla/5.0 (Linux; Android 9; ELE-AL00 Build/HUAWEIELE-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 60 | "jdapp;android;10.5.0;;;Mozilla/5.0 (Linux; Android 10; LIO-AL00 Build/HUAWEILIO-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 61 | "jdapp;android;11.2.8;;;Mozilla/5.0 (Linux; Android 10; SM-G9750 Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.108 MQQBrowser/6.2 TBS/044942 Mobile Safari/537.36", 62 | "jdapp;iPhone;11.2.5;;;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", 63 | "jdapp;android;11.2.4;;;Mozilla/5.0 (Linux; Android 12; EVR-AL00 Build/HUAWEIEVR-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045230 Mobile Safari/537.36", 64 | "jdapp;iPhone;11.2.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", 65 | "jdapp;iPhone;11.2.0;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 66 | "jdapp;iPhone;11.1.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 67 | "jdapp;android;11.1.2;;;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/78.0.3904.108 MQQBrowser/6.2 TBS/045131 Mobile Safari/537.36", 68 | "jdapp;android;11.1.0;;;Mozilla/5.0 (Linux; Android 9; HLK-AL00 Build/HONORHLK-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36", 69 | "jdapp;iPhone;11.0.4;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 70 | "jdapp;iPhone;11.0.2;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 71 | "jdapp;android;11.0.0;;;Mozilla/5.0 (Linux; Android 10; LYA-AL10 Build/HUAWEILYA-AL10; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045513 Mobile Safari/537.36", 72 | "jdapp;android;10.5.4;;;Mozilla/5.0 (Linux; Android 10; MI 9 Build/QKQ1.190825.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 MQQBrowser/6.2 TBS/045227 Mobile Safari/537.36", 73 | "jdapp;iPhone;10.5.2;;;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 74 | ] 75 | /** 76 | * 生成随机数字 77 | * @param {number} min 最小值(包含) 78 | * @param {number} max 最大值(不包含) 79 | */ 80 | function randomNumber(min = 0, max = 80) { 81 | return Math.min(Math.floor(min + Math.random() * (max - min)), max); 82 | } 83 | const USER_AGENT = USER_AGENTS[randomNumber(0, USER_AGENTS.length)]; 84 | 85 | function UARAM() { 86 | return USER_AGENTS[randomNumber(0, USER_AGENTS.length)]; 87 | } 88 | 89 | 90 | const $ = new Env("东东健康社区收集能量收集"); 91 | let cookiesArr = [], 92 | message; 93 | 94 | const JD_API_HOST = "https://api.m.jd.com/"; 95 | !(async () => { 96 | cookiesArr[0] = process.env.APP_COOKIE 97 | if (!cookiesArr[0]) { 98 | $.msg( 99 | $.name, 100 | "【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取", 101 | "https://bean.m.jd.com/", 102 | { "open-url": "https://bean.m.jd.com/" } 103 | ); 104 | return; 105 | } 106 | for (let i = 0; i < cookiesArr.length; i++) { 107 | if (cookiesArr[i]) { 108 | cookie = cookiesArr[i]; 109 | $.UserName = decodeURIComponent( 110 | cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1] 111 | ); 112 | $.index = i + 1; 113 | message = ""; 114 | console.log(`\n******开始【京东账号${$.index}】${$.UserName}*********\n`); 115 | await collectScore(); 116 | } 117 | } 118 | })() 119 | .catch((e) => { 120 | $.log("", `❌ ${$.name}, 失败! 原因: ${e}!`, ""); 121 | }) 122 | .finally(() => { 123 | $.done(); 124 | }); 125 | 126 | function collectScore() { 127 | return new Promise(async (resolve) => { 128 | $.post(taskUrl("jdhealth_collectProduceScore", {}), async (err, resp, data) => { 129 | try { 130 | if (safeGet(data)) { 131 | data = $.toObj(data); 132 | if (data?.data?.bizCode === 0) { 133 | if (data?.data?.result?.produceScore) 134 | console.log( 135 | `任务完成成功,获得:${ 136 | data?.data?.result?.produceScore ?? "未知" 137 | }能量` 138 | ); 139 | else 140 | console.log( 141 | `任务领取结果:${data?.data?.bizMsg ?? JSON.stringify(data)}` 142 | ); 143 | } else { 144 | console.log(`任务完成失败:${data?.data?.bizMsg ?? JSON.stringify(data)}`); 145 | } 146 | } 147 | } catch (e) { 148 | console.log(e); 149 | } finally { 150 | resolve(); 151 | } 152 | }); 153 | }); 154 | } 155 | 156 | function taskUrl(function_id, body = {}) { 157 | return { 158 | url: `${JD_API_HOST}/client.action`, 159 | body: `functionId=${function_id}&body={}&client=wh5&clientVersion=1.0.0&uuid=`, 160 | headers: { 161 | Cookie: cookie, 162 | origin: "https://h5.m.jd.com", 163 | referer: "https://h5.m.jd.com/", 164 | "Content-Type": "application/x-www-form-urlencoded", 165 | "User-Agent": $.isNode() ? USER_AGENT : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1", 166 | }, 167 | }; 168 | } 169 | 170 | function safeGet(data) { 171 | try { 172 | if (typeof JSON.parse(data) == "object") { 173 | return true; 174 | } 175 | } catch (e) { 176 | console.log(e); 177 | console.log(`京东服务器访问数据为空,请检查自身设备网络情况`); 178 | return false; 179 | } 180 | } 181 | 182 | // prettier-ignore 183 | 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)} 184 | -------------------------------------------------------------------------------- /node_module/Dev.md: -------------------------------------------------------------------------------- 1 | # 开发须知 2 | ## 需要安装Node js 3 | https://baidu.com 4 | ## 切换 npm 源 5 | `npm config set registry https://registry.npm.taobao.org/` 6 | 7 | # 需要执行 8 | `npm install` 9 | # 运行 10 | `node file.js` 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "app_scripts", 3 | "author": "killall-love", 4 | "license": "killall-love", 5 | "dependencies": { 6 | "axios": "^1.4.0", 7 | "cookie": "^0.5.0", 8 | "crypto": "^1.0.1", 9 | "crypto-js": "^4.0.0", 10 | "date-fns": "^2.30.0", 11 | "dotenv": "^16.3.1", 12 | "download": "^8.0.0", 13 | "got": "^11.5.1", 14 | "http-server": "^0.12.3", 15 | "jsdom": "^22.1.0", 16 | "jsdom-browser.screen": "^0.2.2", 17 | "md5": "^2.3.0", 18 | "moment": "^2.29.4", 19 | "nodemailer": "^6.9.4", 20 | "png-js": "^1.0.0", 21 | "qrcode-terminal": "^0.12.0", 22 | "request": "^2.88.2", 23 | "tough-cookie": "^4.1.3", 24 | "ts-md5": "^1.3.1", 25 | "tslib": "^2.6.1", 26 | "tunnel": "^0.0.6", 27 | "ws": "^7.4.3", 28 | "xhr2": "^0.2.1" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /scripts/config.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "name": "东东农场", 4 | "file": "dongdongFarm", 5 | "version": "2", 6 | "cron": "0 15 10 ? * * ", 7 | "scope": "com.jingdong.app.mall" 8 | }, 9 | { 10 | "name": "东东健康社区一键领取(快捷)", 11 | "file": "jdhealth_collectProduceScore", 12 | "version": "1", 13 | "cron": "0 15 10 ? * * ", 14 | "scope": "com.jingdong.app.mall" 15 | }, 16 | { 17 | "name": "京豆详情统计", 18 | "file": "jd_bean_info", 19 | "version": "1", 20 | "cron": "0 15 10 ? * * ", 21 | "scope": "com.jingdong.app.mall" 22 | }, 23 | { 24 | "name": "京东试用", 25 | "file": "jd_try", 26 | "version": "1", 27 | "cron": "0 15 10 ? * * ", 28 | "scope": "com.jingdong.app.mall" 29 | }, 30 | { 31 | "name": "京东评价", 32 | "file": "jd_comment", 33 | "version": "1", 34 | "cron": "0 15 10 ? * * ", 35 | "scope": "com.jingdong.app.mall" 36 | }, 37 | { 38 | "name": "习酒", 39 | "file": "xj", 40 | "version": "1", 41 | "cron": "0 */2 * * * *", 42 | "env": [ 43 | { 44 | "envName": "xjhd", 45 | "envHint": "习酒Token多个用@隔开" 46 | } 47 | ], 48 | "scope": "" 49 | }, 50 | { 51 | "name": "测试脚本", 52 | "file": "dongdongFarm2", 53 | "version": "2", 54 | "cron": "0 15 10 ? * * ", 55 | "env": [ 56 | { 57 | "envName": "JD_KEY_CK", 58 | "envHint": "测试变量" 59 | }, 60 | { 61 | "envName": "JD_KEY_CK2", 62 | "envHint": "测试变量2" 63 | } 64 | ], 65 | "scope": "com.jingdong.app.mall" 66 | }, 67 | { 68 | "name": "感谢你们", 69 | "file": "thank", 70 | "version": "4", 71 | "cron": "0 15 10 ? * * ", 72 | "scope": "" 73 | }, 74 | { 75 | "name": "饿了么吃货豆", 76 | "file": "ele", 77 | "version": "5", 78 | "cron": "0 15 10 ? * * ", 79 | "scope": "me.ele", 80 | "env": [ 81 | { 82 | "envName": "elmGrabCoupon", 83 | "envHint": "是否自动抢卷需要 9 点 59 运行脚本 1抢卷 0不抢 单纯跑脚本请写0" 84 | } 85 | ] 86 | }, 87 | { 88 | "name": "美团Leaf 3.15", 89 | "file": "meituanV3", 90 | "version": "15", 91 | "cron": "0 15 10 ? * * ", 92 | "scope": "com.sankuai.meituan", 93 | "env": [ 94 | { 95 | "envName": "MEITUAN_UUID", 96 | "envHint": "输入UUID" 97 | } 98 | ] 99 | }, 100 | { 101 | "name": "美团抢券25-12", 102 | "file": "mt_coupons", 103 | "version": "3", 104 | "cron": "58 59 10 ? * * ", 105 | "scope": "com.sankuai.meituan", 106 | "env": [ 107 | { 108 | "envName": "TEST_MT_TIME", 109 | "envHint": "0开启测试 1关闭测试 不填默认关闭" 110 | }, 111 | { 112 | "envName": "MT_COOKIES", 113 | "envHint": "留空则采用App内置Cookie,可自己填入网页Cookie" 114 | } 115 | ] 116 | }, 117 | { 118 | "name": "美团抢券30-15 (临时--新增三张)", 119 | "file": "mt3015", 120 | "version": "5", 121 | "cron": "58 59 10 ? * * ", 122 | "scope": "com.sankuai.meituan", 123 | "env": [ 124 | { 125 | "envName": "MT_COOKIES", 126 | "envHint": "留空则采用App内置Cookie,可自己填入网页Cookie" 127 | } 128 | ] 129 | },{ 130 | "name": "美团测试抢券", 131 | "file": "mt_test", 132 | "version": "2", 133 | "cron": "58 59 10 ? * * ", 134 | "scope": "com.sankuai.meituan", 135 | "env": [ 136 | { 137 | "envName": "MT_COOKIES", 138 | "envHint": "留空则采用App内置Cookie,可自己填入网页Cookie" 139 | }, 140 | { 141 | "envName": "MT_TEST_URL", 142 | "envHint": "输入MT抢券链接" 143 | } 144 | ] 145 | }, 146 | { 147 | "name": "渤海宣传员", 148 | "file": "bhxcy", 149 | "version": "1", 150 | "cron": "0 15 10 ? * * ", 151 | "scope": "", 152 | "env": [ 153 | { 154 | "envName": "bhxcytoken", 155 | "envHint": "小程序里的uid和token例如:uid=1234567&token=qweqwertyuio" 156 | } 157 | ] 158 | } 159 | ] 160 | -------------------------------------------------------------------------------- /sendNotify.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @Last Modified time: 2021-5-1 15:00:54 3 | * sendNotify 推送通知功能 4 | * @param text 通知头 5 | * @param desp 通知体 6 | * @param params 某些推送通知方式点击弹窗可跳转, 例:{ url: 'https://abc.com' } 7 | * @param author 作者仓库等信息 例:`本脚本免费使用 By:xxx` 8 | * @returns {Promise} 9 | */ 10 | 11 | const querystring = require('querystring'); 12 | const $ = new Env(); 13 | const timeout = 15000; //超时时间(单位毫秒) 14 | // =======================================go-cqhttp通知设置区域=========================================== 15 | //gobot_url 填写请求地址http://127.0.0.1/send_private_msg 16 | //gobot_token 填写在go-cqhttp文件设置的访问密钥 17 | //gobot_qq 填写推送到个人QQ或者QQ群号 18 | //go-cqhttp相关API https://docs.go-cqhttp.org/api 19 | let GOBOT_URL = ''; // 推送到个人QQ: http://127.0.0.1/send_private_msg 群:http://127.0.0.1/send_group_msg 20 | let GOBOT_TOKEN = ''; //访问密钥 21 | let GOBOT_QQ = ''; // 如果GOBOT_URL设置 /send_private_msg 则需要填入 user_id=个人QQ 相反如果是 /send_group_msg 则需要填入 group_id=QQ群 22 | 23 | // =======================================微信server酱通知设置区域=========================================== 24 | //此处填你申请的SCKEY. 25 | //(环境变量名 PUSH_KEY) 26 | let SCKEY = ''; 27 | 28 | // =======================================Bark App通知设置区域=========================================== 29 | //此处填你BarkAPP的信息(IP/设备码,例如:https://api.day.app/XXXXXXXX) 30 | let BARK_PUSH = ''; 31 | //BARK app推送铃声,铃声列表去APP查看复制填写 32 | let BARK_SOUND = ''; 33 | //BARK app推送消息的分组, 默认为"QingLong" 34 | let BARK_GROUP = 'jd_scripts'; 35 | 36 | // =======================================telegram机器人通知设置区域=========================================== 37 | //此处填你telegram bot 的Token,telegram机器人通知推送必填项.例如:1077xxx4424:AAFjv0FcqxxxxxxgEMGfi22B4yh15R5uw 38 | //(环境变量名 TG_BOT_TOKEN) 39 | let TG_BOT_TOKEN = ''; 40 | //此处填你接收通知消息的telegram用户的id,telegram机器人通知推送必填项.例如:129xxx206 41 | //(环境变量名 TG_USER_ID) 42 | let TG_USER_ID = ''; 43 | //tg推送HTTP代理设置(不懂可忽略,telegram机器人通知推送功能中非必填) 44 | let TG_PROXY_HOST = ''; //例如:127.0.0.1(环境变量名:TG_PROXY_HOST) 45 | let TG_PROXY_PORT = ''; //例如:1080(环境变量名:TG_PROXY_PORT) 46 | let TG_PROXY_AUTH = ''; //tg代理配置认证参数 47 | //Telegram api自建的反向代理地址(不懂可忽略,telegram机器人通知推送功能中非必填),默认tg官方api(环境变量名:TG_API_HOST) 48 | let TG_API_HOST = 'api.telegram.org'; 49 | // =======================================钉钉机器人通知设置区域=========================================== 50 | //此处填你钉钉 bot 的webhook,例如:5a544165465465645d0f31dca676e7bd07415asdasd 51 | //(环境变量名 DD_BOT_TOKEN) 52 | let DD_BOT_TOKEN = ''; 53 | //密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的字符串 54 | let DD_BOT_SECRET = ''; 55 | 56 | // =======================================企业微信机器人通知设置区域=========================================== 57 | //此处填你企业微信机器人的 webhook(详见文档 https://work.weixin.qq.com/api/doc/90000/90136/91770),例如:693a91f6-7xxx-4bc4-97a0-0ec2sifa5aaa 58 | //(环境变量名 QYWX_KEY) 59 | let QYWX_KEY = ''; 60 | 61 | // =======================================企业微信应用消息通知设置区域=========================================== 62 | /* 63 | 此处填你企业微信应用消息的值(详见文档 https://work.weixin.qq.com/api/doc/90000/90135/90236) 64 | 环境变量名 QYWX_AM依次填入 corpid,corpsecret,touser(注:多个成员ID使用|隔开),agentid,消息类型(选填,不填默认文本消息类型) 65 | 注意用,号隔开(英文输入法的逗号),例如:wwcff56746d9adwers,B-791548lnzXBE6_BWfxdf3kSTMJr9vFEPKAbh6WERQ,mingcheng,1000001,2COXgjH2UIfERF2zxrtUOKgQ9XklUqMdGSWLBoW_lSDAdafat 66 | 可选推送消息类型(推荐使用图文消息(mpnews)): 67 | - 文本卡片消息: 0 (数字零) 68 | - 文本消息: 1 (数字一) 69 | - 图文消息(mpnews): 素材库图片id, 可查看此教程(http://note.youdao.com/s/HMiudGkb)或者(https://note.youdao.com/ynoteshare1/index.html?id=1a0c8aff284ad28cbd011b29b3ad0191&type=note) 70 | */ 71 | let QYWX_AM = ''; 72 | 73 | // =======================================iGot聚合推送通知设置区域=========================================== 74 | //此处填您iGot的信息(推送key,例如:https://push.hellyw.com/XXXXXXXX) 75 | let IGOT_PUSH_KEY = ''; 76 | 77 | // =======================================push+设置区域======================================= 78 | //官方文档:http://www.pushplus.plus/ 79 | //PUSH_PLUS_TOKEN:微信扫码登录后一对一推送或一对多推送下面的token(您的Token),不提供PUSH_PLUS_USER则默认为一对一推送 80 | //PUSH_PLUS_USER: 一对多推送的“群组编码”(一对多推送下面->您的群组(如无则新建)->群组编码,如果您是创建群组人。也需点击“查看二维码”扫描绑定,否则不能接受群组消息推送) 81 | let PUSH_PLUS_TOKEN = ''; 82 | let PUSH_PLUS_USER = ''; 83 | 84 | //==========================云端环境变量的判断与接收========================= 85 | if (process.env.GOBOT_URL) { 86 | GOBOT_URL = process.env.GOBOT_URL; 87 | } 88 | if (process.env.GOBOT_TOKEN) { 89 | GOBOT_TOKEN = process.env.GOBOT_TOKEN; 90 | } 91 | if (process.env.GOBOT_QQ) { 92 | GOBOT_QQ = process.env.GOBOT_QQ; 93 | } 94 | 95 | if (process.env.PUSH_KEY) { 96 | SCKEY = process.env.PUSH_KEY; 97 | } 98 | 99 | if (process.env.QQ_SKEY) { 100 | QQ_SKEY = process.env.QQ_SKEY; 101 | } 102 | 103 | if (process.env.QQ_MODE) { 104 | QQ_MODE = process.env.QQ_MODE; 105 | } 106 | 107 | if (process.env.BARK_PUSH) { 108 | if (process.env.BARK_PUSH.indexOf('https') > -1 || process.env.BARK_PUSH.indexOf('http') > -1) { 109 | //兼容BARK自建用户 110 | BARK_PUSH = process.env.BARK_PUSH; 111 | } else { 112 | BARK_PUSH = `https://api.day.app/${process.env.BARK_PUSH}`; 113 | } 114 | if (process.env.BARK_SOUND) { 115 | BARK_SOUND = process.env.BARK_SOUND; 116 | } 117 | if (process.env.BARK_GROUP) { 118 | BARK_GROUP = process.env.BARK_GROUP; 119 | } 120 | } else { 121 | if (BARK_PUSH && BARK_PUSH.indexOf('https') === -1 && BARK_PUSH.indexOf('http') === -1) { 122 | //兼容BARK本地用户只填写设备码的情况 123 | BARK_PUSH = `https://api.day.app/${BARK_PUSH}`; 124 | } 125 | } 126 | if (process.env.TG_BOT_TOKEN) { 127 | TG_BOT_TOKEN = process.env.TG_BOT_TOKEN; 128 | } 129 | if (process.env.TG_USER_ID) { 130 | TG_USER_ID = process.env.TG_USER_ID; 131 | } 132 | if (process.env.TG_PROXY_AUTH) TG_PROXY_AUTH = process.env.TG_PROXY_AUTH; 133 | if (process.env.TG_PROXY_HOST) TG_PROXY_HOST = process.env.TG_PROXY_HOST; 134 | if (process.env.TG_PROXY_PORT) TG_PROXY_PORT = process.env.TG_PROXY_PORT; 135 | if (process.env.TG_API_HOST) TG_API_HOST = process.env.TG_API_HOST; 136 | 137 | if (process.env.DD_BOT_TOKEN) { 138 | DD_BOT_TOKEN = process.env.DD_BOT_TOKEN; 139 | if (process.env.DD_BOT_SECRET) { 140 | DD_BOT_SECRET = process.env.DD_BOT_SECRET; 141 | } 142 | } 143 | 144 | if (process.env.QYWX_KEY) { 145 | QYWX_KEY = process.env.QYWX_KEY; 146 | } 147 | 148 | if (process.env.QYWX_AM) { 149 | QYWX_AM = process.env.QYWX_AM; 150 | } 151 | 152 | if (process.env.IGOT_PUSH_KEY) { 153 | IGOT_PUSH_KEY = process.env.IGOT_PUSH_KEY; 154 | } 155 | 156 | if (process.env.PUSH_PLUS_TOKEN) { 157 | PUSH_PLUS_TOKEN = process.env.PUSH_PLUS_TOKEN; 158 | } 159 | if (process.env.PUSH_PLUS_USER) { 160 | PUSH_PLUS_USER = process.env.PUSH_PLUS_USER; 161 | } 162 | //==========================云端环境变量的判断与接收========================= 163 | 164 | /** 165 | * sendNotify 推送通知功能 166 | * @param text 通知头 167 | * @param desp 通知体 168 | * @param params 某些推送通知方式点击弹窗可跳转, 例:{ url: 'https://abc.com' } 169 | * @param author 作者仓库等信息 例:`本脚本免费使用 By:xxxx` 170 | * @returns {Promise} 171 | */ 172 | async function sendNotify(text, desp, params = {TG交流群:'https://t.me/Luobook666'}, author = 'Luobook') { 173 | //提供6种通知 174 | desp += '\n\nTG群组:\nhttps://t.me/Luobook666\n公众号:Luobook科技社';//增加作者信息,防止被贩卖等 175 | await Promise.all([ 176 | serverNotify(text, desp), //微信server酱 177 | pushPlusNotify(text, desp) //pushplus(推送加) 178 | ]) 179 | //由于上述两种微信通知需点击进去才能查看到详情,故text(标题内容)携带了账号序号以及昵称信息,方便不点击也可知道是哪个京东哪个活动 180 | text = text.match(/.*?(?=\s?-)/g) ? text.match(/.*?(?=\s?-)/g)[0] : text; 181 | await Promise.all([ 182 | BarkNotify(text, desp, params), //iOS Bark APP 183 | tgBotNotify(text, desp), //telegram 机器人 184 | ddBotNotify(text, desp), //钉钉机器人 185 | qywxBotNotify(text, desp), //企业微信机器人 186 | qywxamNotify(text, desp), //企业微信应用消息推送 187 | iGotNotify(text, desp, params), //iGot 188 | gobotNotify(text, desp),//go-cqhttp 189 | ]); 190 | } 191 | 192 | function gobotNotify(text, desp, time = 2100) { 193 | return new Promise((resolve) => { 194 | if (GOBOT_URL) { 195 | const options = { 196 | url: `${GOBOT_URL}?access_token=${GOBOT_TOKEN}&${GOBOT_QQ}`, 197 | json: { message: `${text}\n${desp}` }, 198 | headers: { 199 | 'Content-Type': 'application/json', 200 | }, 201 | timeout, 202 | }; 203 | setTimeout(() => { 204 | $.post(options, (err, resp, data) => { 205 | try { 206 | if (err) { 207 | console.log('发送go-cqhttp通知调用API失败!!\n'); 208 | console.log(err); 209 | } else { 210 | data = JSON.parse(data); 211 | if (data.retcode === 0) { 212 | console.log('go-cqhttp发送通知消息成功🎉\n'); 213 | } else if (data.retcode === 100) { 214 | console.log(`go-cqhttp发送通知消息异常: ${data.errmsg}\n`); 215 | } else { 216 | console.log( 217 | `go-cqhttp发送通知消息异常\n${JSON.stringify(data)}`, 218 | ); 219 | } 220 | } 221 | } catch (e) { 222 | $.logErr(e, resp); 223 | } finally { 224 | resolve(data); 225 | } 226 | }); 227 | }, time); 228 | } else { 229 | console.log('您未提供GOBOT的GOBOT_URL和GOBOT_TOKEN和GOBOT_QQ,取消GOBOT推送消息通知🚫\n'); 230 | resolve(); 231 | } 232 | }); 233 | } 234 | 235 | function serverNotify(text, desp, time = 2100) { 236 | return new Promise(resolve => { 237 | if (SCKEY) { 238 | //微信server酱推送通知一个\n不会换行,需要两个\n才能换行,故做此替换 239 | desp = desp.replace(/[\n\r]/g, '\n\n'); 240 | const options = { 241 | url: SCKEY.includes('SCT') ? `https://sctapi.ftqq.com/${SCKEY}.send` : `https://sc.ftqq.com/${SCKEY}.send`, 242 | body: `text=${text}&desp=${desp}`, 243 | headers: { 244 | 'Content-Type': 'application/x-www-form-urlencoded' 245 | }, 246 | timeout 247 | } 248 | setTimeout(() => { 249 | $.post(options, (err, resp, data) => { 250 | try { 251 | if (err) { 252 | console.log('发送通知调用API失败!!\n') 253 | console.log(err); 254 | } else { 255 | data = JSON.parse(data); 256 | //server酱和Server酱·Turbo版的返回json格式不太一样 257 | if (data.errno === 0 || data.data.errno === 0) { 258 | console.log('server酱发送通知消息成功🎉\n') 259 | } else if (data.errno === 1024) { 260 | // 一分钟内发送相同的内容会触发 261 | console.log(`server酱发送通知消息异常: ${data.errmsg}\n`) 262 | } else { 263 | console.log(`server酱发送通知消息异常\n${JSON.stringify(data)}`) 264 | } 265 | } 266 | } catch (e) { 267 | $.logErr(e, resp); 268 | } finally { 269 | resolve(data); 270 | } 271 | }) 272 | }, time) 273 | } else { 274 | console.log('\n\n您未提供server酱的SCKEY,取消微信推送消息通知🚫\n'); 275 | resolve() 276 | } 277 | }) 278 | } 279 | 280 | function CoolPush(text, desp) { 281 | return new Promise(resolve => { 282 | if (QQ_SKEY) { 283 | let options = { 284 | url: `https://push.xuthus.cc/${QQ_MODE}/${QQ_SKEY}`, 285 | headers: { 286 | 'Content-Type': 'application/json' 287 | } 288 | } 289 | 290 | // 已知敏感词 291 | text = text.replace(/京豆/g, "豆豆"); 292 | desp = desp.replace(/京豆/g, ""); 293 | desp = desp.replace(/🐶/g, ""); 294 | desp = desp.replace(/红包/g, "H包"); 295 | 296 | switch (QQ_MODE) { 297 | case "email": 298 | options.json = { 299 | "t": text, 300 | "c": desp, 301 | }; 302 | break; 303 | default: 304 | options.body = `${text}\n\n${desp}`; 305 | } 306 | 307 | let pushMode = function (t) { 308 | switch (t) { 309 | case "send": 310 | return "个人"; 311 | case "group": 312 | return "QQ群"; 313 | case "wx": 314 | return "微信"; 315 | case "ww": 316 | return "企业微信"; 317 | case "email": 318 | return "邮件"; 319 | default: 320 | return "未知方式" 321 | } 322 | } 323 | 324 | $.post(options, (err, resp, data) => { 325 | try { 326 | if (err) { 327 | console.log(`发送${pushMode(QQ_MODE)}通知调用API失败!!\n`) 328 | console.log(err); 329 | } else { 330 | data = JSON.parse(data); 331 | if (data.code === 200) { 332 | console.log(`酷推发送${pushMode(QQ_MODE)}通知消息成功🎉\n`) 333 | } else if (data.code === 400) { 334 | console.log(`QQ酷推(Cool Push)发送${pushMode(QQ_MODE)}推送失败:${data.msg}\n`) 335 | } else if (data.code === 503) { 336 | console.log(`QQ酷推出错,${data.message}:${data.data}\n`) 337 | } else { 338 | console.log(`酷推推送异常: ${JSON.stringify(data)}`); 339 | } 340 | } 341 | } catch (e) { 342 | $.logErr(e, resp); 343 | } finally { 344 | resolve(data); 345 | } 346 | }) 347 | } else { 348 | console.log('您未提供酷推的SKEY,取消QQ推送消息通知🚫\n'); 349 | resolve() 350 | } 351 | }) 352 | } 353 | 354 | function BarkNotify(text, desp, params = {}) { 355 | return new Promise(resolve => { 356 | if (BARK_PUSH) { 357 | const index = BARK_PUSH.lastIndexOf('/') + 1 358 | const url = BARK_PUSH.substr(0,index)+"push" 359 | const device_key = BARK_PUSH.substr(index) 360 | const options = { 361 | url, 362 | json:{ 363 | device_key, 364 | title: text, 365 | body:desp, 366 | sound:BARK_SOUND, 367 | group:BARK_GROUP, 368 | }, 369 | headers: { 370 | 'Content-Type': 'application/json; charset=utf-8' 371 | }, 372 | timeout 373 | } 374 | $.post(options, (err, resp, data) => { 375 | try { 376 | if (err) { 377 | console.log('Bark APP发送通知调用API失败!!\n') 378 | console.log(err); 379 | } else { 380 | data = JSON.parse(data); 381 | if (data.code === 200) { 382 | console.log('Bark APP发送通知消息成功🎉\n') 383 | } else { 384 | console.log(`${data.message}\n`); 385 | } 386 | } 387 | } catch (e) { 388 | $.logErr(e, resp); 389 | } finally { 390 | resolve(); 391 | } 392 | }) 393 | } else { 394 | console.log('您未提供Bark的APP推送BARK_PUSH,取消Bark推送消息通知🚫\n'); 395 | resolve() 396 | } 397 | }) 398 | } 399 | 400 | function tgBotNotify(text, desp) { 401 | return new Promise(resolve => { 402 | if (TG_BOT_TOKEN && TG_USER_ID) { 403 | const options = { 404 | url: `https://${TG_API_HOST}/bot${TG_BOT_TOKEN}/sendMessage`, 405 | body: `chat_id=${TG_USER_ID}&text=${text}\n\n${desp}&disable_web_page_preview=true`, 406 | headers: { 407 | 'Content-Type': 'application/x-www-form-urlencoded' 408 | }, 409 | timeout 410 | } 411 | if (TG_PROXY_HOST && TG_PROXY_PORT) { 412 | const tunnel = require("tunnel"); 413 | const agent = { 414 | https: tunnel.httpsOverHttp({ 415 | proxy: { 416 | host: TG_PROXY_HOST, 417 | port: TG_PROXY_PORT * 1, 418 | proxyAuth: TG_PROXY_AUTH 419 | } 420 | }) 421 | } 422 | Object.assign(options, { agent }) 423 | } 424 | $.post(options, (err, resp, data) => { 425 | try { 426 | if (err) { 427 | console.log('telegram发送通知消息失败!!\n') 428 | console.log(err); 429 | } else { 430 | data = JSON.parse(data); 431 | if (data.ok) { 432 | console.log('Telegram发送通知消息成功🎉。\n') 433 | } else if (data.error_code === 400) { 434 | console.log('请主动给bot发送一条消息并检查接收用户ID是否正确。\n') 435 | } else if (data.error_code === 401) { 436 | console.log('Telegram bot token 填写错误。\n') 437 | } 438 | } 439 | } catch (e) { 440 | $.logErr(e, resp); 441 | } finally { 442 | resolve(data); 443 | } 444 | }) 445 | } else { 446 | console.log('您未提供telegram机器人推送所需的TG_BOT_TOKEN和TG_USER_ID,取消telegram推送消息通知🚫\n'); 447 | resolve() 448 | } 449 | }) 450 | } 451 | function ddBotNotify(text, desp) { 452 | return new Promise(resolve => { 453 | const options = { 454 | url: `https://oapi.dingtalk.com/robot/send?access_token=${DD_BOT_TOKEN}`, 455 | json: { 456 | "msgtype": "text", 457 | "text": { 458 | "content": ` ${text}\n\n${desp}` 459 | } 460 | }, 461 | headers: { 462 | 'Content-Type': 'application/json' 463 | }, 464 | timeout 465 | } 466 | if (DD_BOT_TOKEN && DD_BOT_SECRET) { 467 | const crypto = require('crypto'); 468 | const dateNow = Date.now(); 469 | const hmac = crypto.createHmac('sha256', DD_BOT_SECRET); 470 | hmac.update(`${dateNow}\n${DD_BOT_SECRET}`); 471 | const result = encodeURIComponent(hmac.digest('base64')); 472 | options.url = `${options.url}×tamp=${dateNow}&sign=${result}`; 473 | $.post(options, (err, resp, data) => { 474 | try { 475 | if (err) { 476 | console.log('钉钉发送通知消息失败!!\n') 477 | console.log(err); 478 | } else { 479 | data = JSON.parse(data); 480 | if (data.errcode === 0) { 481 | console.log('钉钉发送通知消息成功🎉。\n') 482 | } else { 483 | console.log(`${data.errmsg}\n`) 484 | } 485 | } 486 | } catch (e) { 487 | $.logErr(e, resp); 488 | } finally { 489 | resolve(data); 490 | } 491 | }) 492 | } else if (DD_BOT_TOKEN) { 493 | $.post(options, (err, resp, data) => { 494 | try { 495 | if (err) { 496 | console.log('钉钉发送通知消息失败!!\n') 497 | console.log(err); 498 | } else { 499 | data = JSON.parse(data); 500 | if (data.errcode === 0) { 501 | console.log('钉钉发送通知消息完成。\n') 502 | } else { 503 | console.log(`${data.errmsg}\n`) 504 | } 505 | } 506 | } catch (e) { 507 | $.logErr(e, resp); 508 | } finally { 509 | resolve(data); 510 | } 511 | }) 512 | } else { 513 | console.log('您未提供钉钉机器人推送所需的DD_BOT_TOKEN或者DD_BOT_SECRET,取消钉钉推送消息通知🚫\n'); 514 | resolve() 515 | } 516 | }) 517 | } 518 | 519 | function qywxBotNotify(text, desp) { 520 | return new Promise(resolve => { 521 | const options = { 522 | url: `https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${QYWX_KEY}`, 523 | json: { 524 | msgtype: 'text', 525 | text: { 526 | content: ` ${text}\n\n${desp}`, 527 | }, 528 | }, 529 | headers: { 530 | 'Content-Type': 'application/json', 531 | }, 532 | timeout 533 | }; 534 | if (QYWX_KEY) { 535 | $.post(options, (err, resp, data) => { 536 | try { 537 | if (err) { 538 | console.log('企业微信发送通知消息失败!!\n'); 539 | console.log(err); 540 | } else { 541 | data = JSON.parse(data); 542 | if (data.errcode === 0) { 543 | console.log('企业微信发送通知消息成功🎉。\n'); 544 | } else { 545 | console.log(`${data.errmsg}\n`); 546 | } 547 | } 548 | } catch (e) { 549 | $.logErr(e, resp); 550 | } finally { 551 | resolve(data); 552 | } 553 | }); 554 | } else { 555 | console.log('您未提供企业微信机器人推送所需的QYWX_KEY,取消企业微信推送消息通知🚫\n'); 556 | resolve(); 557 | } 558 | }); 559 | } 560 | 561 | function ChangeUserId(desp) { 562 | const QYWX_AM_AY = QYWX_AM.split(','); 563 | if (QYWX_AM_AY[2]) { 564 | const userIdTmp = QYWX_AM_AY[2].split("|"); 565 | let userId = ""; 566 | for (let i = 0; i < userIdTmp.length; i++) { 567 | const count = "账号" + (i + 1); 568 | const count2 = "签到号 " + (i + 1); 569 | if (desp.match(count2)) { 570 | userId = userIdTmp[i]; 571 | } 572 | } 573 | if (!userId) userId = QYWX_AM_AY[2]; 574 | return userId; 575 | } else { 576 | return "@all"; 577 | } 578 | } 579 | 580 | function qywxamNotify(text, desp) { 581 | return new Promise(resolve => { 582 | if (QYWX_AM) { 583 | const QYWX_AM_AY = QYWX_AM.split(','); 584 | const options_accesstoken = { 585 | url: `https://qyapi.weixin.qq.com/cgi-bin/gettoken`, 586 | json: { 587 | corpid: `${QYWX_AM_AY[0]}`, 588 | corpsecret: `${QYWX_AM_AY[1]}`, 589 | }, 590 | headers: { 591 | 'Content-Type': 'application/json', 592 | }, 593 | timeout 594 | }; 595 | $.post(options_accesstoken, (err, resp, data) => { 596 | html = desp.replace(/\n/g, "
") 597 | var json = JSON.parse(data); 598 | accesstoken = json.access_token; 599 | let options; 600 | 601 | switch (QYWX_AM_AY[4]) { 602 | case '0': 603 | options = { 604 | msgtype: 'textcard', 605 | textcard: { 606 | title: `${text}`, 607 | description: `${desp}`, 608 | url: '', 609 | btntxt: '更多' 610 | } 611 | } 612 | break; 613 | 614 | case '1': 615 | options = { 616 | msgtype: 'text', 617 | text: { 618 | content: `${text}\n\n${desp}` 619 | } 620 | } 621 | break; 622 | 623 | default: 624 | options = { 625 | msgtype: 'mpnews', 626 | mpnews: { 627 | articles: [ 628 | { 629 | title: `${text}`, 630 | thumb_media_id: `${QYWX_AM_AY[4]}`, 631 | author: `智能助手`, 632 | content_source_url: ``, 633 | content: `${html}`, 634 | digest: `${desp}` 635 | } 636 | ] 637 | } 638 | } 639 | }; 640 | if (!QYWX_AM_AY[4]) { 641 | //如不提供第四个参数,则默认进行文本消息类型推送 642 | options = { 643 | msgtype: 'text', 644 | text: { 645 | content: `${text}\n\n${desp}` 646 | } 647 | } 648 | } 649 | options = { 650 | url: `https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=${accesstoken}`, 651 | json: { 652 | touser: `${ChangeUserId(desp)}`, 653 | agentid: `${QYWX_AM_AY[3]}`, 654 | safe: '0', 655 | ...options 656 | }, 657 | headers: { 658 | 'Content-Type': 'application/json', 659 | }, 660 | } 661 | 662 | $.post(options, (err, resp, data) => { 663 | try { 664 | if (err) { 665 | console.log('成员ID:' + ChangeUserId(desp) + '企业微信应用消息发送通知消息失败!!\n'); 666 | console.log(err); 667 | } else { 668 | data = JSON.parse(data); 669 | if (data.errcode === 0) { 670 | console.log('成员ID:' + ChangeUserId(desp) + '企业微信应用消息发送通知消息成功🎉。\n'); 671 | } else { 672 | console.log(`${data.errmsg}\n`); 673 | } 674 | } 675 | } catch (e) { 676 | $.logErr(e, resp); 677 | } finally { 678 | resolve(data); 679 | } 680 | }); 681 | }); 682 | } else { 683 | console.log('您未提供企业微信应用消息推送所需的QYWX_AM,取消企业微信应用消息推送消息通知🚫\n'); 684 | resolve(); 685 | } 686 | }); 687 | } 688 | 689 | function iGotNotify(text, desp, params = {}) { 690 | return new Promise(resolve => { 691 | if (IGOT_PUSH_KEY) { 692 | // 校验传入的IGOT_PUSH_KEY是否有效 693 | const IGOT_PUSH_KEY_REGX = new RegExp("^[a-zA-Z0-9]{24}$") 694 | if (!IGOT_PUSH_KEY_REGX.test(IGOT_PUSH_KEY)) { 695 | console.log('您所提供的IGOT_PUSH_KEY无效\n') 696 | resolve() 697 | return 698 | } 699 | const options = { 700 | url: `https://push.hellyw.com/${IGOT_PUSH_KEY.toLowerCase()}`, 701 | body: `title=${text}&content=${desp}&${querystring.stringify(params)}`, 702 | headers: { 703 | 'Content-Type': 'application/x-www-form-urlencoded' 704 | }, 705 | timeout 706 | } 707 | $.post(options, (err, resp, data) => { 708 | try { 709 | if (err) { 710 | console.log('发送通知调用API失败!!\n') 711 | console.log(err); 712 | } else { 713 | if (typeof data === 'string') data = JSON.parse(data); 714 | if (data.ret === 0) { 715 | console.log('iGot发送通知消息成功🎉\n') 716 | } else { 717 | console.log(`iGot发送通知消息失败:${data.errMsg}\n`) 718 | } 719 | } 720 | } catch (e) { 721 | $.logErr(e, resp); 722 | } finally { 723 | resolve(data); 724 | } 725 | }) 726 | } else { 727 | console.log('您未提供iGot的推送IGOT_PUSH_KEY,取消iGot推送消息通知🚫\n'); 728 | resolve() 729 | } 730 | }) 731 | } 732 | 733 | function pushPlusNotify(text, desp) { 734 | return new Promise(resolve => { 735 | if (PUSH_PLUS_TOKEN) { 736 | desp = desp.replace(/[\n\r]/g, '
'); // 默认为html, 不支持plaintext 737 | const body = { 738 | token: `${PUSH_PLUS_TOKEN}`, 739 | title: `${text}`, 740 | content: `${desp}`, 741 | topic: `${PUSH_PLUS_USER}` 742 | }; 743 | const options = { 744 | url: `http://www.pushplus.plus/send`, 745 | body: JSON.stringify(body), 746 | headers: { 747 | 'Content-Type': ' application/json' 748 | }, 749 | timeout 750 | } 751 | $.post(options, (err, resp, data) => { 752 | try { 753 | if (err) { 754 | console.log(`push+发送${PUSH_PLUS_USER ? '一对多' : '一对一'}通知消息失败!!\n`) 755 | console.log(err); 756 | } else { 757 | data = JSON.parse(data); 758 | if (data.code === 200) { 759 | console.log(`push+发送${PUSH_PLUS_USER ? '一对多' : '一对一'}通知消息完成。\n`) 760 | } else { 761 | console.log(`push+发送${PUSH_PLUS_USER ? '一对多' : '一对一'}通知消息失败:${data.msg}\n`) 762 | } 763 | } 764 | } catch (e) { 765 | $.logErr(e, resp); 766 | } finally { 767 | resolve(data); 768 | } 769 | }) 770 | } else { 771 | console.log('您未提供push+推送所需的PUSH_PLUS_TOKEN,取消push+推送消息通知🚫\n'); 772 | resolve() 773 | } 774 | }) 775 | } 776 | 777 | module.exports = { 778 | sendNotify, 779 | BARK_PUSH 780 | } 781 | // prettier-ignore 782 | function Env(t, s) { return new class { constructor(t, s) { this.name = t, this.data = null, this.dataFile = "box.dat", this.logs = [], this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, s), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } getScript(t) { return new Promise(s => { $.get({ url: t }, (t, e, i) => s(i)) }) } runScript(t, s) { return new Promise(e => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let o = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); o = o ? 1 * o : 20, o = s && s.timeout ? s.timeout : o; const [h, a] = i.split("@"), r = { url: `http://${a}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: o }, headers: { "X-Key": h, Accept: "*/*" } }; $.post(r, (t, s, i) => e(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), s = this.path.resolve(process.cwd(), this.dataFile), e = this.fs.existsSync(t), i = !e && this.fs.existsSync(s); if (!e && !i) return {}; { const i = e ? t : s; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), s = this.path.resolve(process.cwd(), this.dataFile), e = this.fs.existsSync(t), i = !e && this.fs.existsSync(s), o = JSON.stringify(this.data); e ? this.fs.writeFileSync(t, o) : i ? this.fs.writeFileSync(s, o) : this.fs.writeFileSync(t, o) } } lodash_get(t, s, e) { const i = s.replace(/\[(\d+)\]/g, ".$1").split("."); let o = t; for (const t of i) if (o = Object(o)[t], void 0 === o) return e; return o } lodash_set(t, s, e) { return Object(t) !== t ? t : (Array.isArray(s) || (s = s.toString().match(/[^.[\]]+/g) || []), s.slice(0, -1).reduce((t, e, i) => Object(t[e]) === t[e] ? t[e] : t[e] = Math.abs(s[i + 1]) >> 0 == +s[i + 1] ? [] : {}, t)[s[s.length - 1]] = e, t) } getdata(t) { let s = this.getval(t); if (/^@/.test(t)) { const [, e, i] = /^@(.*?)\.(.*?)$/.exec(t), o = e ? this.getval(e) : ""; if (o) try { const t = JSON.parse(o); s = t ? this.lodash_get(t, i, "") : s } catch (t) { s = "" } } return s } setdata(t, s) { let e = !1; if (/^@/.test(s)) { const [, i, o] = /^@(.*?)\.(.*?)$/.exec(s), h = this.getval(i), a = i ? "null" === h ? null : h || "{}" : "{}"; try { const s = JSON.parse(a); this.lodash_set(s, o, t), e = this.setval(JSON.stringify(s), i) } catch (s) { const h = {}; this.lodash_set(h, o, t), e = this.setval(JSON.stringify(h), i) } } else e = $.setval(t, s); return e } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, s) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, s) : this.isQuanX() ? $prefs.setValueForKey(t, s) : this.isNode() ? (this.data = this.loaddata(), this.data[s] = t, this.writedata(), !0) : this.data && this.data[s] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, s = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? $httpClient.get(t, (t, e, i) => { !t && e && (e.body = i, e.statusCode = e.status), s(t, e, i) }) : this.isQuanX() ? $task.fetch(t).then(t => { const { statusCode: e, statusCode: i, headers: o, body: h } = t; s(null, { status: e, statusCode: i, headers: o, body: h }, h) }, t => s(t)) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, s) => { try { const e = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); this.ckjar.setCookieSync(e, null), s.cookieJar = this.ckjar } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: e, statusCode: i, headers: o, body: h } = t; s(null, { status: e, statusCode: i, headers: o, body: h }, h) }, t => s(t))) } post(t, s = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) $httpClient.post(t, (t, e, i) => { !t && e && (e.body = i, e.statusCode = e.status), s(t, e, i) }); else if (this.isQuanX()) t.method = "POST", $task.fetch(t).then(t => { const { statusCode: e, statusCode: i, headers: o, body: h } = t; s(null, { status: e, statusCode: i, headers: o, body: h }, h) }, t => s(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: e, ...i } = t; this.got.post(e, i).then(t => { const { statusCode: e, statusCode: i, headers: o, body: h } = t; s(null, { status: e, statusCode: i, headers: o, body: h }, h) }, t => s(t)) } } time(t) { let s = { "M+": (new Date).getMonth() + 1, "d+": (new Date).getDate(), "H+": (new Date).getHours(), "m+": (new Date).getMinutes(), "s+": (new Date).getSeconds(), "q+": Math.floor(((new Date).getMonth() + 3) / 3), S: (new Date).getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length))); for (let e in s) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? s[e] : ("00" + s[e]).substr(("" + s[e]).length))); return t } msg(s = t, e = "", i = "", o) { const h = t => !t || !this.isLoon() && this.isSurge() ? t : "string" == typeof t ? this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : void 0 : "object" == typeof t && (t["open-url"] || t["media-url"]) ? this.isLoon() ? t["open-url"] : this.isQuanX() ? t : void 0 : void 0; $.isMute || (this.isSurge() || this.isLoon() ? $notification.post(s, e, i, h(o)) : this.isQuanX() && $notify(s, e, i, h(o))), this.logs.push("", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="), this.logs.push(s), e && this.logs.push(e), i && this.logs.push(i) } log(...t) { t.length > 0 ? this.logs = [...this.logs, ...t] : console.log(this.logs.join(this.logSeparator)) } logErr(t, s) { const e = !this.isSurge() && !this.isQuanX() && !this.isLoon(); e ? $.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : $.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t) } wait(t) { return new Promise(s => setTimeout(s, t)) } done(t = {}) { const s = (new Date).getTime(), e = (s - this.startTime) / 1e3; this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, s) } 783 | 784 | -------------------------------------------------------------------------------- /thank.js: -------------------------------------------------------------------------------- 1 | console.log('这是一个特殊的东西') 2 | 3 | console.log('以下排名不分先后顺序,均随机。') 4 | 5 | console.log('') 6 | console.log('感谢猫猫姐姐') 7 | console.log('感谢yu哥') 8 | console.log('感谢so哥') 9 | console.log('感谢好名字哥') 10 | console.log('感谢布兰克哥') 11 | console.log('感谢undefined哥') 12 | console.log('感谢和风') 13 | console.log('感谢和风') 14 | console.log('感谢韵の祈') 15 | 16 | console.log('感谢内测人员:') 17 | console.log('Anarchy') 18 | console.log('yin') 19 | console.log('Lyh') 20 | console.log('小帆') 21 | console.log('妖火 蔡虚坤 43165') 22 | console.log('妖火 摸鱼佬 34611') 23 | console.log('妖火 杨太玄 5237') 24 | 25 | console.log('感谢') 26 | -------------------------------------------------------------------------------- /xj.js: -------------------------------------------------------------------------------- 1 | /* 2 | 微信小程序:习酒会员俱乐部 3 | 默认填写作者推荐码 需要修改在693行修改 4 | 变量为xjhd 5 | 抓包域名 anti-channeling/public/index.php/api/v2/ 6 | 查看请求头的login_code 7 | 比如 export xjhd='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.XXXXXX' 8 | 多账号@隔开 9 | 比如 export xjhd='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.XXXXXX'@'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.XXXXXX' 10 | */ 11 | //定时 0 */2 * * * 吧 12 | const $ = new Env('习酒'); 13 | var request = require("request"); 14 | let status; 15 | status = (status = ($.getval("xjstatus") || "1") ) > 1 ? `${status}` : ""; // 账号扩展字符 16 | let xjhdArr = [],xjcount = '' 17 | let xjhd= process.env.xjhd 18 | 19 | let allMessage = ''; 20 | let xjhds = "" 21 | const logs =0; 22 | const host='https://xcx.exijiu.com/' 23 | const host1='https://apimallwm.exijiu.com/' 24 | var hours = new Date().getHours(); 25 | var s = new Date().getMinutes(); 26 | 27 | var timestamp = Math.round(new Date().getTime()/1000).toString(); 28 | !(async () => { 29 | if (typeof $request !== "undefined") { 30 | 31 | } else { 32 | if(!$.isNode()){ 33 | xjhdArr.push($.getdata('xjhd')) 34 | let xjcount = ($.getval('xjcount') || '1'); 35 | for (let i = 2; i <= xjcount; i++) { 36 | xjhdArr.push($.getdata(`xjhd${i}`)) 37 | } 38 | console.log(`------------- 共${xjhdArr.length}个账号-------------\n`) 39 | for (let i = 0; i < xjhdArr.length; i++) { 40 | if (xjhdArr[i]) { 41 | xjhd = xjhdArr[i]; 42 | $.index = i + 1; 43 | 44 | } 45 | } 46 | }else { 47 | if (process.env.xjhd && process.env.xjhd.indexOf('@') > -1) { 48 | xjhdArr = process.env.xjhd.split('@'); 49 | console.log(`您选择的是用"&"隔开\n`) 50 | } else { 51 | xjhds = [process.env.xjhd] 52 | }; 53 | Object.keys(xjhds).forEach((item) => { 54 | if (xjhds[item]) { 55 | xjhdArr.push(xjhds[item]) 56 | } 57 | }) 58 | console.log(`共${xjhdArr.length}个cookie`) 59 | for (let k = 0; k < xjhdArr.length; k++) { 60 | $.message = "" 61 | xjhd = xjhdArr[k] 62 | $.index = k + 1; 63 | 64 | console.log(`\n开始【习酒${$.index}】`) 65 | 66 | 67 | await getJifenShopMemberInfo() 68 | await getJwt() 69 | 70 | 71 | } 72 | 73 | 74 | } 75 | } 76 | })() 77 | .catch((e) => $.logErr(e)) 78 | .finally(() => $.done()) 79 | 80 | function hasDataMsCenterUser() { 81 | return new Promise((resolve) => { 82 | 83 | $.get(indexapi1(`anti-channeling/public/index.php/api/v2/Member/hasDataMsCenterUser`,token), async (err, resp, data) => { 84 | 85 | try { 86 | if (err) { 87 | console.log(`${JSON.stringify(err)}`) 88 | console.log(`${$.name} API请求失败,请检查网路重试`) 89 | }// else { 90 | if (safeGet(data)) { 91 | data = JSON.parse(data); 92 | if(data.code==0){ 93 | 94 | console.log(`刷新:${data.msg}`) 95 | 96 | 97 | 98 | } 99 | else if(data.code == -1){ 100 | console.log(data.msg) 101 | 102 | } 103 | } 104 | 105 | } catch (e) { 106 | $.logErr(e, resp) 107 | } finally { 108 | resolve(data); 109 | } 110 | }) 111 | }) 112 | } 113 | function getJifenShopMemberInfo() { 114 | return new Promise((resolve) => { 115 | 116 | $.get(indexapi(`anti-channeling/public/index.php/api/v2/Member/getJifenShopMemberInfo`), async (err, resp, data) => { 117 | 118 | try { 119 | if (err) { 120 | console.log(`${JSON.stringify(err)}`) 121 | console.log(`${$.name} API请求失败,请检查网路重试`) 122 | }// else { 123 | if (safeGet(data)) { 124 | data = JSON.parse(data); 125 | if(data.code==0){ 126 | 127 | console.log(`id:${data.data.id}\nintegration:${data.data.integration}\n${data.data['level_name']}`) 128 | 129 | 130 | 131 | } 132 | else if(data.code == -1){ 133 | console.log(data.msg) 134 | 135 | } 136 | } 137 | 138 | } catch (e) { 139 | $.logErr(e, resp) 140 | } finally { 141 | resolve(data); 142 | } 143 | }) 144 | }) 145 | } 146 | function getJwt() { 147 | return new Promise((resolve) => { 148 | 149 | $.get(indexapi(`anti-channeling/public/index.php/api/v2/Member/getJwt`), async (err, resp, data) => { 150 | 151 | try { 152 | if (err) { 153 | console.log(`${JSON.stringify(err)}`) 154 | console.log(`${$.name} API请求失败,请检查网路重试`) 155 | }// else { 156 | if (safeGet(data)) { 157 | data = JSON.parse(data); 158 | if(data.code==0){ 159 | token = data.data.jwt 160 | id = data.data.member_id 161 | console.log(id) 162 | await hasDataMsCenterUser() 163 | await gardenmemberwine() 164 | await info() 165 | await member() 166 | await signin() 167 | await dailySign() 168 | await Gardenquestiontask() 169 | await dailyShare() 170 | await $.wait(1000) 171 | await dailyShare() 172 | await $.wait(1000) 173 | await dailyShare() 174 | await realscene() 175 | //await sorghum() 176 | for(let i=0;i<1;i++){ 177 | await watering() 178 | await manuring() 179 | } 180 | await sorghumindex() 181 | 182 | 183 | //await extend(2) 184 | } 185 | else if(data.code == -1){ 186 | console.log(data.msg) 187 | 188 | } 189 | } 190 | 191 | } catch (e) { 192 | $.logErr(e, resp) 193 | } finally { 194 | resolve(data); 195 | } 196 | }) 197 | }) 198 | } 199 | function signin() { 200 | return new Promise((resolve) => { 201 | 202 | $.post(xjpost(`member/signin/sign`,'from=miniprogram_index',token), async (err, resp, data) => { 203 | 204 | try { 205 | if (err) { 206 | console.log(`${JSON.stringify(err)}`) 207 | console.log(`${$.name} API请求失败,请检查网路重试`) 208 | }// else { 209 | if (safeGet(data)) { 210 | data = JSON.parse(data); 211 | if(data.err==0){ 212 | 213 | console.log("signin:"+data.msg) 214 | 215 | 216 | 217 | } 218 | else if(data.err !== 0){ 219 | console.log("signin:"+data.msg) 220 | 221 | } 222 | } 223 | 224 | } catch (e) { 225 | $.logErr(e, resp) 226 | } finally { 227 | resolve(data); 228 | } 229 | }) 230 | }) 231 | } 232 | 233 | function dailySign() { 234 | return new Promise((resolve) => { 235 | 236 | $.post(xjpost(`garden/sign/dailySign`,'',token), async (err, resp, data) => { 237 | 238 | try { 239 | if (err) { 240 | console.log(`${JSON.stringify(err)}`) 241 | console.log(`${$.name} API请求失败,请检查网路重试`) 242 | }// else { 243 | if (safeGet(data)) { 244 | data = JSON.parse(data); 245 | if(data.err==0){ 246 | 247 | console.log("dailySign:"+data.data.tips+data.msg) 248 | 249 | 250 | 251 | } 252 | else if(data.err !== 0){ 253 | console.log(data.msg) 254 | 255 | } 256 | } 257 | 258 | } catch (e) { 259 | $.logErr(e, resp) 260 | } finally { 261 | resolve(data); 262 | } 263 | }) 264 | }) 265 | } 266 | function Gardenquestiontask() { 267 | return new Promise((resolve) => { 268 | 269 | $.get(xjget(`garden/Gardenquestiontask/index`,token), async (err, resp, data) => { 270 | 271 | try { 272 | if (err) { 273 | console.log(`${JSON.stringify(err)}`) 274 | console.log(`${$.name} API请求失败,请检查网路重试`) 275 | }// else { 276 | if (safeGet(data)) { 277 | data = JSON.parse(data); 278 | if(data.err==0){ 279 | ansid = data.data[0].id 280 | answer = data.data[0].answer 281 | 282 | console.log(data.data[0].title) 283 | console.log("答案为:"+answer) 284 | await answerResults(ansid,answer) 285 | 286 | } 287 | else if(data.err !== 0){ 288 | console.log(data.msg) 289 | 290 | } 291 | } 292 | 293 | } catch (e) { 294 | $.logErr(e, resp) 295 | } finally { 296 | resolve(data); 297 | } 298 | }) 299 | }) 300 | } 301 | function answerResults(a,b) { 302 | return new Promise((resolve) => { 303 | 304 | $.get(xjget(`garden/Gardenquestiontask/answerResults?answer=%5B%7B%22itemid%22%3A${a}%2C%22selected%22%3A%22${b}%22%7D%5D`,token), async (err, resp, data) => { 305 | 306 | try { 307 | if (err) { 308 | console.log(`${JSON.stringify(err)}`) 309 | console.log(`${$.name} API请求失败,请检查网路重试`) 310 | }// else { 311 | if (safeGet(data)) { 312 | data = JSON.parse(data); 313 | if(data.err==0){ 314 | 315 | console.log("答题:"+data.msg) 316 | 317 | 318 | } 319 | else if(data.err !== 0){ 320 | console.log(data.msg) 321 | 322 | } 323 | } 324 | 325 | } catch (e) { 326 | $.logErr(e, resp) 327 | } finally { 328 | resolve(data); 329 | } 330 | }) 331 | }) 332 | } 333 | function dailyShare() { 334 | return new Promise((resolve) => { 335 | 336 | $.post(xjpost(`garden/gardenmemberinfo/dailyShare`,'',token), async (err, resp, data) => { 337 | 338 | try { 339 | if (err) { 340 | console.log(`${JSON.stringify(err)}`) 341 | console.log(`${$.name} API请求失败,请检查网路重试`) 342 | }// else { 343 | if (safeGet(data)) { 344 | data = JSON.parse(data); 345 | if(data.err==0){ 346 | 347 | console.log("分享:"+data.msg) 348 | 349 | 350 | } 351 | else if(data.err !== 0){ 352 | console.log(data.msg) 353 | 354 | } 355 | } 356 | 357 | } catch (e) { 358 | $.logErr(e, resp) 359 | } finally { 360 | resolve(data); 361 | } 362 | }) 363 | }) 364 | } 365 | function realscene() { 366 | return new Promise((resolve) => { 367 | 368 | $.get(xjget(`garden/realscene/reward`,token), async (err, resp, data) => { 369 | 370 | try { 371 | if (err) { 372 | console.log(`${JSON.stringify(err)}`) 373 | console.log(`${$.name} API请求失败,请检查网路重试`) 374 | }// else { 375 | if (safeGet(data)) { 376 | data = JSON.parse(data); 377 | if(data.err==0){ 378 | 379 | console.log("查看:"+data.msg) 380 | 381 | 382 | } 383 | else if(data.err !== 0){ 384 | console.log("查看:"+data.msg) 385 | 386 | } 387 | } 388 | 389 | } catch (e) { 390 | $.logErr(e, resp) 391 | } finally { 392 | resolve(data); 393 | } 394 | }) 395 | }) 396 | } 397 | 398 | function sorghum(id,type) { 399 | return new Promise((resolve) => { 400 | 401 | $.post(xjpost(`garden/sorghum/seed`,'{"id":'+id+',"type":'+type+'}',token), async (err, resp, data) => { 402 | 403 | try { 404 | if (err) { 405 | console.log(`${JSON.stringify(err)}`) 406 | console.log(`${$.name} API请求失败,请检查网路重试`) 407 | }// else { 408 | if (safeGet(data)) { 409 | data = JSON.parse(data); 410 | if(data.err==0){ 411 | console.log("种植高粱:"+data.msg) 412 | console.log("施肥次数:"+data.data['manure_num']) 413 | console.log("浇水次数:"+data.data['water_num']) 414 | //type = data.data[0].type 415 | //if(type == 1){ 416 | // await harvest() 417 | //} 418 | } 419 | else if(data.err !== 0){ 420 | console.log(data.msg) 421 | 422 | } 423 | } 424 | 425 | } catch (e) { 426 | $.logErr(e, resp) 427 | } finally { 428 | resolve(data); 429 | } 430 | }) 431 | }) 432 | } 433 | 434 | function watering() { 435 | return new Promise((resolve) => { 436 | 437 | $.post(xjpost(`garden/sorghum/watering`,'{"id":772352}',token), async (err, resp, data) => { 438 | 439 | try { 440 | if (err) { 441 | console.log(`${JSON.stringify(err)}`) 442 | console.log(`${$.name} API请求失败,请检查网路重试`) 443 | }// else { 444 | if (safeGet(data)) { 445 | data = JSON.parse(data); 446 | if(data.err==0){ 447 | console.log(data.msg) 448 | console.log("施肥次数:"+data.data['manure_num']) 449 | console.log("浇水次数:"+data.data['water_num']) 450 | type = data.data.type 451 | if(type == 1){ 452 | await harvest() 453 | } 454 | } 455 | else if(data.err !== 0){ 456 | console.log(data.msg) 457 | 458 | } 459 | } 460 | 461 | } catch (e) { 462 | $.logErr(e, resp) 463 | } finally { 464 | resolve(data); 465 | } 466 | }) 467 | }) 468 | } 469 | function manuring() { 470 | return new Promise((resolve) => { 471 | 472 | $.post(xjpost(`garden/sorghum/manuring`,'{"id":772352}',token), async (err, resp, data) => { 473 | 474 | try { 475 | if (err) { 476 | console.log(`${JSON.stringify(err)}`) 477 | console.log(`${$.name} API请求失败,请检查网路重试`) 478 | }// else { 479 | if (safeGet(data)) { 480 | data = JSON.parse(data); 481 | if(data.err==0){ 482 | console.log(data.msg) 483 | console.log("施肥次数:"+data.data['manure_num']) 484 | console.log("浇水次数:"+data.data['water_num']) 485 | type = data.data.type 486 | if(type == 1){ 487 | await harvest() 488 | } 489 | } 490 | else if(data.err !== 0){ 491 | console.log(data.msg) 492 | 493 | } 494 | } 495 | 496 | } catch (e) { 497 | $.logErr(e, resp) 498 | } finally { 499 | resolve(data); 500 | } 501 | }) 502 | }) 503 | } 504 | function harvest(id) { 505 | return new Promise((resolve) => { 506 | 507 | $.post(xjpost(`garden/sorghum/harvest`,'{"id":'+id+'}',token), async (err, resp, data) => { 508 | 509 | try { 510 | if (err) { 511 | console.log(`${JSON.stringify(err)}`) 512 | console.log(`${$.name} API请求失败,请检查网路重试`) 513 | }// else { 514 | if (safeGet(data)) { 515 | data = JSON.parse(data); 516 | if(data.err==0){ 517 | console.log(data.msg) 518 | 519 | 520 | } 521 | else if(data.err !== 0){ 522 | console.log(data.msg) 523 | 524 | } 525 | } 526 | 527 | } catch (e) { 528 | $.logErr(e, resp) 529 | } finally { 530 | resolve(data); 531 | } 532 | }) 533 | }) 534 | } 535 | function sorghumindex() { 536 | return new Promise((resolve) => { 537 | 538 | $.get(xjget(`garden/sorghum/index`,token), async (err, resp, data) => { 539 | // $.log(data) 540 | try { 541 | if (err) { 542 | console.log(`${JSON.stringify(err)}`) 543 | console.log(`${$.name} API请求失败,请检查网路重试`) 544 | }// else { 545 | if (safeGet(data)) { 546 | data = JSON.parse(data); 547 | if(data.err==0){ 548 | list = data.data 549 | for(let i=0;i { 588 | 589 | $.post(xjpost(`garden/sorghum/extend`,'{"serial_number":'+id+'}',token), async (err, resp, data) => { 590 | 591 | try { 592 | if (err) { 593 | console.log(`${JSON.stringify(err)}`) 594 | console.log(`${$.name} API请求失败,请检查网路重试`) 595 | }// else { 596 | if (safeGet(data)) { 597 | data = JSON.parse(data); 598 | if(data.err==0){ 599 | console.log(data.msg) 600 | 601 | 602 | } 603 | else if(data.err !== 0){ 604 | console.log(data.msg) 605 | 606 | } 607 | } 608 | 609 | } catch (e) { 610 | $.logErr(e, resp) 611 | } finally { 612 | resolve(data); 613 | } 614 | }) 615 | }) 616 | } 617 | 618 | function gardenmemberwine() { 619 | return new Promise((resolve) => { 620 | 621 | $.get(xjget(`garden/gardenmemberwine/index `,token), async (err, resp, data) => { 622 | 623 | try { 624 | if (err) { 625 | console.log(`${JSON.stringify(err)}`) 626 | console.log(`${$.name} API请求失败,请检查网路重试`) 627 | }// else { 628 | if (safeGet(data)) { 629 | data = JSON.parse(data); 630 | if(data.err==0){ 631 | if(data.total==1){ 632 | console.log("酿酒成熟时间:"+data.data[0].crop_time) 633 | console.log('ID: '+data.data[0].id) 634 | if(data.data[0].status==4){ 635 | console.log('已成熟 可以收取') 636 | status =data.data[0].status 637 | await harvestWine(data.data[0].id) 638 | } 639 | }else console.log('还未酿酒') 640 | await makeWine() 641 | } 642 | else if(data.err !== 0){ 643 | console.log(data.msg) 644 | 645 | } 646 | } 647 | 648 | } catch (e) { 649 | $.logErr(e, resp) 650 | } finally { 651 | resolve(data); 652 | } 653 | }) 654 | }) 655 | } 656 | function harvestWine(a) { 657 | return new Promise((resolve) => { 658 | 659 | $.get(xjget(`garden/gardenmemberwine/harvestWine?id=${a}`,token), async (err, resp, data) => { 660 | 661 | try { 662 | if (err) { 663 | console.log(`${JSON.stringify(err)}`) 664 | console.log(`${$.name} API请求失败,请检查网路重试`) 665 | }// else { 666 | if (safeGet(data)) { 667 | data = JSON.parse(data); 668 | if(data.err==0){ 669 | 670 | console.log("收取:"+data.msg) 671 | await makeWine() 672 | 673 | } 674 | else if(data.err !== 0){ 675 | console.log(data.msg) 676 | 677 | } 678 | } 679 | 680 | } catch (e) { 681 | $.logErr(e, resp) 682 | } finally { 683 | resolve(data); 684 | } 685 | }) 686 | }) 687 | } 688 | function harvestWine(a) { 689 | return new Promise((resolve) => { 690 | 691 | $.get(xjget(`garden/gardenmemberwine/harvestWine?id=${a}`,token), async (err, resp, data) => { 692 | 693 | try { 694 | if (err) { 695 | console.log(`${JSON.stringify(err)}`) 696 | console.log(`${$.name} API请求失败,请检查网路重试`) 697 | }// else { 698 | if (safeGet(data)) { 699 | data = JSON.parse(data); 700 | if(data.err==0){ 701 | 702 | console.log("收取:"+data.msg) 703 | await makeWine() 704 | 705 | } 706 | else if(data.err !== 0){ 707 | console.log(data.msg) 708 | 709 | } 710 | } 711 | 712 | } catch (e) { 713 | $.logErr(e, resp) 714 | } finally { 715 | resolve(data); 716 | } 717 | }) 718 | }) 719 | } 720 | function member() { 721 | return new Promise((resolve) => { 722 | 723 | $.get(xjget(`member/recommend/personal_center?phone_no=17683989907`,token), async (err, resp, data) => { 724 | 725 | try { 726 | if (err) { 727 | console.log(`${JSON.stringify(err)}`) 728 | console.log(`${$.name} API请求失败,请检查网路重试`) 729 | }// else { 730 | if (safeGet(data)) { 731 | data = JSON.parse(data); 732 | if(data.err==0){ 733 | 734 | 735 | } 736 | else if(data.err !== 0){ 737 | 738 | 739 | } 740 | } 741 | 742 | } catch (e) { 743 | $.logErr(e, resp) 744 | } finally { 745 | resolve(data); 746 | } 747 | }) 748 | }) 749 | } 750 | 751 | function all() { 752 | return new Promise((resolve) => { 753 | 754 | $.get(xjget(`garden/Sorghum/harvestAll`,token), async (err, resp, data) => { 755 | 756 | try { 757 | if (err) { 758 | console.log(`${JSON.stringify(err)}`) 759 | console.log(`${$.name} API请求失败,请检查网路重试`) 760 | }// else { 761 | if (safeGet(data)) { 762 | data = JSON.parse(data); 763 | if(data.err==0){ 764 | 765 | console.log("收取:"+data.msg) 766 | 767 | 768 | } 769 | else if(data.err !== 0){ 770 | console.log(data.msg) 771 | 772 | } 773 | } 774 | 775 | } catch (e) { 776 | $.logErr(e, resp) 777 | } finally { 778 | resolve(data); 779 | } 780 | }) 781 | }) 782 | } 783 | 784 | function makeWine() { 785 | return new Promise((resolve) => { 786 | 787 | $.post(xjpost1(`garden/gardenmemberwine/makeWine`,'volumn=200',token), async (err, resp, data) => { 788 | 789 | try { 790 | if (err) { 791 | console.log(`${JSON.stringify(err)}`) 792 | console.log(`${$.name} API请求失败,请检查网路重试`) 793 | }// else { 794 | if (safeGet(data)) { 795 | data = JSON.parse(data); 796 | if(data.err==0){ 797 | 798 | console.log("收取:"+data.msg) 799 | 800 | 801 | } 802 | else if(data.err !== 0){ 803 | console.log(data.msg) 804 | 805 | } 806 | } 807 | 808 | } catch (e) { 809 | $.logErr(e, resp) 810 | } finally { 811 | resolve(data); 812 | } 813 | }) 814 | }) 815 | } 816 | function info() { 817 | return new Promise((resolve) => { 818 | 819 | $.get(xjget(`garden/Gardenmemberinfo/getMemberInfo`,token), async (err, resp, data) => { 820 | 821 | try { 822 | if (err) { 823 | console.log(`${JSON.stringify(err)}`) 824 | console.log(`${$.name} API请求失败,请检查网路重试`) 825 | }// else { 826 | if (safeGet(data)) { 827 | data = JSON.parse(data); 828 | if(data.err==0){ 829 | 830 | console.log('积分:'+data.data.integration) 831 | console.log('高粱:'+data.data.sorghum) 832 | console.log('小麦:'+data.data.wheat) 833 | console.log('酒曲:'+data.data['wine_yeast']) 834 | console.log('酒:'+data.data.wine) 835 | if(data.data.wine>0){ 836 | await exchange(data.data.wine) 837 | } 838 | 839 | 840 | } 841 | else if(data.err !== 0){ 842 | console.log(data.msg) 843 | 844 | } 845 | } 846 | 847 | } catch (e) { 848 | $.logErr(e, resp) 849 | } finally { 850 | resolve(data); 851 | } 852 | }) 853 | }) 854 | } 855 | function exchange(a) { 856 | return new Promise((resolve) => { 857 | 858 | $.get(xjget(`garden/Gardenjifenshop/exchange?wine=${a}`,token), async (err, resp, data) => { 859 | 860 | try { 861 | if (err) { 862 | console.log(`${JSON.stringify(err)}`) 863 | console.log(`${$.name} API请求失败,请检查网路重试`) 864 | }// else { 865 | if (safeGet(data)) { 866 | data = JSON.parse(data); 867 | if(data.err==0){ 868 | 869 | console.log('积分:'+data.msg) 870 | 871 | } 872 | else if(data.err !== 0){ 873 | console.log(data.msg) 874 | 875 | } 876 | } 877 | 878 | } catch (e) { 879 | $.logErr(e, resp) 880 | } finally { 881 | resolve(data); 882 | } 883 | }) 884 | }) 885 | } 886 | 887 | function indexapi1(a,body,token) { 888 | return { 889 | 890 | url: `${host}${a}`, 891 | 892 | headers: { 893 | 'Host': 'xcx.exijiu.com', 894 | 'Connection': 'keep-alive', 895 | 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat', 896 | 'content-type': 'application/json', 897 | 'login_code': xjhd, 898 | 'Authorization': token, 899 | 'Referer': 'https://servicewechat.com/wx489f950decfeb93e/195/page-frame.html', 900 | 'Accept-Encoding': 'gzip, deflate', 901 | 902 | } 903 | } 904 | } 905 | 906 | function indexapi(a,body) { 907 | return { 908 | 909 | url: `${host}${a}`, 910 | 911 | headers: { 912 | 'Host': 'xcx.exijiu.com', 913 | 'Connection': 'keep-alive', 914 | 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat', 915 | 'content-type': 'application/json', 916 | 'login_code': xjhd, 917 | 'Referer': 'https://servicewechat.com/wx489f950decfeb93e/195/page-frame.html', 918 | 'Accept-Encoding': 'gzip, deflate', 919 | 920 | } 921 | } 922 | } 923 | function xjget(a,token) { 924 | return { 925 | 926 | url: `${host1}${a}`, 927 | headers: { 928 | 'Host': 'apimallwm.exijiu.com', 929 | 'Connection': 'keep-alive', 930 | 'Authorization': token, 931 | 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat', 932 | 'Content-Type': 'application/x-www-form-urlencoded', 933 | 'Accept': '*/*', 934 | 'Sec-Fetch-Site': 'same-site', 935 | 'Sec-Fetch-Mode': 'cors', 936 | 'Sec-Fetch-Dest': 'empty', 937 | 'Referer': 'https://mallwm.exijiu.com/', 938 | 'Accept-Language': 'en-us,en', 939 | 'Accept-Encoding':' gzip, deflate', 940 | 'login_code': xjhd, 941 | } 942 | } 943 | } 944 | function xjpost(a,b,token) { 945 | return { 946 | 947 | url: `${host1}${a}`, 948 | body:`${b}`, 949 | headers: { 950 | 'Host': 'apimallwm.exijiu.com', 951 | 'Connection': 'keep-alive', 952 | 'Authorization': token, 953 | 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat', 954 | 'Content-Type': 'application/json, text/plain, */*', 955 | 'Accept': '*/*', 956 | 'Sec-Fetch-Site': 'same-site', 957 | 'Sec-Fetch-Mode': 'cors', 958 | 'Sec-Fetch-Dest': 'empty', 959 | 'Referer': 'https://mallwm.exijiu.com/', 960 | 'Accept-Language': 'en-us,en', 961 | 'Accept-Encoding':' gzip, deflate', 962 | 'login_code': xjhd, 963 | } 964 | } 965 | } 966 | function xjpost1(a,b,token) { 967 | return { 968 | 969 | url: `${host1}${a}`, 970 | body:`${b}`, 971 | headers: { 972 | 'Host': 'apimallwm.exijiu.com', 973 | 'Connection': 'keep-alive', 974 | 'Authorization': token, 975 | 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 MicroMessenger/7.0.9.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat', 976 | 'Content-Type': 'application/x-www-form-urlencoded', 977 | 'Accept': 'application/json, text/plain, */*', 978 | 'Sec-Fetch-Site': 'same-site', 979 | 'Sec-Fetch-Mode': 'cors', 980 | 'Sec-Fetch-Dest': 'empty', 981 | 'Referer': 'https://mallwm.exijiu.com/', 982 | 'Accept-Language': 'en-us,en', 983 | 'Accept-Encoding':' gzip, deflate', 984 | 'login_code': xjhd, 985 | } 986 | } 987 | } 988 | 989 | 990 | function safeGet(data) { 991 | try { 992 | if (typeof JSON.parse(data) == "object") { 993 | return true; 994 | } 995 | } catch (e) { 996 | console.log(e); 997 | console.log(`京东服务器访问数据为空,请检查自身设备网络情况`); 998 | return false; 999 | } 1000 | } 1001 | function jsonParse(str) { 1002 | if (typeof str == "string") { 1003 | try { 1004 | return JSON.parse(str); 1005 | } catch (e) { 1006 | console.log(e); 1007 | $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie') 1008 | return []; 1009 | } 1010 | } 1011 | } 1012 | 1013 | function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();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){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};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=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];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("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} 1014 | --------------------------------------------------------------------------------