├── .gitignore
├── JDJRValidator_Aaron.js
├── JDSignValidator.js
├── JS_USER_AGENTS.js
├── LICENSE
├── README.md
├── USER_AGENTS.js
├── backUp
├── GetJdCookie.md
├── GetJdCookie2.md
├── GetJdCookie3.md
├── JDJRValidator_Smiek.js
├── JD_extra_cookie.js
├── README.md
├── TG_PUSH.md
├── ZooFaker_Necklace.js
├── aclog.png
├── elecV2P.md
├── getJDCookie.js
├── jdJxncShareCodes.js
├── jdJxncTokens.js
├── jd_DrawEntrance.js
├── jd_HappyNewYear_Shares.js
├── jd_UnknownTask5.js
├── jd_april.js
├── jd_april2.js
├── jd_babel_red.js
├── jd_bean_change.js
├── jd_beauty_ex.js
├── jd_big_winner.js
├── jd_bookshop.js
├── jd_bt_sign.js
├── jd_btdraw.py
├── jd_bzlshdgt.js
├── jd_car.js
├── jd_car_exchange.js
├── jd_carnivalcity.js
├── jd_carnivalcity_help.js
├── jd_cash_exchange.js
├── jd_cfd_fresh.js
├── jd_cfd_fresh_exchange.js
├── jd_city.js
├── jd_city_exchange.js
├── jd_citytx.js
├── jd_cjhz.js
├── jd_clean_car.js
├── jd_crazy_joy.js
├── jd_crazy_joy_bonus.js
├── jd_crazy_joy_coin.js
├── jd_daily_egg.js
├── jd_ddo_pk.js
├── jd_ddworld.js
├── jd_ddworld_exchange.js
├── jd_delCoupon.js
├── jd_djjl.js
├── jd_dqmh.js
├── jd_dt.js
├── jd_earn30.js
├── jd_enen.js.bak
├── jd_exchangejxbeans.js
├── jd_family.js
├── jd_fan.js
├── jd_fanli.js
├── jd_fcdyj.js
├── jd_fcwb_help.js
├── jd_freshgoods.js
├── jd_genz.js
├── jd_getred.py
├── jd_goldPhone.js
├── jd_gyp.js
├── jd_half_redrain.js
├── jd_hb_a.js
├── jd_industrial_task.js
├── jd_jchsign.js
├── jd_jingsubang.js
├── jd_joy.js
├── jd_joy_park_newtask.js
├── jd_joy_reward.js
├── jd_joy_run.js
├── jd_joy_steal.js
├── jd_joyjd_open_list.js
├── jd_jr_draw.js
├── jd_jump.js
├── jd_jxd.js
├── jd_jxg.js
├── jd_jxmc_mkmb.js
├── jd_jxnc.js
├── jd_kj.js
├── jd_kxcdz.js
├── jd_kyd.js
├── jd_live_redrain.js
├── jd_lotteryMachine.js
├── jd_lottery_drew.js
├── jd_lsj.js
├── jd_lxLottery.js
├── jd_market_lottery.js
├── jd_mf.js
├── jd_mhtask.js
├── jd_mhyyl.js
├── jd_mofang_ex.js
├── jd_mohe.js
├── jd_mpdzcar.js
├── jd_mpdzcar_game.js
├── jd_mpdzcar_help.js
├── jd_nh_sign.js
├── jd_ns_open.js
├── jd_plusLottery.js
├── jd_price.js
├── jd_qcshj.js
├── jd_qixi.js
├── jd_qjd.js
├── jd_rankingList.js
├── jd_red.js
├── jd_selectionOfficer.js
├── jd_shop.js
├── jd_sign_graphics1.js
├── jd_sjnhj.js
├── jd_small_home.js
├── jd_speed.js
├── jd_split.js
├── jd_star_shop.js
├── jd_summer_exchange.js
├── jd_superMarket.js
├── jd_super_redrain.js
├── jd_sxLottery.js
├── jd_syj.js
├── jd_task.json
├── jd_tiger.js
├── jd_travel.js
├── jd_ttpt.js
├── jd_unbind.js
├── jd_unsubscriLive.js
├── jd_utils.js
├── jd_vivo.js
├── jd_wish.js
├── jd_wxCollectionActivity.js
├── jd_wxj.js
├── jd_xiaolong.js
├── jd_xiaolongfan.js
├── jd_xqscjd.js
├── jd_xsqjd.js
├── jd_xtg.js
├── jd_year.js
├── jd_yijia.js
├── jd_zd.js
├── jd_zsign.js
├── jx_cashback.js
├── jx_sign_xd.js
├── jx_ttysq.js
├── mengniu.js
├── redrian_user.py
├── reposync.md
├── rush_anjia.js
├── sendNotify.js
└── tencentscf.md
├── config.json
├── githubAction.md
├── icon
├── DD_bot.png
├── Snipaste_2020-08-28_09-31-42.png
├── TG_PUSH1.png
├── TG_PUSH2.png
├── TG_PUSH3.png
├── action1.png
├── action2.png
├── action3.png
├── bark.jpg
├── bean_sign_simple.jpg
├── disable-action.jpg
├── fork.png
├── git1.jpg
├── git10.jpg
├── git11.jpg
├── git12.jpg
├── git13.jpg
├── git14.jpg
├── git2.jpg
├── git3.jpg
├── git4.jpg
├── git5.jpg
├── git6.jpg
├── git7.png
├── git8.jpg
├── git9.jpg
├── iCloud1.png
├── iCloud2.png
├── iCloud3.png
├── iCloud4.png
├── iCloud5.png
├── iCloud6.png
├── iCloud7.png
├── iCloud8.png
├── jd1.jpg
├── jd2.jpg
├── jd3.jpg
├── jd4.jpg
├── jd5.png
├── jd6.png
├── jd7.png
├── jd8.png
├── jd_moneyTree.png
├── jd_pet.png
├── qh1.png
├── qh2.png
├── qh3.png
└── txy.png
├── index.js
├── jdCookie.js
├── jdDreamFactoryShareCodes.js
├── jdFactoryShareCodes.js
├── jdFruitShareCodes.js
├── jdPetShareCodes.js
├── jdPlantBeanShareCodes.js
├── jd_CheckCK.js
├── jd_angryKoi.js
├── jd_babel_sign.js
├── jd_bean_change.js
├── jd_bean_home.js
├── jd_bean_sign.js
├── jd_beauty.js
├── jd_blueCoin.js
├── jd_car.js
├── jd_cash.js
├── jd_ccSign.js
├── jd_cfd.js
├── jd_cfd_hb.js
├── jd_cfd_loop.js
├── jd_cfd_mooncake.js
├── jd_cfd_pearl_ex.js
├── jd_cleancart.js
├── jd_club_lottery.js
├── jd_computer.js
├── jd_connoisseur.js
├── jd_ddly.js
├── jd_dpqd.js
├── jd_dreamFactory.js
├── jd_dwapp.js
├── jd_fan.js
├── jd_fcdyj.js
├── jd_fruit.js
├── jd_get_share_code.js
├── jd_gold_creator.js
├── jd_gold_sign.js
├── jd_health.js
├── jd_health_plant.py
├── jd_jdfactory.js
├── jd_jdtj_winner.js
├── jd_jdzz.js
├── jd_jfcz.js
├── jd_jin_tie.js
├── jd_jmf.js
├── jd_joy_feedPets.js
├── jd_joy_park.js
├── jd_joy_park_task.js
├── jd_joyjd_open.js
├── jd_jxgckc.js
├── jd_jxlhb.js
├── jd_jxmc.js
├── jd_kd.js
├── jd_live.js
├── jd_m_sign.js
├── jd_moneyTree.js
├── jd_moneyTree_help.js
├── jd_ms.js
├── jd_nnfls.js
├── jd_nzmh.js
├── jd_pet.js
├── jd_pigPet.js
├── jd_plantBean.js
├── jd_productZ4Brand.js
├── jd_qqxing.js
├── jd_redrain.js
├── jd_redrain_half.js
├── jd_sddd.js
├── jd_sevenDay.js
├── jd_sgmh.js
├── jd_signFree.js
├── jd_sign_graphics.js
├── jd_speed_redpocke.js
├── jd_speed_sign.js
├── jd_try.js
├── jd_try_notify.py
├── jd_tyt.js
├── jd_unsubscribe.js
├── jd_wish.js
├── jd_wsdlb.js
├── jd_wxgame.js
├── jd_xfxd.js
├── jd_xmf.js
├── jd_z_health_energy.js
├── jd_zdjr.js
├── jd_zjb.js
├── jx_sign.js
├── package.json
├── ql.js
├── sendNotify.js
├── sendNotify.py
├── serverless.yml
└── sign_graphics_validate.js
/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules/
2 | /box.dat
3 | /CookieSet.json
4 | /jdCookie.js
5 | /JD_DailyBonus.js
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## 【青龙】拉取仓库命令:
2 |
3 | #### 可以直链github/国外机:
4 | `ql repo https://github.com/zero205/JD_tencent_scf.git "jd_|jx_|jdCookie" "backUp|icon" "^jd[^_]|USER|sendNotify|sign_graphics_validate|JDJR|JDSign|ql" "main"`
5 |
6 | #### 国内镜像(选一个即可):
7 |
8 | `ql repo https://hub.fastgit.xyz/zero205/JD_tencent_scf.git "jd_|jx_|jdCookie" "backUp|icon" "^jd[^_]|USER|sendNotify|sign_graphics_validate|JDJR|JDSign|ql" "main"`
9 |
10 | `ql repo https://hub.0z.gs/zero205/JD_tencent_scf.git "jd_|jx_|jdCookie" "backUp|icon" "^jd[^_]|USER|sendNotify|sign_graphics_validate|JDJR|JDSign|ql" "main"`
11 |
12 | `ql repo https://hub.shutcm.cf/zero205/JD_tencent_scf.git "jd_|jx_|jdCookie" "backUp|icon" "^jd[^_]|USER|sendNotify|sign_graphics_validate|JDJR|JDSign|ql" "main"`
13 |
14 |
15 | ### (直连/镜像均不可用时,请参照下面使用直连命令并设置代理)
16 |
17 | 设置代理/国内加速:
18 |
19 | 老版青龙(临时解决),需要设置config.sh(如果还有extra.sh的话,也改)中的GithubProxyUrl改为
20 | https://pd.zwc365.com/ 或 https://pd.zwc365.com/cfworker/
21 |
22 | 新版青龙可以改ProxyUrl为自己的科学上网代理,来走自己的代理
23 |
24 | 或者直接将上面两个代理地址追加到url之前来临时解决
25 | `ql repo https://pd.zwc365.com/https://github.com/zero205/JD_tencent_scf.git "jd_|jx_|jdCookie" "backUp|icon" "^jd[^_]|USER|sendNotify|sign_graphics_validate|JDJR|JDSign|ql" "main"``
26 |
27 | [高级用户,可以自己创建自己的cf woker做git代理(注意将cnpmjs设为0)](https://github.com/hunshcn/gh-proxy#cf-worker%E7%89%88%E6%9C%AC%E9%83%A8%E7%BD%B2)
28 |
29 | [或者尝试修改host来尝试直连](https://www.cnblogs.com/jiannanchun/p/15397235.html)
--------------------------------------------------------------------------------
/USER_AGENTS.js:
--------------------------------------------------------------------------------
1 | const USER_AGENTS = []
2 | /**
3 | * 生成随机数字
4 | * @param {number} min 最小值(包含)
5 | * @param {number} max 最大值(不包含)
6 | */
7 | function randomNumber(min = 0, max = 100) {
8 | return Math.min(Math.floor(min + Math.random() * (max - min)), max);
9 | }
10 |
11 | /**
12 | * 得到一个两数之间的随机整数,包括两个数在内
13 | * @param min
14 | * @param max
15 | * @returns {number}
16 | */
17 | function getRandomIntInclusive(min, max) {
18 | min = Math.ceil(min);
19 | max = Math.floor(max);
20 | return Math.floor(Math.random() * (max - min + 1)) + min; //含最大值,含最小值
21 | }
22 | /**
23 | * 生成随机 iPhoneID
24 | * @returns {string}
25 | */
26 | function randPhoneId() {
27 | return Math.random().toString(36).slice(2, 10) +
28 | Math.random().toString(36).slice(2, 10) +
29 | Math.random().toString(36).slice(2, 10) +
30 | Math.random().toString(36).slice(2, 10) +
31 | Math.random().toString(36).slice(2, 10);
32 | }
33 |
34 | const USER_AGENT = `jdapp;iPhone;10.2.0;${Math.ceil(Math.random()*4+10)}.${Math.ceil(Math.random()*4)};${randPhoneId()};network/4g;model/iPhone11,8;addressid/1188016812;appBuild/167724;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS ${getRandomIntInclusive(11, 14)}_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1`;
35 |
36 | module.exports = {
37 | USER_AGENT
38 | }
39 |
--------------------------------------------------------------------------------
/backUp/GetJdCookie.md:
--------------------------------------------------------------------------------
1 | ## 浏览器获取京东cookie教程
2 |
3 | **以下浏览器都行**
4 |
5 | - Chrome浏览器
6 | - 新版Edge浏览器
7 | - 国产360,QQ浏览器切换到极速模式
8 |
9 | ### 操作步骤
10 |
11 | 1. 电脑浏览器打开京东网址 [https://m.jd.com/](https://m.jd.com/)
12 | 2. 按键盘F12键打开开发者工具,然后点下图中的图标
13 | 
14 | 3. 此时是未登录状态(使用手机短信验证码登录),如已登录请忽略此步骤
15 | - 使用手机短信验证码登录(此方式cookie有效时长大概31天,其他登录方式比较短)
16 | 4. 登录后,选择Network,有很多链接的话点箭头这里清空下
17 | 
18 | 5. 然后再点我的,链接就变少了
19 | 
20 | 6. 点第一个链接(log.gif)进去,找到cookie,复制出来,新建一个TXT文本临时保存一下,下面需要用到
21 | 
22 | 7. 第六步复制出来的cookie比较长,我们只需要`pt_pin=xxxx;`和 `pt_key=xxxx;`部分的内容即可(注:英文引号`;`是必要的)。可以用下面的脚本,在Chrome浏览器按F12,console里面输入下面脚本按enter回车键
23 | ```
24 | var CV = '单引号里面放第六步拿到的cookie';
25 | var CookieValue = CV.match(/pt_pin=.+?;/) + CV.match(/pt_key=.+?;/);
26 | copy(CookieValue);
27 | ```
28 | 8. 这样子整理出关键的的cookie已经在你的剪贴板上, 可直接粘贴
29 |
30 | 9. 如果需获取第二个京东账号的cookie,不要在刚才的浏览器上面退出登录账号一(否则刚才获取的cookie会失效),需另外换一个浏览器(Chrome浏览器 `ctr+shift+n` 打开无痕模式也行),然后继续按上面步骤操作即可
31 |
32 |
33 |
--------------------------------------------------------------------------------
/backUp/GetJdCookie2.md:
--------------------------------------------------------------------------------
1 | ## 浏览器插件获取京东cookie教程
2 | > 此教程内容由tg用户@wukongdada提供,特此感谢
3 |
4 | **以下浏览器都行**
5 |
6 | - Chrome浏览器
7 | - 新版Edge浏览器(chrome内核)
8 |
9 | ### 操作步骤
10 |
11 | 1. 电脑浏览器打开京东网址 [https://m.jd.com/](https://m.jd.com/)
12 | 2. Chrome类浏览器安装EditThisCookie插件
13 | - Chrome插件商店搜EditThisCookie, 或者[打开此网站](https://chrome.google.com/webstore/detail/editthiscookie/fngmhnnpilhplaeedifhccceomclgfbg?utm_source=chrome-ntp-icon) 进行安装
14 | - 仅使用百分浏览器,谷歌浏览器测试过,其他谷歌类浏览器请自行测试。
15 | - 无法登录Chrome插件商店或者打不开网址建议使用edge chrome版。
16 | 3. edge chrome浏览器安装Cookie Editor插件
17 | - [edge插件商店](edge://extensions/)搜Cookie Editor,或[打开以下网址](https://microsoftedge.microsoft.com/addons/detail/cookie-editor/ajfboaconbpkglpfanbmlfgojgndmhmc?hl=zh-CN) 完成插件安装
18 | 4. 以下是chrome和edge的相关设置截图,输入的网址是 ``jd.com``
19 |
20 | 
21 |
22 | 
23 |
24 | 5. 现在点击回到京东触屏版,再点击EditThisCookie/Cookie Editor,再点击搜索,输入key或pin,如下图所示的pt_key,复制pt_key的value值。此插件可以看到cookie的有效期。
25 |
26 | 
27 |
28 | 6. 按照以下格式形成自己的jd_cookie
29 | - `pt_key=复制插件搜索出来的key值;pt_pin=复制插件搜索出来的pin值;` ,后面的英文引号`;`是必须要的
30 | - 给一个京东cookie具体示例 `pt_key=jdDC2F833333EFDGTCE5BD4AD1A952D4F4DF84A46052;pt_pin=jd_123456;`
31 |
32 | 7. 如果需获取第二个京东账号的cookie,不要在刚才的浏览器上面退出登录账号一(否则刚才获取的cookie会失效),需另外换一个浏览器(Chrome浏览器 `ctr+shift+n` 打开无痕模式也行),然后继续按上面步骤操作即可
33 |
34 |
35 |
--------------------------------------------------------------------------------
/backUp/GetJdCookie3.md:
--------------------------------------------------------------------------------
1 | # 【浏览器扩展程序】获取京东cookie教程
2 | > 此教程内容由GitHub用户@jinwyp发现,GitHub用户@an0na进行PR,特此感谢
3 |
4 | **以下浏览器都行**
5 |
6 | - Chrome浏览器
7 | - 新版Edge浏览器(chrome内核)
8 |
9 | ## 操作步骤
10 | > 以Chrome浏览器使用做示例
11 |
12 | 1. 下载Chrome浏览器的扩展程序:[jdcookie.zip](https://github.com/jinwyp/tgfcerblock/releases/download/v1.0/jdcookie.zip)
13 | 2. **解压zip文件到**任意文件夹做准备
14 | 3. 打开Chrome浏览器输入**chrome://extensions/** 回车,点击**右上角**开启**开发者模式**, 再点击**左上角**的**加载已解压的扩展程序**按钮,选择之前解压的文件夹即可
15 | 4. 打开[京东页面](https://m.jd.com/), 输入账号密码进行登录
16 | 5. 进入该插件点击**显示Cookie**按钮即可
17 |
18 | ## 截图
19 |
20 | 
21 |
22 | 
23 |
24 | 
25 |
--------------------------------------------------------------------------------
/backUp/JD_extra_cookie.js:
--------------------------------------------------------------------------------
1 | /*
2 | 感谢github@dompling的PR
3 |
4 | Author: 2Ya
5 |
6 | Github: https://github.com/dompling
7 |
8 | ===================
9 | 特别说明:
10 | 1.获取多个京东cookie的脚本,不和NobyDa的京东cookie冲突。
11 | ===================
12 | ===================
13 | 使用方式:在代理软件配置好下方配置后,复制 https://home.m.jd.com/myJd/newhome.action 到浏览器打开 ,在个人中心自动获取 cookie,
14 | 若弹出成功则正常使用。否则继续再此页面继续刷新一下试试
15 | ===================
16 |
17 | ===================
18 | [MITM]
19 | hostname = wq.jd.com
20 |
21 | 【Surge脚本配置】:
22 | ===================
23 | [Script]
24 | 获取京东Cookie = type=http-request,pattern=^https:\/\/wq\.jd\.com\/user_new\/info\/GetJDUserInfoUnion,requires-body=1,max-size=0,script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/JD_extra_cookie.js,script-update-interval=0
25 |
26 | ===================
27 | 【Loon脚本配置】:
28 | ===================
29 | [Script]
30 | http-request https:\/\/wq\.jd\.com\/user_new\/info\/GetJDUserInfoUnion tag=获取京东Cookie, script-path=https://raw.githubusercontent.com/LXK9301/jd_scripts/master/JD_extra_cookie.js
31 |
32 |
33 | ===================
34 | 【 QX 脚本配置 】 :
35 | ===================
36 |
37 | [rewrite_local]
38 | https:\/\/wq\.jd\.com\/user_new\/info\/GetJDUserInfoUnion url script-request-header https://raw.githubusercontent.com/LXK9301/jd_scripts/master/JD_extra_cookie.js
39 |
40 | */
41 |
42 | const APIKey = "CookiesJD";
43 | $ = new API(APIKey, true);
44 | const CacheKey = `#${APIKey}`;
45 | if ($request) GetCookie();
46 |
47 | function getCache() {
48 | var cache = $.read(CacheKey) || "[]";
49 | $.log(cache);
50 | return JSON.parse(cache);
51 | }
52 |
53 | function GetCookie() {
54 | try {
55 | if ($request.headers && $request.url.indexOf("GetJDUserInfoUnion") > -1) {
56 | var CV = $request.headers["Cookie"] || $request.headers["cookie"];
57 | if (CV.match(/(pt_key=.+?pt_pin=|pt_pin=.+?pt_key=)/)) {
58 | var CookieValue = CV.match(/pt_key=.+?;/) + CV.match(/pt_pin=.+?;/);
59 | var UserName = CookieValue.match(/pt_pin=(.+?);/)[1];
60 | var DecodeName = decodeURIComponent(UserName);
61 | var CookiesData = getCache();
62 | var updateCookiesData = [...CookiesData];
63 | var updateIndex;
64 | var CookieName = "【账号】";
65 | var updateCodkie = CookiesData.find((item, index) => {
66 | var ck = item.cookie;
67 | var Account = ck
68 | ? ck.match(/pt_pin=.+?;/)
69 | ? ck.match(/pt_pin=(.+?);/)[1]
70 | : null
71 | : null;
72 | const verify = UserName === Account;
73 | if (verify) {
74 | updateIndex = index;
75 | }
76 | return verify;
77 | });
78 | var tipPrefix = "";
79 | if (updateCodkie) {
80 | updateCookiesData[updateIndex].cookie = CookieValue;
81 | CookieName = `【账号${updateIndex + 1}】`;
82 | tipPrefix = "更新京东";
83 | } else {
84 | updateCookiesData.push({
85 | userName: DecodeName,
86 | cookie: CookieValue,
87 | });
88 | CookieName = "【账号" + updateCookiesData.length + "】";
89 | tipPrefix = "首次写入京东";
90 | }
91 | const cacheValue = JSON.stringify(updateCookiesData, null, "\t");
92 | $.write(cacheValue, CacheKey);
93 | $.notify(
94 | "用户名: " + DecodeName,
95 | "",
96 | tipPrefix + CookieName + "Cookie成功 🎉"
97 | );
98 | } else {
99 | $.notify("写入京东Cookie失败", "", "请查看脚本内说明, 登录网页获取 ‼️");
100 | }
101 | $.done();
102 | return;
103 | } else {
104 | $.notify("写入京东Cookie失败", "", "请检查匹配URL或配置内脚本类型 ‼️");
105 | }
106 | } catch (eor) {
107 | $.write("", CacheKey);
108 | $.notify("写入京东Cookie失败", "", "已尝试清空历史Cookie, 请重试 ⚠️");
109 | console.log(
110 | `\n写入京东Cookie出现错误 ‼️\n${JSON.stringify(
111 | eor
112 | )}\n\n${eor}\n\n${JSON.stringify($request.headers)}\n`
113 | );
114 | }
115 | $.done();
116 | }
117 |
118 | // prettier-ignore
119 | function ENV(){const isQX=typeof $task!=="undefined";const isLoon=typeof $loon!=="undefined";const isSurge=typeof $httpClient!=="undefined"&&!isLoon;const isJSBox=typeof require=="function"&&typeof $jsbox!="undefined";const isNode=typeof require=="function"&&!isJSBox;const isRequest=typeof $request!=="undefined";const isScriptable=typeof importModule!=="undefined";return{isQX,isLoon,isSurge,isNode,isJSBox,isRequest,isScriptable}}
120 | // prettier-ignore
121 | function HTTP(baseURL,defaultOptions={}){const{isQX,isLoon,isSurge,isScriptable,isNode}=ENV();const methods=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"];function send(method,options){options=typeof options==="string"?{url:options}:options;options.url=baseURL?baseURL+options.url:options.url;options={...defaultOptions,...options};const timeout=options.timeout;const events={...{onRequest:()=>{},onResponse:(resp)=>resp,onTimeout:()=>{},},...options.events,};events.onRequest(method,options);let worker;if(isQX){worker=$task.fetch({method,...options})}else if(isLoon||isSurge||isNode){worker=new Promise((resolve,reject)=>{const request=isNode?require("request"):$httpClient;request[method.toLowerCase()](options,(err,response,body)=>{if(err)reject(err);else resolve({statusCode:response.status||response.statusCode,headers:response.headers,body,})})})}else if(isScriptable){const request=new Request(options.url);request.method=method;request.headers=options.headers;request.body=options.body;worker=new Promise((resolve,reject)=>{request.loadString().then((body)=>{resolve({statusCode:request.response.statusCode,headers:request.response.headers,body,})}).catch((err)=>reject(err))})}let timeoutid;const timer=timeout?new Promise((_,reject)=>{timeoutid=setTimeout(()=>{events.onTimeout();return reject(`${method}URL:${options.url}exceeds the timeout ${timeout}ms`)},timeout)}):null;return(timer?Promise.race([timer,worker]).then((res)=>{clearTimeout(timeoutid);return res}):worker).then((resp)=>events.onResponse(resp))}const http={};methods.forEach((method)=>(http[method.toLowerCase()]=(options)=>send(method,options)));return http}
122 | // prettier-ignore
123 | function API(name="untitled",debug=false){const{isQX,isLoon,isSurge,isNode,isJSBox,isScriptable}=ENV();return new(class{constructor(name,debug){this.name=name;this.debug=debug;this.http=HTTP();this.env=ENV();this.node=(()=>{if(isNode){const fs=require("fs");return{fs}}else{return null}})();this.initCache();const delay=(t,v)=>new Promise(function(resolve){setTimeout(resolve.bind(null,v),t)});Promise.prototype.delay=function(t){return this.then(function(v){return delay(t,v)})}}initCache(){if(isQX)this.cache=JSON.parse($prefs.valueForKey(this.name)||"{}");if(isLoon||isSurge)this.cache=JSON.parse($persistentStore.read(this.name)||"{}");if(isNode){let fpath="root.json";if(!this.node.fs.existsSync(fpath)){this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"wx"},(err)=>console.log(err))}this.root={};fpath=`${this.name}.json`;if(!this.node.fs.existsSync(fpath)){this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"wx"},(err)=>console.log(err));this.cache={}}else{this.cache=JSON.parse(this.node.fs.readFileSync(`${this.name}.json`))}}}persistCache(){const data=JSON.stringify(this.cache);if(isQX)$prefs.setValueForKey(data,this.name);if(isLoon||isSurge)$persistentStore.write(data,this.name);if(isNode){this.node.fs.writeFileSync(`${this.name}.json`,data,{flag:"w"},(err)=>console.log(err));this.node.fs.writeFileSync("root.json",JSON.stringify(this.root),{flag:"w"},(err)=>console.log(err))}}write(data,key){this.log(`SET ${key}`);if(key.indexOf("#")!==-1){key=key.substr(1);if(isSurge||isLoon){return $persistentStore.write(data,key)}if(isQX){return $prefs.setValueForKey(data,key)}if(isNode){this.root[key]=data}}else{this.cache[key]=data}this.persistCache()}read(key){this.log(`READ ${key}`);if(key.indexOf("#")!==-1){key=key.substr(1);if(isSurge||isLoon){return $persistentStore.read(key)}if(isQX){return $prefs.valueForKey(key)}if(isNode){return this.root[key]}}else{return this.cache[key]}}delete(key){this.log(`DELETE ${key}`);if(key.indexOf("#")!==-1){key=key.substr(1);if(isSurge||isLoon){$persistentStore.write(null,key)}if(isQX){$prefs.removeValueForKey(key)}if(isNode){delete this.root[key]}}else{delete this.cache[key]}this.persistCache()}notify(title,subtitle="",content="",options={}){const openURL=options["open-url"];const mediaURL=options["media-url"];if(isQX)$notify(title,subtitle,content,options);if(isSurge){$notification.post(title,subtitle,content+`${mediaURL?"\n多媒体:"+mediaURL:""}`,{url:openURL})}if(isLoon){let opts={};if(openURL)opts["openUrl"]=openURL;if(mediaURL)opts["mediaUrl"]=mediaURL;if(JSON.stringify(opts)=="{}"){$notification.post(title,subtitle,content)}else{$notification.post(title,subtitle,content,opts)}}if(isNode||isScriptable){const content_=content+(openURL?`\n点击跳转:${openURL}`:"")+(mediaURL?`\n多媒体:${mediaURL}`:"");if(isJSBox){const push=require("push");push.schedule({title:title,body:(subtitle?subtitle+"\n":"")+content_,})}else{console.log(`${title}\n${subtitle}\n${content_}\n\n`)}}}log(msg){if(this.debug)console.log(msg)}info(msg){console.log(msg)}error(msg){console.log("ERROR: "+msg)}wait(millisec){return new Promise((resolve)=>setTimeout(resolve,millisec))}done(value={}){if(isQX||isLoon||isSurge){$done(value)}else if(isNode&&!isJSBox){if(typeof $context!=="undefined"){$context.headers=value.headers;$context.statusCode=value.statusCode;$context.body=value.body}}}})(name,debug)}
124 |
--------------------------------------------------------------------------------
/backUp/README.md:
--------------------------------------------------------------------------------
1 | ## 禁止Star/Fork!!
2 | ## 请勿使用Action运行脚本!
3 | ## 有条(科学)件(上网)的可以 [点此加入组织](https://t.me/jd_zero_205)
4 |
5 | ## 本仓库部分脚本已加入JDHelloWorld大佬助力池,默认加入助力池互助
6 | ## 由于限制TG群内成员提交助力码,请需要互助的 [加入组织](https://t.me/jd_zero_205),获取使用[教程](https://t.me/jd_zero205_tz/53)
7 | ## 不需要助力池请添加环境变量,变量名:`JD_JOIN_ZLC`,变量值:`false`
8 |
9 | ## 请勿直接fork!!云函数用户先按照下方教程建立私库!!!
10 | ## 已经创建公开仓库的请点击仓库右上角`Setting`,拉到页面最下方,点击`Change visibility`,选择`Make private`,填入黑体仓库名称进行确认!
11 |
12 | ## 使用教程
13 |
14 | ### 【青龙】拉取仓库命令:
15 | 可以直链github/国外机:`ql repo https://github.com/zero205/JD_tencent_scf.git "jd_|jx_|jdCookie" "backUp|icon" "^jd[^_]|USER|sendNotify|sign_graphics_validate|JDJR|JDSign|ql" "main"`
16 |
17 | 国内镜像(部分人不可用):
18 |
19 | `ql repo https://github.com.cnpmjs.org/zero205/JD_tencent_scf.git "jd_|jx_|jdCookie" "backUp|icon" "^jd[^_]|USER|sendNotify|sign_graphics_validate|JDJR|JDSign|ql" "main"`
20 |
21 | (直连/镜像均不可用时,请参照下面使用直连命令并设置代理)
22 |
23 | 设置代理/国内加速:
24 |
25 | 老版青龙(临时解决),需要设置config.sh(如果还有extra.sh的话,也改)中的GithubProxyUrl改为
26 | https://pd.zwc365.com/ 或 https://pd.zwc365.com/cfworker/
27 |
28 | 新版青龙可以改ProxyUrl为自己的科学上网代理,来走自己的代理
29 |
30 | 或者直接将上面两个代理地址追加到url之前来临时解决
31 | `ql repo https://pd.zwc365.com/https://github.com/zero205/JD_tencent_scf.git "jd_|jx_|jdCookie" "backUp|icon" "^jd[^_]|USER|sendNotify|sign_graphics_validate|JDJR|JDSign|ql" "main"``
32 |
33 | [高级用户,可以自己创建自己的cf woker做git代理(注意将cnpmjs设为0)](https://github.com/hunshcn/gh-proxy#cf-worker%E7%89%88%E6%9C%AC%E9%83%A8%E7%BD%B2)
34 |
35 | [或者尝试修改host来尝试直连](https://www.cnblogs.com/jiannanchun/p/15397235.html)
36 |
37 | ### 腾讯云函数部署建议阅读@hshx123大佬的[教程](https://杏铃.top/teach/jd.html)【推荐】.[旧教程](./backUp/tencentscf.md)【备用】
38 |
39 | ### [elecV2P](https://github.com/elecV2/elecV2P) 部署【随缘维护,建议转战➟[Docker](https://www.runoob.com/docker/windows-docker-install.html) [青龙](https://github.com/whyour/qinglong)】
40 | * 安装教程:[点此查看](https://github.com/elecV2/elecV2P-dei/blob/master/docs/01-overview.md)
41 | * 订阅任务:`https://ghproxy.com/https://raw.githubusercontent.com/zero205/JD_tencent_scf/main/jd_task.json`
42 | * elecV2P京东CK、通知填写格式等相关补充说明:[点此查看](./backUp/elecV2P.md)
43 |
44 | ### 获取京东cookie教程可参考:
45 |
46 | + [浏览器获取京东cookie教程](./backUp/GetJdCookie.md)
47 |
48 | + [插件获取京东cookie教程](./backUp/GetJdCookie2.md)
49 |
50 | + [浏览器扩展程序获取京东cookie教程](./backUp/GetJdCookie3.md)
51 |
52 | ## 特别声明:
53 |
54 | * 本仓库发布的Script项目中涉及的任何解锁和解密分析脚本,仅用于测试和学习研究,禁止用于商业用途,不能保证其合法性,准确性,完整性和有效性,请根据情况自行判断.
55 |
56 | * 本项目内所有资源文件,禁止任何公众号、自媒体进行任何形式的转载、发布。
57 |
58 | * lxk0301对任何脚本问题概不负责,包括但不限于由任何脚本错误导致的任何损失或损害.
59 |
60 | * 间接使用脚本的任何用户,包括但不限于建立VPS或在某些行为违反国家/地区法律或相关法规的情况下进行传播, lxk0301 对于由此引起的任何隐私泄漏或其他后果概不负责.
61 |
62 | * 请勿将Script项目的任何内容用于商业或非法目的,否则后果自负.
63 |
64 | * 如果任何单位或个人认为该项目的脚本可能涉嫌侵犯其权利,则应及时通知并提供身份证明,所有权证明,我们将在收到认证文件后删除相关脚本.
65 |
66 | * 任何以任何方式查看此项目的人或直接或间接使用该Script项目的任何脚本的使用者都应仔细阅读此声明。lxk0301 保留随时更改或补充此免责声明的权利。一旦使用并复制了任何相关脚本或Script项目的规则,则视为您已接受此免责声明.
67 |
68 | **您必须在下载后的24小时内从计算机或手机中完全删除以上内容.**
69 | > ***您使用或者复制了本仓库且本人制作的任何脚本,则视为`已接受`此声明,请仔细阅读***
70 |
71 | ## 环境变量
72 | - [环境变量集合](./githubAction.md)
73 |
74 | ## 特别感谢(排名不分先后):
75 |
76 |
77 | * [@NobyDa](https://github.com/NobyDa)
78 |
79 | * [@chavyleung](https://github.com/chavyleung)
80 |
81 | * [@liuxiaoyucc](https://github.com/liuxiaoyucc)
82 |
83 | * [@Zero-S1](https://github.com/Zero-S1)
84 |
85 | * [@uniqueque](https://github.com/uniqueque)
86 |
87 | * [@nzw9314](https://github.com/nzw9314)
88 |
89 | * [@JDHelloWorld](https://github.com/JDHelloWorld)
90 |
91 | * [@smiek2221](https://github.com/smiek2221)
92 |
93 | * [@star261](https://github.com/star261)
94 |
95 | * [@Wenmoux](https://github.com/Wenmoux)
96 |
97 | * [@Tsukasa007](https://github.com/Tsukasa007)
98 |
99 | * [@Aaron](https://github.com/Aaron)
100 |
--------------------------------------------------------------------------------
/backUp/TG_PUSH.md:
--------------------------------------------------------------------------------
1 | **TG_PUSH教程**
2 |
3 | 利用Telegram机器人推送通知,需要在环境变量填入正确的```TG_BOT_TOKEN```以及```TG_USER_ID```,以下教程简明阐述如何获取token以及UserID
4 |
5 | Ⅰ.首先在Telegram上搜索[BotFather](https://t.me/BotFather)机器人
6 |
7 | 
8 |
9 | Ⅱ.利用[BotFather](https://t.me/BotFather)创建一个属于自己的通知机器人,按照下图中的1、2、3步骤拿到token,格式形如```10xxx4:AAFcqxxxxgER5uw```。填入```TG_BOT_TOKEN```
10 |
11 | 
12 |
13 | **新创建的机器人需要跟它发一条消息来开启对话,否则可能会遇到secret填对了但是收不到消息的情况**
14 |
15 | Ⅲ.再次在Telegram上搜索[getuserIDbot](https://t.me/getuserIDbot)机器人,获取UserID。填入```TG_USER_ID```
16 |
17 | 
18 |
19 | 至此,获取**TG_BOT_TOKEN**以及**TG_USER_ID**的教程结束
20 |
--------------------------------------------------------------------------------
/backUp/aclog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/backUp/aclog.png
--------------------------------------------------------------------------------
/backUp/elecV2P.md:
--------------------------------------------------------------------------------
1 | #### elecV2P 环境变量使用说明
2 | * 1.以京东CK为例,登录elecV2P后台(默认地址:127.0.0.1:80)
3 | * 2.选择`JSMANAGE`,key填`CookiesJD`,下面空白处即value值按下面的格式填写,多账号以此类推,自行删减。
4 | ```bash
5 | [
6 | {
7 | "userName": "jd_5bbxxx414",
8 | "cookie": "pt_key=xxx;pt_pin=jd_5xxx414;"
9 | },
10 | {
11 | "userName": "jd_739xxx89e",
12 | "cookie": "pt_key=xxx;pt_pin=jd_739xxx89e;"
13 | },
14 | {
15 | "userName": "jd_413xxxe89",
16 | "cookie": "pt_key=xxx;pt_pin=jd_413xxxe89;"
17 | }
18 | ]
19 | ```
20 | * 其他环境变量按正常填写即可
21 | #### elecV2P 京东任务订阅地址
22 | `https://raw.githubusercontent.com/zero205/JD_tencent_scf/main/jd_task.json`
23 | #### 订阅地址使用说明
24 | * 登录elecV2P后台,选择`TASK`,选择添加订阅任务,输入上面的订阅地址,点击获取内容,点击全部添加即可
25 |
26 | #### elecV2P 通知方式
27 | * [点此查看](https://github.com/zero205/JD_tencent_scf/issues/15)
28 |
--------------------------------------------------------------------------------
/backUp/jdJxncShareCodes.js:
--------------------------------------------------------------------------------
1 | /*
2 | 京喜农场助力码
3 | 此助力码要求种子 active 相同才能助力,多个账号的话可以种植同样的种子,如果种子不同的话,会自动跳过使用云端助力
4 | 此文件为Node.js专用。其他用户请忽略
5 | 支持京东N个账号
6 | */
7 | //云服务器腾讯云函数等NOde.js用户在此处填写京京喜农场的好友码。
8 | // 同一个京东账号的好友助力码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例
9 | // 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2
10 | let JxncShareCodes = [
11 | '{"smp":"f6611d***9cdd31012ead697f***b30af***29","active":"jdnc_1_1yuanguazi21030***_2","joinnum":1}',//账号一的好友shareCode,不同好友中间用@符号隔开
12 | '{"smp":"f6611d***9cdd31012ead697f***b30af***29","active":"jdnc_1_1yuanguazi21030***_2","joinnum":1}',//账号二的好友shareCode,不同好友中间用@符号隔开
13 | ]
14 | // 判断github action里面是否有京喜农场助力码
15 | if (process.env.JXNC_SHARECODES) {
16 | if (process.env.JXNC_SHARECODES.indexOf('&') > -1) {
17 | console.log(`您的京喜农场助力码选择的是用&隔开\n`)
18 | JxncShareCodes = process.env.JXNC_SHARECODES.split('&');
19 | } else if (process.env.JXNC_SHARECODES.indexOf('\n') > -1) {
20 | console.log(`您的京喜农场助力码选择的是用换行隔开\n`)
21 | JxncShareCodes = process.env.JXNC_SHARECODES.split('\n');
22 | } else {
23 | JxncShareCodes = process.env.JXNC_SHARECODES.split();
24 | }
25 | } else if (process.env.JD_COOKIE) {
26 | // console.log(`由于您secret里面未提供助力码,故此处运行将会给脚本内置的码进行助力,请知晓!`)
27 | }
28 | for (let i = 0; i < JxncShareCodes.length; i++) {
29 | const index = (i + 1 === 1) ? '' : (i + 1);
30 | exports['JxncShareCode' + index] = JxncShareCodes[i];
31 | }
32 |
--------------------------------------------------------------------------------
/backUp/jdJxncTokens.js:
--------------------------------------------------------------------------------
1 | /*
2 | 京喜农场 Tokens
3 | 此文件为Node.js专用。其他用户请忽略
4 | 支持京东N个账号
5 | */
6 | // 每个账号 token 是一个 json,示例如下
7 | // {"farm_jstoken":"749a90f871adsfads8ffda7bf3b1576760","timestamp":"1610165423873","phoneid":"42c7e3dadfadsfdsaac-18f0e4f4a0cf"}
8 | let JxncTokens = [
9 | '',//账号一的京喜农场token
10 | '',//账号二的京喜农场token
11 | ]
12 | // 判断github action里面是否有京喜农场 token
13 | if (process.env.JXNCTOKENS) {
14 | if (process.env.JXNCTOKENS.indexOf('&') > -1) {
15 | console.log(`您的京喜农场 token 选择的是用&隔开\n`)
16 | JxncTokens = process.env.JXNCTOKENS.split('&');
17 | } else if (process.env.JXNCTOKENS.indexOf('\n') > -1) {
18 | console.log(`您的京喜农场 token 选择的是用换行隔开\n`)
19 | JxncTokens = process.env.JXNCTOKENS.split('\n');
20 | } else {
21 | JxncTokens = process.env.JXNCTOKENS.split();
22 | }
23 | } else if (process.env.JD_COOKIE) {
24 | console.log(`由于您secret里面未提供 tokens,当种植 APP 种子时,将不能正常进行任务,请提供 token 或 种植非 APP 种子!`)
25 | }
26 | for (let i = 0; i < JxncTokens.length; i++) {
27 | const index = (i + 1 === 1) ? '' : (i + 1);
28 | exports['JXNCTOKEN' + index] = JxncTokens[i];
29 | }
30 |
--------------------------------------------------------------------------------
/backUp/jd_btdraw.py:
--------------------------------------------------------------------------------
1 | # -*- coding:utf-8 -*-
2 | #pip install PyExecJS
3 |
4 |
5 | """
6 | cron: 23 10 * * *
7 | new Env('京东金融天天试手气');
8 | """
9 |
10 |
11 | import requests
12 | import json
13 | import time
14 | import os
15 | import re
16 | import sys
17 | import random
18 | import string
19 | import urllib
20 |
21 | try:
22 | import execjs
23 | except:
24 | print('缺少依赖文件PyExecJS,请先去Python3安装PyExecJS后再执行')
25 | sys.exit(0)
26 |
27 | def printf(text):
28 | print(text)
29 | sys.stdout.flush()
30 |
31 | def load_send():
32 | global send
33 | cur_path = os.path.abspath(os.path.dirname(__file__))
34 | sys.path.append(cur_path)
35 | if os.path.exists(cur_path + "/sendNotify.py"):
36 | try:
37 | from sendNotify import send
38 | except:
39 | send=False
40 | printf("加载通知服务失败~")
41 | else:
42 | send=False
43 | printf("加载通知服务失败~")
44 | load_send()
45 |
46 | def get_remarkinfo():
47 | url='http://127.0.0.1:5600/api/envs'
48 | try:
49 | with open('/ql/config/auth.json', 'r') as f:
50 | token=json.loads(f.read())['token']
51 | headers={
52 | 'Accept':'application/json',
53 | 'authorization':'Bearer '+token,
54 | }
55 | response=requests.get(url=url,headers=headers)
56 |
57 | for i in range(len(json.loads(response.text)['data'])):
58 | if json.loads(response.text)['data'][i]['name']=='JD_COOKIE':
59 | try:
60 | if json.loads(response.text)['data'][i]['remarks'].find('@@')==-1:
61 | remarkinfos[json.loads(response.text)['data'][i]['value'].split(';')[1].replace('pt_pin=','')]=json.loads(response.text)['data'][i]['remarks'].replace('remark=','')
62 | else:
63 | remarkinfos[json.loads(response.text)['data'][i]['value'].split(';')[1].replace('pt_pin=','')]=json.loads(response.text)['data'][i]['remarks'].split("@@")[0].replace('remark=','').replace(';','')
64 | except:
65 | pass
66 | except:
67 | printf('读取auth.json文件出错,跳过获取备注')
68 |
69 | def randomuserAgent():
70 | global uuid,addressid,iosVer,iosV,clientVersion,iPhone,area,ADID,lng,lat
71 | uuid=''.join(random.sample(['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','a','b','c','z'], 40))
72 | addressid = ''.join(random.sample('1234567898647', 10))
73 | iosVer = ''.join(random.sample(["15.1.1","14.5.1", "14.4", "14.3", "14.2", "14.1", "14.0.1"], 1))
74 | iosV = iosVer.replace('.', '_')
75 | clientVersion=''.join(random.sample(["10.3.0", "10.2.7", "10.2.4"], 1))
76 | iPhone = ''.join(random.sample(["8", "9", "10", "11", "12", "13"], 1))
77 | area=''.join(random.sample('0123456789', 2)) + '_' + ''.join(random.sample('0123456789', 4)) + '_' + ''.join(random.sample('0123456789', 5)) + '_' + ''.join(random.sample('0123456789', 4))
78 | ADID = ''.join(random.sample('0987654321ABCDEF', 8)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 12))
79 | lng='119.31991256596'+str(random.randint(100,999))
80 | lat='26.1187118976'+str(random.randint(100,999))
81 | UserAgent=''
82 | if not UserAgent:
83 | return f'jdapp;iPhone;10.0.4;{iosVer};{uuid};network/wifi;ADID/{ADID};model/iPhone{iPhone},1;addressid/{addressid};appBuild/167707;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS {iosV} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/null;supportJDSHWK/1'
84 | else:
85 | return UserAgent
86 |
87 | def JDSignValidator(url):
88 | with open('JDSignValidator.js', 'r', encoding='utf-8') as f:
89 | jstext = f.read()
90 | js = execjs.compile(jstext)
91 | result = js.call('getBody', url)
92 | fp=result['fp']
93 | a=result['a']
94 | d=result['d']
95 | return fp,a,d
96 |
97 |
98 | def geteid(a,d):
99 | url=f'https://gia.jd.com/fcf.html?a={a}'
100 | data=f'&d={d}'
101 | headers={
102 | 'Host':'gia.jd.com',
103 | 'Content-Type':'application/x-www-form-urlencoded;charset=UTF-8',
104 | 'Origin':'https://jrmkt.jd.com',
105 | 'Accept-Encoding':'gzip, deflate, br',
106 | 'Connection':'keep-alive',
107 | 'Accept':'*/*',
108 | 'User-Agent':UserAgent,
109 | 'Referer':'https://jrmkt.jd.com/',
110 | 'Content-Length':'376',
111 | 'Accept-Language':'zh-CN,zh-Hans;q=0.9',
112 | }
113 | response=requests.post(url=url,headers=headers,data=data)
114 | return response.text
115 |
116 | def draw(activityid,eid,fp):
117 | global sendNotifyflag
118 | global prizeAward
119 | sendNotifyflag=False
120 | prizeAward=0
121 | url='https://jrmkt.jd.com/activity/newPageTake/takePrize'
122 | data=f'activityId={activityid}&eid={eid}&fp={fp}'
123 | headers={
124 | 'Host':'jrmkt.jd.com',
125 | 'Accept':'application/json, text/javascript, */*; q=0.01',
126 | 'X-Requested-With':'XMLHttpRequest',
127 | 'Accept-Language':'zh-CN,zh-Hans;q=0.9',
128 | 'Accept-Encoding':'gzip, deflate, br',
129 | 'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8',
130 | 'Origin':'https://jrmkt.jd.com',
131 | 'User-Agent':UserAgent,
132 | 'Connection':'keep-alive',
133 | 'Referer':'https://jrmkt.jd.com/ptp/wl/vouchers.html?activityId=Q029794F612c2E2O1D2a0N161v0Z2i2s9nJ&jrcontainer=h5&jrlogin=true&jrcloseweb=false',
134 | 'Content-Length':str(len(data)),
135 | 'Cookie':ck
136 | }
137 | response=requests.post(url=url,headers=headers,data=data)
138 | try:
139 | if json.loads(response.text)['prizeModels'][0]['prizeAward'].find('元')!=-1:
140 | printf('获得'+json.loads(response.text)['prizeModels'][0]['useLimit']+'的'+json.loads(response.text)['prizeModels'][0]['prizeName']+'\n金额:'+json.loads(response.text)['prizeModels'][0]['prizeAward']+'\n有效期:'+json.loads(response.text)['prizeModels'][0]['validTime']+'\n\n')
141 | if int((json.loads(response.text)['prizeModels'][0]['prizeAward']).replace('.00元',''))>=5:
142 | prizeAward=json.loads(response.text)['prizeModels'][0]['prizeAward']
143 | sendNotifyflag=True
144 | if json.loads(response.text)['prizeModels'][0]['prizeAward'].find('期')!=-1:
145 | printf(response.text)
146 | send('抽到白条分期券','去看日志')
147 | except:
148 | printf('出错啦,出错原因为:'+json.loads(response.text)['failDesc']+'\n\n')
149 |
150 | time.sleep(5)
151 |
152 | if __name__ == '__main__':
153 | printf('游戏入口:京东金融-白条-天天试手气\n')
154 | remarkinfos={}
155 | get_remarkinfo()
156 | try:
157 | cks = os.environ["JD_COOKIE"].split("&")
158 | except:
159 | f = open("/jd/config/config.sh", "r", encoding='utf-8')
160 | cks = re.findall(r'Cookie[0-9]*="(pt_key=.*?;pt_pin=.*?;)"', f.read())
161 | f.close()
162 | for ck in cks:
163 | ck = ck.strip()
164 | if ck[-1] != ';':
165 | ck += ';'
166 | ptpin = re.findall(r"pt_pin=(.*?);", ck)[0]
167 | try:
168 | if remarkinfos[ptpin]!='':
169 | printf("--账号:" + remarkinfos[ptpin] + "--")
170 | username=remarkinfos[ptpin]
171 | else:
172 | printf("--无备注账号:" + urllib.parse.unquote(ptpin) + "--")
173 | username=urllib.parse.unquote(ptpin)
174 | except:
175 | printf("--账号:" + urllib.parse.unquote(ptpin) + "--")
176 | username=urllib.parse.unquote(ptpin)
177 | UserAgent=randomuserAgent()
178 | info=JDSignValidator('https://prodev.m.jd.com/mall/active/498THTs5KGNqK5nEaingGsKEi6Ao/index.html')
179 | eid=json.loads(geteid(info[1],info[2]).split('_*')[1])['eid']
180 | fp=info[0]
181 | draw('Q029794F612c2E2O1D2a0N161v0Z2i2s9nJ',eid,fp)
182 | if sendNotifyflag:
183 | send('京东白条抽奖通知',username+'抽到'+str(prizeAward)+'的优惠券了,速去京东金融-白条-天天试手气查看')
184 |
--------------------------------------------------------------------------------
/backUp/jd_getred.py:
--------------------------------------------------------------------------------
1 | """
2 | const $ = new Env("统计东哥历史红包");
3 | 统计东哥历史红包
4 | """
5 |
6 | import requests
7 | import sys
8 | import re
9 | import time
10 | import os
11 |
12 |
13 | def gettimestamp():
14 | return str(int(time.time() * 1000))
15 |
16 |
17 | def printf(text):
18 | print(text)
19 | sys.stdout.flush()
20 |
21 |
22 | def getinfo(ck):
23 | isNext = True
24 | page = 1
25 | sum = 0
26 | usedsum = 0
27 | jxsum = 0
28 | usedjx = 0
29 | litesum = 0
30 | usedlite = 0
31 | healthsum = 0
32 | usedhealth = 0
33 | jdsum = 0
34 | usedjd = 0
35 | tysum = 0
36 | usedty = 0
37 | count = 0
38 | redinfo = []
39 | while isNext:
40 | url = "https://wq.jd.com/user/info/QueryUserRedEnvelopesV2?type=2&orgFlag=JD_PinGou_New&page=%s&cashRedType=1&redBalanceFlag=0&channel=3&_=%s&sceneval=2&g_login_type=1&g_ty=ls" % (
41 | page, gettimestamp())
42 | headers = {
43 | 'accept': '*/*',
44 | 'accept-encoding': 'gzip, deflate, br',
45 | 'accept-language': 'zh-CN,zh;q=0.9',
46 | 'dnt': '1',
47 | 'referer': 'https://wqs.jd.com/',
48 | 'sec-fetch-dest': 'script',
49 | 'sec-fetch-mode': 'no-cors',
50 | 'sec-fetch-site': 'same-site',
51 | 'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1',
52 | 'cookie': ck
53 | }
54 | r = requests.get(url, headers=headers).json()
55 | if r['data']['unUseRedInfo']['redList'] == None:
56 | print('最近六个月累计红包总数', count, '累计红包总额 %.2f元' % sum, '已使用红包总额 %.2f元\n' % usedsum)
57 | print(
58 | '其中:\n京东商城:总金额%.2f元\t已使用:%.2f元\n京喜:总金额%.2f元\t已使用:%.2f元\n极速版:总金额%.2f元\t已使用:%.2f元\n京东健康:总金额%.2f元\t已使用:%.2f元\n通用红包:总金额%.2f元\t已使用:%.2f元\n' % (
59 | jdsum, usedjd, jxsum, usedjx, litesum, usedlite, healthsum, usedhealth, tysum, usedty))
60 | print('所有红包统计:')
61 | for i in redinfo:
62 | print('%s\t总计%s个\t总金额%.2f元\t已使用%.2f元' % (i[0], i[1], i[2], i[3]))
63 | isNext = False
64 | else:
65 | page += 1
66 | count = r['data']['unUseRedInfo']['count']
67 | for i in r['data']['unUseRedInfo']['redList']:
68 | sum += float(i['discount'])
69 | usedsum += (float(i['discount']) - float(i['balance']))
70 | if "京喜" in i['orgLimitStr']:
71 | jxsum += float(i['discount'])
72 | usedjx += (float(i['discount']) - float(i['balance']))
73 | elif "极速" in i['orgLimitStr']:
74 | litesum += float(i['discount'])
75 | usedlite += (float(i['discount']) - float(i['balance']))
76 | elif "健康" in i['orgLimitStr']:
77 | healthsum += float(i['discount'])
78 | usedhealth += (float(i['discount']) - float(i['balance']))
79 | elif "京东商城" in i['orgLimitStr']:
80 | jdsum += float(i['discount'])
81 | usedjd += (float(i['discount']) - float(i['balance']))
82 | else:
83 | tysum += float(i['discount'])
84 | usedty += (float(i['discount']) - float(i['balance']))
85 | isExist = 0
86 | activityName = i['activityName']
87 | for ii in redinfo:
88 | if ii[0] == activityName:
89 | isExist = 1
90 | ii[1] += 1
91 | ii[2] += float(i['discount'])
92 | ii[3] += float(i['discount']) - float(i['balance'])
93 | break
94 | if isExist == 0:
95 | temp = [activityName, 1, float(i['discount']), float(i['discount']) - float(i['balance'])]
96 | redinfo.append(temp)
97 | time.sleep(0.2)
98 |
99 |
100 | if __name__ == '__main__':
101 | try:
102 | cks = os.environ["JD_COOKIE"].split("&")
103 | except:
104 | f = open("/jd/config/config.sh", "r", encoding='utf-8')
105 | cks = re.findall(r'Cookie[0-9]*="(pt_key=.*?;pt_pin=.*?;)"', f.read())
106 | f.close()
107 | for ck in cks:
108 | ptpin = re.findall(r"pt_pin=(.*?);", ck)[0]
109 | printf("\n--------开始京东账号" + ptpin + "--------\n")
110 | try:
111 | getinfo(ck)
112 | except:
113 | print("发生异常错误")
114 |
--------------------------------------------------------------------------------
/backUp/jd_hb_a.js:
--------------------------------------------------------------------------------
1 | /**
2 | 开新红包
3 | 入口:https://u.jd.com/YLvI6zb
4 | cron 10 0,12 * * * jd_hb_a.js
5 | TG频道:https://t.me/sheeplost
6 | */
7 | const $ = new Env('开新红包');
8 | const notify = $.isNode() ? require('./sendNotify') : '';
9 | //Node.js用户请在jdCookie.js处填写京东ck;
10 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
11 | //IOS等用户直接用NobyDa的jd cookie
12 | let cookiesArr = [], cookie = '';
13 | if ($.isNode()) {
14 | Object.keys(jdCookieNode).forEach((item) => {
15 | cookiesArr.push(jdCookieNode[item])
16 | });
17 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => { };
18 | } else {
19 | let cookiesData = $.getdata('CookiesJD') || "[]";
20 | cookiesData = jsonParse(cookiesData);
21 | cookiesArr = cookiesData.map(item => item.cookie);
22 | cookiesArr.reverse();
23 | cookiesArr.push(...[$.getdata('CookieJD2'), $.getdata('CookieJD')]);
24 | cookiesArr.reverse();
25 | cookiesArr = cookiesArr.filter(item => item !== "" && item !== null && item !== undefined);
26 | }
27 | !(async () => {
28 | if (!cookiesArr[0]) {
29 | $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', { "open-url": "https://bean.m.jd.com/bean/signIndex.action" });
30 | return;
31 | }
32 | for (let i = 0; i < cookiesArr.length; i++) {
33 | 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`;
34 | if (cookiesArr[i]) {
35 | cookie = cookiesArr[i];
36 | $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
37 | $.index = i + 1;
38 | $.isLogin = true;
39 | $.nickName = '';
40 | await TotalBean();
41 | console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`);
42 | if (!$.isLogin) {
43 | $.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" });
44 |
45 | if ($.isNode()) {
46 | await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
47 | }
48 | continue
49 | }
50 | lng = '30.' + random(99999999999999, 10000000000000);
51 | lat = '114.' + random(99999999999999, 10000000000000);
52 | await main();
53 | }
54 | }
55 | })().catch((e) => { $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') }).finally(() => { $.done(); })
56 |
57 | async function main() {
58 | let hbInfo = await task()
59 | if (hbInfo.code === "0") {
60 | if (hbInfo.subCode === "0") {
61 | console.log(JSON.stringify(hbInfo.rewardsInfo));
62 | } else if (hbInfo.subCode === "103") {
63 | console.log(hbInfo.msg);
64 | } else {
65 | console.log(hbInfo);
66 | }
67 | }
68 | }
69 | function task() {
70 | let opt = {
71 | url: `https://api.m.jd.com/client.action?uuid=${uuidRandom()}&client=wh5&clientVersion=1.0.0&osVersion=13.5&networkType=wifi&ext=${encodeURIComponent({ "prstate": "0" })}&area=19_1627_37865_37880&appid=content_ecology&functionId=doInteractiveAssignment&t=${new Date().getTime()}&body=${encodeURIComponent(JSON.stringify({ "geo": { "lng": lng, "lat": lat }, "mcChannel": 0, "encryptProjectId": "2WEk1DXkbrknieahiCPVMsrrVKq3", "encryptAssignmentId": "35dfnpBFXKYUgYPoESEDTa2Fkpha", "sourceCode": "aceacesy20211202", "itemId": "", "actionType": "", "completionFlag": true }))}`,
72 | headers: {
73 | "Host": "api.m.jd.com",
74 | "Origin": "https://prodev.m.jd.com",
75 | "Cookie": cookie,
76 | "Content-Length": "0",
77 | "Connection": "keep-alive",
78 | "Accept": "application/json, text/plain, */*",
79 | "User-Agent": UA,
80 | "Accept-Language": "zh-cn",
81 | "Referer": "https://prodev.m.jd.com/mall/active/3EiRJz64mjsqY44PinYgmNTrQMfD/index.html",
82 | "Accept-Encoding": "gzip, deflate, br",
83 | "Content-Type": "text/plain",
84 | },
85 | }
86 | return new Promise(resolve => {
87 | $.post(opt, (err, resp, data) => {
88 | try {
89 | if (err) {
90 | console.log(err)
91 | } else {
92 | if (data) {
93 | data = JSON.parse(data);
94 | } else {
95 | $.log("API返回了空数据")
96 | }
97 | }
98 | } catch (e) {
99 | $.logErr(e, resp)
100 | } finally {
101 | resolve(data);
102 | }
103 | })
104 | })
105 | }
106 | function uuidRandom() {
107 | return Math.random().toString(16).slice(2, 10) +
108 | Math.random().toString(16).slice(2, 10) +
109 | Math.random().toString(16).slice(2, 10) +
110 | Math.random().toString(16).slice(2, 10) +
111 | Math.random().toString(16).slice(2, 10);
112 | }
113 | function random(min, max) {
114 | return Math.floor(Math.random() * (max - min)) + min;
115 | }
116 | function TotalBean() { return new Promise(async e => { const n = { url: "https://wq.jd.com/user_new/info/GetJDUserInfoUnion?sceneval=2", headers: { Host: "wq.jd.com", Accept: "*/*", Connection: "keep-alive", Cookie: cookie, "User-Agent": UA, "Accept-Language": "zh-cn", Referer: "https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&", "Accept-Encoding": "gzip, deflate, br" } }; $.get(n, (n, o, a) => { try { if (n) $.logErr(n); else if (a) { if (1001 === (a = JSON.parse(a))["retcode"]) return void ($.isLogin = !1); 0 === a["retcode"] && a.data && a.data.hasOwnProperty("userInfo") && ($.nickName = a.data.userInfo.baseInfo.nickname), 0 === a["retcode"] && a.data && a.data["assetInfo"] && ($.beanCount = a.data && a.data["assetInfo"]["beanNum"]) } else console.log("京东服务器返回空数据") } catch (e) { $.logErr(e) } finally { e() } }) }) }
117 | 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) }
--------------------------------------------------------------------------------
/backUp/jd_jchsign.js:
--------------------------------------------------------------------------------
1 | /**
2 | 京车会签到
3 | cron 19 8 * * * jd_jchsign.js
4 | TG频道:https://t.me/sheeplost
5 | */
6 | const $ = new Env('京车会签到');
7 | const notify = $.isNode() ? require('./sendNotify') : '';
8 | //Node.js用户请在jdCookie.js处填写京东ck;
9 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
10 | //IOS等用户直接用NobyDa的jd cookie
11 | let cookiesArr = [], cookie = '';
12 | if ($.isNode()) {
13 | Object.keys(jdCookieNode).forEach((item) => {
14 | cookiesArr.push(jdCookieNode[item])
15 | });
16 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => { };
17 | } else {
18 | let cookiesData = $.getdata('CookiesJD') || "[]";
19 | cookiesData = jsonParse(cookiesData);
20 | cookiesArr = cookiesData.map(item => item.cookie);
21 | cookiesArr.reverse();
22 | cookiesArr.push(...[$.getdata('CookieJD2'), $.getdata('CookieJD')]);
23 | cookiesArr.reverse();
24 | cookiesArr = cookiesArr.filter(item => item !== "" && item !== null && item !== undefined);
25 | }
26 | !(async () => {
27 | if (!cookiesArr[0]) {
28 | $.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/',
29 | { "open-url": "https://bean.m.jd.com/" });
30 | return;
31 | }
32 | for (let i = 0; i < cookiesArr.length; i++) {
33 | UA = `jdjchapp;jdlog;iPhone;1.2.0;13.3;${uuid()};Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;`
34 | if (cookiesArr[i]) {
35 | cookie = cookiesArr[i];
36 | originCookie = cookiesArr[i]
37 | $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
38 | $.index = i + 1;
39 | $.isLogin = true;
40 | $.nickName = '';
41 | await checkCookie();
42 | console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`);
43 | if (!$.isLogin) {
44 | $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/`, { "open-url": "https://bean.m.jd.com/" });
45 | if ($.isNode()) {
46 | await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
47 | }
48 | continue
49 | }
50 | await main();
51 | }
52 | }
53 | })().catch(e => $.logErr(e)).finally(() => $.done());
54 |
55 | async function main() {
56 | let signInfo = await task('jch_nv_jBeansAvailableNub', {});
57 | if (signInfo) {
58 | console.log(`已连续签到${signInfo.data.signDays}天,去签到!`);
59 | let doSignInfo = await task('jch_nv_doSign', {});
60 | console.log(JSON.stringify(doSignInfo));
61 | }
62 | }
63 |
64 | function task(function_id, body) {
65 | return new Promise((resolve) => {
66 | const op = {
67 | url: `https://api.m.jd.com/${function_id}?body=${encodeURIComponent(JSON.stringify(body))}&functionId=${function_id}&appid=M-JDJCH`,
68 | headers: {
69 | Host: "api.m.jd.com",
70 | "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
71 | Origin: "https://m-jch.jd.com",
72 | Cookie: "environment=jdjchapp; " + cookie,
73 | Connection: "keep-alive",
74 | Accept: "application/json, text/plain, */*",
75 | "User-Agent": UA,
76 | Referer: "https://m-jch.jd.com/jd-beans/list",
77 | },
78 | };
79 | $.get(op, (err, resp, data) => {
80 | try {
81 | if (err) {
82 | console.log(err)
83 | } else {
84 | data = JSON.parse(data);
85 | if (data && data.data && JSON.stringify(data.data) === '{}') {
86 | console.log(JSON.stringify(data));
87 | }
88 | }
89 | } catch (e) {
90 | $.logErr(e, resp)
91 | } finally {
92 | resolve(data || {});
93 | }
94 | });
95 | })
96 | }
97 | function checkCookie() {
98 | const options = {
99 | url: "https://me-api.jd.com/user_new/info/GetJDUserInfoUnion",
100 | headers: {
101 | "Host": "me-api.jd.com",
102 | "Accept": "*/*",
103 | "Connection": "keep-alive",
104 | "Cookie": cookie,
105 | "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Mobile/15E148 Safari/604.1",
106 | "Accept-Language": "zh-cn",
107 | "Referer": "https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&",
108 | "Accept-Encoding": "gzip, deflate, br",
109 | }
110 | };
111 | return new Promise(resolve => {
112 | $.get(options, (err, resp, data) => {
113 | try {
114 | if (err) {
115 | $.logErr(err)
116 | } else {
117 | if (data) {
118 | data = JSON.parse(data);
119 | if (data.retcode === "1001") {
120 | $.isLogin = false; //cookie过期
121 | return;
122 | }
123 | if (data.retcode === "0" && data.data.hasOwnProperty("userInfo")) {
124 | $.nickName = data.data.userInfo.baseInfo.nickname;
125 | }
126 | } else {
127 | $.log('API返回了空数据');
128 | }
129 | }
130 | } catch (e) {
131 | $.logErr(e)
132 | } finally {
133 | resolve();
134 | }
135 | })
136 | })
137 | }
138 | function uuid() {
139 | return 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);
140 | }
141 | 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) }
--------------------------------------------------------------------------------
/backUp/jd_market_lottery.js:
--------------------------------------------------------------------------------
1 | // author: 疯疯
2 | /*
3 | 幸运大转盘
4 | 活动地址:https://pro.m.jd.com/mall/active/3ryu78eKuLyY5YipWWVSeRQEpLQP/index.html
5 | 脚本兼容: Quantumult X, Surge, Loon, JSBox, Node.js
6 | ==============Quantumult X==============
7 | [task_local]
8 | #幸运大转盘
9 | 4 10 * * * https://gitee.com/lxk0301/jd_scripts/raw/master/jd_market_lottery.js, tag=幸运大转盘, enabled=true
10 |
11 | ==============Loon==============
12 | [Script]
13 | cron "4 10 * * *" script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_market_lottery.js,tag=幸运大转盘
14 |
15 | ================Surge===============
16 | 幸运大转盘 = type=cron,cronexp="4 10 * * *",wake-system=1,timeout=3600,script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_market_lottery.js
17 |
18 | ===============小火箭==========
19 | 幸运大转盘 = type=cron,script-path=https://gitee.com/lxk0301/jd_scripts/raw/master/jd_market_lottery.js, cronexpr="4 10 * * *", timeout=3600, enable=true
20 | */
21 |
22 | const $ = new Env("幸运大转盘");
23 | const jdCookieNode = $.isNode() ? require("./jdCookie.js") : "";
24 | let cookiesArr = [],
25 | cookie = "",
26 | allMsg = '';
27 |
28 | if ($.isNode()) {
29 | Object.keys(jdCookieNode).forEach((item) => {
30 | cookiesArr.push(jdCookieNode[item]);
31 | });
32 | console.log(`如果出现提示 ?.data. 错误,请升级nodejs版本(进入容器后,apk add nodejs-current)`)
33 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === "false") console.log = () => {};
34 | } else {
35 | cookiesArr = [
36 | $.getdata("CookieJD"),
37 | $.getdata("CookieJD2"),
38 | ...$.toObj($.getdata("CookiesJD") || "[]").map((item) => item.cookie)].filter((item) => !!item);
39 | }
40 | const JD_API_HOST = "https://api.m.jd.com/client.action";
41 | !(async () => {
42 | if (!cookiesArr[0]) {
43 | $.msg(
44 | $.name,
45 | "【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取",
46 | "https://bean.m.jd.com/",
47 | {"open-url": "https://bean.m.jd.com/"}
48 | );
49 | return;
50 | }
51 | for (let i = 0; i < cookiesArr.length; i++) {
52 | if (cookiesArr[i]) {
53 | cookie = cookiesArr[i];
54 | $.UserName = decodeURIComponent(
55 | cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]
56 | );
57 | $.index = i + 1;
58 | console.log(`\n******开始【京东账号${$.index}】${$.UserName}*********\n`);
59 | await main()
60 | }
61 | }
62 | await showMsg()
63 | })()
64 | .catch((e) => {
65 | $.log("", `❌ ${$.name}, 失败! 原因: ${e}!`, "");
66 | })
67 | .finally(() => {
68 | $.done();
69 | });
70 | function showMsg() {
71 | return new Promise(async resolve => {
72 | if (allMsg) $.msg($.name, '', allMsg);
73 | resolve();
74 | })
75 | }
76 | async function main() {
77 | await getInfo('https://pro.m.jd.com/mall/active/3ryu78eKuLyY5YipWWVSeRQEpLQP/index.html')
78 | await getInfo('https://pro.m.jd.com/mall/active/3ryu78eKuLyY5YipWWVSeRQEpLQP/index.html')
79 | }
80 | async function getInfo(url) {
81 | return new Promise(resolve=>{
82 | $.get({
83 | url,
84 | headers:{
85 | "Cookie": cookie,
86 | "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")
87 | }
88 | },async (err,resp,data)=>{
89 | try{
90 | if(err){
91 |
92 | }else{
93 | data = $.toObj(data.match(/window.__react_data__ = (\{.*\})/)[1])
94 | let taskList = data?.activityData?.floorList?.filter(vo=>vo.template==='score_task')[0]
95 | //console.log(data?.activityData?.floorList)
96 | for(let vo of taskList['taskItemList']){
97 | for(let i = vo.joinTimes; i< vo.taskLimit;++i){
98 | console.log(`去完成${vo?.flexibleData?.taskName ?? vo.enAwardK}任务,第${i+1}次`)
99 | await doTask(vo.enAwardK)
100 | await $.wait(500)
101 | }
102 | }
103 | let lottery = data?.activityData?.floorList?.filter(vo=>vo.template==='choujiang_wheel')[0]
104 | //console.log(lottery)
105 | const {userScore,lotteryScore} = lottery.lotteryGuaGuaLe
106 | if(lotteryScore<=userScore) {
107 | console.log(`抽奖需要${lotteryScore},当前${userScore}分,去抽奖`)
108 | await doLottery("a84f9428da0bb36a6a11884c54300582")
109 | } else {
110 | console.log(`当前积分已不足去抽奖`)
111 | }
112 | }
113 | }catch (e) {
114 |
115 | }finally {
116 | resolve()
117 | }
118 |
119 | })
120 | })
121 | }
122 | function doTask(enAwardK) {
123 | return new Promise(resolve => {
124 | $.post(taskUrl('babelDoScoreTask',{enAwardK,"isQueryResult":0,"siteClient":"apple","mitemAddrId":"","geo":{"lng":"","lat":""},"addressId":"","posLng":"","posLat":"","homeLng":"","homeLat":"","focus":"","innerAnchor":"","cv":"2.0"}),
125 | (err,resp,data)=>{
126 | try{
127 | if(err){
128 |
129 | }else{
130 | data = $.toObj(data)
131 | console.log(data.promptMsg)
132 | }
133 | }catch (e) {
134 |
135 | }finally {
136 | resolve()
137 | }
138 | })
139 | })
140 | }
141 | function doLottery(enAwardK,authType="2") {
142 | return new Promise(resolve => {
143 | $.post(taskUrl('babelGetLottery',{enAwardK,authType}),
144 | (err,resp,data)=>{
145 | try{
146 | if(err){
147 |
148 | }else{
149 | data = $.toObj(data)
150 | console.log(data.promptMsg)
151 | allMsg += `【京东账号${$.index}】${$.UserName}:${data.promptMsg}\n`
152 | }
153 | }catch (e) {
154 |
155 | }finally {
156 | resolve()
157 | }
158 | })
159 | })
160 | }
161 | function taskUrl(function_id, body = {}) {
162 | return {
163 | url: `${JD_API_HOST}/client.action?functionId=${function_id}`,
164 | body: `body=${escape(JSON.stringify(body))}&client=wh5&clientVersion=1.0.0`,
165 | headers: {
166 | "Cookie": cookie,
167 | "origin": "https://h5.m.jd.com",
168 | "referer": "https://h5.m.jd.com/",
169 | 'Content-Type': 'application/x-www-form-urlencoded',
170 | "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")
171 | }
172 | }
173 | }
174 |
175 | function safeGet(data) {
176 | try {
177 | if (typeof JSON.parse(data) == "object") {
178 | return true;
179 | }
180 | } catch (e) {
181 | console.log(e);
182 | console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
183 | return false;
184 | }
185 | }
186 |
187 | // prettier-ignore
188 | 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("",`🔔${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)}
--------------------------------------------------------------------------------
/backUp/jd_mhyyl.js:
--------------------------------------------------------------------------------
1 | /*
2 | 萌虎摇摇乐
3 | cron 0 10,20 * * * https://raw.githubusercontent.com/star261/jd/main/scripts/jd_mhyyl.js
4 | * */
5 | const $ = new Env('萌虎摇摇乐');
6 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
7 | let cookiesArr = [];
8 | let allInvite = [];
9 | if ($.isNode()) {
10 | Object.keys(jdCookieNode).forEach((item) => {
11 | cookiesArr.push(jdCookieNode[item])
12 | });
13 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
14 | } else {
15 | cookiesArr = [
16 | $.getdata("CookieJD"),
17 | $.getdata("CookieJD2"),
18 | ...$.toObj($.getdata("CookiesJD") || "[]").map((item) => item.cookie)].filter((item) => !!item);
19 | }
20 | !(async () => {
21 | if (!cookiesArr[0]) {
22 | $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
23 | return;
24 | }
25 | for (let i = 0; i < cookiesArr.length; i++) {
26 | if (cookiesArr[i]) {
27 | $.cookie = cookiesArr[i];
28 | $.UserName = decodeURIComponent($.cookie.match(/pt_pin=([^; ]+)(?=;?)/) && $.cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
29 | $.index = i + 1;
30 | console.log(`\n******开始【京东账号${$.index}】${$.UserName}*********\n`);
31 | await main($.cookie);
32 | }
33 | }
34 | if(allInvite.length > 0 ){
35 | console.log(`\n开始脚本内互助\n`);
36 | }
37 | let helpCodeList = [];
38 | for (let i = 0; i < cookiesArr.length; i++) {
39 | $.cookie = cookiesArr[i];
40 | $.UserName = decodeURIComponent($.cookie.match(/pt_pin=([^; ]+)(?=;?)/) && $.cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
41 | for (let j = 0; j < allInvite.length; j++) {
42 | if($.UserName === allInvite[j].user){
43 | helpCodeList.push(allInvite[j])
44 | }
45 | }
46 | }
47 | })().catch((e) => {$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')}).finally(() => {$.done();})
48 |
49 | async function main(ck) {
50 | let usName = decodeURIComponent(ck.match(/pt_pin=([^; ]+)(?=;?)/) && ck.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
51 | let UA = `jdapp;iPhone;10.0.8;14.6;${randomWord(false,40,40)};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`;
52 | let mainInfo = await takePost('{"apiMapping":"/api/index/indexInfo"}',ck,UA);
53 | if(JSON.stringify(mainInfo) === '{}'){
54 | console.log(`\n${usName},获取活动详情失败`);
55 | return ;
56 | }
57 | console.log(`\n${usName},获取活动详情成功,去瓜分`);
58 | let receivePrize = await takePost('{"apiMapping":"/api/carveUp/receivePrize"}',ck,UA);
59 | console.log(JSON.stringify(receivePrize));
60 | }
61 | function getRandomArrayElements(arr, count) {
62 | var shuffled = arr.slice(0), i = arr.length, min = i - count, temp, index;
63 | while (i-- > min) {
64 | index = Math.floor((i + 1) * Math.random());
65 | temp = shuffled[index];
66 | shuffled[index] = shuffled[i];
67 | shuffled[i] = temp;
68 | }
69 | return shuffled.slice(min);
70 | }
71 | async function takePost(info,ck,UA){
72 | let body = `appid=china-joy&functionId=collect_bliss_cards_prod&body=${info}&t=${Date.now()}&loginType=2`
73 | let options = {
74 | url: `https://api.m.jd.com/api`,
75 | body:body,
76 | headers: {
77 | "Host":"api.m.jd.com",
78 | "Accept": "application/json, text/plain, */*",
79 | "Content-Type":"application/x-www-form-urlencoded",
80 | "Origin":"https://yearfestival.jd.com",
81 | 'Cookie': ck,
82 | "Accept-Language": "zh-CN",
83 | "User-Agent": UA,
84 | "Referer": `https://yearfestival.jd.com/`,
85 | "Accept-Encoding": "gzip, deflate, br",
86 | }
87 | }
88 | return new Promise(resolve => {
89 | $.post(options, async (err, resp, data) => {
90 | try {
91 | if (err) {
92 | console.log(`${JSON.stringify(err)}`)
93 | console.log(`${$.name} API请求失败,请检查网路重试`)
94 | } else {
95 | if(data){
96 | data = JSON.parse(data);
97 | }
98 | }
99 | } catch (e) {
100 | $.logErr(e, resp)
101 | } finally {
102 | resolve(data['data'] || {});
103 | }
104 | })
105 | })
106 | }
107 | function randomWord(randomFlag, min, max){
108 | var str = "",
109 | range = min,
110 | arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
111 |
112 | // 随机产生
113 | if(randomFlag){
114 | range = Math.round(Math.random() * (max-min)) + min;
115 | }
116 | for(var i=0; i-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)}
124 |
--------------------------------------------------------------------------------
/backUp/jd_nh_sign.js:
--------------------------------------------------------------------------------
1 | /*
2 | 年货节签到
3 | 只有大吉才会推送
4 | cron 23 7 * * * https://raw.githubusercontent.com/star261/jd/main/scripts/jd_nh_sign.js
5 | * * */
6 | const $ = new Env('年货节签到');
7 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
8 | const notify = $.isNode() ? require('./sendNotify') : '';
9 | let message = '';
10 | let cookiesArr = []
11 | if ($.isNode()) {
12 | Object.keys(jdCookieNode).forEach((item) => {
13 | cookiesArr.push(jdCookieNode[item])
14 | })
15 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {
16 | };
17 | } else {
18 | cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
19 | }
20 | !(async () => {
21 | if (!cookiesArr[0]) {
22 | $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
23 | return;
24 | }
25 | if(Date.now() > 1644249600000){
26 | console.log(`活动已结束`);
27 | return ;
28 | }
29 | for (let i = 0; i < cookiesArr.length; i++) {
30 | if (cookiesArr[i]) {
31 | $.cookie = cookiesArr[i];
32 | $.UserName = decodeURIComponent($.cookie.match(/pt_pin=([^; ]+)(?=;?)/) && $.cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
33 | $.index = i + 1;
34 | console.log(`\n******开始【京东账号${$.index}】${$.UserName}*********\n`);
35 | await main();
36 | }
37 | }
38 | if(message){
39 | await notify.sendNotify(`年货节签到`, message);
40 | }
41 | })().catch((e) => {$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')}).finally(() => {$.done();})
42 |
43 | async function main() {
44 | $.UUID = randomString(40)
45 | $.UA = `jdapp;iPhone;10.2.0;13.1.2;${$.UUID};M/5.0;network/wifi;ADID/;model/iPhone8,1;addressid/${randomString(10)};appBuild/${randomString(6)};jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 13_1_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E228;supportJDSHWK/1;`
46 | let mainInfo = await takeRequest('queryInteractiveInfo',`{"encryptProjectId":"MD6S5z8gGgtP2VLJkLqmWPuDtHe","sourceCode":"aceaceglqd20211215"}`);
47 | if(mainInfo.msg === 'success'){
48 | console.log(`获取详情成功`);
49 | }else{
50 | console.log(`获取详情失败`);
51 | return ;
52 | }
53 | let assignmentList = mainInfo.assignmentList;
54 | for (let i = 0; i < assignmentList.length; i++) {
55 | let oneInfo = assignmentList[i];
56 | if(oneInfo.timeStatus !== 1){
57 | console.log(`任务:${oneInfo.assignmentName},未达成`);
58 | }else if(oneInfo.timeStatus === 1 && oneInfo.completionFlag){
59 | console.log(`任务:${oneInfo.assignmentName},已完成`);
60 | }else if(oneInfo.timeStatus === 1){
61 | await $.wait(2000);
62 | console.log(`任务:${oneInfo.assignmentName},去完成`);
63 | let ext = '';
64 | if(oneInfo.assignmentName === '9日大奖'){
65 | ext = {"exchangeNum":1};
66 | }
67 | if(oneInfo.assignmentName === '17日大奖'){
68 | ext = {"exchangeNum":1};
69 | }
70 | if(oneInfo.assignmentName === '24日大奖'){
71 | ext = {"exchangeNum":1};
72 | }
73 | let info = {
74 | "encryptProjectId":"MD6S5z8gGgtP2VLJkLqmWPuDtHe",
75 | "encryptAssignmentId":oneInfo.encryptAssignmentId,
76 | "sourceCode":"aceaceglqd20211215",
77 | "completionFlag":true,
78 | };
79 | if(ext){
80 | info['ext'] = ext
81 | }
82 | let signInfo = await takeRequest('doInteractiveAssignment',JSON.stringify(info));
83 | if(signInfo && signInfo.rewardsInfo && signInfo.rewardsInfo.successRewards){
84 | let allSignInfo = signInfo.rewardsInfo.successRewards;
85 | for(let type in allSignInfo){
86 | let prizeInfo = allSignInfo[type];
87 | if(type === '1'){
88 | console.log(`获得:签到次数+1`);
89 | continue;
90 | }
91 | for (let j = 0; j < prizeInfo.length; j++) {
92 | let prize = prizeInfo[j];
93 | console.log(`获得:${prize.rewardName},${prize.prizeName},${prize.useRange || ''}`);
94 | if(prize.rewardName.indexOf('大吉') !== -1){
95 | message += `账号${$.index},${$.UserName},获得:${prize.rewardName},${prize.prizeName},${prize.useRange || ''}\n`;
96 | }
97 | }
98 | }
99 | }
100 | console.log(JSON.stringify(signInfo));
101 | }
102 | }
103 | }
104 |
105 | async function takeRequest(functionId,bodyInfo) {
106 | let url = `https://api.m.jd.com/client.action`;
107 | let body = `functionId=${functionId}&appid=publicUseApi&body=${bodyInfo}&t=${Date.now()}&client=wh5&clientVersion=1.0.0&sid=&uuid=${$.UUID}&area=&networkType=wifi`;
108 | let options = {
109 | url: url,
110 | body:body,
111 | headers: {
112 | "Accept": "application/json",
113 | "Content-Type": "application/x-www-form-urlencoded",
114 | "Origin": "https://prodev.m.jd.com",
115 | 'Cookie': $.cookie,
116 | "Accept-Language": "zh-CN",
117 | "User-Agent": $.UA,
118 | "Referer": 'https://prodev.m.jd.com/mall/active/fARfxZh3zdMqs4tkFBhpqaQKTGA/index.html',
119 | "Accept-Encoding": "gzip, deflate, br",
120 | }
121 | }
122 | return new Promise(resolve => {
123 | $.post(options, async (err, resp, data) => {
124 | try {
125 | if (err) {
126 | console.log(`${JSON.stringify(err)}`)
127 | console.log(`${$.name} API请求失败,请检查网路重试`)
128 | } else {
129 | if(data){
130 | data = JSON.parse(data);
131 | }
132 | }
133 | } catch (e) {
134 | $.logErr(e, resp)
135 | } finally {
136 | resolve(data || {});
137 | }
138 | })
139 | })
140 | }
141 |
142 | function randomString(e) {
143 | e = e || 32;
144 | let t = "abcdef0123456789", a = t.length, n = "";
145 | for (i = 0; i < e; i++)
146 | n += t.charAt(Math.floor(Math.random() * a));
147 | return n
148 | }
149 | // prettier-ignore
150 | 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)}
151 |
--------------------------------------------------------------------------------
/backUp/jd_sjnhj.js:
--------------------------------------------------------------------------------
1 | /*
2 | 手机年货节
3 | 日常任务,10豆的样子,先到先得
4 | cron 10 0 1-30 1 * https://raw.githubusercontent.com/star261/jd/main/scripts/jd_sjnhj.js
5 | * */
6 | const $ = new Env('手机年货节');
7 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
8 | let cookiesArr = [];
9 | if ($.isNode()) {
10 | Object.keys(jdCookieNode).forEach((item) => {
11 | cookiesArr.push(jdCookieNode[item])
12 | });
13 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
14 | } else {
15 | cookiesArr = [
16 | $.getdata("CookieJD"),
17 | $.getdata("CookieJD2"),
18 | ...$.toObj($.getdata("CookiesJD") || "[]").map((item) => item.cookie)].filter((item) => !!item);
19 | }
20 | !(async () => {
21 | if (!cookiesArr[0]) {
22 | $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
23 | return;
24 | }
25 | if(Date.now() > 1643558400000){
26 | console.log(`结束`);
27 | return ;
28 | }
29 | for (let i = 0; i < cookiesArr.length; i++) {
30 | if (cookiesArr[i]) {
31 | $.cookie = cookiesArr[i];
32 | $.UserName = decodeURIComponent($.cookie.match(/pt_pin=([^; ]+)(?=;?)/) && $.cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
33 | $.index = i + 1;
34 | console.log(`\n******开始【京东账号${$.index}】${$.UserName}*********\n`);
35 | await main($.cookie);
36 | }
37 | }
38 | })().catch((e) => {$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')}).finally(() => {$.done();})
39 |
40 | async function main(ck) {
41 | let usName = decodeURIComponent(ck.match(/pt_pin=([^; ]+)(?=;?)/) && ck.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
42 | let UA = `jdapp;iPhone;10.0.8;14.6;${randomWord(false,40,40)};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`;
43 | let indexInfo = await takePost('{"apiMapping":"/api/index/index"}',ck,UA);
44 | if(JSON.stringify(indexInfo) === '{}'){
45 | console.log(`\n${usName},获取活动详情失败`);
46 | return ;
47 | }
48 | console.log(`\n${usName},获取活动详情成功`);
49 | let runFlag = true;
50 | for (let i = 0; i < 3 && runFlag; i++) {
51 | runFlag = false;
52 | let taskInfo = await takePost('{"apiMapping":"/api/task/getTaskList"}',ck,UA);
53 | for (let i = 0; i < taskInfo.taskList.length; i++) {
54 | let oneTask = taskInfo.taskList[i];
55 | if(oneTask.finishNum === oneTask.totalNum){
56 | console.log(`${usName},任务:${oneTask.taskItemName},已完成`);
57 | continue;
58 | }
59 | console.log(`${usName},任务:${oneTask.taskItemName},去执行`);
60 | let doTask = await takePost(`{"taskId":"${oneTask.taskId}","taskItemId":"${oneTask.taskItemId}","apiMapping":"/api/task/doTask"}`,ck,UA);
61 | await $.wait(2000);
62 | let getReward = await takePost(`{"taskId":"${oneTask.taskId}","taskItemId":"${oneTask.taskItemId}","timestamp":${doTask.timeStamp},"skuId":"","taskType":null,"apiMapping":"/api/task/getReward"}`,ck,UA);
63 | if(getReward.taskFinish){
64 | console.log(`${usName},获得京豆:${getReward.jbean || 0}`)
65 | }else {
66 | //console.log(`${JSON.stringify(getReward)}`);
67 | }
68 | runFlag = true;
69 | }
70 | }
71 | }
72 |
73 | async function takePost(info,ck,UA){
74 | let body = `appid=china-joy&functionId=festival_floor_prod&body=${info}&t=${Date.now()}&loginType=2`;
75 | let options = {
76 | url: `https://api.m.jd.com/api`,
77 | body:body,
78 | headers: {
79 | "Host":"api.m.jd.com",
80 | "Accept": "application/json, text/plain, */*",
81 | "Content-Type":"application/x-www-form-urlencoded",
82 | "Origin":"https://yearfestival.jd.com",
83 | 'Cookie': ck,
84 | "Accept-Language": "zh-CN",
85 | "User-Agent": UA,
86 | "Referer": `https://prodev.m.jd.com/mall/active/4MmNbTkve7YDv3cqfN65jyU54rSB/index.html`,
87 | "Accept-Encoding": "gzip, deflate, br",
88 | }
89 | }
90 | return new Promise(resolve => {
91 | $.post(options, async (err, resp, data) => {
92 | try {
93 | if (err) {
94 | console.log(`${JSON.stringify(err)}`)
95 | console.log(`${$.name} API请求失败,请检查网路重试`)
96 | } else {
97 | if(data){
98 | data = JSON.parse(data);
99 | }
100 | }
101 | } catch (e) {
102 | $.logErr(e, resp)
103 | } finally {
104 | resolve(data['data'] || {});
105 | }
106 | })
107 | })
108 | }
109 | function randomWord(randomFlag, min, max){
110 | var str = "",
111 | range = min,
112 | arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'];
113 |
114 | // 随机产生
115 | if(randomFlag){
116 | range = Math.round(Math.random() * (max-min)) + min;
117 | }
118 | for(var i=0; i-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)}
126 |
127 |
--------------------------------------------------------------------------------
/backUp/jd_tiger.js:
--------------------------------------------------------------------------------
1 | /*
2 | 萌虎摇摇乐
3 | https://yearfestival.jd.com
4 | 优先内部互助,剩余次数助力作者和助力池
5 | 0 0,12,18 * * * jd_tiger.js
6 | 转义自HW大佬
7 | const $ = new Env('萌虎摇摇乐');
8 | */
9 | const name = '萌虎摇摇乐'
10 | let UA = process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)
11 | const got = require('got')
12 | const notify = require('./sendNotify')
13 | const jdCookieNode = require('./jdCookie.js')
14 | let shareCodesSelf = []
15 | let cookiesArr = [],
16 | cookie
17 | Object.keys(jdCookieNode).forEach((item) => {
18 | cookiesArr.push(jdCookieNode[item])
19 | })
20 |
21 | !(async () => {
22 | if (!cookiesArr[0]) {
23 | console.error('No CK found')
24 | return
25 | }
26 | for (let i = 0; i < cookiesArr.length; i++) {
27 | cookie = cookiesArr[i]
28 | const userName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
29 | console.log(`\n开始【京东账号${i + 1}】${userName}\n`)
30 | try {
31 | let res = await api({ "apiMapping": "/api/task/support/getShareId" })
32 | console.log('助力码:', res.data)
33 | await wait(1000)
34 | shareCodesSelf.push(res.data)
35 | res = await api({ "apiMapping": "/api/task/support/list" })
36 | console.log('收到助力:', res.data.supportedNum)
37 | await wait(1000)
38 |
39 | res = await api({ "apiMapping": "/api/task/brand/tabs" })
40 | await wait(1000)
41 | for (let tab of res.data) {
42 | let taskGroupId = tab.taskGroupId
43 | res = await api({ "taskGroupId": taskGroupId, "apiMapping": "/api/task/brand/getTaskList" })
44 | for (let t of res.data) {
45 | for (let i = t.finishNum; i < t.totalNum; i++) {
46 | res = await getTaskDetail(taskGroupId)
47 | if (res) {
48 | console.log(taskGroupId, res.taskId, res.taskItemId, res.taskType, res.taskItemName)
49 | let sleep = res.browseTime ? res.browseTime * 1000 : 1000
50 | res = await api({ "taskGroupId": taskGroupId, "taskId": res.taskId, "taskItemId": res.taskItemId, "apiMapping": "/api/task/brand/doTask" })
51 | await wait(sleep)
52 | if (res.data.taskType === 'BROWSE_TASK') {
53 | res = await api({ "taskGroupId": taskGroupId, "taskId": res.data.taskId, "taskItemId": res.data.taskItemId, "timestamp": res.data.timeStamp, "apiMapping": "/api/task/brand/getReward" })
54 | console.log('任务完成,积分:', res.data.integral, ',京豆:', res.data.jbean)
55 | await wait(1000)
56 | } else if (res.data.taskType === 'FOLLOW_SHOP_TASK') {
57 | // console.log('任务完成,获得:', res.data.rewardInfoVo?.integral, res.data.rewardInfoVo?.jbean)
58 | console.log(res.data.rewardInfoVo)
59 | }
60 | }
61 | }
62 | }
63 | }
64 | } catch (e) {
65 | console.log('黑号?', e)
66 | }
67 | }
68 | let authorCode = []
69 | let res = await getAuthorShareCode('https://raw.githubusercontent.com/zero205/updateTeam/main/shareCodes/tiger.json')
70 | if (!res) {
71 | res = await getAuthorShareCode('https://raw.fastgit.org/zero205/updateTeam/main/shareCodes/tiger.json')
72 | }
73 | if (res) {
74 | authorCode = res.sort(() => 0.5 - Math.random())
75 | const limit = 3
76 | if (authorCode.length > limit) {
77 | authorCode = authorCode.splice(0, limit)
78 | }
79 | }
80 | for (let i = 0; i < cookiesArr.length; i++) {
81 | cookie = cookiesArr[i]
82 | const userName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
83 | const pool = await getShareCodePool('tiger', 5)
84 | // if (shareCodesHW.length === 0) {
85 | // shareCodesHW = await getshareCodeHW('tiger')
86 | // }
87 | // index === 0 ?
88 | // shareCodes = Array.from(new Set([...shareCodesHW, ...shareCodesSelf, ...temp])) :
89 | // shareCodes = Array.from(new Set([...shareCodesSelf, ...shareCodesHW, ...temp]))
90 | shareCodes = Array.from(new Set([...shareCodesSelf, ...authorCode, ...pool]))
91 | // console.log(shareCodes)
92 | for (let code of shareCodes) {
93 | console.log(`账号${i + 1} 去助力 ${code} ${shareCodesSelf.includes(code) ? '(内部)' : ''}`)
94 | try {
95 | const res = await api({ "shareId": code, "apiMapping": "/api/task/support/doSupport" })
96 | if (res.data.status === 1) {
97 | !res.data.supporterPrize ?
98 | console.log('不助力自己') :
99 | console.log('助力成功,京豆:', res.data.supporterPrize.beans, ',积分:', res.data.supporterPrize.score)
100 | } else if (res.data.status === 7) {
101 | console.log('上限')
102 | break
103 | } else if (res.data.status === 3) {
104 | console.log('已助力过')
105 | } else {
106 | console.log('其他情况', res.data.status)
107 | }
108 | await wait(1000)
109 | } catch (e) {
110 | console.log('黑号?', e)
111 | }
112 |
113 | }
114 | }
115 | for (let i = 0; i < cookiesArr.length; i++) {
116 | cookie = cookiesArr[i]
117 | const userName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
118 | console.log(`\n开始【京东账号${i + 1}】${userName}\n`)
119 | try {
120 | let res = await api({ "apiMapping": "/api/index/indexInfo" })
121 | let lotteryNum = res.data.lotteryNum
122 | console.log('抽奖次数:', lotteryNum)
123 | for (let i = 0; i < lotteryNum; i++) {
124 | res = await api({ "apiMapping": "/api/lottery/lottery" })
125 | console.log('抽奖', i + 1, '/', lotteryNum, res.data.prizeName)
126 | await wait(4000)
127 | }
128 | } catch (e) {
129 | console.log('黑号?', e)
130 | }
131 | }
132 | })()
133 | .catch((e) => {
134 | console.error(`${name} error: ${e.stack}`)
135 | })
136 | .finally(() => {
137 | console.log(`${name} finished}`)
138 | })
139 |
140 | async function getAuthorShareCode(url) {
141 | try {
142 | const options = {
143 | url,
144 | "timeout": 10000,
145 | headers: {
146 | "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/87.0.4280.88"
147 | }
148 | };
149 | const { body } = await got(options)
150 | // console.debug('getAuthorShareCode:',body)
151 | return JSON.parse(body) || []
152 | } catch (e) {
153 | // console.warn('getAuthorShareCode:', e)
154 | return false
155 | }
156 |
157 | }
158 |
159 | function wait(time) {
160 | return new Promise(resolve => {
161 | setTimeout(() => {
162 | resolve()
163 | }, time)
164 | })
165 | }
166 |
167 | async function api(r_body) {
168 | const options = {
169 | url: 'https://api.m.jd.com/api',
170 | headers: {
171 | 'Host': 'api.m.jd.com',
172 | 'Origin': 'https://yearfestival.jd.com',
173 | 'Accept': 'application/json, text/plain, */*',
174 | 'User-Agent': UA,
175 | 'Referer': 'https://yearfestival.jd.com/',
176 | 'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
177 | 'Cookie': cookie
178 | },
179 | form: {
180 | appid: 'china-joy',
181 | functionId: 'collect_bliss_cards_prod',
182 | body: JSON.stringify(r_body),
183 | t: Date.now(),
184 | loginType: 2
185 | }
186 | // body: `appid=china-joy&functionId=collect_bliss_cards_prod&body=${JSON.stringify(r_body)}&t=${Date.now()}&loginType=2`
187 | }
188 | const { body } = await got.post(options)
189 | // console.debug(options)
190 | // console.log(body)
191 | return JSON.parse(body)
192 | }
193 |
194 | async function getShareCodePool(key, num) {
195 | let shareCode = []
196 | for (let i = 0; i < 2; i++) {
197 | try {
198 | const { body } = await got(`https://api.jdsharecode.xyz/api/${key}/${num}`)
199 | console.debug('getShareCodePool:', body)
200 | shareCode = JSON.parse(body).data || []
201 | console.log(`随机获取${num}个${key}成功:${JSON.stringify(shareCode)}`)
202 | if (shareCode.length !== 0) {
203 | break
204 | }
205 | } catch (e) {
206 | // console.warn(e.stack)
207 | console.log("getShareCodePool Error, Retry...")
208 | await wait(2000 + Math.floor((Math.random() * 4000)))
209 | }
210 | }
211 | return shareCode
212 | }
213 |
214 |
215 | async function getTaskDetail(taskGroupId) {
216 | let res = await api({ "taskGroupId": taskGroupId, "apiMapping": "/api/task/brand/getTaskList" })
217 | await wait(1000)
218 | for (let t of res.data) {
219 | if (t.finishNum !== t.totalNum) {
220 | return t
221 | }
222 | }
223 | return ''
224 | }
225 |
--------------------------------------------------------------------------------
/backUp/jd_zd.js:
--------------------------------------------------------------------------------
1 | /*
2 | 战队投注
3 | cron 11 0,23 * * * jd_zd.js
4 | */
5 | const $ = new Env('战队投注');
6 | const notify = $.isNode() ? require('./sendNotify') : '';
7 | //Node.js用户请在jdCookie.js处填写京东ck;
8 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
9 |
10 | //IOS等用户直接用NobyDa的jd cookie
11 | let cookiesArr = [], cookie = '', message;
12 | $.tytpacketId = []
13 | if ($.isNode()) {
14 | Object.keys(jdCookieNode).forEach((item) => {
15 | cookiesArr.push(jdCookieNode[item])
16 | })
17 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => { };
18 | } else {
19 | cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
20 | }
21 | const JD_API_HOST = 'https://api.m.jd.com/client.action';
22 |
23 | !(async () => {
24 | if (!cookiesArr[0]) {
25 | $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', { "open-url": "https://bean.m.jd.com/bean/signIndex.action" });
26 | return;
27 | }
28 | for (let i = 0; i < cookiesArr.length; i++) {
29 | if (cookiesArr[i]) {
30 | cookie = cookiesArr[i];
31 | $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
32 | $.index = i + 1;
33 | $.isLogin = true;
34 | $.nickName = '';
35 | message = '';
36 | console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`);
37 | if (!$.isLogin) {
38 | $.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" });
39 | if ($.isNode()) {
40 | await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
41 | }
42 | continue
43 | }
44 | await tythelp();
45 | }
46 | }
47 | })()
48 | .catch((e) => {
49 | $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
50 | })
51 | .finally(() => {
52 | $.done();
53 | })
54 |
55 | function tythelp() {
56 | return new Promise(async (resolve) => {
57 | let options = {
58 | url: `https://api.m.jd.com/ /?functionId=arenaVote&body=%7B%22voteTeam%22%3A%22teamA%22%2C%22linkId%22%3A%22uUl_jZbOjqg_yc1cgiQCCQ%22%7D&_t=1640012313621&appid=activities_platform&client=activities_platform&clientVersion=1.0.0`,
59 | headers: {
60 | 'Host': 'api.m.jd.com',
61 | 'accept': 'application/json, text/plain, */*',
62 | 'user-agent': 'Mozilla/5.0 (Linux; Android 9; Note9 Build/PKQ1.181203.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.72 MQQBrowser/6.2 TBS/045909 Mobile Safari/537.36 MMWEBID/8813 MicroMessenger/8.0.16.2040(0x28001057) Process/tools WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64',
63 | 'origin': 'https://wzry-champion-team.jd.com',
64 | 'referer': 'https://wzry-champion-team.jd.com/',
65 | 'accept-encoding': 'gzip, deflate, br',
66 | 'accept-language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
67 | "Cookie": cookie,
68 | }
69 | }
70 | $.get(options, async (err, resp, data) => {
71 | try {
72 | data = JSON.parse(data);
73 | // console.log(data)
74 | if (data.code == 0) {
75 | console.log(`返回:${JSON.stringify(data)}`)
76 | } else {
77 | console.log(data.errMsg)
78 | }
79 | } catch (e) {
80 | $.logErr(e, resp);
81 | } finally {
82 | resolve(data);
83 | }
84 | });
85 | });
86 | }
87 |
88 | function jsonParse(str) {
89 | if (typeof str == "string") {
90 | try {
91 | return JSON.parse(str);
92 | } catch (e) {
93 | console.log(e);
94 | $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
95 | return [];
96 | }
97 | }
98 | }
99 | // prettier-ignore
100 | 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) }
101 |
--------------------------------------------------------------------------------
/backUp/redrian_user.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 |
4 |
5 | import asyncio
6 | import datetime
7 | import os
8 | import re
9 | import sys
10 | import time
11 |
12 | from telethon import events, TelegramClient
13 |
14 | from .. import chat_id, jdbot, logger, API_ID, API_HASH, PROXY_START, proxy, JD_DIR, TOKEN
15 | from ..bot.utils import cmd, V4, QL, CONFIG_SH_FILE, get_cks, AUTH_FILE
16 | from ..diy.utils import getbean, rwcon, my_chat_id, myzdjr_chatIds, shoptokenIds
17 |
18 | bot_id = int(TOKEN.split(":")[0])
19 |
20 | client = TelegramClient("user", API_ID, API_HASH, proxy=proxy, connection_retries=None).start() if PROXY_START else TelegramClient("user", API_ID, API_HASH, connection_retries=None).start()
21 |
22 |
23 | @client.on(events.NewMessage(chats=[bot_id, my_chat_id], from_users=chat_id, pattern=r"^user(\?|\?)$"))
24 | async def user(event):
25 | try:
26 | msg = await jdbot.send_message(chat_id, r'`user.py`监控已正常启动!')
27 | await asyncio.sleep(5)
28 | await jdbot.delete_messages(chat_id, msg)
29 | except Exception as e:
30 | title = "【💥错误💥】"
31 | name = "文件名:" + os.path.split(__file__)[-1].split(".")[0]
32 | function = "函数名:" + sys._getframe().f_code.co_name
33 | tip = '建议百度/谷歌进行查询'
34 | await jdbot.send_message(chat_id, f"{title}\n\n{name}\n{function}\n错误原因:{str(e)}\n\n{tip}")
35 | logger.error(f"错误--->{str(e)}")
36 |
37 |
38 | @client.on(events.NewMessage(chats=-1001728533280, pattern=r'export\s(jd_redrain_half_url|jd_redrain_activityId|jd_redrain_url).*=(".*"|\'.*\')'))
39 | async def activityID(event):
40 | try:
41 | text = event.message.text
42 | if "jd_redrain_half_url" in text:
43 | name = "半点京豆雨"
44 | elif "jd_redrain_activityId" in text:
45 | name = "整点京豆雨"
46 | elif "jd_redrain_url" in text:
47 | name = "整点京豆雨"
48 | else:
49 | return
50 | msg = await jdbot.send_message(chat_id, f'【监控】 监测到`{name}` 环境变量!')
51 | messages = event.message.text.split("\n")
52 | change = ""
53 | for message in messages:
54 | if "export " not in message:
55 | continue
56 | kv = message.replace("export ", "")
57 | key = kv.split("=")[0]
58 | value = re.findall(r'"([^"]*)"', kv)[0]
59 | configs = rwcon("str")
60 | if kv in configs:
61 | continue
62 | if key in configs:
63 | configs = re.sub(f'{key}=("|\').*("|\')', kv, configs)
64 | change += f"【替换】 `{name}` 环境变量成功\n`{kv}`\n\n"
65 | msg = await jdbot.edit_message(msg, change)
66 | else:
67 | if V4:
68 | end_line = 0
69 | configs = rwcon("list")
70 | for config in configs:
71 | if "第五区域" in config and "↑" in config:
72 | end_line = configs.index(config) - 1
73 | break
74 | configs.insert(end_line, f'export {key}="{value}"\n')
75 | else:
76 | configs = rwcon("str")
77 | configs += f'export {key}="{value}"\n'
78 | change += f"【新增】 `{name}` 环境变量成功\n`{kv}`\n\n"
79 | msg = await jdbot.edit_message(msg, change)
80 | rwcon(configs)
81 | if len(change) == 0:
82 | await jdbot.edit_message(msg, f"【取消】 `{name}` 环境变量无需改动!")
83 | return
84 | try:
85 | if "jd_redrain_half_url" in event.message.text:
86 | # await cmd('otask /jd/own/raw/jd_redrain_half.js now')
87 | msg = await jdbot.send_message(chat_id, r'`更换半点雨ID完毕')
88 | await asyncio.sleep(1)
89 | await jdbot.delete_messages(chat_id, msg)
90 | elif "jd_redrain_activityId" in event.message.text:
91 | # await cmd('otask /jd/own/raw/jd_redrain.js now')
92 | msg = await jdbot.send_message(chat_id, r'`更换整点雨ID完毕')
93 | await asyncio.sleep(1)
94 | await jdbot.delete_messages(chat_id, msg)
95 | elif "jd_redrain_url" in event.message.text:
96 | # await cmd('otask /jd/own/raw/jd_redrain.js now')
97 | msg = await jdbot.send_message(chat_id, r'`更换整点雨ID完毕')
98 | await asyncio.sleep(1)
99 | await jdbot.delete_messages(chat_id, msg)
100 | else:
101 | await jdbot.edit_message(msg, f"看到这行字,是有严重BUG!")
102 | except ImportError:
103 | pass
104 | except Exception as e:
105 | title = "【💥错误💥】"
106 | name = "文件名:" + os.path.split(__file__)[-1].split(".")[0]
107 | function = "函数名:" + sys._getframe().f_code.co_name
108 | tip = '建议百度/谷歌进行查询'
109 | await jdbot.send_message(chat_id, f"{title}\n\n{name}\n{function}\n错误原因:{str(e)}\n\n{tip}")
110 | logger.error(f"错误--->{str(e)}")
111 |
--------------------------------------------------------------------------------
/backUp/reposync.md:
--------------------------------------------------------------------------------
1 | # 通过reposync方式进行代码同步
2 |
3 |
4 | ### 申请PAT
5 |
6 | [点此来生成一个 token](https://github.com/settings/tokens/new) ,把 `repo`和`workflow` 两部分勾上,然后点击最下面的创建按钮。
7 |
8 | ### 填写PAT到Secrets
9 |
10 | 申请完毕后,在分支中点击`Settings`-`Secrets`-`New secret`
11 |
12 | `name`填`PAT`,`Value`填入上方申请到的PAT,保存即可
13 |
14 | ### 手动触发一次代码同步
15 |
16 | 点击`Actions`,点击右上角的star运行所有脚本
17 |
18 | 等待两分钟左右,能够发现代码全部同步过来
19 |
20 | ## Enjoy
21 |
22 | 操作到这一步,表示您已经全部完成了
23 |
24 | 剩下的去配置cookie等secrets就好啦
25 |
--------------------------------------------------------------------------------
/backUp/tencentscf.md:
--------------------------------------------------------------------------------
1 |
2 | # 云函数快速部署京东脚本
3 | > - Github Action 部署[点这里](tencentscf.md#github-action-部署)
4 | > - ~~本地安装依赖使用serverless部署~~
5 |
6 | # Github Action 部署
7 | ## 1. 开通服务
8 |
9 | 依次登录 [SCF 云函数控制台](https://console.cloud.tencent.com/scf) 和 [SLS 控制台](https://console.cloud.tencent.com/sls) 开通相关服务,确保账户下已开通服务并创建相应[服务角色](https://console.cloud.tencent.com/cam/role) **SCF_QcsRole、SLS_QcsRole**
10 |
11 | > 注意!为了确保权限足够,获取这两个参数时不要使用子账户!此外,腾讯云账户需要[实名认证](https://console.cloud.tencent.com/developer/auth)。
12 |
13 | ## 2. 新建一个访问密钥 [点此新建密钥](https://console.cloud.tencent.com/cam/capi)
14 | > 将获得的`SecretId`和`SecretKey`分别添加到仓库的secrets变量里面
15 | > 变量名Name:`TENCENT_SECRET_ID`,变量值Value:`SecretId`的值
16 | > 变量名Name:`TENCENT_SECRET_KEY`,变量值Value:`SecretKey`的值
17 |
18 | **secrets变量位置 : `仓库Settings`->`左边栏的Secrets`->`右上角New repository secret`->`Name填变量名称,Value填变量值`**
19 | **secrets变量位置 : `仓库Settings`->`左边栏的Secrets`->`右上角New repository secret`->`Name填变量名称,Value填变量值`**
20 | **secrets变量位置 : `仓库Settings`->`左边栏的Secrets`->`右上角New repository secret`->`Name填变量名称,Value填变量值`**
21 |
22 | ## 3. 配置secrets变量
23 |
24 | 除必需的`JD_COOKIE`外,secret变量新增三个选填变量`SCF_REGION`,`TENCENT_FUNCTION_NAME`,`TENCENTSCF_MEMORYSIZE`(都有默认值,可不修改)
25 |
26 | `SCF_REGION`用于控制部署区域的选择,value可填`ap-guangzhou`,其他地区具体参数代码填写可以自行查找官方说明 [地域和可用区](https://cloud.tencent.com/document/product/213/6091)
27 |
28 | `TENCENT_FUNCTION_NAME`用于控制部署到云函数后函数名的命名(别瞎改,改名的话确保之前的已经删除)
29 |
30 | `TENCENTSCF_MEMORYSIZE`值为运行内存大小的设定值,默认为`64`(需求更大内存的可填入`128`,云函数有64MB就基本能满足日常需求了)
31 |
32 | **【注意】提高内存设定值相应地也会加快消耗云函数的免费额度,超出免费额度将会产生费用**
33 |
34 | ### __重要的说三遍__
35 | ### 如果涉及一个变量配置多个值,如多个cookie,互助码,多个取消订阅关键字,去掉里面的 *__[空格]()__* 和 __*[换行]()*__ 使用 `&` 连接
36 | ### 如果涉及一个变量配置多个值,如多个cookie,互助码,多个取消订阅关键字,去掉里面的 *__[空格]()__* 和 __*[换行]()*__ 使用 `&` 连接
37 | ### 如果涉及一个变量配置多个值,如多个cookie,互助码,多个取消订阅关键字,去掉里面的 *__[空格]()__* 和 __*[换行]()*__ 使用 `&` 连接
38 |
39 | ## 4. 执行action workflow进行部署,workflow未报错即部署成功
40 | **下图workflow名字现在叫做Deploy**
41 |
42 | 
43 | ## 5. 查看和测试
44 | 登录后,在 [腾讯云函数地址](https://console.cloud.tencent.com/scf/index) 点击管理控制台,查看最新部署的函数。
45 |
46 | 在左侧栏的日志查询中,可以查看到触发的日志,包括是否打卡成功等。
47 |
48 | **请点击右下角切换旧版编辑器!**
49 |
50 | **自己参照图内填写测试脚本名称,不带后缀,测什么,填什么**
51 | 
52 |
--------------------------------------------------------------------------------
/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "jd_xfxd": [0],
3 | "jd_computer": [0],
4 | "jd_m_sign":[0],
5 | "jd_babel_sign":[0],
6 | "jd_fan":[0],
7 | "jd_redrain": 1,
8 | "jd_joyjd_open": [13],
9 | "jd_wxgame": [23],
10 | "jd_fruit":[6, 12 ,18],
11 | "jx_sign": [8, 13],
12 | "jd_car": [1, 5],
13 | "jd_bean_sign": [1],
14 | "jd_sign_graphics": [5],
15 | "jd_cfd": [6, 8, 10, 12, 14, 16, 18, 20, 22],
16 | "jd_dreamFactory": [4, 6, 8, 10, 12, 14, 16, 18, 20, 22],
17 | "jd_jdtj_winner": [6, 12, 15, 21],
18 | "jd_bean_home": [7],
19 | "jd_cash": [7],
20 | "jd_ccSign": [7],
21 | "jd_cfd_mooncake": [7, 23],
22 | "jd_club_lottery": [1, 23],
23 | "jd_connoisseur": [3, 9],
24 | "jd_ddly": [9],
25 | "jd_dwapp": [7, 19],
26 | "jd_gold_creator": [1, 22],
27 | "jd_health": [6, 22],
28 | "jd_jdzz": [1],
29 | "jd_jin_tie": [1],
30 | "jd_joy_feedPets": 1,
31 | "jd_joy_park": [3, 6, 9, 12, 15, 18, 21],
32 | "jd_joy_park_task": [6, 12, 18],
33 | "jd_jxmc": [2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22],
34 | "jd_kd": [3],
35 | "jd_live": [12, 13, 14],
36 | "jd_moneyTree_help": [6, 10, 14, 18, 22],
37 | "jd_moneyTree": [6, 14, 22],
38 | "jd_pet": [6, 12, 18],
39 | "jd_pigPet": [2, 8, 14, 20],
40 | "jd_plantBean": [7, 9, 11, 13, 15, 17, 19, 21],
41 | "jd_sddd": [1, 12],
42 | "jd_sgmh": [8],
43 | "jd_productZ4Brand": [14,20],
44 | "jd_tyt": [6, 10, 14, 18, 22],
45 | "jd_wish": [1, 3],
46 | "jd_wsdlb": [6, 12, 18],
47 | "jd_z_health_energy": [6, 8, 10, 12, 14, 16, 18, 20, 22],
48 | "jd_zjb": [7],
49 | "jd_HappyNewYear_Shares": [13,22],
50 | "jd_freshgoods": [10,13],
51 | "jx_ttysq":[10,13],
52 | "jd_sxLottery":[10],
53 | "jd_jfcz":[13],
54 | "jd_nnfls": [10,20],
55 | "jd_xmf":[3,13],
56 | "jd_fanli": [10],
57 | "jd_ms": [10],
58 | "jd_mpdzcar": [10],
59 | "jd_mpdzcar_game": [5,9,13],
60 | "jd_mpdzcar_help": [7],
61 | "jd_gold_sign": [9],
62 | "jd_qqxing": 6,
63 | "jd_bean_change": [17],
64 | "jd_jdfactory": [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23],
65 | "jd_speed_sign": [11, 13],
66 | "jd_try": [4],
67 | "jd_cfd_loop": [8, 16],
68 | "jd_unsubscribe": [23],
69 | "params":
70 | {
71 | "global":
72 | {
73 | "timeout": 10
74 | },
75 | "jd_try":
76 | {
77 | "timeout": 30
78 | },
79 | "jd_speed_sign":
80 | {
81 | "timeout": 55
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/githubAction.md:
--------------------------------------------------------------------------------
1 | ## 环境变量说明
2 |
3 | ##### 京东(必须)
4 |
5 | | Name | 归属 | 属性 | 说明 |
6 | | :---------: | :--: | ---- | ------------------------------------------------------------ |
7 | | `JD_COOKIE` | 京东 | 必须 | 京东cookie,多个账号的cookie使用`&`隔开。具体获取参考[浏览器获取京东cookie教程](./backUp/GetJdCookie.md) 或者 [插件获取京东cookie教程](./backUp/GetJdCookie2.md) |
8 |
9 | ##### 京东隐私安全 环境变量
10 |
11 | | Name | 归属 | 属性 | 默认值 | 说明 |
12 | | :-------------: | :---------: | :----: | :----: | ------------------------------------------------------------ |
13 | | `JD_DEBUG` | 脚本打印log | 非必须 | true | 运行脚本时,是否显示log,默认显示。改成false表示不显示,注重隐私的人可以设置 JD_DEBUG 为false |
14 | | `JD_USER_AGENT` | 京东 | 非必须 | | 自定义此库里京东系列脚本的UserAgent,不懂不知不会UserAgent的请不要随意填写内容。如需使用此功能建议填写京东APP的UA |
15 |
16 | ##### 推送通知环境变量(目前提供`微信server酱`、`pushplus(推送加)`、`iOS Bark APP`、`telegram机器人`、`钉钉机器人`、`企业微信机器人`、`iGot`等通知方式)
17 |
18 | | Name | 归属 | 属性 | 说明 |
19 | | :---------------: | :----------------------------------------------------------: | :----: | ------------------------------------------------------------ |
20 | | `PUSH_KEY` | 微信server酱推送 | 非必须 | server酱的微信通知[官方文档](http://sc.ftqq.com/3.version),已兼容 [Server酱·Turbo版](https://sct.ftqq.com/) |
21 | | `BARK_PUSH` | [BARK推送](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) | 非必须 | IOS用户下载BARK这个APP,填写内容是app提供的`设备码`,例如:https://api.day.app/123 ,那么此处的设备码就是`123`,再不懂看 [这个图](icon/bark.jpg)(注:支持自建填完整链接即可) |
22 | | `BARK_SOUND` | [BARK推送](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) | 非必须 | bark推送声音设置,例如`choo`,具体值请在`bark`-`推送铃声`-`查看所有铃声` |
23 | | `BARK_GROUP` | [BARK推送](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) | 非必须 | bark推送消息分组,例如`jd_scripts` |
24 | | `TG_BOT_TOKEN` | telegram推送 | 非必须 | tg推送(需设备可连接外网),`TG_BOT_TOKEN`和`TG_USER_ID`两者必需,填写自己申请[@BotFather](https://t.me/BotFather)的Token,如`10xxx4:AAFcqxxxxgER5uw` , [具体教程](./backUp/TG_PUSH.md) |
25 | | `TG_USER_ID` | telegram推送 | 非必须 | tg推送(需设备可连接外网),`TG_BOT_TOKEN`和`TG_USER_ID`两者必需,填写[@getuseridbot](https://t.me/getuseridbot)中获取到的纯数字ID, [具体教程](./backUp/TG_PUSH.md) |
26 | | `DD_BOT_TOKEN` | 钉钉推送 | 非必须 | 钉钉推送(`DD_BOT_TOKEN`和`DD_BOT_SECRET`两者必需)[官方文档](https://developers.dingtalk.com/document/app/custom-robot-access) ,只需`https://oapi.dingtalk.com/robot/send?access_token=XXX` 等于`=`符号后面的XXX即可 |
27 | | `DD_BOT_SECRET` | 钉钉推送 | 非必须 | (`DD_BOT_TOKEN`和`DD_BOT_SECRET`两者必需) ,密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的`SECXXXXXXXXXX`等字符 , 注:钉钉机器人安全设置只需勾选`加签`即可,其他选项不要勾选,再不懂看 [这个图](icon/DD_bot.png) |
28 | | `QYWX_KEY` | 企业微信机器人推送 | 非必须 | 密钥,企业微信推送 webhook 后面的 key [详见官方说明文档](https://work.weixin.qq.com/api/doc/90000/90136/91770) |
29 | | `QYWX_AM` | 企业微信应用消息推送 | 非必须 | corpid,corpsecret,touser,agentid,素材库图片id [参考文档1](http://note.youdao.com/s/HMiudGkb) [参考文档2](http://note.youdao.com/noteshare?id=1a0c8aff284ad28cbd011b29b3ad0191)
素材库图片填0为图文消息, 填1为纯文本消息 |
30 | | `IGOT_PUSH_KEY` | iGot推送 | 非必须 | iGot聚合推送,支持多方式推送,确保消息可达。 [参考文档](https://wahao.github.io/Bark-MP-helper ) |
31 | | `PUSH_PLUS_TOKEN` | pushplus推送 | 非必须 | 微信扫码登录后一对一推送或一对多推送下面的token(您的Token) [官方网站](http://www.pushplus.plus/) |
32 | | `PUSH_PLUS_USER` | pushplus推送 | 非必须 | 一对多推送的“群组编码”(一对多推送下面->您的群组(如无则新建)->群组编码)注:(1、需订阅者扫描二维码 2、如果您是创建群组所属人,也需点击“查看二维码”扫描绑定,否则不能接受群组消息推送),只填`PUSH_PLUS_TOKEN`默认为一对一推送 |
33 | | `TG_PROXY_HOST` | Telegram 代理的 IP | 非必须 | 代理类型为 http。例子:http代理 http://127.0.0.1:1080 则填写 127.0.0.1 |
34 | | `TG_PROXY_PORT` | Telegram 代理的端口 | 非必须 | 例子:http代理 http://127.0.0.1:1080 则填写 1080 |
35 |
36 | ##### 互助码类环境变量
37 |
38 | | Name | 归属 | 属性 | 需要助力次数/可提供助力次数 | 说明 |
39 | | :-------------------------: | :----------------: | :----: | :-----------------------: | ------------------------------------------------------------ |
40 | | `FRUITSHARECODES` | 东东农场
互助码 | 非必须 | 5/3 | 填写规则请看[jdFruitShareCodes.js](./jdFruitShareCodes.js)或见下方[互助码的填写规则](#互助码的填写规则) |
41 | | `PETSHARECODES` | 东东萌宠
互助码 | 非必须 | 5/5 | 填写规则和上面类似或见下方[互助码的填写规则](#互助码的填写规则) |
42 | | `PLANT_BEAN_SHARECODES` | 种豆得豆
互助码 | 非必须 | 9/3 | 填写规则和上面类似或见下方[互助码的填写规则](#互助码的填写规则) |
43 | | `DDFACTORY_SHARECODES` | 东东工厂
互助码 | 非必须 | 5/3 | 填写规则和上面类似或见下方[互助码的填写规则](#互助码的填写规则) |
44 | | `DREAM_FACTORY_SHARE_CODES` | 京喜工厂
互助码 | 非必须 | 不固定/3 | 填写规则和上面类似或见下方[互助码的填写规则](#互助码的填写规则) |
45 | | `JDZZ_SHARECODES` | 京东赚赚
互助码 | 非必须 | 5/2 | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) |
46 | | `JDJOY_SHARECODES` | 疯狂的JOY
互助码 | 非必须 | 6/ | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) |
47 | | `BOOKSHOP_SHARECODES` | 京东书店
互助码 | 非必须 | 10/ | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) |
48 | | `JD_CASH_SHARECODES` | 签到领现金
互助码 | 非必须 | 10/ | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) |
49 | | `JXNC_SHARECODES` | 京喜农场
互助码 | 非必须 | / | 注意:京喜农场种植种子发生变化的时候,互助码也会变!!
每个账号 shareCode 是一个 json,
json 需要用单引号包裹且是一行字符串,
否则设置环境变量时会出错,
示例:'{"smp":"22bdadsfaadsfadse8a",
"active":"jdnc_1_btorange210113_2","joinnum":"1"}',
多账单间使用`&`或换行分开。
详细说明参见[#Pr202](https://github.com/LXK9301/jd_scripts/pull/202)
如果使用`docker-compose`部署就不需要在互助码两端加单引号。详细参见Issues[#I35AG8](https://gitee.com/lxk0301/jd_scripts/issues/I35AG8)|
50 | | `JDSGMH_SHARECODES` | 闪购盲盒
互助码 | 非必须 | 10/ | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) |
51 | | `JDCFD_SHARECODES` | 京喜财富岛
互助码 | 非必须 | 未知/未知 | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) |
52 | | `dyjCode` | 大赢家
互助码 | 非必须 | 未知/未知 | 仅支持单个互助码,,暂不支持多号。格式:redEnvelopeId@markedPin |
53 | | `TYT_PACKETID` | 推一推
互助码 | 非必须 | 未知/未知 | 仅支持单个互助码,暂不支持多号 |
54 | | `MONEYTREE_SHARECODES` | 摇钱树
互助码 | 非必须 | 未知/未知 | 填写规则和上面类似,或见下方[互助码的填写规则](#互助码的填写规则) |
55 |
56 | ##### 控制脚本功能环境变量
57 |
58 |
59 | | Name | 归属 | 属性 | 说明 |
60 | | :--------------------------: | :--------------------------: | :----: | ------------------------------------------------------------ |
61 | | `JD_BEAN_STOP` | 京东多合一签到 | 非必须 | `jd_bean_sign.js`自定义延迟签到,单位毫秒.默认分批并发无延迟,
延迟作用于每个签到接口,如填入延迟则切换顺序签到(耗时较长),
如需填写建议输入数字`1`,详见[此处说明](https://github.com/NobyDa/Script/blob/master/JD-DailyBonus/JD_DailyBonus.js#L93) |
62 | | `JD_BEAN_SIGN_STOP_NOTIFY` | 京东多合一签到 | 非必须 | `jd_bean_sign.js`脚本运行后不推送签到结果通知,默认推送,填`true`表示不发送通知 |
63 | | `JD_BEAN_SIGN_NOTIFY_SIMPLE` | 京东多合一签到 | 非必须 | `jd_bean_sign.js`脚本运行后推送签到结果简洁版通知,
默认推送全部签到结果,填`true`表示推送简洁通知,[效果图](./icon/bean_sign_simple.jpg) |
64 | | `PET_NOTIFY_CONTROL` | 东东萌宠
推送开关 | 非必须 | 控制京东萌宠是否静默运行,
`false`为否(发送推送通知消息),`true`为是(即:不发送推送通知消息) |
65 | | `FRUIT_NOTIFY_CONTROL` | 东东农场
推送开关 | 非必须 | 控制京东农场是否静默运行,
`false`为否(发送推送通知消息),`true`为是(即:不发送推送通知消息) |
66 | | `JD_JOY_REWARD_NOTIFY` | 宠汪汪
兑换京豆推送开关 | 非必须 | 控制`jd_joy_reward.js`脚本是否静默运行,
`false`为否(发送推送通知消息),`true`为是(即:不发送推送通知消息) |
67 | | `JOY_FEED_COUNT` | 宠汪汪喂食数量 | 非必须 | 控制`jd_joy_feedPets.js`脚本喂食数量,可以填的数字10,20,40,80,其他数字不可. |
68 | | `JOY_HELP_FEED` | 宠汪汪帮好友喂食 | 非必须 | 控制`jd_joy_steal.js`脚本是否给好友喂食,`false`为否,`true`为是(给好友喂食) |
69 | | `JOY_RUN_FLAG` | 宠汪汪是否赛跑 | 非必须 | 控制`jd_joy.js`脚本是否参加赛跑(默认参加双人赛跑),
`false`为否,`true`为是,脚本默认是`true` |
70 | | `JOY_TEAM_LEVEL` | 宠汪汪
参加什么级别的赛跑 | 非必须 | 控制`jd_joy.js`脚本参加几人的赛跑,可选数字为`2`,`10`,`50`,
其中2代表参加双人PK赛,10代表参加10人突围赛,
50代表参加50人挑战赛(注:此项功能在`JOY_RUN_FLAG`为true的时候才生效),
如若想设置不同账号参加不同类别的比赛则用&区分即可(如下三个账号:`2&10&50`) |
71 | | `JOY_RUN_NOTIFY` | 宠汪汪
宠汪汪赛跑获胜后是否推送通知 | 非必须 | 控制`jd_joy.js`脚本宠汪汪赛跑获胜后是否推送通知,
`false`为否(不推送通知消息),`true`为是(即:发送推送通知消息)
|
72 | | `JOY_RUN_HELP_MYSELF` | 宠汪汪
赛跑自己账号内部互助 | 非必须 | 输入`true`为开启内部互助 |
73 | | `JD_JOY_REWARD_NAME` | 宠汪汪
积分兑换多少京豆 | 非必须 | 目前可填值为`20`或者`500`,脚本默认`20`,`0`表示不兑换京豆 |
74 | | `MARKET_COIN_TO_BEANS` | 东东超市
兑换京豆数量 | 非必须 | 控制`jd_blueCoin.js`兑换京豆数量,
可输入值为`20`或者`1000`的数字或者其他商品的名称,例如`碧浪洗衣凝珠` |
75 | | `MARKET_REWARD_NOTIFY` | 东东超市
兑换奖品推送开关 | 非必须 | 控制`jd_blueCoin.js`兑换奖品成功后是否静默运行,
`false`为否(发送推送通知消息),`true`为是(即:不发送推送通知消息) |
76 | | `JOIN_PK_TEAM` | 东东超市
自动参加PK队伍 | 非必须 | 每次pk活动参加作者创建的pk队伍,`true`表示参加,`false`表示不参加 |
77 | | `SUPERMARKET_LOTTERY` | 东东超市抽奖 | 非必须 | 每天运行脚本是否使用金币去抽奖,`true`表示抽奖,`false`表示不抽奖 |
78 | | `FRUIT_BEAN_CARD` | 农场
使用水滴换豆卡 | 非必须 | 农场使用水滴换豆卡(如果出现限时活动时100g水换20豆,此时比浇水划算,推荐换豆),
`true`表示换豆(不浇水),`false`表示不换豆(继续浇水),脚本默认是浇水 |
79 | | `UN_SUBSCRIBES` | jd_unsubscribe.js | 非必须 | 共四个参数,换行隔开.四个参数分别表示
`取关商品数量`,`取关店铺数量`,`遇到此商品不再进行取关`,`遇到此店铺不再进行取关`,[具体使用往下看](#取关店铺secret的说明) |
80 | | `JDJOY_HELPSELF` | 疯狂的JOY
循环助力 | 非必须 | 疯狂的JOY循环助力,`true`表示循环助力,`false`表示不循环助力,默认不开启循环助力。 |
81 | | `JDJOY_APPLYJDBEAN` | 疯狂的JOY
京豆兑换 | 非必须 | 疯狂的JOY京豆兑换,目前最小值为2000京豆(详情请查看活动页面-提现京豆),
默认数字`0`不开启京豆兑换。 |
82 | | `BUY_JOY_LEVEL` | 疯狂的JOY
购买joy等级 | 非必须 | 疯狂的JOY自动购买什么等级的JOY |
83 | | `MONEY_TREE_SELL_FRUIT` | 摇钱树
是否卖出金果 | 非必须 | 控制摇钱树脚本是否自动卖出金果兑换成金币,`true`卖出,`false`不卖出,默认`false` |
84 | | `FACTORAY_WANTPRODUCT_NAME` | 东东工厂
心仪商品 | 非必须 | 提供心仪商品名称(请尽量填写完整和别的商品有区分度),达到条件后兑换,
如不提供则会兑换当前所选商品 |
85 | | `DREAMFACTORY_FORBID_ACCOUNT`| 京喜工厂
控制哪个京东账号不运行此脚本 | 非必须 | 输入`1`代表第一个京东账号不运行,多个使用`&`连接,例:`1&3`代表账号1和账号3不运行京喜工厂脚本,注:输入`0`,代表全部账号不运行京喜工厂脚本 |
86 | | `JDFACTORY_FORBID_ACCOUNT`| 东东工厂
控制哪个京东账号不运行此脚本 | 非必须 | 输入`1`代表第一个京东账号不运行,多个使用`&`连接,例:`1&3`代表账号1和账号3不运行东东工厂脚本,注:输入`0`,代表全部账号不运行东东工厂脚本 |
87 | | `CFD_NOTIFY_CONTROL` | 京喜财富岛
控制是否运行脚本后通知 | 非必须 | 输入`true`为通知,不填则为不通知 |
88 | | `JD_JOY_PARK` | 汪汪乐园
控制是否运行此脚本,默认是 | 非必须 | 输入`false`为不运行 |
89 | | `JD_TRY` | 京东试用
控制是否运行此脚本,默认否 | 非必须 | 输入`true`为运行 |
90 | | `NOT_RUN` | 禁止运行某脚本
控制是否运行此脚本
云函数专用 | 非必须 | 输入`对应脚本名称,多个脚本用&连接` |
91 |
92 | ##### 互助码的填写规则
93 |
94 | > 互助码如何获取:运行相应脚本后,在日志里面可以找到。
95 |
96 | 同一个京东账号的好友互助码用@隔开,不同京东账号互助码用&或者换行隔开,下面给一个文字示例和具体互助码示例说明
97 |
98 | 两个账号各两个互助码的文字示例:
99 |
100 | ```
101 | 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2
102 | ```
103 |
104 | 两个账号各两个互助码的真实示例:
105 | ```
106 | 0a74407df5df4fa99672a037eec61f7e@dbb21614667246fabcfd9685b6f448f3&6fbd26cc27ac44d6a7fed34092453f77@61ff5c624949454aa88561f2cd721bf6&6fbd26cc27ac44d6a7fed34092453f77@61ff5c624949454aa88561f2cd721bf6
107 | ```
108 |
109 |
110 |
111 | #### 取关店铺secret的说明
112 |
113 | > secret依次是`取关商品数`,`取关店铺数`,`遇到此商品不再进行取关`,`遇到此店铺不再进行取关`
114 |
115 | 例如我要取关 `100`个商品,`100`个店铺,商品遇到商品关键字 `iPhone12` 停止取关,店铺遇到 `Apple京东自营旗舰店` 不再取关
116 | 则使用`换行`或者`&`隔开即可,
117 | 下面给出换行隔开示例:
118 |
119 | ```
120 | 100
121 | 100
122 | iPhone12
123 | Apple京东自营旗舰店
124 | ```
125 |
126 | 下面给出`&`符号隔开示例:
127 | ```
128 | 100&100&iPhone12&Apple京东自营旗舰店
129 | ```
130 |
131 | #### 关于脚本推送通知频率
132 |
133 | > 如果你填写了推送通知方式中的某一种通知所需环境变量,那么脚本通知情况如下:
134 |
135 | > 目前默认只有jd_fruit.js,jd_pet.js,jd_bean_sign.js,jd_bean_change.js,jd_jxnc.js这些脚本(默认)每次运行后都通知
136 |
137 | ```
138 | 其余的脚本平常运行都是不通知,只有在京东cookie失效以及达到部分条件后,才会推送通知
139 | ```
140 |
--------------------------------------------------------------------------------
/icon/DD_bot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/DD_bot.png
--------------------------------------------------------------------------------
/icon/Snipaste_2020-08-28_09-31-42.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/Snipaste_2020-08-28_09-31-42.png
--------------------------------------------------------------------------------
/icon/TG_PUSH1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/TG_PUSH1.png
--------------------------------------------------------------------------------
/icon/TG_PUSH2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/TG_PUSH2.png
--------------------------------------------------------------------------------
/icon/TG_PUSH3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/TG_PUSH3.png
--------------------------------------------------------------------------------
/icon/action1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/action1.png
--------------------------------------------------------------------------------
/icon/action2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/action2.png
--------------------------------------------------------------------------------
/icon/action3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/action3.png
--------------------------------------------------------------------------------
/icon/bark.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/bark.jpg
--------------------------------------------------------------------------------
/icon/bean_sign_simple.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/bean_sign_simple.jpg
--------------------------------------------------------------------------------
/icon/disable-action.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/disable-action.jpg
--------------------------------------------------------------------------------
/icon/fork.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/fork.png
--------------------------------------------------------------------------------
/icon/git1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/git1.jpg
--------------------------------------------------------------------------------
/icon/git10.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/git10.jpg
--------------------------------------------------------------------------------
/icon/git11.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/git11.jpg
--------------------------------------------------------------------------------
/icon/git12.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/git12.jpg
--------------------------------------------------------------------------------
/icon/git13.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/git13.jpg
--------------------------------------------------------------------------------
/icon/git14.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/git14.jpg
--------------------------------------------------------------------------------
/icon/git2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/git2.jpg
--------------------------------------------------------------------------------
/icon/git3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/git3.jpg
--------------------------------------------------------------------------------
/icon/git4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/git4.jpg
--------------------------------------------------------------------------------
/icon/git5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/git5.jpg
--------------------------------------------------------------------------------
/icon/git6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/git6.jpg
--------------------------------------------------------------------------------
/icon/git7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/git7.png
--------------------------------------------------------------------------------
/icon/git8.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/git8.jpg
--------------------------------------------------------------------------------
/icon/git9.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/git9.jpg
--------------------------------------------------------------------------------
/icon/iCloud1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/iCloud1.png
--------------------------------------------------------------------------------
/icon/iCloud2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/iCloud2.png
--------------------------------------------------------------------------------
/icon/iCloud3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/iCloud3.png
--------------------------------------------------------------------------------
/icon/iCloud4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/iCloud4.png
--------------------------------------------------------------------------------
/icon/iCloud5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/iCloud5.png
--------------------------------------------------------------------------------
/icon/iCloud6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/iCloud6.png
--------------------------------------------------------------------------------
/icon/iCloud7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/iCloud7.png
--------------------------------------------------------------------------------
/icon/iCloud8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/iCloud8.png
--------------------------------------------------------------------------------
/icon/jd1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/jd1.jpg
--------------------------------------------------------------------------------
/icon/jd2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/jd2.jpg
--------------------------------------------------------------------------------
/icon/jd3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/jd3.jpg
--------------------------------------------------------------------------------
/icon/jd4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/jd4.jpg
--------------------------------------------------------------------------------
/icon/jd5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/jd5.png
--------------------------------------------------------------------------------
/icon/jd6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/jd6.png
--------------------------------------------------------------------------------
/icon/jd7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/jd7.png
--------------------------------------------------------------------------------
/icon/jd8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/jd8.png
--------------------------------------------------------------------------------
/icon/jd_moneyTree.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/jd_moneyTree.png
--------------------------------------------------------------------------------
/icon/jd_pet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/jd_pet.png
--------------------------------------------------------------------------------
/icon/qh1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/qh1.png
--------------------------------------------------------------------------------
/icon/qh2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/qh2.png
--------------------------------------------------------------------------------
/icon/qh3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/qh3.png
--------------------------------------------------------------------------------
/icon/txy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zt6/github_zero205_JD_tencent_scf/98ee66e0ab7036e2b4b61de8f1487904fac86209/icon/txy.png
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | //'use strict';
2 | exports.main_handler = async (event, context, callback) => {
3 | console.log('云函数帮助:自己私库下readme文件,或者访问:https://github.com/zero205/JD_tencent_scf/tree/scf2')
4 | let params = {}
5 | let scripts = []
6 | if (event["TriggerName"] == 'remote') {
7 | console.log('remote触发:', event["Message"])
8 | const got = require('got')
9 | const links = ['https://raw.fastgit.org/zero205/JD_tencent_scf/main/','https://raw.githubusercontent.com/zero205/JD_tencent_scf/main/']
10 | for (let i = 0; i < links.length; i++) {
11 | try {
12 | const { body } = await got(`${links[i]}${event["Message"]}.js`, {
13 | timeout: 5000,
14 | retry: 2
15 | })
16 | eval(body)
17 | break
18 | } catch (error) {
19 | console.error(`got error:`, error)
20 | }
21 | }
22 | return
23 | } else if (event["TriggerName"] == 'config') {
24 | let now_hour = (new Date().getUTCHours() + 8) % 24
25 | console.log('hourly config触发,当前:', now_hour)
26 | if (event["Message"]) {
27 | const hour = Number(event["Message"])
28 | if (!isNaN(hour) && hour >= 0 && hour <= 23) {
29 | now_hour = hour
30 | console.log('hourly config触发,自定义触发小时:', now_hour)
31 | }
32 | }
33 | const { readFileSync, accessSync, constants } = require('fs')
34 | const config_file = process.cwd() + '/config.json'
35 | try {
36 | await accessSync(config_file, constants.F_OK)
37 | console.log(`${config_file} 存在`)
38 | } catch (err) {
39 | console.error(`${config_file} 不存在,结束`)
40 | return
41 | }
42 | let config
43 | try {
44 | config = JSON.parse(await readFileSync(config_file))
45 | } catch (e) {
46 | console.error(`read config error:${e}`)
47 | return
48 | }
49 | // console.debug(JSON.stringify(config))
50 | params = config['params']
51 | delete config['params']
52 |
53 | const config_diy_file = process.cwd() + '/config_diy.json'
54 | try {
55 | await accessSync(config_diy_file, constants.F_OK)
56 | console.log(`${config_diy_file} 存在`)
57 | const config_diy = JSON.parse(await readFileSync(config_diy_file))
58 | if (config_diy['params']) {
59 | params = { ...params, ...config_diy['params'] }
60 | delete config_diy['params']
61 | }
62 | config = { ...config, ...config_diy }
63 | } catch (err) {
64 | console.error(`${config_diy_file} 不存在或解析异常`)
65 | }
66 | console.log("params:", params)
67 | for (let script in config) {
68 | // console.debug(`script:${script}`)
69 | const cron = config[script]
70 | if (typeof cron == 'number') {
71 | // console.debug(`number param:${cron}`)
72 | if (now_hour % cron == 0) {
73 | console.debug(`${script}:数字参数触发`)
74 | scripts.push(script)
75 | }
76 | } else {
77 | // console.debug(`dict param:${cron}`)
78 | if (cron.includes(now_hour)) {
79 | console.debug(`${script}:列表参数触发`)
80 | scripts.push(script)
81 | }
82 | }
83 | }
84 | } else {
85 | if (!event["Message"]) {
86 | console.error('参数触发方式:未接收到任何参数,请阅读@hshx123大佬教程的测试步骤,查看如何使用.')
87 | return
88 | }
89 | console.log('参数触发方式(不读取配置文件),触发参数:', event["Message"])
90 | scripts = event["Message"].split("&")
91 | }
92 | if (process.env.NOT_RUN) {
93 | const not_run = process.env.NOT_RUN.split("&")
94 | scripts = scripts.filter(script => {
95 | const flag = not_run.includes(script)
96 | if (flag) {
97 | console.log(`not run:${script}`)
98 | }
99 | return !flag
100 | })
101 | }
102 | if (!scripts.length) {
103 | console.log('No Script to Execute, Exit!')
104 | return
105 | }
106 | const is_sync = (params['global'] && params['global']['exec'] == 'sync')
107 | console.log('当前是', is_sync ? '同' : '异', '步执行')
108 | if (is_sync) {
109 | const { execFile } = require('child_process')
110 | const min = 1000 * 60
111 | const param_names = ['timeout']
112 | for (const script of scripts) {
113 | const name = './' + script + '.js'
114 | const param_run = {}
115 | const param = params[script]
116 | for (const param_name of param_names) {
117 | if (param) {
118 | if (param[param_name]) {
119 | console.debug(`${script} has specific ${param_name}:${param[param_name]}`)
120 | param_run[param_name] = min * param[param_name]
121 | }
122 | } else if (params['global'] && params['global'][param_name]) {
123 | console.debug(`${script} use global ${param_name}`)
124 | param_run[param_name] = min * params['global'][param_name]
125 | } else {
126 | console.warn(`No global ${param_name}!`)
127 | }
128 | }
129 | console.log(`run script:${script}`)
130 | try {
131 | await (async () => {
132 | return new Promise((resolve) => {
133 | const child = execFile(process.execPath, [name], param_run)
134 | child.stdout.on('data', function(data) {
135 | console.log(data)
136 | })
137 | child.stderr.on('data', function(data) {
138 | console.error(data)
139 | })
140 | child.on('close', function(code) {
141 | console.log(`${script} finished`)
142 | delete child
143 | resolve()
144 | })
145 | })
146 | })()
147 | } catch (e) {
148 | console.error(`${script} ERROR:${e}`)
149 | console.error(`stdout:${e.stdout}`)
150 | }
151 | }
152 | } else {
153 | console.log('异步执行不支持params参数');
154 | ['log', 'warn', 'error', 'debug', 'info'].forEach((methodName) => {
155 | const originalMethod = console[methodName]
156 | console[methodName] = (...args) => {
157 | try {
158 | throw new Error()
159 | } catch (error) {
160 | let stack = error
161 | .stack // Grabs the stack trace
162 | .split('\n')[2] // Grabs third line
163 | .split("/").slice(-1)[0] // Grabs file name and line number
164 | .replace('.js', '')
165 | stack = `${stack.substring(0, stack.lastIndexOf(':'))}:`
166 | originalMethod.apply(
167 | console,
168 | [
169 | stack,
170 | ...args
171 | ]
172 | )
173 | }
174 | }
175 | })
176 | for (const script of scripts) {
177 | console.log(`run script:${script}`)
178 | const name = './' + script + '.js'
179 | try {
180 | require(name)
181 | } catch (e) {
182 | console.error(`异步${script}异常:`, e)
183 | }
184 | }
185 | }
186 | }
187 |
--------------------------------------------------------------------------------
/jdCookie.js:
--------------------------------------------------------------------------------
1 | /*
2 | 此文件为Node.js专用。其他用户请忽略
3 | */
4 | //此处填写京东账号cookie。
5 | let CookieJDs = [
6 | '',//账号一ck,例:pt_key=XXX;pt_pin=XXX;
7 | '',//账号二ck,例:pt_key=XXX;pt_pin=XXX;如有更多,依次类推
8 | ]
9 | // 判断环境变量里面是否有京东ck
10 | if (process.env.JD_COOKIE) {
11 | if (process.env.JD_COOKIE.indexOf('&') > -1) {
12 | console.log(`您的cookie选择的是用&隔开\n`)
13 | CookieJDs = process.env.JD_COOKIE.split('&');
14 | } else if (process.env.JD_COOKIE.indexOf('\n') > -1) {
15 | console.log(`您的cookie选择的是用换行隔开\n`)
16 | CookieJDs = process.env.JD_COOKIE.split('\n');
17 | } else {
18 | CookieJDs = [process.env.JD_COOKIE];
19 | }
20 | }
21 | /*
22 | if (JSON.stringify(process.env).indexOf('GITHUB')>-1) {
23 | console.log(`请勿使用github action运行此脚本,无论你是从你自己的私库还是其他哪里拉取的源代码,都会导致我被封号\n`);
24 | !(async () => {
25 | // await require('./sendNotify').sendNotify('提醒', `请勿使用github action、滥用github资源会封我仓库以及账号`)
26 | // await process.exit(0);
27 | })()
28 | }
29 | */
30 | CookieJDs = [...new Set(CookieJDs.filter(item => !!item))]
31 | console.log(`\n====================共有${CookieJDs.length}个京东账号Cookie=========\n`);
32 | console.log(`==================脚本执行- 北京时间(UTC+8):${new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000).toLocaleString()}=====================\n`)
33 | if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
34 | for (let i = 0; i < CookieJDs.length; i++) {
35 | const index = (i + 1 === 1) ? '' : (i + 1);
36 | exports['CookieJD' + index] = CookieJDs[i].trim();
37 | }
38 |
--------------------------------------------------------------------------------
/jdDreamFactoryShareCodes.js:
--------------------------------------------------------------------------------
1 | /*
2 | 京喜工厂互助码
3 | 此文件为Node.js专用。其他用户请忽略
4 | 支持京东N个账号
5 | */
6 | //云服务器腾讯云函数等NOde.js用户在此处填写东东萌宠的好友码。
7 | // 同一个京东账号的好友互助码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例
8 | // 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2
9 | let shareCodes = [
10 | '6lw84c1ARwpoRyOtfnF77g==@J1t777njetfQcyEg57lzQA==@W9u_eBl3YKbSjXu0QP3HGQ==@VV55A_oKz5u5CYrL3jxPdg==',//账号一的好友shareCode,不同好友中间用@符号隔开
11 | '6lw84c1ARwpoRyOtfnF77g==@J1t777njetfQcyEg57lzQA==@W9u_eBl3YKbSjXu0QP3HGQ==@VV55A_oKz5u5CYrL3jxPdg==',//账号二的好友shareCode,不同好友中间用@符号隔开
12 | ]
13 | // 判断github action里面是否有京喜工厂互助码
14 | if (process.env.DREAM_FACTORY_SHARE_CODES) {
15 | if (process.env.DREAM_FACTORY_SHARE_CODES.indexOf('&') > -1) {
16 | console.log(`您的互助码选择的是用&隔开\n`)
17 | shareCodes = process.env.DREAM_FACTORY_SHARE_CODES.split('&');
18 | } else if (process.env.DREAM_FACTORY_SHARE_CODES.indexOf('\n') > -1) {
19 | console.log(`您的互助码选择的是用换行隔开\n`)
20 | shareCodes = process.env.DREAM_FACTORY_SHARE_CODES.split('\n');
21 | } else {
22 | shareCodes = process.env.DREAM_FACTORY_SHARE_CODES.split();
23 | }
24 | } else if (process.env.DREAM_FACTORY_SHARE_CODES) {
25 | console.log(`您secret里面未提供助力码,优先进行自己账号内互助,然后再给脚本内置的码进行助力,请知晓!`)
26 | }
27 | for (let i = 0; i < shareCodes.length; i++) {
28 | const index = (i + 1 === 1) ? '' : (i + 1);
29 | exports['shareCodes' + index] = shareCodes[i];
30 | }
31 |
--------------------------------------------------------------------------------
/jdFactoryShareCodes.js:
--------------------------------------------------------------------------------
1 | /*
2 | 东东工厂互助码
3 | 此文件为Node.js专用。其他用户请忽略
4 | 支持京东N个账号
5 | */
6 | //云服务器腾讯云函数等NOde.js用户在此处填写东东萌宠的好友码。
7 | // 同一个京东账号的好友互助码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例
8 | // 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2
9 | let shareCodes = [
10 | 'T0225KkcRUxL9FKDJh7ylvMLcACjVWnYaS5kRrbA@T0225KkcRx0Q_AaCdRr1xf8DIQCjVWnYaS5kRrbA@T0225KkcRksZpgDSIBj3xvADdQCjVWnYaS5kRrbA@T018v_52Qxge81HeJB2b1ACjVWnYaS5kRrbA@T0205KkcPFd_vD2uSkCi3YhXCjVWnYaS5kRrbA',//账号一的好友shareCode,不同好友中间用@符号隔开
11 | 'T0225KkcRUxL9FKDJh7ylvMLcACjVWnYaS5kRrbA@T0225KkcRx0Q_AaCdRr1xf8DIQCjVWnYaS5kRrbA@T0225KkcRksZpgDSIBj3xvADdQCjVWnYaS5kRrbA@T018v_52Qxge81HeJB2b1ACjVWnYaS5kRrbA@T0205KkcPFd_vD2uSkCi3YhXCjVWnYaS5kRrbA',//账号二的好友shareCode,不同好友中间用@符号隔开
12 | ]
13 | // 判断github action里面是否有东东工厂互助码
14 | if (process.env.DDFACTORY_SHARECODES) {
15 | if (process.env.DDFACTORY_SHARECODES.indexOf('&') > -1) {
16 | console.log(`您的互助码选择的是用&隔开\n`)
17 | shareCodes = process.env.DDFACTORY_SHARECODES.split('&');
18 | } else if (process.env.DDFACTORY_SHARECODES.indexOf('\n') > -1) {
19 | console.log(`您的互助码选择的是用换行隔开\n`)
20 | shareCodes = process.env.DDFACTORY_SHARECODES.split('\n');
21 | } else {
22 | shareCodes = process.env.DDFACTORY_SHARECODES.split();
23 | }
24 | } else if (process.env.DDFACTORY_SHARECODES) {
25 | console.log(`您secret里面未提供助力码,优先进行自己账号内互助,然后再给脚本内置的码进行助力,请知晓!`)
26 | }
27 | for (let i = 0; i < shareCodes.length; i++) {
28 | const index = (i + 1 === 1) ? '' : (i + 1);
29 | exports['shareCodes' + index] = shareCodes[i];
30 | }
31 |
--------------------------------------------------------------------------------
/jdFruitShareCodes.js:
--------------------------------------------------------------------------------
1 | /*
2 | 东东农场互助码
3 | 此文件为Node.js专用。其他用户请忽略
4 | 支持京东N个账号
5 | */
6 | //云服务器腾讯云函数等NOde.js用户在此处填写京东东农场的好友码。
7 | // 同一个京东账号的好友互助码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例
8 | // 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2
9 | let FruitShareCodes = [
10 | //账号一的好友shareCode,不同好友的shareCode中间用@符号隔开
11 | '35fcfda6d3af48e7afe79f5e18a39e55@5a41b6db624346cdbe347b61279fda8f@3fa4d41fe66e47bd8a9549e33e3b9b54@5dc8a7b9f4544a8ca79f8cf62d0c7623@4918db5a466c4332843c75064a5a3880@9b8419ddb29240468d06edfd61fa642e',
12 | //账号二的好友shareCode,不同好友的shareCode中间用@符号隔开
13 | '35fcfda6d3af48e7afe79f5e18a39e55@5a41b6db624346cdbe347b61279fda8f@3fa4d41fe66e47bd8a9549e33e3b9b54@5dc8a7b9f4544a8ca79f8cf62d0c7623@4918db5a466c4332843c75064a5a3880',
14 | ]
15 | // 判断github action里面是否有水果互助码
16 | if (process.env.FRUITSHARECODES) {
17 | if (process.env.FRUITSHARECODES.indexOf('&') > -1) {
18 | console.log(`您的东东农场互助码选择的是用&隔开\n`)
19 | FruitShareCodes = process.env.FRUITSHARECODES.split('&');
20 | } else if (process.env.FRUITSHARECODES.indexOf('\n') > -1) {
21 | console.log(`您的东东农场互助码选择的是用换行隔开\n`)
22 | FruitShareCodes = process.env.FRUITSHARECODES.split('\n');
23 | } else {
24 | FruitShareCodes = process.env.FRUITSHARECODES.split();
25 | }
26 | } else if (process.env.JD_COOKIE) {
27 | console.log(`您secret里面未提供助力码,优先进行自己账号内互助,然后再给脚本内置的码进行助力,请知晓!`)
28 | }
29 | for (let i = 0; i < FruitShareCodes.length; i++) {
30 | const index = (i + 1 === 1) ? '' : (i + 1);
31 | exports['FruitShareCode' + index] = FruitShareCodes[i];
32 | }
33 |
--------------------------------------------------------------------------------
/jdPetShareCodes.js:
--------------------------------------------------------------------------------
1 | /*
2 | 东东萌宠互助码
3 | 此文件为Node.js专用。其他用户请忽略
4 | 支持京东N个账号
5 | */
6 | //云服务器腾讯云函数等NOde.js用户在此处填写东东萌宠的好友码。
7 | // 同一个京东账号的好友互助码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例
8 | // 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2
9 | let PetShareCodes = [
10 | //账号一的好友shareCode,不同好友的shareCode中间用@符号隔开
11 | 'MTAxODc2NTEzMDAwMDAwMDAxMzgwNTcyNw==@MTAxODc2NTEzMzAwMDAwMDAxMzgwNDg3OQ==@MTE1NDAxNzcwMDAwMDAwMzUxNDMwMDc=@MTE1NDQ5MzYwMDAwMDAwMzUxNDMwMTE=@MTE1NDUwMTI0MDAwMDAwMDM2OTQ2Mjk1',
12 | //账号二的好友shareCode,不同好友的shareCode中间用@符号隔开
13 | 'MTAxODc2NTEzMDAwMDAwMDAxMzgwNTcyNw==@MTAxODc2NTEzMzAwMDAwMDAxMzgwNDg3OQ==@MTE1NDAxNzcwMDAwMDAwMzUxNDMwMDc=@MTE1NDQ5MzYwMDAwMDAwMzUxNDMwMTE=@MTE1NDUwMTI0MDAwMDAwMDM2OTQ2Mjk1',
14 | ]
15 | // 判断github action里面是否有东东萌宠互助码
16 | if (process.env.PETSHARECODES) {
17 | if (process.env.PETSHARECODES.indexOf('&') > -1) {
18 | console.log(`您的东东萌宠互助码选择的是用&隔开\n`)
19 | PetShareCodes = process.env.PETSHARECODES.split('&');
20 | } else if (process.env.PETSHARECODES.indexOf('\n') > -1) {
21 | console.log(`您的东东萌宠互助码选择的是用换行隔开\n`)
22 | PetShareCodes = process.env.PETSHARECODES.split('\n');
23 | } else {
24 | PetShareCodes = process.env.PETSHARECODES.split();
25 | }
26 | } else if (process.env.JD_COOKIE) {
27 | console.log(`您secret里面未提供助力码,优先进行自己账号内互助,然后再给脚本内置的码进行助力,请知晓!`)
28 | }
29 | for (let i = 0; i < PetShareCodes.length; i++) {
30 | const index = (i + 1 === 1) ? '' : (i + 1);
31 | exports['PetShareCode' + index] = PetShareCodes[i];
32 | }
33 |
--------------------------------------------------------------------------------
/jdPlantBeanShareCodes.js:
--------------------------------------------------------------------------------
1 | /*
2 | 京东种豆得豆互助码
3 | 此文件为Node.js专用。其他用户请忽略
4 | 支持京东N个账号
5 | */
6 | //云服务器腾讯云函数等NOde.js用户在此处填写东东萌宠的好友码。
7 | // 同一个京东账号的好友互助码用@符号隔开,不同京东账号之间用&符号或者换行隔开,下面给一个示例
8 | // 如: 京东账号1的shareCode1@京东账号1的shareCode2&京东账号2的shareCode1@京东账号2的shareCode2
9 | let PlantBeanShareCodes = [
10 | //账号一的好友shareCode,不同好友的shareCode中间用@符号隔开
11 | 'mlrdw3aw26j3xc6xycqtc74umufg2kphl3yfaxy@4npkonnsy7xi3ii7u6y52byc4urucexhl2wh2pq@olmijoxgmjutydymkyc56wollvia4yorekjt5ky@q7knrx5fitalyburqkflsm4jjq3h7wlwy7o5jii@4npkonnsy7xi2dkkbvl643342m5of4rpapky3ha@u72q4vdn3zes3byfckc62jqcbkxq3wtymnzrz2i@e7lhibzb3zek3ziaj5fstdr2qbxofrnt63pxzpq@fn5sjpg5zdejmpxw4mttxyyppqmy3t6eveppesy',
12 | //账号二的好友shareCode,不同好友的shareCode中间用@符号隔开
13 | 'mlrdw3aw26j3xc6xycqtc74umufg2kphl3yfaxy@4npkonnsy7xi3ii7u6y52byc4urucexhl2wh2pq@olmijoxgmjutydymkyc56wollvia4yorekjt5ky@q7knrx5fitalyburqkflsm4jjq3h7wlwy7o5jii@4npkonnsy7xi2dkkbvl643342m5of4rpapky3ha@u72q4vdn3zes3byfckc62jqcbkxq3wtymnzrz2i@e7lhibzb3zek3ziaj5fstdr2qbxofrnt63pxzpq@fn5sjpg5zdejmpxw4mttxyyppqmy3t6eveppesy',
14 | ]
15 | // 判断github action里面是否有种豆得豆互助码
16 | if (process.env.PLANT_BEAN_SHARECODES) {
17 | if (process.env.PLANT_BEAN_SHARECODES.indexOf('&') > -1) {
18 | console.log(`您的种豆互助码选择的是用&隔开\n`)
19 | PlantBeanShareCodes = process.env.PLANT_BEAN_SHARECODES.split('&');
20 | } else if (process.env.PLANT_BEAN_SHARECODES.indexOf('\n') > -1) {
21 | console.log(`您的种豆互助码选择的是用换行隔开\n`)
22 | PlantBeanShareCodes = process.env.PLANT_BEAN_SHARECODES.split('\n');
23 | } else {
24 | PlantBeanShareCodes = process.env.PLANT_BEAN_SHARECODES.split();
25 | }
26 | } else if (process.env.JD_COOKIE) {
27 | console.log(`您secret里面未提供助力码,优先进行自己账号内互助,然后再给脚本内置的码进行助力,请知晓!`)
28 | }
29 | for (let i = 0; i < PlantBeanShareCodes.length; i++) {
30 | const index = (i + 1 === 1) ? '' : (i + 1);
31 | exports['PlantBeanShareCodes' + index] = PlantBeanShareCodes[i];
32 | }
33 |
--------------------------------------------------------------------------------
/jd_car.js:
--------------------------------------------------------------------------------
1 | /*
2 | 汽车签到
3 | cron 43 7,21 * * * jd_car.js
4 | const $ = new Env('汽车签到');
5 | */
6 | const name = '汽车签到'
7 | let UA
8 | const got = require('got')
9 | const notify = require('./sendNotify')
10 | const jdCookieNode = require('./jdCookie.js')
11 |
12 | function oc(fn, defaultVal) { //optioanl chaining
13 | try {
14 | return fn()
15 | } catch (e) {
16 | return undefined
17 | }
18 | }
19 |
20 | let cookiesArr = [],
21 | cookie
22 | Object.keys(jdCookieNode).forEach((item) => {
23 | cookiesArr.push(jdCookieNode[item])
24 | });
25 | !(async () => {
26 | if (!cookiesArr[0]) {
27 | console.error('No CK found')
28 | return
29 | }
30 | for (let i = 0; i < cookiesArr.length; i++) {
31 | if (cookiesArr[i]) {
32 | cookie = cookiesArr[i]
33 | const UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
34 | console.log(`\n******开始【京东账号${i + 1}】${UserName}*********\n`);
35 | UA = process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)
36 | await main()
37 | }
38 | if (i != cookiesArr.length - 1) {
39 | await wait(3000)
40 | }
41 | }
42 |
43 | })()
44 | .catch((e) => {
45 | console.error(`${name} 错误 :${e.stack}`)
46 | })
47 | .finally(() => {
48 | console.log(`${name} finish`)
49 | })
50 |
51 | function wait(time) {
52 | return new Promise(resolve => {
53 | setTimeout(() => {
54 | resolve()
55 | }, time)
56 | })
57 | }
58 |
59 | async function main() {
60 | await signBeanIndex()
61 | await wait(3000)
62 | await cgame()
63 | }
64 |
65 | async function signBeanIndex() {
66 | const options = {
67 | url: `https://api.m.jd.com/client.action`,
68 | headers: {
69 | "Content-Type": "application/x-www-form-urlencoded",
70 | 'Host': `api.m.jd.com`,
71 | 'Origin': 'https://api.m.jd.com',
72 | 'Referer': `https://api.m.jd.com`,
73 | 'Cookie': cookie
74 | },
75 | body: "functionId=signBeanIndex&appid=ld"
76 | }
77 | const { body } = await got.post(options)
78 | const data = JSON.parse(body)
79 |
80 | let title = oc(() => data.data.dailyAward.title) || oc(() => data.data.continuityAward.title)
81 | let bean = oc(() => data.data.dailyAward.beanAward.beanCount) || oc(() => data.data.continuityAward.beanAward.beanCount)
82 | if (bean) {
83 | console.log(`${title} 获得${bean}京豆`)
84 | }
85 | }
86 |
87 | async function cgame() {
88 | const options = {
89 | url: `https://cgame-stadium.jd.com/api/v1/sign`,
90 | headers: {
91 | 'Connection': 'keep-alive',
92 | 'Accept-Encoding': 'gzip, deflate, br',
93 | 'Content-Type': 'application/json',
94 | 'Origin': 'https://pro.m.jd.com',
95 | 'ActivityId': '7c51826be9f241c1ad9733df34d242c5',
96 | 'Host': 'cgame-stadium.jd.com',
97 | 'Referer': 'https://pro.m.jd.com/mall/active/dj6us2JJRLMMBb4iDaSK4wxvBMt/index.html',
98 | 'Accept-Language': 'zh-cn',
99 | 'Accept': 'application/json',
100 | 'Cookie': cookie
101 | }
102 | }
103 | const { body } = await got.post(options)
104 | const data = JSON.parse(body)
105 |
106 | let bean = oc(() => data.data.beanNum)
107 | if (bean > 0) {
108 | console.log(`汽车签到 获得${bean}京豆`)
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/jd_jxgckc.js:
--------------------------------------------------------------------------------
1 | /*
2 | cron "10 10 * * *" script-path=jx_products_detail.js,tag=京喜工厂商品列表详情
3 | **/
4 | const $ = new Env('京喜工厂商品列表详情');
5 | const JD_API_HOST = 'https://m.jingxi.com/';
6 | const notify = $.isNode() ? require('./sendNotify') : '';
7 | const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
8 | $.cookieArr = [];
9 | $.currentCookie = '';
10 | let showMsg = '';
11 | !(async () => {
12 | if (!getCookies()) return;
13 | for (let i = 0; i < $.cookieArr.length; i++) {
14 | $.currentCookie = $.cookieArr[i];
15 | $.index = i + 1;
16 | if ($.currentCookie) {
17 | const userName = decodeURIComponent(
18 | $.currentCookie.match(/pt_pin=(.+?);/) && $.currentCookie.match(/pt_pin=(.+?);/)[1],
19 | );
20 | $.log(`\n开始【京东账号${i + 1}】${userName}`);
21 | await getCommodityList();
22 |
23 | console.log(showMsg);
24 |
25 | //只发送给第一个号
26 | if (i ===0) {
27 | // 账号${$.index} - ${$.UserName}
28 | await notify.sendNotify(`${$.name}`, `${showMsg}`);
29 | break
30 | }
31 |
32 | }
33 | }
34 | })()
35 | .catch(e => $.logErr(e))
36 | .finally(() => $.done());
37 |
38 | function getCookies() {
39 | if ($.isNode()) {
40 | $.cookieArr = Object.values(jdCookieNode);
41 | } else {
42 | const CookiesJd = JSON.parse($.getdata("CookiesJD") || "[]").filter(x => !!x).map(x => x.cookie);
43 | $.cookieArr = [$.getdata("CookieJD") || "", $.getdata("CookieJD2") || "", ...CookiesJd].filter(x=>!!x);
44 | }
45 | if (!$.cookieArr[0]) {
46 | $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {
47 | 'open-url': 'https://bean.m.jd.com/',
48 | });
49 | return false;
50 | }
51 | return true;
52 | }
53 |
54 | function getCommodityList() {
55 | return new Promise(resolve => {
56 | $.get(taskUrl('diminfo/GetCommodityList', `flag=2&pageNo=1&pageSize=10000`), async (err, resp, data) => {
57 | try {
58 | const { ret, data: { commodityList = [] } = {}, msg } = JSON.parse(data);
59 | // $.log(`\n获取商品详情:${msg}\n${$.showLog ? data : ''}`);
60 | for (let index = 0; index < commodityList.length; index++) {
61 | const { commodityId, stockNum } = commodityList[index];
62 | await getCommodityDetail(commodityId, stockNum);
63 | await $.wait(1000);
64 | }
65 | } catch (e) {
66 | $.logErr(e, resp);
67 | } finally {
68 | resolve();
69 | }
70 | });
71 | });
72 | }
73 |
74 | function getCommodityDetail(commodityId, num) {
75 | return new Promise(async resolve => {
76 | $.get(
77 | taskUrl('diminfo/GetCommodityDetails', `commodityId=${commodityId}`),
78 | (err, resp, data) => {
79 | try {
80 | const { ret, data: { commodityList = [] } = {}, msg } = JSON.parse(data);
81 | // $.log(`\n获取商品详情:${msg}\n${$.showLog ? data : ''}`);
82 | const { starLevel, name, price, productLimSeconds } = commodityList[0];
83 | showMsg += `⭐️商品--${name}, 所需等级 ${starLevel},所需电力: ${price / 100} 万,限时 ${
84 | productLimSeconds / 60 / 60 / 24
85 | } 天,📦库存:${num},最短需要 ${(price / 864 / 2).toFixed(2)} \n`;
86 | ;
87 | } catch (e) {
88 | $.logErr(e, resp);
89 | } finally {
90 | resolve();
91 | }
92 | },
93 | );
94 | });
95 | }
96 |
97 | function taskUrl(function_path, body) {
98 | return {
99 | url: `${JD_API_HOST}dreamfactory/${function_path}?${body}&zone=dream_factory&sceneval=2&g_login_type=1&_time=${Date.now()}&_=${Date.now()}`,
100 | headers: {
101 | Cookie: $.currentCookie,
102 | Accept: `*/*`,
103 | Connection: `keep-alive`,
104 | Referer: `https://st.jingxi.com/pingou/dream_factory/index.html`,
105 | 'Accept-Encoding': `gzip, deflate, br`,
106 | Host: `m.jingxi.com`,
107 | 'User-Agent': `jdpingou;android;3.6.6;10;9366134603335346-2356564626532336;network/wifi;model/PCCM00;addressid/2724627094;aid/9f1d035d2eedb52c;oaid/0990A8DEE8484D29A1F033DCEFB178E3e82dce91adda643738be64a5c1dbd373;osVer/29;appBuild/1830;psn/Y3zi9DfAnZ9m /CaT1 855ftH5Ommmjk|80;psq/17;adk/;ads/;pap/JA2020_3112531|3.6.6|ANDROID 10;osv/10;pv/58.17;installationId/64c27574699b447f9e83bb051482e0bc;jdv/0|androidapp|t_335139774|appshare|Wxfriends|1629270186766|1629270192;ref/HomeFragment;partner/oppo;apprpd/Home_Main;eufv/1;Mozilla/5.0 (Linux; Android 10; PCCM00 Build/QKQ1.191021.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045135 Mobile Safari/537.36`,
108 | 'Accept-Language': `zh-cn`,
109 | },
110 | };
111 | }
112 |
113 | // prettier-ignore
114 | function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let o=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");o=o?1*o:20,o=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)}
115 |
--------------------------------------------------------------------------------
/jd_try_notify.py:
--------------------------------------------------------------------------------
1 | #Source::https://github.com/Hyper-Beast/JD_Scripts
2 |
3 | """
4 | cron: 20 20 * * *
5 | new Env('京东试用成功通知');
6 | """
7 |
8 |
9 | import requests
10 | import json
11 | import time
12 | import os
13 | import re
14 | import sys
15 | import random
16 | import string
17 | import urllib
18 |
19 |
20 |
21 | #以下部分参考Curtin的脚本:https://github.com/curtinlv/JD-Script
22 |
23 | UserAgent = ''
24 | uuid=''.join(random.sample(['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','a','b','c','z'], 40))
25 | addressid = ''.join(random.sample('1234567898647', 10))
26 | iosVer = ''.join(random.sample(["14.5.1", "14.4", "14.3", "14.2", "14.1", "14.0.1", "13.7", "13.1.2", "13.1.1"], 1))
27 | iosV = iosVer.replace('.', '_')
28 | clientVersion=''.join(random.sample(["10.3.0", "10.2.7", "10.2.4", "10.2.2", "10.2.0", "10.1.6"], 1))
29 | iPhone = ''.join(random.sample(["8", "9", "10", "11", "12", "13"], 1))
30 | area=''.join(random.sample('0123456789', 2)) + '_' + ''.join(random.sample('0123456789', 4)) + '_' + ''.join(random.sample('0123456789', 5)) + '_' + ''.join(random.sample('0123456789', 4))
31 | ADID = ''.join(random.sample('0987654321ABCDEF', 8)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 12))
32 |
33 | def userAgent():
34 | """
35 | 随机生成一个UA
36 | jdapp;iPhone;10.0.4;14.2;9fb54498b32e17dfc5717744b5eaecda8366223c;network/wifi;ADID/2CF597D0-10D8-4DF8-C5A2-61FD79AC8035;model/iPhone11,1;addressid/7785283669;appBuild/167707;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/null;supportJDSHWK/1
37 | :return: ua
38 | """
39 | if not UserAgent:
40 | return f'jdapp;iPhone;10.0.4;{iosVer};{uuid};network/wifi;ADID/{ADID};model/iPhone{iPhone},1;addressid/{addressid};appBuild/167707;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS {iosV} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/null;supportJDSHWK/1'
41 | else:
42 | return UserAgent
43 |
44 | #以上部分参考Curtin的脚本:https://github.com/curtinlv/JD-Script
45 |
46 | def load_send():
47 | global send
48 | cur_path = os.path.abspath(os.path.dirname(__file__))
49 | sys.path.append(cur_path)
50 | if os.path.exists(cur_path + "/sendNotify.py"):
51 | try:
52 | from sendNotify import send
53 | except:
54 | send=False
55 | print("加载通知服务失败~")
56 | else:
57 | send=False
58 | print("加载通知服务失败~")
59 | load_send()
60 |
61 |
62 | def printf(text):
63 | print(text)
64 | sys.stdout.flush()
65 |
66 | def get_remarkinfo():
67 | url='http://127.0.0.1:5600/api/envs'
68 | try:
69 | with open('/ql/config/auth.json', 'r') as f:
70 | token=json.loads(f.read())['token']
71 | headers={
72 | 'Accept':'application/json',
73 | 'authorization':'Bearer '+token,
74 | }
75 | response=requests.get(url=url,headers=headers)
76 |
77 | for i in range(len(json.loads(response.text)['data'])):
78 | if json.loads(response.text)['data'][i]['name']=='JD_COOKIE':
79 | try:
80 | if json.loads(response.text)['data'][i]['remarks'].find('@@')==-1:
81 | remarkinfos[json.loads(response.text)['data'][i]['value'].split(';')[1].replace('pt_pin=','')]=json.loads(response.text)['data'][i]['remarks'].replace('remark=','')
82 | else:
83 | remarkinfos[json.loads(response.text)['data'][i]['value'].split(';')[1].replace('pt_pin=','')]=json.loads(response.text)['data'][i]['remarks'].split("@@")[0].replace('remark=','').replace(';','')
84 | except:
85 | pass
86 | except:
87 | print('读取auth.json文件出错,跳过获取备注')
88 |
89 | def get_succeedinfo(ck):
90 | url='https://api.m.jd.com/client.action'
91 | headers={
92 | 'accept':'application/json, text/plain, */*',
93 | 'content-type':'application/x-www-form-urlencoded',
94 | 'origin':'https://prodev.m.jd.com',
95 | 'content-length':'249',
96 | 'accept-language':'zh-CN,zh-Hans;q=0.9',
97 | 'User-Agent':userAgent(),
98 | 'referer':'https://prodev.m.jd.com/',
99 | 'accept-encoding':'gzip, deflate, br',
100 | 'cookie':ck
101 | }
102 | data=f'appid=newtry&functionId=try_MyTrials&uuid={uuid}&clientVersion={clientVersion}&client=wh5&osVersion={iosVer}&area={area}&networkType=wifi&body=%7B%22page%22%3A1%2C%22selected%22%3A2%2C%22previewTime%22%3A%22%22%7D'
103 | response=requests.post(url=url,headers=headers,data=data)
104 | isnull=True
105 | try:
106 | for i in range(len(json.loads(response.text)['data']['list'])):
107 | if(json.loads(response.text)['data']['list'][i]['text']['text']).find('试用资格将保留')!=-1:
108 | print(json.loads(response.text)['data']['list'][i]['trialName'])
109 | try:
110 | if remarkinfos[ptpin]!='':
111 | send("京东试用待领取物品通知",'账号名称:'+remarkinfos[ptpin]+'\n'+'商品名称:'+json.loads(response.text)['data']['list'][i]['trialName']+"\n"+"商品链接:https://item.jd.com/"+json.loads(response.text)['data']['list'][i]['skuId']+".html")
112 | isnull=False
113 | else:
114 | send("京东试用待领取物品通知",'账号名称:'+urllib.parse.unquote(ptpin)+'\n'+'商品名称:'+json.loads(response.text)['data']['list'][i]['trialName']+"\n"+"商品链接:https://item.jd.com/"+json.loads(response.text)['data']['list'][i]['skuId']+".html")
115 | isnull=False
116 | except Exception as e:
117 | printf(str(e))
118 | if isnull==True:
119 | print("没有在有效期内待领取的试用品\n\n")
120 | except:
121 | print('获取信息出错,可能是账号已过期')
122 | pass
123 | if __name__ == '__main__':
124 | remarkinfos={}
125 | try:
126 | get_remarkinfo()
127 | except:
128 | pass
129 | try:
130 | cks = os.environ["JD_COOKIE"].split("&")
131 | except:
132 | f = open("/jd/config/config.sh", "r", encoding='utf-8')
133 | cks = re.findall(r'Cookie[0-9]*="(pt_key=.*?;pt_pin=.*?;)"', f.read())
134 | f.close()
135 | for ck in cks:
136 | ck = ck.strip()
137 | if ck[-1] != ';':
138 | ck += ';'
139 | ptpin = re.findall(r"pt_pin=(.*?);", ck)[0]
140 | try:
141 | if remarkinfos[ptpin]!='':
142 | printf("--账号:" + remarkinfos[ptpin] + "--")
143 | else:
144 | printf("--无备注账号:" + urllib.parse.unquote(ptpin) + "--")
145 | except Exception as e:
146 | printf("--账号:" + urllib.parse.unquote(ptpin) + "--")
147 | get_succeedinfo(ck)
148 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "",
3 | "version": "1.0.0",
4 | "description": "{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}",
5 | "main": "AlipayManor.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "repository": {
10 | "type": "git",
11 | "url": ""
12 | },
13 | "keywords": [
14 | "京东薅羊毛工具, 京东水果、宠物、种豆等等"
15 | ],
16 | "author": "",
17 | "license": "ISC",
18 | "dependencies": {
19 | "crypto-js": "^4.1.1",
20 | "got": "^11.8.2",
21 | "png-js": "^1.0.0",
22 | "request": "^2.88.2",
23 | "tough-cookie": "^4.0.0",
24 | "tunnel": "0.0.6",
25 | "ws": "^7.5.3",
26 | "jsdom": "^17.0.0"
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/ql.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const got = require('got');
4 | require('dotenv').config();
5 | const { readFile } = require('fs/promises');
6 | const path = require('path');
7 |
8 | const qlDir = '/ql';
9 | const fs = require('fs');
10 | let Fileexists = fs.existsSync('/ql/data/config/auth.json');
11 | let authFile="";
12 | if (Fileexists)
13 | authFile="/ql/data/config/auth.json"
14 | else
15 | authFile="/ql/config/auth.json"
16 | //const authFile = path.join(qlDir, 'config/auth.json');
17 |
18 | const api = got.extend({
19 | prefixUrl: 'http://127.0.0.1:5600',
20 | retry: { limit: 0 },
21 | });
22 |
23 | async function getToken() {
24 | const authConfig = JSON.parse(await readFile(authFile));
25 | return authConfig.token;
26 | }
27 |
28 | module.exports.getEnvs = async () => {
29 | const token = await getToken();
30 | const body = await api({
31 | url: 'api/envs',
32 | searchParams: {
33 | searchValue: 'JD_COOKIE',
34 | t: Date.now(),
35 | },
36 | headers: {
37 | Accept: 'application/json',
38 | authorization: `Bearer ${token}`,
39 | },
40 | }).json();
41 | return body.data;
42 | };
43 |
44 | module.exports.getEnvsCount = async () => {
45 | const data = await this.getEnvs();
46 | return data.length;
47 | };
48 |
49 | module.exports.addEnv = async (cookie, remarks) => {
50 | const token = await getToken();
51 | const body = await api({
52 | method: 'post',
53 | url: 'api/envs',
54 | params: { t: Date.now() },
55 | json: [{
56 | name: 'JD_COOKIE',
57 | value: cookie,
58 | remarks,
59 | }],
60 | headers: {
61 | Accept: 'application/json',
62 | authorization: `Bearer ${token}`,
63 | 'Content-Type': 'application/json;charset=UTF-8',
64 | },
65 | }).json();
66 | return body;
67 | };
68 |
69 | module.exports.updateEnv = async (cookie, eid, remarks) => {
70 | const token = await getToken();
71 | const body = await api({
72 | method: 'put',
73 | url: 'api/envs',
74 | params: { t: Date.now() },
75 | json: {
76 | name: 'JD_COOKIE',
77 | value: cookie,
78 | _id: eid,
79 | remarks,
80 | },
81 | headers: {
82 | Accept: 'application/json',
83 | authorization: `Bearer ${token}`,
84 | 'Content-Type': 'application/json;charset=UTF-8',
85 | },
86 | }).json();
87 | return body;
88 | };
89 |
90 | module.exports.updateEnv11 = async (cookie, eid, remarks) => {
91 | const token = await getToken();
92 | const body = await api({
93 | method: 'put',
94 | url: 'api/envs',
95 | params: { t: Date.now() },
96 | json: {
97 | name: 'JD_COOKIE',
98 | value: cookie,
99 | id: eid,
100 | remarks,
101 | },
102 | headers: {
103 | Accept: 'application/json',
104 | authorization: `Bearer ${token}`,
105 | 'Content-Type': 'application/json;charset=UTF-8',
106 | },
107 | }).json();
108 | return body;
109 | };
110 |
111 | module.exports.DisableCk = async (eid) => {
112 | const token = await getToken();
113 | const body = await api({
114 | method: 'put',
115 | url: 'api/envs/disable',
116 | params: { t: Date.now() },
117 | body: JSON.stringify([eid]),
118 | headers: {
119 | Accept: 'application/json',
120 | authorization: `Bearer ${token}`,
121 | 'Content-Type': 'application/json;charset=UTF-8',
122 | },
123 | }).json();
124 | return body;
125 | };
126 |
127 | module.exports.EnableCk = async (eid) => {
128 | const token = await getToken();
129 | const body = await api({
130 | method: 'put',
131 | url: 'api/envs/enable',
132 | params: { t: Date.now() },
133 | body: JSON.stringify([eid]),
134 | headers: {
135 | Accept: 'application/json',
136 | authorization: `Bearer ${token}`,
137 | 'Content-Type': 'application/json;charset=UTF-8',
138 | },
139 | }).json();
140 | return body;
141 | };
142 |
143 | module.exports.getstatus = async(eid) => {
144 | const envs = await this.getEnvs();
145 | var tempid = 0;
146 | for (let i = 0; i < envs.length; i++) {
147 | tempid = 0;
148 | if (envs[i]._id) {
149 | tempid = envs[i]._id;
150 | }
151 | if (envs[i].id) {
152 | tempid = envs[i].id;
153 | }
154 | if (tempid == eid) {
155 | return envs[i].status;
156 | }
157 | }
158 | return 99;
159 | };
160 |
161 | module.exports.getEnvById = async(eid) => {
162 | const envs = await this.getEnvs();
163 | var tempid = 0;
164 | for (let i = 0; i < envs.length; i++) {
165 | tempid = 0;
166 | if (envs[i]._id) {
167 | tempid = envs[i]._id;
168 | }
169 | if (envs[i].id) {
170 | tempid = envs[i].id;
171 | }
172 | if (tempid == eid) {
173 | return envs[i].value;
174 | }
175 | }
176 | return "";
177 | };
178 |
179 | module.exports.getEnvByPtPin = async (Ptpin) => {
180 | const envs = await this.getEnvs();
181 | for (let i = 0; i < envs.length; i++) {
182 | var tempptpin = decodeURIComponent(envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/) && envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
183 | if(tempptpin==Ptpin){
184 | return envs[i];
185 | }
186 | }
187 | return "";
188 | };
189 |
190 | module.exports.delEnv = async (eid) => {
191 | const token = await getToken();
192 | const body = await api({
193 | method: 'delete',
194 | url: 'api/envs',
195 | params: { t: Date.now() },
196 | body: JSON.stringify([eid]),
197 | headers: {
198 | Accept: 'application/json',
199 | authorization: `Bearer ${token}`,
200 | 'Content-Type': 'application/json;charset=UTF-8',
201 | },
202 | }).json();
203 | return body;
204 | };
205 |
--------------------------------------------------------------------------------
/serverless.yml:
--------------------------------------------------------------------------------
1 | # serverless.yml
2 |
3 | #组件信息
4 | component: scf # (必选) 组件名称,在该实例中为scf
5 | name: jdscript # (必选) 组件实例名称。
6 |
7 | #组件参数配置
8 | inputs:
9 | name: scf-${name} # 云函数名称,默认为 ${name}-${stage}-${app}
10 | namespace: default
11 | enableRoleAuth: true # 默认会尝试创建 SCF_QcsRole 角色,如果不需要配置成 false 即可
12 | src:
13 | src: ./
14 | exclude:
15 | - '*.!(js|txt|json)'
16 | - 'backUp/**'
17 | - 'icon/**'
18 | - 'package.json'
19 | - 'package-lock.json'
20 | - 'LICENSE'
21 | - 'ql.js'
22 | - 'jd_CheckCK.js'
23 | handler: index.main_handler #入口
24 | runtime: Nodejs12.16 # 运行环境 默认 Nodejs12.16
25 | region: ap-guangzhou # 函数所在区域
26 | description: This is a function in ${app} application.
27 | memorySize: 64 # 内存大小,单位MB
28 | timeout: 3600 # 超时时间,单位秒
29 | asyncRunEnable: true # 是否启用异步执行
30 | traceEnable: true
31 | retryNum: 0
32 | events: #触发器
33 | - timer:
34 | parameters:
35 | name: config
36 | cronExpression: "0 0 * * * * *"
37 | enable: true
38 | argument: config
39 | - timer: #超市蓝币兑换
40 | parameters:
41 | name: blueCoin
42 | cronExpression: "0 59 23 * * * *"
43 | enable: false
44 | argument: jd_blueCoin
45 | - timer:
46 | parameters:
47 | name: cfd
48 | cronExpression: "59 0 0 * * * *"
49 | enable: true
50 | argument: jd_cfd
51 | - timer:
52 | parameters:
53 | name: cfd_pearl
54 | cronExpression: "50 59 * * * * *"
55 | enable: true
56 | argument: jd_cfd_pearl_ex
57 | - timer:
58 | parameters:
59 | name: jxmc
60 | cronExpression: "59 19 0 * * * *"
61 | enable: true
62 | argument: jd_jxmc
63 | - timer:
64 | parameters:
65 | name: jd_redrain_half
66 | cronExpression: "59 29 21,22 * * * *"
67 | enable: true
68 | argument: jd_redrain_half
69 | environment: # 环境变量
70 | variables: # 环境变量对象
71 |
--------------------------------------------------------------------------------