diff --git a/src/main/resources/filter.txt b/src/main/resources/filter.txt
index 1359bed..8c54be8 100644
--- a/src/main/resources/filter.txt
+++ b/src/main/resources/filter.txt
@@ -19,14 +19,14 @@
剪
剂
丸
+SD
鼻膏
U盘
-sd
龟头
鼻炎
-SD
鼻毛
鼻影
+sd
鼻头
鼻塞
黑沙
@@ -469,14 +469,15 @@ SD
鼠标手
鼠标垫
黄金卡
-hpv
-LED
-FMJ
-HPV
-VGA
-SD卡
黄膏贴
+VGA
+FMJ
+LED
+HPV
+SD卡
+uv镜
麦克风
+hpv
鸳鸯锅
鸥曼GTL
鱼塘膜
@@ -484,6 +485,7 @@ SD卡
高升专
马桶垫
马桶刷
+马克笔
马丁靴
香囊袋
飞机杯
@@ -641,6 +643,7 @@ SD卡
百日宴
白板笔
番茄丁
+男人茶
电话牌
电话卡
电脑包
@@ -700,7 +703,6 @@ SD卡
洗鼻器
洗地液
洋娃娃
-uv镜
注射针
注射器
泡澡球
@@ -931,6 +933,7 @@ uv镜
养生茶
养殖膜
公文包
+八宝茶
八倍镜
充电桩
充电头
@@ -972,20 +975,21 @@ uv镜
丁香茶
一片装
一次性
-G100
-PVC板
-车载u盘
-hdmi
-视频mv
-HDMI
-H10E
-T口弯头
鼻腔喷雾
黑芝麻丸
黑色水笔
鸡毛掸子
高清配件
香薰精油
+hdmi
+车载u盘
+PVC板
+视频mv
+G100
+HDMI
+4/3膜
+T口弯头
+H10E
食用色素
静音阻尼
静脉曲张
@@ -998,7 +1002,6 @@ T口弯头
防水涂料
防水敷贴
防卫尖刺
-4/3膜
钙咀嚼片
钓鱼插件
钓鱼手竿
@@ -1150,17 +1153,15 @@ T口弯头
中国电信
下关沱茶
万向滑轮
-儿童n95
-DHA藻油
-0-12岁
-鱼池防水膜
-鱼塘专用膜
-SUP掌机
-慢性鼻1炎
-轻酸瓶3%
win10
-靠背收纳袋
+SUP掌机
+鱼池防水膜
除菌洗地液
+DHA藻油
+慢性鼻1炎
+鱼塘专用膜
+轻酸瓶3%
+靠背收纳袋
钓箱置物袋
金属探测器
行车记录仪
@@ -1180,6 +1181,7 @@ win10
枇杷雪梨膏
枇杷秋梨膏
摄像头镜片
+儿童n95
接线式直管
打印机碳带
手机充电线
@@ -1202,87 +1204,97 @@ win10
儿童沐浴露
儿童暖暖套
仿真小蛋糕
+0-12岁
人参五宝茶
中央扶手箱
-SMOVES
-HEISHA
-宝宝儿童零食
-儿童电话手表
-远投路滑配件
-奥咖云南特产
-儿童电动牙刷
-小苍兰沐浴露
-视线盲区贴纸
-儿童串珠玩具
黑色塑料薄膜
-轮胎专用胶水
-樱の色鱼子酱
-汽车尾部挂件
-擦车清洁工具
-办公会议茶杯
-矶钓钓鱼配件
-不干胶标签带
-烘焙彩针糖果
-儿童保温水杯
-移动wifi
+SMOVES
KVM切换器
-windows
-Ockered
+轮胎专用胶水
+HEISHA
+移动wifi
+远投路滑配件
+视线盲区贴纸
+矶钓钓鱼配件
+烘焙彩针糖果
+汽车尾部挂件
+樱の色鱼子酱
+擦车清洁工具
+小苍兰沐浴露
+宝宝儿童零食
+奥咖云南特产
+办公会议茶杯
+儿童电话手表
+儿童电动牙刷
+儿童保温水杯
+儿童串珠玩具
+不干胶标签带
+QHE+ 其嘉
led开关电源
-汽车头枕腰靠套装
+windows
+人参黄精枸杞茶
+Ockered
金龙鱼 面条挂面
+汽车头枕腰靠套装
N1162有线鼠标
-KB216有线键盘
-德生源氨基酸洗发水
女士内裤,少女内裤
塑料士兵小军人玩具
+KB216有线键盘
+德生源氨基酸洗发水
+乐凡希 三明治火腿片
奇异果嫩肤磨砂沐浴乳
MS116 有线鼠标
生鲜火锅 250g墨鱼饼
生鲜 方便菜 500g排骨*2
+破壳茶叶正味碳焙铁观音一级罐装100g
破壳茶叶铁观音正味浓香型一级罐装100g
正宗农家鸡蛋散养农村柴鸡蛋营养美味健康轻食
+新鲜羊肉卷肥牛卷涮火锅套餐烧烤配菜火锅食材
夕恒手机散热器吃鸡神器半导体冰冻冷风散热器
-野铺子雪媚娘蛋黄酥6枚装 野铺子蛋黄酥【6枚装】
+新鲜鱼类海鲜水产 健康轻食 生鲜 2斤装鳕鱼
安宝笛蓓缦水养柔肤茉莉海盐磨砂沐浴露40ml*3
+野铺子雪媚娘蛋黄酥6枚装 野铺子蛋黄酥【6枚装】
奥咖云南特产贡菊茶40g/罐无硫天然生态贡菊茶罐装
破壳茶叶poke福建安溪铁观音浓香型圆罐装散茶100g
羊蝎子批发现杀羊脊骨内蒙古新鲜火锅食材 羊蝎子1000g
+方便食品 烧烤火锅食材海鲜水产 原味烤肠200g/包*1
落花啼春 吊坠女佛公弥勒笑佛玉坠玉石阿富汗项链挂坠玉佩玉器
新鲜雪花肥牛卷牛肉片牛肉卷涮火锅套餐配菜火锅食材 2斤肥牛卷
-奥咖姜枣黑糖茶300克/盒云南特产女生大姨妈月经期温暖小肚肚
正宗内蒙古羊肉卷 羔羊卷 涮火锅食材火锅料 1000g羊肉卷
+奥咖姜枣黑糖茶300克/盒云南特产女生大姨妈月经期温暖小肚肚
瑞发德 藤椒琵琶腿 400g 烤鸡腿 鸡肉 冷冻油炸半成品小吃
羊杂清真 原味羊杂 熟食速食火锅食材新鲜免切批发 纯羊杂4斤装
a1雪绒蛋糕550g早餐食品小面包蒸蛋糕 a1雪绒蛋糕550g
+礼物金大福珠宝小雏菊银手链女款925银气质韩版简约手链 小雏菊
THISE利斯欧洲原装进口全脂纯牛奶500ml高钙有机健康高端奶
+乐凡希 三明治火腿片 三连包 150克(50克 X 3) 冷藏熟食
牛杂牛肚牛百叶白千层毛肚丝黑毛肚配菜批发新鲜火锅食材 1000g白千层
【5盒装】丹麦风味曲奇饼干休闲零食小吃 【5盒装】丹麦风味曲奇饼干
-乐凡希 三明治火腿片 三连包 150克(50克 X 3) 冷藏熟食
3份起正宗武汉热干面过早速食拌面碱水面带调料酱包方便面条湖北 6包
-奇异果嫩肤磨砂沐浴乳 香氛清洁香水沐浴露留香沐浴液 红樱桃300ml
-老北京炸酱面杂酱面休闲食品韩国拌面方便面速食特产网红面条102g/包
3份起正宗武汉热干面过早速食拌面碱水面带调料酱包方便面条湖北 12包
+奇异果嫩肤磨砂沐浴乳 香氛清洁香水沐浴露留香沐浴液 红樱桃300ml
盖世 美人唇杏鲍菇木耳海茸/裙带菜150g*4袋 解冻即食 海鲜水产
+老北京炸酱面杂酱面休闲食品韩国拌面方便面速食特产网红面条102g/包
牛黄喉烧烤新鲜配菜牛杂牛喉管涮锅麻辣烫凉拌火锅食材 250g*2牛黄喉
新鲜 猪胸骨 猪脆骨 散养土猪肉 软骨 猪排骨 批发 猪胸骨1000g
+满沃 黑枸杞(大果>7MM)100克 青海柴达木大果黑枸杞 天然花青素
牛杂牛肚牛百叶白千层毛肚丝黑毛肚配菜批发新鲜火锅食材 1000g黑毛肚丝
丹麦风味曲奇饼干大分量盒装休闲零食饼干礼包 丹麦风味曲奇饼干360g/盒
正宗农家鸡蛋 散养农村柴鸡蛋 营养美味早餐 现捡 玉米黄虫草蛋 鸡蛋20枚
宝佩 印尼五瓣小金刚菩提子双龙肉纹国潮复古单圈手链文玩佛珠手串男女 松石款
+老北京炸酱面杂酱面休闲食品韩国拌面方便面速食特产网红面条102g/包 10包
金汤佛跳墙正宗即食袋装海参鲍鱼捞饭盆菜海鲜大礼包熟食海鲜 2袋佛跳墙250g
猫村长泰式榴莲糖238g桶装特浓泰式风味榴莲奶糖 泰式风味榴莲糖238g/桶
-老北京炸酱面杂酱面休闲食品韩国拌面方便面速食特产网红面条102g/包 10包
-惠发 速冻炸鸡食品 裹粉鸡胸肉 鸡米花 鸡排 半成品 烧烤食材 400g鸡米花
厚切猪五花肉片韩国烤肉食材新鲜烧烤食材韩式烤肉片生猪肉 五花肉片250g*2盒
-舟山 黄花鱼新鲜冷冻 小黄鱼海鲜水产 清蒸红烧烧烤油炸皆可 整箱六斤装中号黄花鱼
+惠发 速冻炸鸡食品 裹粉鸡胸肉 鸡米花 鸡排 半成品 烧烤食材 400g鸡米花
老北京炸酱面杂酱面休闲食品韩国拌面方便面速食特产网红面条102g/包 3包尝鲜装
+舟山 黄花鱼新鲜冷冻 小黄鱼海鲜水产 清蒸红烧烧烤油炸皆可 整箱六斤装中号黄花鱼
宝藏驼 猴头菇驼奶饼干代餐膳食纤维休闲零食小吃独立包装开袋即食饼干400g*1盒
中国龙瓷 生日礼物送女生男友情人节十二生肖摆件创意礼品工艺品德化白瓷器摆件伴手礼物
-野生金鲳鱼大号新鲜冷冻鲜活白鲳鱼海昌鱼平鱼海鲜水产 大号金鲳鱼*1条(约8两-1斤)
啡趣精品挂耳咖啡现磨美式黑咖啡无糖滤挂式手冲咖啡粉新鲜烘焙风味原产地新朋友入会礼盒装
-SeeHe喜氢485ml瓶装 含氢饮用水 富氢水 水素水 弱碱性 办公室用水 12瓶装
+野生金鲳鱼大号新鲜冷冻鲜活白鲳鱼海昌鱼平鱼海鲜水产 大号金鲳鱼*1条(约8两-1斤)
MASIL 玛丝兰韩国三次方氨基酸洗发水便携旅行装8ml去屑控油(8ml*20条/盒)
+SeeHe喜氢485ml瓶装 含氢饮用水 富氢水 水素水 弱碱性 办公室用水 12瓶装
中秋节送礼 广式月饼 手工酥皮 莲蓉乌月饼 休闲零食 散装蛋黄莲蓉乌米月饼*6个 50g
黄海大鲅鱼新鲜鲅鱼鲅鱼整条鲅鱼马鲛鱼批发野生海捕鲅鱼 小号鲅鱼2500g(6两-8两/条)
TIMESWIND天然新疆玉多彩葫芦莲花手串戈壁玉黄玉古风个性女款玉石手链 玉莲花珠葫芦手链
@@ -1292,6 +1304,7 @@ S925银几何显脸瘦的耳环女潮时尚长款气质蝴蝶结流苏耳坠个
国拓 地道纯猪肉脆皮烤肠300g 早餐热狗肠 纯肉肠 香肠 烧烤囤货食材 脆皮火山石烤肠 台湾烤肠
【JD空运】云南高原种植丹东99草莓新鲜奶油草莓 平安夜送礼盒孕妇水果 坏果包赔 2盒中果 礼盒装
排骨正宗香酥炸排骨速冻菜肴 快手菜 速食方便菜 蒜香腌制半成品 黑椒 半成品菜 排骨2包*500g
+利客(RIKAY) 无线蓝牙耳机双唛长续航AI降噪挂耳式商务运动跑步开车代驾外卖适用苹果华为小米OPPO手机
荷美尔(Hormel)精选低温午餐肉300g/包 囤货必备全程冷链植物配料慢煮工艺口感绵密 火锅食材泡面搭档
女士香水三件套装淡香清新自由之水反转巴黎香水礼盒套装情人节生日礼物节日送礼 【黑鸦片香水三件套/每瓶30ml】
斐济原装进口 Fitsui斐粹 理疗级饮用天然矿泉水 高偏硅酸型高端饮用水 整箱1.5L*12瓶 1.5L整箱
diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml
deleted file mode 100644
index 32cab36..0000000
--- a/src/main/resources/log4j2.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/main/resources/test_assets.js b/src/main/resources/test_assets.js
deleted file mode 100644
index fd56950..0000000
--- a/src/main/resources/test_assets.js
+++ /dev/null
@@ -1,2185 +0,0 @@
-/*
-京东资产变动通知脚本:https://jdsharedresourcescdn.azureedge.net/jdresource/jd_bean_change.js
-Modified time: 2021-05-17 15:25:41
-统计昨日京豆的变化情况,包括收入,支出,以及显示当前京豆数量,目前小问题:下单使用京豆后,退款重新购买,计算统计会出现异常
-统计红包以及过期红包
-网页查看地址 : https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean
-支持京东双账号
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-============QuantumultX==============
-[task_local]
-#京东资产变动通知
-2 9 * * * https://jdsharedresourcescdn.azureedge.net/jdresource/jd_bean_change.js, tag=京东资产变动通知, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
-================Loon===============
-[Script]
-cron "2 9 * * *" script-path=https://jdsharedresourcescdn.azureedge.net/jdresource/jd_bean_change.js, tag=京东资产变动通知
-=============Surge===========
-[Script]
-京东资产变动通知 = type=cron,cronexp="2 9 * * *",wake-system=1,timeout=3600,script-path=https://jdsharedresourcescdn.azureedge.net/jdresource/jd_bean_change.js
-============小火箭=========
-京东资产变动通知 = type=cron,script-path=https://jdsharedresourcescdn.azureedge.net/jdresource/jd_bean_change.js, cronexpr="2 9 * * *", timeout=3600, enable=true
- */
-let roleMap = {
- "jd_4521b375ebb5d":"锟子怪",
- "jd_542c10c0222bc":"康子怪",
- "jd_66dcb31363ef6":"涛子怪",
- "jd_45d917547c763":"跑腿小怪",
- "417040678_m":"斌子怪",
- "jd_73d88459d908e":"杰杰子",
- "381550701lol":"漪漪子",
- "jd_4333d5dc1ac5f":"舒楠子",
- "realm_":"泽子怪"
-}
-let dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=d2b6042cb38f0df63e20797c002208d2710104750c18a1dc84d54106a859a3f0"
-const $ = new Env('京东资产变动通知');
-let jdFruitShareArr = [], isBox = false, notify, newShareCodes;
-//助力好友分享码(最多4个,否则后面的助力失败),原因:动动农场每人每天只有四次助力机会
-//此此内容是IOS用户下载脚本到本地使用,填写互助码的地方,同一动动账号的好友互助码请使用@符号隔开。
-//下面给出两个账号的填写示例(iOS只支持2个动动账号)
-let shareCodes =
- [ // 这个列表填入你要助力的好友的shareCode
-]
-let subTitle = '', option = {}, isFruitFinished = false;
-const retainWater = 100;//保留水滴大于多少g,默认100g;
-let jdNotify = false;//是否关闭通知,false打开通知推送,true关闭通知推送
-let jdFruitBeanCard = false;//农场使用水滴换豆卡(如果出现限时活动时100g水换20豆,此时比浇水划算,推荐换豆),true表示换豆(不浇水),false表示不换豆(继续浇水),脚本默认是浇水
-let randomCount = $.isNode() ? 0 : 0;
-const JD_API_HOST = 'https://api.m.jd.com/client.action';
-const urlSchema = `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/3KSjXqQabiTuD1cJ28QskrpWoBKT/index.html%22%20%7D`;
-
-let allMessage = '';
-let message = "";
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-!(async () => {
- await requireConfig();
- message += "[通知] 资产变动 \n\n --- \n\n"
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
- return;
- }
- let count = 0
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
- $.index = i + 1;
- $.beanCount = 0;
- $.incomeBean = 0;
- $.expenseBean = 0;
- $.todayIncomeBean = 0;
- $.errorMsg = '';
- $.isLogin = true;
- $.nickName = '';
- $.balance = 0;
- $.expiredBalance = 0;
-
- username = $.UserName
- if (roleMap[username] == undefined){
- continue
- }
- username = roleMap[username]
-
- await TotalBean();
- //加上名称
- message = message + "【羊毛姐妹】" + username + `( ${$.nickName} )`+ " \n\n "
-
- console.log(`\n********开始【京东账号${$.index}】${$.nickName || $.UserName}******\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- }
- continue
- }
- await bean();
- await showMsg();
- await shareCodesFormat();
- await jdFruit();
- await jdWish()
- }
- message += "----\n\n"
- if( (count+1)%4 ==0 || i == cookiesArr.length -1 ){
- message = message + getPic()
- postToDingTalk(message)
- message = ""
- }
- count ++
- }
-
- if ($.isNode() && allMessage) {
- await notify.sendNotify(`${$.name}`, `${allMessage}`, { url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean` })
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- if (message != ""){
- postToDingTalk(message)
- }
- $.done();
- })
-
-
- function requireConfig() {
- return new Promise(resolve => {
- that.log('开始获取配置文件\n')
- notify = $.isNode() ? require('./sendNotify') : '';
- //Node.js用户请在jdCookie.js处填写动动ck;
- const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
- const jdFruitShareCodes = $.isNode() ? require('./jdFruitShareCodes.js') : '';
- //IOS等用户直接用NobyDa的jd cookie
- if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- if (jdCookieNode[item]) {
- cookiesArr.push(jdCookieNode[item])
- }
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') that.log = () => {};
- } else {
- let cookiesData = $.getdata('CookiesJD') || "[]";
- cookiesData = jsonParse(cookiesData);
- cookiesArr = cookiesData.map(item => item.cookie);
- cookiesArr.reverse();
- cookiesArr.push(...[$.getdata('CookieJD2'), $.getdata('CookieJD')]);
- cookiesArr.reverse();
- cookiesArr = cookiesArr.filter(item => item !== "" && item !== null && item !== undefined);
- }
- that.log(`共${cookiesArr.length}个动动账号\n`)
- resolve()
- })
- }
-
-async function showMsg() {
- // if ($.errorMsg) return
- allMessage += `账号${$.index}:${$.nickName || $.UserName}\n今日收入:${$.todayIncomeBean}京豆 🐶\n昨日收入:${$.incomeBean}京豆 🐶\n昨日支出:${$.expenseBean}京豆 🐶\n当前京豆:${$.beanCount}(今日将过期${$.expirejingdou})京豆 🐶${$.message}${$.index !== cookiesArr.length ? '\n\n' : ''}`;
- message += "" + `【总京豆】:${$.beanCount}( 今日将过期${$.expirejingdou} )京豆 🐶` +"\n\n"
- message += "" + `【今日收入】:${$.todayIncomeBean}京豆 🐶` +"\n\n"
- message += "" + `【昨日收入】:${$.incomeBean}京豆 🐶` +"\n\n"
- message += "" + `【昨日支出】:${$.expenseBean}京豆 🐶` +"\n\n"
-
-
-
- message += "" + `【当前总红包】:${$.balance}( 今日总过期${$.expiredBalance} )元 🧧` +"\n\n"
- message += "" + `【京喜红包】:${$.jxRed}( 今日将过期${$.jxRedExpire.toFixed(2)} )元 🧧` +"\n\n"
- message += "" + `【极速红包】:${$.jsRed}( 今日将过期${$.jsRedExpire.toFixed(2)} )元 🧧` +"\n\n"
- message += "" + `【京东红包】:${$.jdRed}( 今日将过期${$.jdRedExpire.toFixed(2)} )元 🧧` +"\n\n"
- message += "" + `【健康红包】:${$.jdhRed}( 今日将过期${$.jdhRedExpire.toFixed(2)} )元 🧧` +"\n\n"
- // if ($.isNode()) {
- // await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `账号${$.index}:${$.nickName || $.UserName}\n昨日收入:${$.incomeBean}京豆 🐶\n昨日支出:${$.expenseBean}京豆 🐶\n当前京豆:${$.beanCount}京豆 🐶${$.message}`, { url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean` })
- // }
- $.msg($.name, '', `账号${$.index}:${$.nickName || $.UserName}\n今日收入:${$.todayIncomeBean}京豆 🐶\n昨日收入:${$.incomeBean}京豆 🐶\n昨日支出:${$.expenseBean}京豆 🐶\n当前京豆:${$.beanCount}(今日将过期${$.expirejingdou})京豆🐶${$.message}`, {"open-url": "https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean"});
-}
-
-async function bean() {
- // console.log(`北京时间零点时间戳:${parseInt((Date.now() + 28800000) / 86400000) * 86400000 - 28800000}`);
- // console.log(`北京时间2020-10-28 06:16:05::${new Date("2020/10/28 06:16:05+08:00").getTime()}`)
- // 不管哪个时区。得到都是当前时刻北京时间的时间戳 new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000
-
- //前一天的0:0:0时间戳
- const tm = parseInt((Date.now() + 28800000) / 86400000) * 86400000 - 28800000 - (24 * 60 * 60 * 1000);
- // 今天0:0:0时间戳
- const tm1 = parseInt((Date.now() + 28800000) / 86400000) * 86400000 - 28800000;
- let page = 1, t = 0, yesterdayArr = [], todayArr = [];
- do {
- let response = await getJingBeanBalanceDetail(page);
- // console.log(`第${page}页: ${JSON.stringify(response)}`);
- if (response && response.code === "0") {
- page++;
- let detailList = response.detailList;
- if (detailList && detailList.length > 0) {
- for (let item of detailList) {
- const date = item.date.replace(/-/g, '/') + "+08:00";
- if (new Date(date).getTime() >= tm1 && (!item['eventMassage'].includes("退还") && !item['eventMassage'].includes('扣赠'))) {
- todayArr.push(item);
- } else if (tm <= new Date(date).getTime() && new Date(date).getTime() < tm1 && (!item['eventMassage'].includes("退还") && !item['eventMassage'].includes('扣赠'))) {
- //昨日的
- yesterdayArr.push(item);
- } else if (tm > new Date(date).getTime()) {
- //前天的
- t = 1;
- break;
- }
- }
- } else {
- $.errorMsg = `数据异常`;
- $.msg($.name, ``, `账号${$.index}:${$.nickName}\n${$.errorMsg}`);
- t = 1;
- }
- } else if (response && response.code === "3") {
- console.log(`cookie已过期,或者填写不规范,跳出`)
- t = 1;
- } else {
- console.log(`未知情况:${JSON.stringify(response)}`);
- console.log(`未知情况,跳出`)
- t = 1;
- }
- } while (t === 0);
- for (let item of yesterdayArr) {
- if (Number(item.amount) > 0) {
- $.incomeBean += Number(item.amount);
- } else if (Number(item.amount) < 0) {
- $.expenseBean += Number(item.amount);
- }
- }
- for (let item of todayArr) {
- if (Number(item.amount) > 0) {
- $.todayIncomeBean += Number(item.amount);
- }
- }
- await queryexpirejingdou();//过期京豆
- await redPacket();//过期红包
- // console.log(`昨日收入:${$.incomeBean}个京豆 🐶`);
- // console.log(`昨日支出:${$.expenseBean}个京豆 🐶`)
-}
-function TotalBean() {
- return new Promise(async resolve => {
- const options = {
- url: "https://me-api.jd.com/user_new/info/GetJDUserInfoUnion",
- headers: {
- Host: "me-api.jd.com",
- Accept: "*/*",
- Connection: "keep-alive",
- Cookie: cookie,
- "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"),
- "Accept-Language": "zh-cn",
- "Referer": "https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&",
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- $.logErr(err)
- } else {
- if (data) {
- data = JSON.parse(data);
- if (data['retcode'] === "1001") {
- $.isLogin = false; //cookie过期
- return;
- }
- if (data['retcode'] === "0" && data.data && data.data.hasOwnProperty("userInfo")) {
- $.nickName = data.data.userInfo.baseInfo.nickname;
- }
- if (data['retcode'] === '0' && data.data && data.data['assetInfo']) {
- $.beanCount = data.data && data.data['assetInfo']['beanNum'];
- }
- } else {
- $.log('京东服务器返回空数据');
- }
- }
- } catch (e) {
- $.logErr(e)
- } finally {
- resolve();
- }
- })
- })
-}
-function getJingBeanBalanceDetail(page) {
- return new Promise(async resolve => {
- const options = {
- "url": `https://api.m.jd.com/client.action?functionId=getJingBeanBalanceDetail`,
- "body": `body=${escape(JSON.stringify({"pageSize": "20", "page": page.toString()}))}&appid=ld`,
- "headers": {
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (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"),
- 'Host': 'api.m.jd.com',
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Cookie': cookie,
- }
- }
- $.post(options, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- data = JSON.parse(data);
- // console.log(data)
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function queryexpirejingdou() {
- return new Promise(async resolve => {
- const options = {
- "url": `https://wq.jd.com/activep3/singjd/queryexpirejingdou?_=${Date.now()}&g_login_type=1&sceneval=2`,
- "headers": {
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-cn",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "Host": "wq.jd.com",
- "Referer": "https://wqs.jd.com/promote/201801/bean/mybean.html",
- "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.1 Mobile/15E148 Safari/604.1"
- }
- }
- $.expirejingdou = 0;
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- // console.log(data)
- data = JSON.parse(data.slice(23, -13));
- // console.log(data)
- if (data.ret === 0) {
- data['expirejingdou'].map(item => {
- console.log(`${timeFormat(item['time'] * 1000)}日过期京豆:${item['expireamount']}\n`);
- })
- $.expirejingdou = data['expirejingdou'][0]['expireamount'];
- // if ($.expirejingdou > 0) {
- // $.message += `\n今日将过期:${$.expirejingdou}京豆 🐶`;
- // }
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function redPacket() {
- return new Promise(async resolve => {
- const options = {
- "url": `https://m.jingxi.com/user/info/QueryUserRedEnvelopesV2?type=1&orgFlag=JD_PinGou_New&page=1&cashRedType=1&redBalanceFlag=1&channel=1&_=${+new Date()}&sceneval=2&g_login_type=1&g_ty=ls`,
- "headers": {
- 'Host': 'm.jingxi.com',
- 'Accept': '*/*',
- 'Connection': 'keep-alive',
- 'Accept-Language': 'zh-cn',
- 'Referer': 'https://st.jingxi.com/my/redpacket.shtml?newPg=App&jxsid=16156262265849285961',
- 'Accept-Encoding': 'gzip, deflate, br',
- "Cookie": cookie,
- '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")
- }
- }
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- data = JSON.parse(data).data
- $.jxRed = 0, $.jsRed = 0, $.jdRed = 0, $.jdhRed = 0, $.jxRedExpire = 0, $.jsRedExpire = 0, $.jdRedExpire = 0, $.jdhRedExpire = 0;
- let t = new Date()
- t.setDate(t.getDate() + 1)
- t.setHours(0, 0, 0, 0)
- t = parseInt((t - 1) / 1000)
- for (let vo of data.useRedInfo.redList || []) {
- if (vo.orgLimitStr && vo.orgLimitStr.includes("京喜")) {
- $.jxRed += parseFloat(vo.balance)
- if (vo['endTime'] === t) {
- $.jxRedExpire += parseFloat(vo.balance)
- }
- } else if (vo.activityName.includes("极速版")) {
- $.jsRed += parseFloat(vo.balance)
- if (vo['endTime'] === t) {
- $.jsRedExpire += parseFloat(vo.balance)
- }
- } else if (vo.orgLimitStr && vo.orgLimitStr.includes("京东健康")) {
- $.jdhRed += parseFloat(vo.balance)
- if (vo['endTime'] === t) {
- $.jdhRedExpire += parseFloat(vo.balance)
- }
- } else {
- $.jdRed += parseFloat(vo.balance)
- if (vo['endTime'] === t) {
- $.jdRedExpire += parseFloat(vo.balance)
- }
- }
- }
- $.jxRed = $.jxRed.toFixed(2)
- $.jsRed = $.jsRed.toFixed(2)
- $.jdRed = $.jdRed.toFixed(2)
- $.jdhRed = $.jdhRed.toFixed(2)
- $.balance = data.balance
- $.expiredBalance = ($.jxRedExpire + $.jsRedExpire + $.jdRedExpire).toFixed(2)
- $.message += `\n当前总红包:${$.balance}(今日总过期${$.expiredBalance})元 🧧\n京喜红包:${$.jxRed}(今日将过期${$.jxRedExpire.toFixed(2)})元 🧧\n极速红包:${$.jsRed}(今日将过期${$.jsRedExpire.toFixed(2)})元 🧧\n京东红包:${$.jdRed}(今日将过期${$.jdRedExpire.toFixed(2)})元 🧧\n健康红包:${$.jdhRed}(今日将过期${$.jdhRedExpire.toFixed(2)})元 🧧`;
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function jsonParse(str) {
- if (typeof str == "string") {
- try {
- return JSON.parse(str);
- } catch (e) {
- console.log(e);
- $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
- return [];
- }
- }
-}
-function timeFormat(time) {
- let date;
- if (time) {
- date = new Date(time)
- } else {
- date = new Date();
- }
- return date.getFullYear() + '-' + ((date.getMonth() + 1) >= 10 ? (date.getMonth() + 1) : '0' + (date.getMonth() + 1)) + '-' + (date.getDate() >= 10 ? date.getDate() : '0' + date.getDate());
-}
-// prettier-ignore
-function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,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)}
-
-//农场代码
-
-async function jdFruit() {
- subTitle = `【动动账号${$.index}】${$.nickName}`;
- try {
- await initForFarm();
- if ($.farmInfo.farmUserPro) {
- // option['media-url'] = $.farmInfo.farmUserPro.goodsImage;
- message = message + "【水果名称】 " + `${$.farmInfo.farmUserPro.name}` + "\n\n";
- // message += "【已兑换水果】" + `${$.farmInfo.farmUserPro.winTimes}` + "次\n\n";
- that.log(`\n【动动账号${$.index}(${$.nickName || $.UserName})的${$.name}好友互助码】${$.farmInfo.farmUserPro.shareCode}\n`);
- that.log(`\n【已成功兑换水果】${$.farmInfo.farmUserPro.winTimes}次\n`);
- await getHelp();
- await masterHelpShare();//助力好友
- await setHelp();
- if ($.farmInfo.treeState === 2 || $.farmInfo.treeState === 3) {
- option['open-url'] = urlSchema;
- message = message + " " + $.UserName + "\n【提醒⏰】" + fruitName + "已可领取\n请去动动APP或微信小程序查看\n点击弹窗即达"
- $.msg($.name, ``, `【动动账号${$.index}】${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去动动APP或微信小程序查看\n点击弹窗即达`, option);
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}水果已可领取`, `【动动账号${$.index}】${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去动动APP或微信小程序查看`);
- }
- return
- } else if ($.farmInfo.treeState === 1) {
- that.log(`\n${$.farmInfo.farmUserPro.name}种植中...\n`)
- } else if ($.farmInfo.treeState === 0) {
- //已下单购买, 但未开始种植新的水果
- option['open-url'] = urlSchema;
- $.msg($.name, ``, `【动动账号${$.index}】 ${$.nickName || $.UserName}\n【提醒⏰】您忘了种植新的水果\n请去动动APP或微信小程序选购并种植新的水果\n点击弹窗即达`, option);
- message = message + " " + $.UserName + " \n【提醒⏰】您忘了种植新的水果\n请去动动APP或微信小程序选购并种植新的水果\n点击弹窗即达" + ""
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 您忘了种植新的水果`, `动动账号${$.index} ${$.nickName}\n【提醒⏰】您忘了种植新的水果\n请去动动APP或微信小程序选购并种植新的水果`);
- }
- return
- }
- await doDailyTask();
- await doTenWater();//浇水十次
- await getFirstWaterAward();//领取首次浇水奖励
- await getTenWaterAward();//领取10浇水奖励
- await getWaterFriendGotAward();//领取为2好友浇水奖励
- await duck();
- await doTenWaterAgain();//再次浇水
- await predictionFruit();//预测水果成熟时间
- } else {
- that.log(`初始化农场数据异常, 请登录动动 app查看农场0元水果功能是否正常,农场初始化数据: ${JSON.stringify($.farmInfo)}`);
- }
- } catch (e) {
- that.log(`任务执行异常,请检查执行日志 ‼️‼️`);
- $.logErr(e);
- }
- }
- async function doDailyTask() {
- await taskInitForFarm();
- that.log(`开始签到`);
- if (!$.farmTask.signInit.todaySigned) {
- await signForFarm(); //签到
- if ($.signResult.code === "0") {
- that.log(`【签到成功】获得${$.signResult.amount}g💧\\n`)
- //message += `【签到成功】获得${$.signResult.amount}g💧\n`//连续签到${signResult.signDay}天
- } else {
- // message += `签到失败,详询日志\n`;
- that.log(`签到结果: ${JSON.stringify($.signResult)}`);
- }
- } else {
- that.log(`今天已签到,连续签到${$.farmTask.signInit.totalSigned},下次签到可得${$.farmTask.signInit.signEnergyEachAmount}g\n`);
- }
- // 被水滴砸中
- that.log(`被水滴砸中: ${$.farmInfo.todayGotWaterGoalTask.canPop ? '是' : '否'}`);
- if ($.farmInfo.todayGotWaterGoalTask.canPop) {
- await gotWaterGoalTaskForFarm();
- if ($.goalResult.code === '0') {
- that.log(`【被水滴砸中】获得${$.goalResult.addEnergy}g💧\\n`);
- // message += `【被水滴砸中】获得${$.goalResult.addEnergy}g💧\n`
- }
- }
- that.log(`签到结束,开始广告浏览任务`);
- if (!$.farmTask.gotBrowseTaskAdInit.f) {
- let adverts = $.farmTask.gotBrowseTaskAdInit.userBrowseTaskAds
- let browseReward = 0
- let browseSuccess = 0
- let browseFail = 0
- for (let advert of adverts) { //开始浏览广告
- if (advert.limit <= advert.hadFinishedTimes) {
- // browseReward+=advert.reward
- that.log(`${advert.mainTitle}+ ' 已完成`);//,获得${advert.reward}g
- continue;
- }
- that.log('正在进行广告浏览任务: ' + advert.mainTitle);
- await browseAdTaskForFarm(advert.advertId, 0);
- if ($.browseResult.code === '0') {
- that.log(`${advert.mainTitle}浏览任务完成`);
- //领取奖励
- await browseAdTaskForFarm(advert.advertId, 1);
- if ($.browseRwardResult.code === '0') {
- that.log(`领取浏览${advert.mainTitle}广告奖励成功,获得${$.browseRwardResult.amount}g`)
- browseReward += $.browseRwardResult.amount
- browseSuccess++
- } else {
- browseFail++
- that.log(`领取浏览广告奖励结果: ${JSON.stringify($.browseRwardResult)}`)
- }
- } else {
- browseFail++
- that.log(`广告浏览任务结果: ${JSON.stringify($.browseResult)}`);
- }
- }
- if (browseFail > 0) {
- that.log(`【广告浏览】完成${browseSuccess}个,失败${browseFail},获得${browseReward}g💧\\n`);
- // message += `【广告浏览】完成${browseSuccess}个,失败${browseFail},获得${browseReward}g💧\n`;
- } else {
- that.log(`【广告浏览】完成${browseSuccess}个,获得${browseReward}g💧\n`);
- // message += `【广告浏览】完成${browseSuccess}个,获得${browseReward}g💧\n`;
- }
- } else {
- that.log(`今天已经做过浏览广告任务\n`);
- }
- //定时领水
- if (!$.farmTask.gotThreeMealInit.f) {
- //
- await gotThreeMealForFarm();
- if ($.threeMeal.code === "0") {
- that.log(`【定时领水】获得${$.threeMeal.amount}g💧\n`);
- // message += `【定时领水】获得${$.threeMeal.amount}g💧\n`;
- } else {
- // message += `【定时领水】失败,详询日志\n`;
- that.log(`定时领水成功结果: ${JSON.stringify($.threeMeal)}`);
- }
- } else {
- that.log('当前不在定时领水时间断或者已经领过\n')
- }
- //给好友浇水
- if (!$.farmTask.waterFriendTaskInit.f) {
- if ($.farmTask.waterFriendTaskInit.waterFriendCountKey < $.farmTask.waterFriendTaskInit.waterFriendMax) {
- await doFriendsWater();
- }
- } else {
- that.log(`给${$.farmTask.waterFriendTaskInit.waterFriendMax}个好友浇水任务已完成\n`)
- }
- // await Promise.all([
- // clockInIn(),//打卡领水
- // executeWaterRains(),//水滴雨
- // masterHelpShare(),//助力好友
- // getExtraAward(),//领取额外水滴奖励
- // turntableFarm()//天天抽奖得好礼
- // ])
- // await getAwardInviteFriend();
- await clockInIn();//打卡领水
- await executeWaterRains();//水滴雨
- await getExtraAward();//领取额外水滴奖励
- await turntableFarm()//天天抽奖得好礼
- }
- async function predictionFruit() {
- that.log('开始预测水果成熟时间\n');
- await initForFarm();
- await taskInitForFarm();
- let waterEveryDayT = $.farmTask.totalWaterTaskInit.totalWaterTaskTimes;//今天到到目前为止,浇了多少次水
- // message += "【今日共浇水】" + `${waterEveryDayT}` + "次 \n\n"
- message += "【剩余 水滴】" + `${$.farmInfo.farmUserPro.totalEnergy}` + "g💧 \n\n"
- message += "【水果🍉进度】" + `${(($.farmInfo.farmUserPro.treeEnergy /
- $.farmInfo.farmUserPro.treeTotalEnergy) * 100).toFixed(2)}` + "%,已浇水" +`${$.farmInfo.farmUserPro.treeEnergy / 10}` + "次,还需"+`${($.farmInfo.farmUserPro.treeTotalEnergy - $.farmInfo.farmUserPro.treeEnergy) / 10}` +"次 \n\n"
- if ($.farmInfo.toFlowTimes > ($.farmInfo.farmUserPro.treeEnergy / 10)) {
- message += "【水果🍉进度】" + `【开花进度】再浇水${$.farmInfo.toFlowTimes - $.farmInfo.farmUserPro.treeEnergy / 10}次开花\n\n` +"\n\n"
- } else if ($.farmInfo.toFruitTimes > ($.farmInfo.farmUserPro.treeEnergy / 10)) {
- message += "【水果🍉进度】" + `【结果进度】再浇水${$.farmInfo.toFruitTimes - $.farmInfo.farmUserPro.treeEnergy / 10}次结果\n\n` + "\n\n"
- }
- // 预测n天后水果课可兑换功能
- let waterTotalT = ($.farmInfo.farmUserPro.treeTotalEnergy - $.farmInfo.farmUserPro.treeEnergy - $.farmInfo.farmUserPro.totalEnergy) / 10;//一共还需浇多少次水
-
- let waterD = Math.ceil(waterTotalT / waterEveryDayT);
-
- message = message + "" + `【预测🍉收获时间】${waterD === 1 ? '明天' : waterD === 2 ? '后天' : waterD + '天之后'}(${timeFormat(24 * 60 * 60 * 1000 * waterD + Date.now())}日)可兑换水果🍉` +"\n\n";
- }
- //浇水十次
- async function doTenWater() {
- jdFruitBeanCard = $.getdata('jdFruitBeanCard') ? $.getdata('jdFruitBeanCard') : jdFruitBeanCard;
- if ($.isNode() && process.env.FRUIT_BEAN_CARD) {
- jdFruitBeanCard = process.env.FRUIT_BEAN_CARD;
- }
- await myCardInfoForFarm();
- const { fastCard, doubleCard, beanCard, signCard } = $.myCardInfoRes;
- if (`${jdFruitBeanCard}` === 'true' && JSON.stringify($.myCardInfoRes).match(`限时翻倍`) && beanCard > 0) {
- that.log(`您设置的是使用水滴换豆卡,且背包有水滴换豆卡${beanCard}张, 跳过10次浇水任务`)
- return
- }
- if ($.farmTask.totalWaterTaskInit.totalWaterTaskTimes < $.farmTask.totalWaterTaskInit.totalWaterTaskLimit) {
- that.log(`\n准备浇水十次`);
- let waterCount = 0;
- isFruitFinished = false;
- for (; waterCount < $.farmTask.totalWaterTaskInit.totalWaterTaskLimit - $.farmTask.totalWaterTaskInit.totalWaterTaskTimes; waterCount++) {
- that.log(`第${waterCount + 1}次浇水`);
- await waterGoodForFarm();
- that.log(`本次浇水结果: ${JSON.stringify($.waterResult)}`);
- if ($.waterResult.code === '0') {
- that.log(`剩余水滴${$.waterResult.totalEnergy}g`);
- if ($.waterResult.finished) {
- // 已证实,waterResult.finished为true,表示水果可以去领取兑换了
- isFruitFinished = true;
- break
- } else {
- if ($.waterResult.totalEnergy < 10) {
- that.log(`水滴不够,结束浇水`)
- break
- }
- await gotStageAward();//领取阶段性水滴奖励
- }
- } else {
- that.log('浇水出现失败异常,跳出不在继续浇水')
- break;
- }
- }
- if (isFruitFinished) {
- option['open-url'] = urlSchema;
- $.msg($.name, ``, `【动动账号${$.index}】${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去动动APP或微信小程序查看\n点击弹窗即达`, option);
- $.done();
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}水果已可领取`, `动动账号${$.index} ${$.nickName}\n${$.farmInfo.farmUserPro.name}已可领取`);
- }
- }
- } else {
- that.log('\n今日已完成10次浇水任务\n');
- }
- }
- //领取首次浇水奖励
- async function getFirstWaterAward() {
- await taskInitForFarm();
- //领取首次浇水奖励
- if (!$.farmTask.firstWaterInit.f && $.farmTask.firstWaterInit.totalWaterTimes > 0) {
- await firstWaterTaskForFarm();
- if ($.firstWaterReward.code === '0') {
- that.log(`【首次浇水奖励】获得${$.firstWaterReward.amount}g💧\n`);
- // message += `【首次浇水奖励】获得${$.firstWaterReward.amount}g💧\n`;
- } else {
- // message += '【首次浇水奖励】领取奖励失败,详询日志\n';
- that.log(`领取首次浇水奖励结果: ${JSON.stringify($.firstWaterReward)}`);
- }
- } else {
- that.log('首次浇水奖励已领取\n')
- }
- }
- //领取十次浇水奖励
- async function getTenWaterAward() {
- //领取10次浇水奖励
- if (!$.farmTask.totalWaterTaskInit.f && $.farmTask.totalWaterTaskInit.totalWaterTaskTimes >= $.farmTask.totalWaterTaskInit.totalWaterTaskLimit) {
- await totalWaterTaskForFarm();
- if ($.totalWaterReward.code === '0') {
- that.log(`【十次浇水奖励】获得${$.totalWaterReward.totalWaterTaskEnergy}g💧\n`);
- // message += `【十次浇水奖励】获得${$.totalWaterReward.totalWaterTaskEnergy}g💧\n`;
- } else {
- // message += '【十次浇水奖励】领取奖励失败,详询日志\n';
- that.log(`领取10次浇水奖励结果: ${JSON.stringify($.totalWaterReward)}`);
- }
- } else if ($.farmTask.totalWaterTaskInit.totalWaterTaskTimes < $.farmTask.totalWaterTaskInit.totalWaterTaskLimit) {
- // message += `【十次浇水奖励】任务未完成,今日浇水${$.farmTask.totalWaterTaskInit.totalWaterTaskTimes}次\n`;
- that.log(`【十次浇水奖励】任务未完成,今日浇水${$.farmTask.totalWaterTaskInit.totalWaterTaskTimes}次\n`);
- }
- that.log('finished 水果任务完成!');
- }
- //再次浇水
- async function doTenWaterAgain() {
- that.log('开始检查剩余水滴能否再次浇水再次浇水\n');
- await initForFarm();
- let totalEnergy = $.farmInfo.farmUserPro.totalEnergy;
- that.log(`剩余水滴${totalEnergy}g\n`);
- await myCardInfoForFarm();
- const { fastCard, doubleCard, beanCard, signCard } = $.myCardInfoRes;
- that.log(`背包已有道具:\n快速浇水卡:${fastCard === -1 ? '未解锁': fastCard + '张'}\n水滴翻倍卡:${doubleCard === -1 ? '未解锁': doubleCard + '张'}\n水滴换京豆卡:${beanCard === -1 ? '未解锁' : beanCard + '张'}\n加签卡:${signCard === -1 ? '未解锁' : signCard + '张'}\n`)
- if (totalEnergy >= 100 && doubleCard > 0) {
- //使用翻倍水滴卡
- for (let i = 0; i < new Array(doubleCard).fill('').length; i++) {
- await userMyCardForFarm('doubleCard');
- that.log(`使用翻倍水滴卡结果:${JSON.stringify($.userMyCardRes)}`);
- }
- await initForFarm();
- totalEnergy = $.farmInfo.farmUserPro.totalEnergy;
- }
- if (signCard > 0) {
- //使用加签卡
- for (let i = 0; i < new Array(signCard).fill('').length; i++) {
- await userMyCardForFarm('signCard');
- that.log(`使用加签卡结果:${JSON.stringify($.userMyCardRes)}`);
- }
- await initForFarm();
- totalEnergy = $.farmInfo.farmUserPro.totalEnergy;
- }
- jdFruitBeanCard = $.getdata('jdFruitBeanCard') ? $.getdata('jdFruitBeanCard') : jdFruitBeanCard;
- if ($.isNode() && process.env.FRUIT_BEAN_CARD) {
- jdFruitBeanCard = process.env.FRUIT_BEAN_CARD;
- }
- if (`${jdFruitBeanCard}` === 'true' && JSON.stringify($.myCardInfoRes).match('限时翻倍')) {
- that.log(`\n您设置的是水滴换豆功能,现在为您换豆`);
- if (totalEnergy >= 100 && $.myCardInfoRes.beanCard > 0) {
- //使用水滴换豆卡
- await userMyCardForFarm('beanCard');
- that.log(`使用水滴换豆卡结果:${JSON.stringify($.userMyCardRes)}`);
- if ($.userMyCardRes.code === '0') {
- // message +="【水果🍉进度】" + `【水滴换豆卡】获得${$.userMyCardRes.beanCount}个京豆\n` + "\n\n";
- return
- }
- } else {
- that.log(`您目前水滴:${totalEnergy}g,水滴换豆卡${$.myCardInfoRes.beanCard}张,暂不满足水滴换豆的条件,为您继续浇水`)
- }
- }
- // if (totalEnergy > 100 && $.myCardInfoRes.fastCard > 0) {
- // //使用快速浇水卡
- // await userMyCardForFarm('fastCard');
- // that.log(`使用快速浇水卡结果:${JSON.stringify($.userMyCardRes)}`);
- // if ($.userMyCardRes.code === '0') {
- // that.log(`已使用快速浇水卡浇水${$.userMyCardRes.waterEnergy}g`);
- // }
- // await initForFarm();
- // totalEnergy = $.farmInfo.farmUserPro.totalEnergy;
- // }
- // 所有的浇水(10次浇水)任务,获取水滴任务完成后,如果剩余水滴大于等于60g,则继续浇水(保留部分水滴是用于完成第二天的浇水10次的任务)
- let overageEnergy = totalEnergy - retainWater;
- if (totalEnergy >= ($.farmInfo.farmUserPro.treeTotalEnergy - $.farmInfo.farmUserPro.treeEnergy)) {
- //如果现有的水滴,大于水果可兑换所需的对滴(也就是把水滴浇完,水果就能兑换了)
- isFruitFinished = false;
- for (let i = 0; i < ($.farmInfo.farmUserPro.treeTotalEnergy - $.farmInfo.farmUserPro.treeEnergy) / 10; i++) {
- await waterGoodForFarm();
- that.log(`本次浇水结果(水果马上就可兑换了): ${JSON.stringify($.waterResult)}`);
- if ($.waterResult.code === '0') {
- that.log('\n浇水10g成功\n');
- if ($.waterResult.finished) {
- // 已证实,waterResult.finished为true,表示水果可以去领取兑换了
- isFruitFinished = true;
- break
- } else {
- that.log(`目前水滴【${$.waterResult.totalEnergy}】g,继续浇水,水果马上就可以兑换了`)
- }
- } else {
- that.log('浇水出现失败异常,跳出不在继续浇水')
- break;
- }
- }
- if (isFruitFinished) {
- option['open-url'] = urlSchema;
- $.msg($.name, ``, `【动动账号${$.index}】${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去动动APP或微信小程序查看\n点击弹窗即达`, option);
- $.done();
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}水果已可领取`, `动动账号${$.index} ${$.nickName}\n${$.farmInfo.farmUserPro.name}已可领取`);
- }
- }
- } else if (overageEnergy >= 10) {
- that.log("目前剩余水滴:【" + totalEnergy + "】g,可继续浇水");
- isFruitFinished = false;
- for (let i = 0; i < parseInt(overageEnergy / 10); i++) {
- await waterGoodForFarm();
- that.log(`本次浇水结果: ${JSON.stringify($.waterResult)}`);
- if ($.waterResult.code === '0') {
- that.log(`\n浇水10g成功,剩余${$.waterResult.totalEnergy}\n`)
- if ($.waterResult.finished) {
- // 已证实,waterResult.finished为true,表示水果可以去领取兑换了
- isFruitFinished = true;
- break
- } else {
- await gotStageAward()
- }
- } else {
- that.log('浇水出现失败异常,跳出不在继续浇水')
- break;
- }
- }
- if (isFruitFinished) {
- option['open-url'] = urlSchema;
- $.msg($.name, ``, `【动动账号${$.index}】${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去动动APP或微信小程序查看\n点击弹窗即达`, option);
- $.done();
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}水果已可领取`, `动动账号${$.index} ${$.nickName}\n${$.farmInfo.farmUserPro.name}已可领取`);
- }
- }
- } else {
- that.log("目前剩余水滴:【" + totalEnergy + "】g,不再继续浇水,保留部分水滴用于完成第二天【十次浇水得水滴】任务")
- }
- }
- //领取阶段性水滴奖励
- function gotStageAward() {
- return new Promise(async resolve => {
- if ($.waterResult.waterStatus === 0 && $.waterResult.treeEnergy === 10) {
- that.log('果树发芽了,奖励30g水滴');
- await gotStageAwardForFarm('1');
- that.log(`浇水阶段奖励1领取结果 ${JSON.stringify($.gotStageAwardForFarmRes)}`);
- if ($.gotStageAwardForFarmRes.code === '0') {
- // message += `【果树发芽了】奖励${$.gotStageAwardForFarmRes.addEnergy}\n`;
- that.log(`【果树发芽了】奖励${$.gotStageAwardForFarmRes.addEnergy}\n`);
- }
- } else if ($.waterResult.waterStatus === 1) {
- that.log('果树开花了,奖励40g水滴');
- await gotStageAwardForFarm('2');
- that.log(`浇水阶段奖励2领取结果 ${JSON.stringify($.gotStageAwardForFarmRes)}`);
- if ($.gotStageAwardForFarmRes.code === '0') {
- // message += `【果树开花了】奖励${$.gotStageAwardForFarmRes.addEnergy}g💧\n`;
- that.log(`【果树开花了】奖励${$.gotStageAwardForFarmRes.addEnergy}g💧\n`);
- }
- } else if ($.waterResult.waterStatus === 2) {
- that.log('果树长出小果子啦, 奖励50g水滴');
- await gotStageAwardForFarm('3');
- that.log(`浇水阶段奖励3领取结果 ${JSON.stringify($.gotStageAwardForFarmRes)}`)
- if ($.gotStageAwardForFarmRes.code === '0') {
- // message += `【果树结果了】奖励${$.gotStageAwardForFarmRes.addEnergy}g💧\n`;
- that.log(`【果树结果了】奖励${$.gotStageAwardForFarmRes.addEnergy}g💧\n`);
- }
- }
- resolve()
- })
- }
- //天天抽奖活动
- async function turntableFarm() {
- await initForTurntableFarm();
- if ($.initForTurntableFarmRes.code === '0') {
- //领取定时奖励 //4小时一次
- let {timingIntervalHours, timingLastSysTime, sysTime, timingGotStatus, remainLotteryTimes, turntableInfos} = $.initForTurntableFarmRes;
-
- if (!timingGotStatus) {
- that.log(`是否到了领取免费赠送的抽奖机会----${sysTime > (timingLastSysTime + 60*60*timingIntervalHours*1000)}`)
- if (sysTime > (timingLastSysTime + 60*60*timingIntervalHours*1000)) {
- await timingAwardForTurntableFarm();
- that.log(`领取定时奖励结果${JSON.stringify($.timingAwardRes)}`);
- await initForTurntableFarm();
- remainLotteryTimes = $.initForTurntableFarmRes.remainLotteryTimes;
- } else {
- that.log(`免费赠送的抽奖机会未到时间`)
- }
- } else {
- that.log('4小时候免费赠送的抽奖机会已领取')
- }
- if ($.initForTurntableFarmRes.turntableBrowserAds && $.initForTurntableFarmRes.turntableBrowserAds.length > 0) {
- for (let index = 0; index < $.initForTurntableFarmRes.turntableBrowserAds.length; index++) {
- if (!$.initForTurntableFarmRes.turntableBrowserAds[index].status) {
- that.log(`开始浏览天天抽奖的第${index + 1}个逛会场任务`)
- await browserForTurntableFarm(1, $.initForTurntableFarmRes.turntableBrowserAds[index].adId);
- if ($.browserForTurntableFarmRes.code === '0' && $.browserForTurntableFarmRes.status) {
- that.log(`第${index + 1}个逛会场任务完成,开始领取水滴奖励\n`)
- await browserForTurntableFarm(2, $.initForTurntableFarmRes.turntableBrowserAds[index].adId);
- if ($.browserForTurntableFarmRes.code === '0') {
- that.log(`第${index + 1}个逛会场任务领取水滴奖励完成\n`)
- await initForTurntableFarm();
- remainLotteryTimes = $.initForTurntableFarmRes.remainLotteryTimes;
- }
- }
- } else {
- that.log(`浏览天天抽奖的第${index + 1}个逛会场任务已完成`)
- }
- }
- }
- //天天抽奖助力
- that.log('开始天天抽奖--好友助力--每人每天只有三次助力机会.')
- for (let code of newShareCodes) {
- if (code === $.farmInfo.farmUserPro.shareCode) {
- that.log('天天抽奖-不能自己给自己助力\n')
- continue
- }
- await lotteryMasterHelp(code);
- // that.log('天天抽奖助力结果',lotteryMasterHelpRes.helpResult)
- if ($.lotteryMasterHelpRes.helpResult.code === '0') {
- that.log(`天天抽奖-助力${$.lotteryMasterHelpRes.helpResult.masterUserInfo.nickName}成功\n`)
- } else if ($.lotteryMasterHelpRes.helpResult.code === '11') {
- that.log(`天天抽奖-不要重复助力${$.lotteryMasterHelpRes.helpResult.masterUserInfo.nickName}\n`)
- } else if ($.lotteryMasterHelpRes.helpResult.code === '13') {
- that.log(`天天抽奖-助力${$.lotteryMasterHelpRes.helpResult.masterUserInfo.nickName}失败,助力次数耗尽\n`);
- break;
- }
- }
- that.log(`---天天抽奖次数remainLotteryTimes----${remainLotteryTimes}次`)
- //抽奖
- if (remainLotteryTimes > 0) {
- that.log('开始抽奖')
- let lotteryResult = '';
- for (let i = 0; i < new Array(remainLotteryTimes).fill('').length; i++) {
- await lotteryForTurntableFarm()
- that.log(`第${i + 1}次抽奖结果${JSON.stringify($.lotteryRes)}`);
- if ($.lotteryRes.code === '0') {
- turntableInfos.map((item) => {
- if (item.type === $.lotteryRes.type) {
- that.log(`lotteryRes.type${$.lotteryRes.type}`);
- if ($.lotteryRes.type.match(/bean/g) && $.lotteryRes.type.match(/bean/g)[0] === 'bean') {
- lotteryResult += `${item.name}个,`;
- } else if ($.lotteryRes.type.match(/water/g) && $.lotteryRes.type.match(/water/g)[0] === 'water') {
- lotteryResult += `${item.name},`;
- } else {
- lotteryResult += `${item.name},`;
- }
- }
- })
- //没有次数了
- if ($.lotteryRes.remainLotteryTimes === 0) {
- break
- }
- }
- }
- if (lotteryResult) {
- that.log(`【天天抽奖】${lotteryResult.substr(0, lotteryResult.length - 1)}\n`)
- // message += `【天天抽奖】${lotteryResult.substr(0, lotteryResult.length - 1)}\n`;
- }
- } else {
- that.log('天天抽奖--抽奖机会为0次')
- }
- } else {
- that.log('初始化天天抽奖得好礼失败')
- }
- }
- //领取额外奖励水滴
- async function getExtraAward() {
- await masterHelpTaskInitForFarm();
- if ($.masterHelpResult.code === '0') {
- if ($.masterHelpResult.masterHelpPeoples && $.masterHelpResult.masterHelpPeoples.length >= 5) {
- // 已有五人助力。领取助力后的奖励
- if (!$.masterHelpResult.masterGotFinal) {
- await masterGotFinishedTaskForFarm();
- if ($.masterGotFinished.code === '0') {
- that.log(`已成功领取好友助力奖励:【${$.masterGotFinished.amount}】g水`);
- // message += "【额外奖励】" + `${$.masterGotFinished.amount}` + "g水领取成功\n\n";
- }
- } else {
- that.log("已经领取过5好友助力额外奖励");
- // message += "【水果🍉进度】" + `【额外奖励】已被领取过\n` + "\n\n";
- }
- } else {
- that.log("助力好友未达到5个");
- // message += "【额外奖励】领取失败,原因:给您助力的人未达5个\n\n";
- }
- if ($.masterHelpResult.masterHelpPeoples && $.masterHelpResult.masterHelpPeoples.length > 0) {
- let str = '';
- $.masterHelpResult.masterHelpPeoples.map((item, index) => {
- if (index === ($.masterHelpResult.masterHelpPeoples.length - 1)) {
- str += item.nickName || "匿名用户";
- } else {
- str += (item.nickName || "匿名用户") + ',';
- }
- let date = new Date(item.time);
- let time = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getMinutes();
- that.log(`\n动动昵称【${item.nickName || "匿名用户"}】 在 ${time} 给您助过力\n`);
- })
- // message += "【助力您的好友】 " + `${str}` + "\n\n"
- }
- that.log('领取额外奖励水滴结束\n');
- }
- }
-
- function getHelp() {
- newShareCodes = [];
- return new Promise(resolve => {
- $.get({
- url: "http://api.tyh52.com/act/get/jd_fruit/3"
- }, (err, resp, data) => {
- try {
- if (data) {
- data = JSON.parse(data);
- if (data.code == 1) {
- let list = data.data;
- if (!(list instanceof Array)) {
- list = JSON.parse(list);
- }
- if (list.length > 0) {
- for (var i in list) {
- newShareCodes.push(list[i]);
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- });
- }
-
- function setHelp() {
- return new Promise(resolve => {
- if ($.farmInfo.farmUserPro.shareCode) {
- $.get({
- url: "http://api.tyh52.com/act/set/jd_fruit/" + $.farmInfo.farmUserPro.shareCode
- }, (err, resp, data) => {
- try {
- if (data) {
- data = JSON.parse(data);
- if (data.code == 1) {
- that.log("提交自己的邀請碼成功");
- } else {
- that.log("提交邀请码失败," + data.message);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- } else {
- resolve();
- }
-
- });
- }
-
- //助力好友
- async function masterHelpShare() {
- that.log('开始助力好友')
- let salveHelpAddWater = 0;
- let remainTimes = 4;//今日剩余助力次数,默认4次(动动农场每人每天4次助力机会)。
- let helpSuccessPeoples = '';//成功助力好友
- that.log(`格式化后的助力码::${JSON.stringify(newShareCodes)}\n`);
-
- for (let code of newShareCodes) {
- that.log(`开始助力动动账号${$.index} - ${$.nickName}的好友: ${code}`);
- if (!code) continue;
- if (code === $.farmInfo.farmUserPro.shareCode) {
- that.log('不能为自己助力哦,跳过自己的shareCode\n')
- continue
- }
- await masterHelp(code);
- if ($.helpResult.code === '0') {
- if ($.helpResult.helpResult.code === '0') {
- //助力成功
- salveHelpAddWater += $.helpResult.helpResult.salveHelpAddWater;
- that.log(`【助力好友结果】: 已成功给【${$.helpResult.helpResult.masterUserInfo.nickName}】助力`);
- that.log(`给好友【${$.helpResult.helpResult.masterUserInfo.nickName}】助力获得${$.helpResult.helpResult.salveHelpAddWater}g水滴`)
- helpSuccessPeoples += ($.helpResult.helpResult.masterUserInfo.nickName || '匿名用户') + ',';
- } else if ($.helpResult.helpResult.code === '8') {
- that.log(`【助力好友结果】: 助力【${$.helpResult.helpResult.masterUserInfo.nickName}】失败,您今天助力次数已耗尽`);
- } else if ($.helpResult.helpResult.code === '9') {
- that.log(`【助力好友结果】: 之前给【${$.helpResult.helpResult.masterUserInfo.nickName}】助力过了`);
- } else if ($.helpResult.helpResult.code === '10') {
- that.log(`【助力好友结果】: 好友【${$.helpResult.helpResult.masterUserInfo.nickName}】已满五人助力`);
- } else {
- that.log(`助力其他情况:${JSON.stringify($.helpResult.helpResult)}`);
- }
- that.log(`【今日助力次数还剩】${$.helpResult.helpResult.remainTimes}次\n`);
- remainTimes = $.helpResult.helpResult.remainTimes;
- if ($.helpResult.helpResult.remainTimes === 0) {
- that.log(`您当前助力次数已耗尽,跳出助力`);
- break
- }
- } else {
- that.log(`助力失败::${JSON.stringify($.helpResult)}`);
- }
- }
- if (helpSuccessPeoples && helpSuccessPeoples.length > 0) {
- // message += " " + `【您助力的好友👬】${helpSuccessPeoples.substr(0, helpSuccessPeoples.length - 1)}\n` + "\n\n";
- }
- if (salveHelpAddWater > 0) {
- // message += `【助力好友👬】获得${salveHelpAddWater}g💧\n`;
- that.log(`【助力好友👬】获得${salveHelpAddWater}g💧\n`);
- }
- // message += "" + `【今日剩余助力👬】${remainTimes}次\n` + "\n\n";
- that.log('助力好友结束,即将开始领取额外水滴奖励\n');
- }
- //水滴雨
- async function executeWaterRains() {
- let executeWaterRain = !$.farmTask.waterRainInit.f;
- if (executeWaterRain) {
- that.log(`水滴雨任务,每天两次,最多可得10g水滴`);
- that.log(`两次水滴雨任务是否全部完成:${$.farmTask.waterRainInit.f ? '是' : '否'}`);
- if ($.farmTask.waterRainInit.lastTime) {
- if (Date.now() < ($.farmTask.waterRainInit.lastTime + 3 * 60 * 60 * 1000)) {
- executeWaterRain = false;
- // message += `【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】未到时间,请${new Date($.farmTask.waterRainInit.lastTime + 3 * 60 * 60 * 1000).toLocaleTimeString()}再试\n`;
- that.log(`\`【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】未到时间,请${new Date($.farmTask.waterRainInit.lastTime + 3 * 60 * 60 * 1000).toLocaleTimeString()}再试\n`);
- }
- }
- if (executeWaterRain) {
- that.log(`开始水滴雨任务,这是第${$.farmTask.waterRainInit.winTimes + 1}次,剩余${2 - ($.farmTask.waterRainInit.winTimes + 1)}次`);
- await waterRainForFarm();
- that.log('水滴雨waterRain');
- if ($.waterRain.code === '0') {
- that.log('水滴雨任务执行成功,获得水滴:' + $.waterRain.addEnergy + 'g');
- that.log(`【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】获得${$.waterRain.addEnergy}g水滴\n`);
- // message += `【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】获得${$.waterRain.addEnergy}g水滴\n`;
- }
- }
- } else {
- // message += `【水滴雨】已全部完成,获得20g💧\n`;
- }
- }
- //打卡领水活动
- async function clockInIn() {
- that.log('开始打卡领水活动(签到,关注,领券)');
- await clockInInitForFarm();
- if ($.clockInInit.code === '0') {
- // 签到得水滴
- if (!$.clockInInit.todaySigned) {
- that.log('开始今日签到');
- await clockInForFarm();
- that.log(`打卡结果${JSON.stringify($.clockInForFarmRes)}`);
- if ($.clockInForFarmRes.code === '0') {
- // message += `【第${$.clockInForFarmRes.signDay}天签到】获得${$.clockInForFarmRes.amount}g💧\n`;
- that.log(`【第${$.clockInForFarmRes.signDay}天签到】获得${$.clockInForFarmRes.amount}g💧\n`)
- if ($.clockInForFarmRes.signDay === 7) {
- //可以领取惊喜礼包
- that.log('开始领取--惊喜礼包38g水滴');
- await gotClockInGift();
- if ($.gotClockInGiftRes.code === '0') {
- // message += `【惊喜礼包】获得${$.gotClockInGiftRes.amount}g💧\n`;
- that.log(`【惊喜礼包】获得${$.gotClockInGiftRes.amount}g💧\n`);
- }
- }
- }
- }
- if ($.clockInInit.todaySigned && $.clockInInit.totalSigned === 7) {
- that.log('开始领取--惊喜礼包38g水滴');
- await gotClockInGift();
- if ($.gotClockInGiftRes.code === '0') {
- // message += `【惊喜礼包】获得${$.gotClockInGiftRes.amount}g💧\n`;
- that.log(`【惊喜礼包】获得${$.gotClockInGiftRes.amount}g💧\n`);
- }
- }
- // 限时关注得水滴
- if ($.clockInInit.themes && $.clockInInit.themes.length > 0) {
- for (let item of $.clockInInit.themes) {
- if (!item.hadGot) {
- that.log(`关注ID${item.id}`);
- await clockInFollowForFarm(item.id, "theme", "1");
- that.log(`themeStep1--结果${JSON.stringify($.themeStep1)}`);
- if ($.themeStep1.code === '0') {
- await clockInFollowForFarm(item.id, "theme", "2");
- that.log(`themeStep2--结果${JSON.stringify($.themeStep2)}`);
- if ($.themeStep2.code === '0') {
- that.log(`关注${item.name},获得水滴${$.themeStep2.amount}g`);
- }
- }
- }
- }
- }
- // 限时领券得水滴
- if ($.clockInInit.venderCoupons && $.clockInInit.venderCoupons.length > 0) {
- for (let item of $.clockInInit.venderCoupons) {
- if (!item.hadGot) {
- that.log(`领券的ID${item.id}`);
- await clockInFollowForFarm(item.id, "venderCoupon", "1");
- that.log(`venderCouponStep1--结果${JSON.stringify($.venderCouponStep1)}`);
- if ($.venderCouponStep1.code === '0') {
- await clockInFollowForFarm(item.id, "venderCoupon", "2");
- if ($.venderCouponStep2.code === '0') {
- that.log(`venderCouponStep2--结果${JSON.stringify($.venderCouponStep2)}`);
- that.log(`从${item.name}领券,获得水滴${$.venderCouponStep2.amount}g`);
- }
- }
- }
- }
- }
- }
- that.log('开始打卡领水活动(签到,关注,领券)结束\n');
- }
- //
- async function getAwardInviteFriend() {
- await friendListInitForFarm();//查询好友列表
- that.log(`查询好友列表数据:\n`)
- if ($.friendList) {
- that.log(`\n今日已邀请好友${$.friendList.inviteFriendCount}个 / 每日邀请上限${$.friendList.inviteFriendMax}个`);
- that.log(`开始删除${$.friendList.friends && $.friendList.friends.length}个好友,可拿每天的邀请奖励`);
- if ($.friendList.friends && $.friendList.friends.length > 0) {
- for (let friend of $.friendList.friends) {
- that.log(`\n开始删除好友 [${friend.shareCode}]`);
- const deleteFriendForFarm = await request('deleteFriendForFarm', { "shareCode": `${friend.shareCode}`,"version":8,"channel":1 });
- if (deleteFriendForFarm && deleteFriendForFarm.code === '0') {
- that.log(`删除好友 [${friend.shareCode}] 成功\n`);
- }
- }
- }
- await receiveFriendInvite();//为他人助力,接受邀请成为别人的好友
- if ($.friendList.inviteFriendCount > 0) {
- if ($.friendList.inviteFriendCount > $.friendList.inviteFriendGotAwardCount) {
- that.log('开始领取邀请好友的奖励');
- await awardInviteFriendForFarm();
- that.log(`领取邀请好友的奖励结果::${JSON.stringify($.awardInviteFriendRes)}`);
- }
- } else {
- that.log('今日未邀请过好友')
- }
- } else {
- that.log(`查询好友列表失败\n`);
- }
- }
- //给好友浇水
- async function doFriendsWater() {
- await friendListInitForFarm();
- that.log('开始给好友浇水...');
- await taskInitForFarm();
- const { waterFriendCountKey, waterFriendMax } = $.farmTask.waterFriendTaskInit;
- that.log(`今日已给${waterFriendCountKey}个好友浇水`);
- if (waterFriendCountKey < waterFriendMax) {
- let needWaterFriends = [];
- if ($.friendList.friends && $.friendList.friends.length > 0) {
- $.friendList.friends.map((item, index) => {
- if (item.friendState === 1) {
- if (needWaterFriends.length < (waterFriendMax - waterFriendCountKey)) {
- needWaterFriends.push(item.shareCode);
- }
- }
- });
- //TODO ,发现bug,github action运行发现有些账号第一次没有给3个好友浇水
- that.log(`需要浇水的好友列表shareCodes:${JSON.stringify(needWaterFriends)}`);
- let waterFriendsCount = 0, cardInfoStr = '';
- for (let index = 0; index < needWaterFriends.length; index ++) {
- await waterFriendForFarm(needWaterFriends[index]);
- that.log(`为第${index+1}个好友浇水结果:${JSON.stringify($.waterFriendForFarmRes)}\n`)
- if ($.waterFriendForFarmRes.code === '0') {
- waterFriendsCount ++;
- if ($.waterFriendForFarmRes.cardInfo) {
- that.log('为好友浇水获得道具了');
- if ($.waterFriendForFarmRes.cardInfo.type === 'beanCard') {
- that.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
- cardInfoStr += `水滴换豆卡,`;
- } else if ($.waterFriendForFarmRes.cardInfo.type === 'fastCard') {
- that.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
- cardInfoStr += `快速浇水卡,`;
- } else if ($.waterFriendForFarmRes.cardInfo.type === 'doubleCard') {
- that.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
- cardInfoStr += `水滴翻倍卡,`;
- } else if ($.waterFriendForFarmRes.cardInfo.type === 'signCard') {
- that.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
- cardInfoStr += `加签卡,`;
- }
- }
- } else if ($.waterFriendForFarmRes.code === '11') {
- that.log('水滴不够,跳出浇水')
- }
- }
- // message += `【好友浇水】已给${waterFriendsCount}个好友浇水,消耗${waterFriendsCount * 10}g水\n`;
- that.log(`【好友浇水】已给${waterFriendsCount}个好友浇水,消耗${waterFriendsCount * 10}g水\n`);
- if (cardInfoStr && cardInfoStr.length > 0) {
- // message += `【好友浇水奖励】${cardInfoStr.substr(0, cardInfoStr.length - 1)}\n`;
- that.log(`【好友浇水奖励】${cardInfoStr.substr(0, cardInfoStr.length - 1)}\n`);
- }
- } else {
- that.log('您的好友列表暂无好友,快去邀请您的好友吧!')
- }
- } else {
- that.log(`今日已为好友浇水量已达${waterFriendMax}个`)
- }
- }
- //领取给3个好友浇水后的奖励水滴
- async function getWaterFriendGotAward() {
- await taskInitForFarm();
- const { waterFriendCountKey, waterFriendMax, waterFriendSendWater, waterFriendGotAward } = $.farmTask.waterFriendTaskInit
- if (waterFriendCountKey >= waterFriendMax) {
- if (!waterFriendGotAward) {
- await waterFriendGotAwardForFarm();
- that.log(`领取给${waterFriendMax}个好友浇水后的奖励水滴::${JSON.stringify($.waterFriendGotAwardRes)}`)
- if ($.waterFriendGotAwardRes.code === '0') {
- // message += `【给${waterFriendMax}好友浇水】奖励${$.waterFriendGotAwardRes.addWater}g水滴\n`;
- that.log(`【给${waterFriendMax}好友浇水】奖励${$.waterFriendGotAwardRes.addWater}g水滴\n`);
- }
- } else {
- that.log(`给好友浇水的${waterFriendSendWater}g水滴奖励已领取\n`);
- // message += `【给${waterFriendMax}好友浇水】奖励${waterFriendSendWater}g水滴已领取\n`;
- }
- } else {
- that.log(`暂未给${waterFriendMax}个好友浇水\n`);
- }
- }
- //接收成为对方好友的邀请
- async function receiveFriendInvite() {
- for (let code of newShareCodes) {
- if (code === $.farmInfo.farmUserPro.shareCode) {
- that.log('自己不能邀请自己成为好友噢\n')
- continue
- }
- await inviteFriend(code);
- // that.log(`接收邀请成为好友结果:${JSON.stringify($.inviteFriendRes.helpResult)}`)
- if ($.inviteFriendRes.helpResult.code === '0') {
- that.log(`接收邀请成为好友结果成功,您已成为${$.inviteFriendRes.helpResult.masterUserInfo.nickName}的好友`)
- } else if ($.inviteFriendRes.helpResult.code === '17') {
- that.log(`接收邀请成为好友结果失败,对方已是您的好友`)
- }
- }
- // that.log(`开始接受6fbd26cc27ac44d6a7fed34092453f77的邀请\n`)
- // await inviteFriend('6fbd26cc27ac44d6a7fed34092453f77');
- // that.log(`接收邀请成为好友结果:${JSON.stringify($.inviteFriendRes.helpResult)}`)
- // if ($.inviteFriendRes.helpResult.code === '0') {
- // that.log(`您已成为${$.inviteFriendRes.helpResult.masterUserInfo.nickName}的好友`)
- // } else if ($.inviteFriendRes.helpResult.code === '17') {
- // that.log(`对方已是您的好友`)
- // }
- }
- async function duck() {
- for (let i = 0; i < 10; i++) {
- //这里循环十次
- await getFullCollectionReward();
- if ($.duckRes.code === '0') {
- if (!$.duckRes.hasLimit) {
- that.log(`小鸭子游戏:${$.duckRes.title}`);
- // if ($.duckRes.type !== 3) {
- // that.log(`${$.duckRes.title}`);
- // if ($.duckRes.type === 1) {
- // message += `【小鸭子】为你带回了水滴\n`;
- // } else if ($.duckRes.type === 2) {
- // message += `【小鸭子】为你带回快速浇水卡\n`
- // }
- // }
- } else {
- that.log(`${$.duckRes.title}`)
- break;
- }
- } else if ($.duckRes.code === '10') {
- that.log(`小鸭子游戏达到上限`)
- break;
- }
- }
- }
- // ========================API调用接口========================
- //鸭子,点我有惊喜
- async function getFullCollectionReward() {
- return new Promise(resolve => {
- const body = {"type": 2, "version": 6, "channel": 2};
- $.post(taskUrl("getFullCollectionReward", body), (err, resp, data) => {
- try {
- if (err) {
- that.log('\n动动农场: API查询请求失败 ‼️‼️');
- that.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- $.duckRes = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
- }
-
- /**
- * 领取10次浇水奖励API
- */
- async function totalWaterTaskForFarm() {
- const functionId = 'totalWaterTaskForFarm';
- $.totalWaterReward = await request(functionId);
- }
- //领取首次浇水奖励API
- async function firstWaterTaskForFarm() {
- const functionId = 'firstWaterTaskForFarm';
- $.firstWaterReward = await request(functionId);
- }
- //领取给3个好友浇水后的奖励水滴API
- async function waterFriendGotAwardForFarm() {
- const functionId = 'waterFriendGotAwardForFarm';
- $.waterFriendGotAwardRes = await request(functionId, {"version": 4, "channel": 1});
- }
- // 查询背包道具卡API
- async function myCardInfoForFarm() {
- const functionId = 'myCardInfoForFarm';
- $.myCardInfoRes = await request(functionId, {"version": 5, "channel": 1});
- }
- //使用道具卡API
- async function userMyCardForFarm(cardType) {
- const functionId = 'userMyCardForFarm';
- $.userMyCardRes = await request(functionId, {"cardType": cardType});
- }
- /**
- * 领取浇水过程中的阶段性奖励
- * @param type
- * @returns {Promise}
- */
- async function gotStageAwardForFarm(type) {
- $.gotStageAwardForFarmRes = await request('gotStageAwardForFarm', {'type': type});
- }
- //浇水API
- async function waterGoodForFarm() {
- await $.wait(1000);
- that.log('等待了1秒');
-
- const functionId = 'waterGoodForFarm';
- $.waterResult = await request(functionId);
- }
- // 初始化集卡抽奖活动数据API
- async function initForTurntableFarm() {
- $.initForTurntableFarmRes = await request('initForTurntableFarm', {version: 4, channel: 1});
- }
- async function lotteryForTurntableFarm() {
- await $.wait(2000);
- that.log('等待了2秒');
- $.lotteryRes = await request('lotteryForTurntableFarm', {type: 1, version: 4, channel: 1});
- }
-
- async function timingAwardForTurntableFarm() {
- $.timingAwardRes = await request('timingAwardForTurntableFarm', {version: 4, channel: 1});
- }
-
- async function browserForTurntableFarm(type, adId) {
- if (type === 1) {
- that.log('浏览爆品会场');
- }
- if (type === 2) {
- that.log('天天抽奖浏览任务领取水滴');
- }
- const body = {"type": type,"adId": adId,"version":4,"channel":1};
- $.browserForTurntableFarmRes = await request('browserForTurntableFarm', body);
- // 浏览爆品会场8秒
- }
- //天天抽奖浏览任务领取水滴API
- async function browserForTurntableFarm2(type) {
- const body = {"type":2,"adId": type,"version":4,"channel":1};
- $.browserForTurntableFarm2Res = await request('browserForTurntableFarm', body);
- }
- /**
- * 天天抽奖拿好礼-助力API(每人每天三次助力机会)
- */
- async function lotteryMasterHelp() {
- $.lotteryMasterHelpRes = await request(`initForFarm`, {
- imageUrl: "",
- nickName: "",
- shareCode: arguments[0] + '-3',
- babelChannel: "3",
- version: 4,
- channel: 1
- });
- }
-
- //领取5人助力后的额外奖励API
- async function masterGotFinishedTaskForFarm() {
- const functionId = 'masterGotFinishedTaskForFarm';
- $.masterGotFinished = await request(functionId);
- }
- //助力好友信息API
- async function masterHelpTaskInitForFarm() {
- const functionId = 'masterHelpTaskInitForFarm';
- $.masterHelpResult = await request(functionId);
- }
- //接受对方邀请,成为对方好友的API
- async function inviteFriend() {
- $.inviteFriendRes = await request(`initForFarm`, {
- imageUrl: "",
- nickName: "",
- shareCode: arguments[0] + '-inviteFriend',
- version: 4,
- channel: 2
- });
- }
- // 助力好友API
- async function masterHelp() {
- $.helpResult = await request(`initForFarm`, {
- imageUrl: "",
- nickName: "",
- shareCode: arguments[0],
- babelChannel: "3",
- version: 2,
- channel: 1
- });
- }
- /**
- * 水滴雨API
- */
- async function waterRainForFarm() {
- const functionId = 'waterRainForFarm';
- const body = {"type": 1, "hongBaoTimes": 100, "version": 3};
- $.waterRain = await request(functionId, body);
- }
- /**
- * 打卡领水API
- */
- async function clockInInitForFarm() {
- const functionId = 'clockInInitForFarm';
- $.clockInInit = await request(functionId);
- }
-
- // 连续签到API
- async function clockInForFarm() {
- const functionId = 'clockInForFarm';
- $.clockInForFarmRes = await request(functionId, {"type": 1});
- }
-
- //关注,领券等API
- async function clockInFollowForFarm(id, type, step) {
- const functionId = 'clockInFollowForFarm';
- let body = {
- id,
- type,
- step
- }
- if (type === 'theme') {
- if (step === '1') {
- $.themeStep1 = await request(functionId, body);
- } else if (step === '2') {
- $.themeStep2 = await request(functionId, body);
- }
- } else if (type === 'venderCoupon') {
- if (step === '1') {
- $.venderCouponStep1 = await request(functionId, body);
- } else if (step === '2') {
- $.venderCouponStep2 = await request(functionId, body);
- }
- }
- }
-
- // 领取连续签到7天的惊喜礼包API
- async function gotClockInGift() {
- $.gotClockInGiftRes = await request('clockInForFarm', {"type": 2})
- }
-
- //定时领水API
- async function gotThreeMealForFarm() {
- const functionId ='gotThreeMealForFarm';
- $.threeMeal = await request(functionId);
- }
- /**
- * 浏览广告任务API
- * type为0时, 完成浏览任务
- * type为1时, 领取浏览任务奖励
- */
- async function browseAdTaskForFarm(advertId, type) {
- const functionId = 'browseAdTaskForFarm';
- if (type === 0) {
- $.browseResult = await request(functionId, {advertId, type});
- } else if (type === 1) {
- $.browseRwardResult = await request(functionId, {advertId, type});
- }
- }
- // 被水滴砸中API
- async function gotWaterGoalTaskForFarm() {
- $.goalResult = await request('gotWaterGoalTaskForFarm', {type: 3});
- }
- //签到API
- async function signForFarm() {
- const functionId = 'signForFarm';
- $.signResult = await request(functionId);
- }
- /**
- * 初始化农场, 可获取果树及用户信息API
- */
- async function initForFarm() {
- return new Promise(resolve => {
- const option = {
- url: `${JD_API_HOST}?functionId=initForFarm`,
- body: `body=${escape(JSON.stringify({"version":4}))}&appid=wh5&clientVersion=9.1.0`,
- headers: {
- "accept": "*/*",
- "accept-encoding": "gzip, deflate, br",
- "accept-language": "zh-CN,zh;q=0.9",
- "cache-control": "no-cache",
- "cookie": cookie,
- "origin": "https://home.m.jd.com",
- "pragma": "no-cache",
- "referer": "https://home.m.jd.com/myJd/newhome.action",
- "sec-fetch-dest": "empty",
- "sec-fetch-mode": "cors",
- "sec-fetch-site": "same-site",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
- "Content-Type": "application/x-www-form-urlencoded"
- },
- timeout: 10000,
- };
- $.post(option, (err, resp, data) => {
- try {
- if (err) {
- that.log('\n动动农场: API查询请求失败 ‼️‼️');
- that.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- $.farmInfo = JSON.parse(data)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
- }
-
- // 初始化任务列表API
- async function taskInitForFarm() {
- that.log('\n初始化任务列表')
- const functionId = 'taskInitForFarm';
- $.farmTask = await request(functionId);
- }
- //获取好友列表API
- async function friendListInitForFarm() {
- $.friendList = await request('friendListInitForFarm', {"version": 4, "channel": 1});
- // that.log('aa', aa);
- }
- // 领取邀请好友的奖励API
- async function awardInviteFriendForFarm() {
- $.awardInviteFriendRes = await request('awardInviteFriendForFarm');
- }
- //为好友浇水API
- async function waterFriendForFarm(shareCode) {
- const body = {"shareCode": shareCode, "version": 6, "channel": 1}
- $.waterFriendForFarmRes = await request('waterFriendForFarm', body);
- }
-
-
- function readShareCode() {
- return new Promise(async resolve => {
- $.get({url: `http://jd.turinglabs.net/api/v2/jd/farm/read/${randomCount}/`, timeout: 10000,}, (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- that.log(`随机取个${randomCount}码放到您固定的互助码后面(不影响已有固定互助)`)
- data = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- await $.wait(10000);
- resolve()
- })
- }
- function shareCodesFormat() {
- return new Promise(async resolve => {
- // that.log(`第${$.index}个动动账号的助力码:::${jdFruitShareArr[$.index - 1]}`)
- newShareCodes = [];
- // if (jdFruitShareArr[$.index - 1]) {
- // newShareCodes = jdFruitShareArr[$.index - 1].split('@');
- // } else {
- // that.log(`由于您第${$.index}个动动账号未提供shareCode,将采纳本脚本自带的助力码\n`)
- // const tempIndex = $.index > shareCodes.length ? (shareCodes.length - 1) : ($.index - 1);
- // newShareCodes = shareCodes[tempIndex].split('@');
- // }
- // const readShareCodeRes = await readShareCode();
- // if (readShareCodeRes && readShareCodeRes.code === 200) {
- // // newShareCodes = newShareCodes.concat(readShareCodeRes.data || []);
- // newShareCodes = [...new Set([...newShareCodes, ...(readShareCodeRes.data || [])])];
- // }
- // that.log(`第${$.index}个动动账号将要助力的好友${JSON.stringify(newShareCodes)}`)
- resolve();
- })
- }
-
- function request(function_id, body = {}, timeout = 1000){
- return new Promise(resolve => {
- setTimeout(() => {
- $.get(taskUrl(function_id, body), (err, resp, data) => {
- try {
- if (err) {
- that.log('\n动动农场: API查询请求失败 ‼️‼️')
- that.log(JSON.stringify(err));
- that.log(`function_id:${function_id}`)
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- }, timeout)
- })
- }
- function safeGet(data) {
- try {
- if (typeof JSON.parse(data) == "object") {
- return true;
- }
- } catch (e) {
- that.log(e);
- that.log(`动动服务器访问数据为空,请检查自身设备网络情况`);
- return false;
- }
- }
- function taskUrl(function_id, body = {}) {
- return {
- url: `${JD_API_HOST}?functionId=${function_id}&appid=wh5&body=${escape(JSON.stringify(body))}`,
- headers: {
- Cookie: cookie,
- UserAgent: $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
- },
- timeout: 10000,
- }
- }
- //-------------------------------------------------东东赚赚------------------------------------------------------------
-
-
-async function jdWish() {
- $.bean = 0
- $.tuan = null
- $.hasOpen = false
- await getTaskList(true)
- await getUserTuanInfo()
- if (!$.tuan) {
- await openTuan()
- if ($.hasOpen) await getUserTuanInfo()
- }
- if ($.tuan) $.tuanList.push($.tuan)
- await helpFriends()
- await getUserInfo()
- $.nowBean = parseInt($.totalBeanNum)
- $.nowNum = parseInt($.totalNum)
- for (let i = 0; i < $.taskList.length; ++i) {
- let task = $.taskList[i]
- if (task['taskId'] === 1 && task['status'] !== 2) {
- that.log(`去做任务:${task.taskName}`)
- await doTask({"taskId": task['taskId'],"mpVersion":"3.4.0"})
- } else if (task['taskId'] !== 3 && task['status'] !== 2) {
- that.log(`去做任务:${task.taskName}`)
- if(task['itemId'])
- await doTask({"itemId":task['itemId'],"taskId":task['taskId'],"mpVersion":"3.4.0"})
- else
- await doTask({"taskId": task['taskId'],"mpVersion":"3.4.0"})
- await $.wait(3000)
- }
- }
- await getTaskList();
- await showMsg1();
- }
-
-
- function helpFriendTuan(body) {
- return new Promise(resolve => {
- $.get(taskTuanUrl("vvipclub_distributeBean_assist", body), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- if (data.success) {
- that.log('助力成功')
- } else {
- if (data.resultCode === '9200008') that.log('不能助力自己')
- else if (data.resultCode === '9200011') that.log('已经助力过')
- else if (data.resultCode === '2400205') that.log('团已满')
- else if (data.resultCode === '2400203') {that.log('助力次数已耗尽');$.canHelp = false}
- else that.log(`未知错误`)
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
- }
-
- function getUserTuanInfo() {
- let body = {"paramData": {"channel": "FISSION_BEAN"}}
- return new Promise(resolve => {
- $.get(taskTuanUrl("distributeBeanActivityInfo", body), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- if (data.data && !data.data.canStartNewAssist) {
- $.tuan = {
- "activityIdEncrypted": data.data.id,
- "assistStartRecordId": data.data.assistStartRecordId,
- "assistedPinEncrypted": data.data.encPin,
- "channel": "FISSION_BEAN"
- }
- $.tuanActId = data.data.id
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
- }
-
- function openTuan() {
- let body = {"activityIdEncrypted": $.tuanActId, "channel": "FISSION_BEAN"}
- return new Promise(resolve => {
- $.get(taskTuanUrl("vvipclub_distributeBean_startAssist", body), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- if (data['success']) {
- $.hasOpen = true
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
- }
-
- function getUserInfo() {
- return new Promise(resolve => {
- $.get(taskUrl1("interactIndex"), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- // if (data.data.shareTaskRes) {
- // that.log(`\n【动动账号${$.index}(${$.nickName || $.UserName})的${$.name}好友互助码】${data.data.shareTaskRes.itemId}\n`);
- // } else {
- // that.log(`\n\n已满5人助力或助力功能已下线,故暂时无${$.name}好友助力码\n\n`)
- // }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
- }
-
- function getTaskList(flag = false) {
- return new Promise(resolve => {
- $.get(taskUrl1("interactTaskIndex"), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- $.taskList = data.data.taskDetailResList
- $.totalNum = data.data.totalNum
- $.totalBeanNum = data.data.totalBeanNum
- if (flag && $.taskList.filter(item => !!item && item['taskId']=== 3) && $.taskList.filter(item => !!item && item['taskId']=== 3).length) {
- $.shareId=$.taskList.filter(item => !!item && item['taskId']=== 3)[0]['itemId'];
- that.log(`\n【动动账号${$.index}(${$.nickName || $.UserName})的${$.name}好友互助码】${$.taskList.filter(item => !!item && item['taskId']=== 3)[0]['itemId']}\n`);
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
- }
-
- // 完成
- function doTask(body, func = "doInteractTask") {
- // that.log(taskUrl("doInteractTask", body))
- return new Promise(resolve => {
- $.get(taskUrl1(func, body), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- // that.log(data)
- if (func === "doInteractTask") {
- if (data.subCode === "S000") {
- that.log(`任务完成,获得 ${data.data.taskDetailResList[0].incomeAmountConf} 金币,${data.data.taskDetailResList[0].beanNum} 京豆`)
- $.bean += parseInt(data.data.taskDetailResList[0].beanNum)
- } else {
- that.log(`任务失败,错误信息:${data.message}`)
- }
- } else {
- that.log(`${data.data.helpResDesc}`)
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
- }
-
- async function helpFriends() {
- await getHelp();
- for (let code of $.newShareCodes) {
- if (!code) continue
- await doTask({"itemId": code, "taskId": "3", "mpVersion": "3.4.0"}, "doHelpTask")
- }
- await setHelp();
- }
-
- function getHelp() {
- $.newShareCodes = [];
- return new Promise(resolve => {
- $.get({
- url: "http://api.tyh52.com/act/get/jdzz/3"
- }, (err, resp, data) => {
- try {
- if (data) {
- data = JSON.parse(data);
- if (data.code == 1) {
- let list = data.data;
- if (!(list instanceof Array)) {
- list = JSON.parse(list);
- }
- if (list.length > 0) {
- for (var i in list) {
- $.newShareCodes.push(list[i]);
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- });
- }
-
- function setHelp() {
- return new Promise(resolve => {
- if ($.shareId) {
- $.get({
- url: "http://api.tyh52.com/act/set/jdzz/" + $.shareId
- }, (err, resp, data) => {
- try {
- if (data) {
- data = JSON.parse(data);
- if (data.code == 1) {
- that.log("提交自己的邀請碼成功");
- } else {
- that.log("提交邀请码失败," + data.message);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- } else {
- resolve();
- }
-
- });
- }
-
- function getHelpTuan() {
- $.tuanList = [];
- return new Promise(resolve => {
- $.get({
- url: "http://api.tyh52.com/act/get/jdzzTuan/3"
- }, (err, resp, data) => {
- try {
- if (data) {
- data = JSON.parse(data);
- if (data.code == 1) {
- let list = data.data;
- if (!(list instanceof Array)) {
- list = JSON.parse(list);
- }
- if (list.length > 0) {
- for (var item of list) {
- let its=item.split('@');
- if(its.length==2){
- let tuan={
- "activityIdEncrypted": $.tuanActId,
- "assistStartRecordId": its[0],
- "assistedPinEncrypted": its[1],
- "channel": "FISSION_BEAN"
- }
- $.tuanList.push(tuan);
- }
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- });
- }
-
- function setHelpTuan() {
- return new Promise(resolve => {
- if ($.tuan) {
- $.get({
- url: "http://api.tyh52.com/act/set/jdzzTuan/" + $.tuan.assistStartRecordId+'@'+$.tuan.assistedPinEncrypted
- }, (err, resp, data) => {
- try {
- if (data) {
- that.log(data);
- data = JSON.parse(data);
- if (data.code == 1) {
- that.log("提交自己的开团碼成功");
- }else{
- that.log("提交开团码失败," + data.message);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- } else {
- resolve();
- }
-
- });
- }
-
- function taskUrl1(functionId, body = {}) {
- return {
- url: `${JD_API_HOST}?functionId=${functionId}&body=${escape(JSON.stringify(body))}&client=wh5&clientVersion=9.1.0`,
- headers: {
- 'Cookie': cookie,
- 'Host': 'api.m.jd.com',
- 'Connection': 'keep-alive',
- 'Content-Type': 'application/json',
- 'Referer': 'http://wq.jd.com/wxapp/pages/hd-interaction/index/index',
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
- 'Accept-Language': 'zh-cn',
- 'Accept-Encoding': 'gzip, deflate, br',
- }
- }
- }
-
- function taskTuanUrl(function_id, body = {}) {
- return {
- url: `${JD_API_HOST}?functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=swat_miniprogram&osVersion=5.0.0&clientVersion=3.1.3&fromType=wxapp×tamp=${new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000}`,
- headers: {
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-cn",
- "Connection": "keep-alive",
- "Content-Type": "application/x-www-form-urlencoded",
- "Host": "api.m.jd.com",
- "Referer": "https://servicewechat.com/wxa5bf5ee667d91626/108/page-frame.html",
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
- }
- }
- }
-
-
-
- function showMsg1() {
- return new Promise(async resolve => {
- that.log( "" + `本次获得${parseInt($.totalBeanNum) - $.nowBean}京豆,${parseInt($.totalNum) - $.nowNum}金币\n` + "\n\n")
- message += "" + `累计获得${$.totalBeanNum}京豆,${$.totalNum}金币\n可兑换${$.totalNum / 10000}元无门槛红包` + "\n\n"
- if (parseInt($.totalBeanNum) - $.nowBean > 0) {
- $.msg($.name, '', `动动账号${$.index} ${$.nickName}\n${message}`);
- } else {
- $.log(message)
- }
- // 云端大于10元无门槛红包时进行通知推送
- if ($.isNode() && $.totalNum >= 1000000) await notify.sendNotify(`${$.name} - 动动账号${$.index} - ${$.nickName}`, `动动账号${$.index} ${$.nickName}\n当前金币:${$.totalNum}个\n可兑换无门槛红包:${parseInt($.totalNum) / 10000}元\n`,)
- resolve();
- })
- }
-
-
-
-
-
-//我加的函数
-function postToDingTalk(messgae) {
- const message1 = "" + messgae
- that.log(messgae)
-
- const body = {
- "msgtype": "markdown",
- "markdown": {
- "title":"资产变动",
- "text": message1
- },
- "at": {
- "atMobiles": [],
- "isAtAll": false
- }
- }
-
-
- $.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
- try {
- that.log(resp)
- that.log(data)
- if (err) {
- that.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- $.duckRes = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- },"json")
-}
-
-
-function toDingtalk(urlmain, bodyMain) {
- return {
- url: urlmain,
- body:bodyMain,
- headers: { 'Content-Type': 'application/json;charset=utf-8' },
- timeout: 10000,
- }
-}
-function getPic(){
- let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
- let address = "\n\n )
- address = address + code[pos] + ")"
- return address
-}
\ No newline at end of file
diff --git a/src/main/resources/test_blineBox.js b/src/main/resources/test_blineBox.js
new file mode 100644
index 0000000..c0eee87
--- /dev/null
+++ b/src/main/resources/test_blineBox.js
@@ -0,0 +1,383 @@
+/*
+闪购盲盒
+长期活动,一人每天5次助力机会,10次被助机会,被助力一次获得一次抽奖机会,前几次必中京豆
+修改自 @yangtingxiao 抽奖机脚本
+活动入口:京东APP首页-闪购-闪购盲盒
+网页地址:https://h5.m.jd.com/babelDiy/Zeus/3vzA7uGuWL2QeJ5UeecbbAVKXftQ/index.html
+更新地址:https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_sgmh.js
+已支持IOS双京东账号, Node.js支持N个京东账号
+脚本兼容: QuantumultX, Surge, Loon, 小火箭,JSBox, Node.js
+============Quantumultx===============
+[task_local]
+#闪购盲盒
+20 8 * * * https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_sgmh.js, tag=闪购盲盒, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
+================Loon==============
+[Script]
+cron "20 8 * * *" script-path=https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_sgmh.js, tag=闪购盲盒
+===============Surge=================
+闪购盲盒 = type=cron,cronexp="20 8 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_sgmh.js
+============小火箭=========
+闪购盲盒 = type=cron,script-path=https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_sgmh.js, cronexpr="20 8 * * *", timeout=3600, enable=true
+ */
+const $ = new Env('闪购盲盒');
+//Node.js用户请在jdCookie.js处填写京东ck;
+const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
+let appId = '1EFRXxg' , homeDataFunPrefix = 'interact_template', collectScoreFunPrefix = 'harmony', message = ''
+let lotteryResultFunPrefix = homeDataFunPrefix, browseTime = 6
+const inviteCodes = [
+ '',
+];
+const randomCount = $.isNode() ? 20 : 5;
+const notify = $.isNode() ? require('./sendNotify') : '';
+let merge = {}
+//IOS等用户直接用NobyDa的jd cookie
+let cookiesArr = [], cookie = '';
+if ($.isNode()) {
+ Object.keys(jdCookieNode).forEach((item) => {
+ cookiesArr.push(jdCookieNode[item])
+ })
+ if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
+} else {
+ cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
+}
+const JD_API_HOST = `https://api.m.jd.com/client.action`;
+!(async () => {
+ if (!cookiesArr[0]) {
+ $.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
+ return;
+ }
+ await requireConfig();
+ for (let i = 0; i < cookiesArr.length; i++) {
+ cookie = cookiesArr[i];
+ if (cookie) {
+ $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
+ $.index = i + 1;
+ $.isLogin = true;
+ $.nickName = '';
+ $.beans = 0
+ message = ''
+ await TotalBean();
+ await shareCodesFormat();
+ console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`);
+ if (!$.isLogin) {
+ $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
+
+ if ($.isNode()) {
+ await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
+ }
+ continue
+ }
+ await interact_template_getHomeData()
+ await showMsg();
+ }
+ }
+})()
+ .catch((e) => $.logErr(e))
+ .finally(() => $.done())
+//获取活动信息
+function interact_template_getHomeData(timeout = 0) {
+ return new Promise((resolve) => {
+ setTimeout( ()=>{
+ let url = {
+ url : `${JD_API_HOST}`,
+ headers : {
+ 'Origin' : `https://h5.m.jd.com`,
+ 'Cookie' : cookie,
+ 'Connection' : `keep-alive`,
+ 'Accept' : `application/json, text/plain, */*`,
+ 'Referer' : `https://h5.m.jd.com/babelDiy/Zeus/2WBcKYkn8viyxv7MoKKgfzmu7Dss/index.html`,
+ 'Host' : `api.m.jd.com`,
+ 'Accept-Encoding' : `gzip, deflate, br`,
+ 'Accept-Language' : `zh-cn`
+ },
+ body : `functionId=${homeDataFunPrefix}_getHomeData&body={"appId":"${appId}","taskToken":""}&client=wh5&clientVersion=1.0.0`
+ }
+ $.post(url, async (err, resp, data) => {
+ try {
+ data = JSON.parse(data);
+ if (data.data.bizCode !== 0) {
+ console.log(data.data.bizMsg);
+ return
+ }
+ scorePerLottery = data.data.result.userInfo.scorePerLottery||data.data.result.userInfo.lotteryMinusScore
+ if (data.data.result.raiseInfo&&data.data.result.raiseInfo.levelList) scorePerLottery = data.data.result.raiseInfo.levelList[data.data.result.raiseInfo.scoreLevel];
+ //console.log(scorePerLottery)
+ for (let i = 0;i < data.data.result.taskVos.length;i ++) {
+ console.log("\n" + data.data.result.taskVos[i].taskType + '-' + data.data.result.taskVos[i].taskName + '-' + (data.data.result.taskVos[i].status === 1 ? `已完成${data.data.result.taskVos[i].times}-未完成${data.data.result.taskVos[i].maxTimes}` : "全部已完成"))
+ //签到
+ if (data.data.result.taskVos[i].taskName === '邀请好友助力') {
+ console.log(`\n【京东账号${$.index}(${$.UserName})的${$.name}好友互助码】${data.data.result.taskVos[i].assistTaskDetailVo.taskToken}\n`);
+ for (let code of $.newShareCodes) {
+ if (!code) continue
+ await harmony_collectScore(code, data.data.result.taskVos[i].taskId);
+ await $.wait(2000)
+ }
+ }
+ else if (data.data.result.taskVos[i].status === 3) {
+ console.log('开始抽奖')
+ await interact_template_getLotteryResult(data.data.result.taskVos[i].taskId);
+ }
+ else if ([0,13].includes(data.data.result.taskVos[i].taskType)) {
+ if (data.data.result.taskVos[i].status === 1) {
+ await harmony_collectScore(data.data.result.taskVos[i].simpleRecordInfoVo.taskToken,data.data.result.taskVos[i].taskId);
+ }
+ }
+ else if ([14,6].includes(data.data.result.taskVos[i].taskType)) {
+ //console.log(data.data.result.taskVos[i].assistTaskDetailVo.taskToken)
+ for (let j = 0;j <(data.data.result.userInfo.lotteryNum||0);j++) {
+ if (appId === "1EFRTxQ") {
+ await ts_smashGoldenEggs()
+ } else {
+ await interact_template_getLotteryResult(data.data.result.taskVos[i].taskId);
+ }
+ }
+ }
+ let list = data.data.result.taskVos[i].productInfoVos || data.data.result.taskVos[i].followShopVo || data.data.result.taskVos[i].shoppingActivityVos || data.data.result.taskVos[i].browseShopVo
+ for (let k = data.data.result.taskVos[i].times; k < data.data.result.taskVos[i].maxTimes; k++) {
+ for (let j in list) {
+ if (list[j].status === 1) {
+ //console.log(list[j].simpleRecordInfoVo||list[j].assistTaskDetailVo)
+ console.log("\n" + (list[j].title || list[j].shopName||list[j].skuName))
+ //console.log(list[j].itemId)
+ if (list[j].itemId) {
+ await harmony_collectScore(list[j].taskToken,data.data.result.taskVos[i].taskId,list[j].itemId,1);
+ if (k === data.data.result.taskVos[i].maxTimes - 1) await interact_template_getLotteryResult(data.data.result.taskVos[i].taskId);
+ } else {
+ await harmony_collectScore(list[j].taskToken,data.data.result.taskVos[i].taskId)
+ }
+ list[j].status = 2;
+ break;
+ }
+ }
+ }
+ }
+ if (scorePerLottery) await interact_template_getLotteryResult();
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve()
+ }
+ })
+ },timeout)
+ })
+}
+//做任务
+function harmony_collectScore(taskToken,taskId,itemId = "",actionType = 0,timeout = 0) {
+ return new Promise((resolve) => {
+ setTimeout( ()=>{
+ let url = {
+ url : `${JD_API_HOST}`,
+ headers : {
+ 'Origin' : `https://h5.m.jd.com`,
+ 'Cookie' : cookie,
+ 'Connection' : `keep-alive`,
+ 'Accept' : `application/json, text/plain, */*`,
+ 'Referer' : `https://h5.m.jd.com/babelDiy/Zeus/2WBcKYkn8viyxv7MoKKgfzmu7Dss/index.html`,//?inviteId=P225KkcRx4b8lbWJU72wvZZcwCjVXmYaS5jQ P225KkcRx4b8lbWJU72wvZZcwCjVXmYaS5jQ?inviteId=${shareCode}
+ 'Host' : `api.m.jd.com`,
+ 'Accept-Encoding' : `gzip, deflate, br`,
+ 'Accept-Language' : `zh-cn`
+ },
+ body : `functionId=${collectScoreFunPrefix}_collectScore&body={"appId":"${appId}","taskToken":"${taskToken}","taskId":${taskId}${itemId ? ',"itemId":"'+itemId+'"' : ''},"actionType":${actionType}&client=wh5&clientVersion=1.0.0`
+ }
+ //console.log(url.body)
+ //if (appId === "1EFRTxQ") url.body += "&appid=golden-egg"
+ $.post(url, async (err, resp, data) => {
+ try {
+ data = JSON.parse(data);
+ if (data.data.bizMsg === "任务领取成功") {
+ await harmony_collectScore(taskToken,taskId,itemId,0,parseInt(browseTime) * 1000);
+ } else{
+ console.log(data.data.bizMsg)
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve()
+ }
+ })
+ },timeout)
+ })
+}
+//抽奖
+function interact_template_getLotteryResult(taskId,timeout = 0) {
+ return new Promise((resolve) => {
+ setTimeout( ()=>{
+ let url = {
+ url : `${JD_API_HOST}`,
+ headers : {
+ 'Origin' : `https://h5.m.jd.com`,
+ 'Cookie' : cookie,
+ 'Connection' : `keep-alive`,
+ 'Accept' : `application/json, text/plain, */*`,
+ 'Referer' : `https://h5.m.jd.com/babelDiy/Zeus/2WBcKYkn8viyxv7MoKKgfzmu7Dss/index.html?inviteId=P04z54XCjVXmYaW5m9cZ2f433tIlGBj3JnLHD0`,//?inviteId=P225KkcRx4b8lbWJU72wvZZcwCjVXmYaS5jQ P225KkcRx4b8lbWJU72wvZZcwCjVXmYaS5jQ
+ 'Host' : `api.m.jd.com`,
+ 'Accept-Encoding' : `gzip, deflate, br`,
+ 'Accept-Language' : `zh-cn`
+ },
+ body : `functionId=${lotteryResultFunPrefix}_getLotteryResult&body={"appId":"${appId}"${taskId ? ',"taskId":"'+taskId+'"' : ''}}&client=wh5&clientVersion=1.0.0`
+ }
+ //console.log(url.body)
+ //if (appId === "1EFRTxQ") url.body = `functionId=ts_getLottery&body={"appId":"${appId}"${taskId ? ',"taskId":"'+taskId+'"' : ''}}&client=wh5&clientVersion=1.0.0&appid=golden-egg`
+ $.post(url, async (err, resp, data) => {
+ try {
+ if (!timeout) console.log('\n开始抽奖')
+ data = JSON.parse(data);
+ if (data.data.bizCode === 0) {
+ if (data.data.result.userAwardsCacheDto.jBeanAwardVo) {
+ console.log('京豆:' + data.data.result.userAwardsCacheDto.jBeanAwardVo.quantity)
+ $.beans += parseInt(data.data.result.userAwardsCacheDto.jBeanAwardVo.quantity)
+ }
+ if (data.data.result.raiseInfo) scorePerLottery = parseInt(data.data.result.raiseInfo.nextLevelScore);
+ if (parseInt(data.data.result.userScore) >= scorePerLottery && scorePerLottery) {
+ await interact_template_getLotteryResult(1000)
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve()
+ }
+ })
+ },timeout)
+ })
+}
+
+
+//通知
+function showMsg() {
+ message += `任务已完成,本次运行获得京豆${$.beans}`
+ return new Promise(resolve => {
+ if ($.beans) $.msg($.name, '', `【京东账号${$.index}】${$.nickName}\n${message}`);
+ $.log(`【京东账号${$.index}】${$.nickName}\n${message}`);
+ resolve()
+ })
+}
+
+function requireConfig() {
+ return new Promise(async resolve => {
+ console.log(`开始获取${$.name}配置文件\n`);
+ //Node.js用户请在jdCookie.js处填写京东ck;
+ let shareCodes = []
+ console.log(`共${cookiesArr.length}个京东账号\n`);
+ if ($.isNode() && process.env.JDSGMH_SHARECODES) {
+ if (process.env.JDSGMH_SHARECODES.indexOf('\n') > -1) {
+ shareCodes = process.env.JDSGMH_SHARECODES.split('\n');
+ } else {
+ shareCodes = process.env.JDSGMH_SHARECODES.split('&');
+ }
+ }
+ $.shareCodesArr = [];
+ if ($.isNode()) {
+ Object.keys(shareCodes).forEach((item) => {
+ if (shareCodes[item]) {
+ $.shareCodesArr.push(shareCodes[item])
+ }
+ })
+ }
+ console.log(`您提供了${$.shareCodesArr.length}个账号的${$.name}助力码\n`);
+ resolve()
+ })
+}
+
+//格式化助力码
+function shareCodesFormat() {
+ return new Promise(async resolve => {
+ // console.log(`第${$.index}个京东账号的助力码:::${$.shareCodesArr[$.index - 1]}`)
+ $.newShareCodes = [];
+ if ($.shareCodesArr[$.index - 1]) {
+ $.newShareCodes = $.shareCodesArr[$.index - 1].split('@');
+ } else {
+ console.log(`由于您第${$.index}个京东账号未提供shareCode,将采纳本脚本自带的助力码\n`)
+ const tempIndex = $.index > inviteCodes.length ? (inviteCodes.length - 1) : ($.index - 1);
+ $.newShareCodes = inviteCodes[tempIndex].split('@');
+ }
+ const readShareCodeRes = await readShareCode();
+ // console.log(readShareCodeRes)
+ if (readShareCodeRes && readShareCodeRes.code === 200) {
+ $.newShareCodes = [...new Set([...$.newShareCodes, ...(readShareCodeRes.data || [])])];
+ }
+ console.log(`第${$.index}个京东账号将要助力的好友${JSON.stringify($.newShareCodes)}`)
+ resolve();
+ })
+}
+
+function readShareCode() {
+ console.log(`开始`)
+ return new Promise(async resolve => {
+ $.get({url: ``, timeout: 10000}, (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(JSON.stringify(err))
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (data) {
+ console.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`)
+ data = JSON.parse(data);
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ await $.wait(2000);
+ resolve()
+ })
+}
+function TotalBean() {
+ return new Promise(async resolve => {
+ const options = {
+ "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
+ "headers": {
+ "Accept": "application/json,text/plain, */*",
+ "Content-Type": "application/x-www-form-urlencoded",
+ "Accept-Encoding": "gzip, deflate, br",
+ "Accept-Language": "zh-cn",
+ "Connection": "keep-alive",
+ "Cookie": cookie,
+ "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
+ "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : "jdapp;iPhone;9.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") : ($.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")
+ }
+ }
+ $.post(options, (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (data) {
+ data = JSON.parse(data);
+ if (data['retcode'] === 13) {
+ $.isLogin = false; //cookie过期
+ return
+ }
+ if (data['retcode'] === 0) {
+ $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
+ } else {
+ $.nickName = $.UserName
+ }
+ } else {
+ console.log(`京东服务器返回空数据`)
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve();
+ }
+ })
+ })
+}
+function jsonParse(str) {
+ if (typeof str == "string") {
+ try {
+ return JSON.parse(str);
+ } catch (e) {
+ console.log(e);
+ $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
+ return [];
+ }
+ }
+}
+function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)}
\ No newline at end of file
diff --git a/src/main/resources/test_fruit.js b/src/main/resources/test_fruit.js
index 113443f..4c630b0 100644
--- a/src/main/resources/test_fruit.js
+++ b/src/main/resources/test_fruit.js
@@ -1,12 +1,3 @@
-let cookiesArr = [], cookie = '', jdFruitShareArr = [], isBox = false, notify;
-let newShareCodes = [];
-//助力好友分享码(最多4个,否则后面的助力失败),原因:动动农场每人每天只有四次助力机会
-//此此内容是IOS用户下载脚本到本地使用,填写互助码的地方,同一动动账号的好友互助码请使用@符号隔开。
-//下面给出两个账号的填写示例(iOS只支持2个动动账号)
-let shareCodes =
- [ // 这个列表填入你要助力的好友的shareCode
- ]
-
let dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=d2b6042cb38f0df63e20797c002208d2710104750c18a1dc84d54106a859a3f0"
let dingtalk2 = "https://oapi.dingtalk.com/robot/send?access_token=1832f969da101ef8273e8ba2258f06f15ec34bc22282066b28ab617042a7a9b6";
let getManName = ""
@@ -27,6 +18,14 @@ let roleMap = {
"羊爱咩咩": "yxb_15390868558",
"18709853042_p": "wzx_18709853042",
}
+let cookiesArr = [], cookie = '', jdFruitShareArr = [], isBox = false, notify;
+let newShareCodes = [];
+//助力好友分享码(最多4个,否则后面的助力失败),原因:动动农场每人每天只有四次助力机会
+//此此内容是IOS用户下载脚本到本地使用,填写互助码的地方,同一动动账号的好友互助码请使用@符号隔开。
+//下面给出两个账号的填写示例(iOS只支持2个动动账号)
+let shareCodes =
+ [ // 这个列表填入你要助力的好友的shareCode
+ ]
let message = '', subTitle = '', option = {}, isFruitFinished = false;
const retainWater = 100;//保留水滴大于多少g,默认100g;
let jdNotify = false;//是否关闭通知,false打开通知推送,true关闭通知推送
@@ -34,6 +33,34 @@ let jdFruitBeanCard = false;//农场使用水滴换豆卡(如果出现限时活
let randomCount = $.isNode() ? 0 : 0;
const JD_API_HOST = 'https://api.m.jd.com/client.action';
const urlSchema = `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/3KSjXqQabiTuD1cJ28QskrpWoBKT/index.html%22%20%7D`;
+/*
+东东水果:脚本更新地址 jd_fruit.js
+更新时间:2021-11-7
+活动入口:京东APP我的-更多工具-东东农场
+东东农场活动链接:https://h5.m.jd.com/babelDiy/Zeus/3KSjXqQabiTuD1cJ28QskrpWoBKT/index.html
+已支持IOS双京东账号,Node.js支持N个京东账号
+脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
+互助码shareCode请先手动运行脚本查看打印可看到
+一天只能帮助3个人。多出的助力码无效
+==========================Quantumultx=========================
+[task_local]
+#jd免费水果
+5 6-18/6 * * * jd_fruit.js, tag=东东农场, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jdnc.png, enabled=true
+=========================Loon=============================
+[Script]
+cron "5 6-18/6 * * *" script-path=jd_fruit.js,tag=东东农场
+
+=========================Surge============================
+东东农场 = type=cron,cronexp="5 6-18/6 * * *",wake-system=1,timeout=3600,script-path=jd_fruit.js
+
+=========================小火箭===========================
+东东农场 = type=cron,script-path=jd_fruit.js, cronexpr="5 6-18/6 * * *", timeout=3600, enable=true
+
+jd免费水果 搬的https://github.com/liuxiaoyucc/jd-helper/blob/a6f275d9785748014fc6cca821e58427162e9336/fruit/fruit.js
+
+export DO_TEN_WATER_AGAIN="" 默认再次浇水
+
+*/
!(async () => {
await requireConfig();
message += "[通知] 动动农场 \n\n --- \n\n"
diff --git a/src/main/resources/test_lemeonPush.js b/src/main/resources/test_lemeonPush.js
new file mode 100644
index 0000000..c01d416
--- /dev/null
+++ b/src/main/resources/test_lemeonPush.js
@@ -0,0 +1,555 @@
+/*
+入口 极速版 赚金币
+分享到QQ查看邀请码 packetId就是
+#自定义变量
+export tytpacketId=""
+ [task_local]
+#柠檬推一推
+0 0 * * * http://nm66.top/jd_tyt.js, tag=柠檬推一推, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
+*/
+const $ = new Env('柠檬推一推');
+const notify = $.isNode() ? require('./sendNotify') : '';
+//Node.js用户请在jdCookie.js处填写京东ck;
+const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
+const ua = `jdltapp;iPhone;3.1.0;${Math.ceil(Math.random()*4+10)}.${Math.ceil(Math.random()*4)};${randomString(40)}`
+var status = 0
+
+//IOS等用户直接用NobyDa的jd cookie
+let cookiesArr = [],
+ cookie = '',
+ message;
+let tytpacketId = '';
+if (process.env.tytpacketId) {
+ tytpacketId = process.env.tytpacketId;
+}
+if ($.isNode()) {
+ Object.keys(jdCookieNode).forEach((item) => {
+ cookiesArr.push(jdCookieNode[item])
+ })
+ // if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
+} else {
+ cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
+}
+const JD_API_HOST = 'https://api.m.jd.com/client.action';
+
+!(async() => {
+ if (!cookiesArr[0]) {
+ $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {
+ "open-url": "https://bean.m.jd.com/bean/signIndex.action"
+ });
+ return;
+ }
+ console.log("推一推开始")
+ for (let i = cookiesArr.length - 1; i > 0; i--) {
+ if (cookiesArr[i]) {
+ cookie = cookiesArr[i];
+ $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
+ $.index = i + 1;
+ $.isLogin = true;
+ $.nickName = '';
+ message = '';
+ await TotalBean();
+ // console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`);
+ if (!$.isLogin) {
+ $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {
+ "open-url": "https://bean.m.jd.com/bean/signIndex.action"
+ });
+
+ if ($.isNode()) {
+ await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
+ }
+ continue
+ }
+ if (status == 1) {
+ break
+ }
+ await tythelp()
+ await $.wait(10000)
+ }
+ }
+ console.log("推一推结束")
+})()
+ .catch((e) => {
+ $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
+ })
+ .finally(() => {
+ $.done();
+ })
+
+function tythelp() {
+ return new Promise(async(resolve) => {
+ let options = {
+ url: `https://api.m.jd.com/?t=1623066557140`,
+ //dS%2Bp85VyjydPuAOOnFP%2Faw%3D%3D
+ // `functionId=helpCoinDozer&appid=station-soa-h5&client=H5&clientVersion=1.0.0&t=1626442453855&body={"actId":"d5a8c7198ee54de093d2adb04089d3ec","channel":"coin_dozer","antiToken":"yq3pjm7j7k5uvqy47su1626442451438ns7d~NmZeSyVEbFNSd3V7cFVfBnh1AwtmRHpTBiUjb35DFm5vLUROOBEzLUF7G28iAAFBKBgVFA1EPwIVKDclGENXbm8iVlQiAwpTTx1lKSsTCG5vfmsaDUR6LUEnG29+PU8DeXdVWmICZBNSJXN6dAIIUCt8Uww0UW4SUiQleSFWXkAoM0Jkc0oKUwoyKhFmWzEQOTZCXQ1Eei1BKTQ5GENXbm80Qks5ATkdB28tKWoCAl8RZhtkcxY4LUF7G29rPU8eEWZHTA1EbC1BKTM5NBJXbm9oaxohDwpTWR1lf3RNWR56aAcUYUpnQVodZTBmTU9XKSBEX3NcdEFQLXFvaEMOQW9+FV1nVTUUD3Z2OydQGkY/Pk0NJxQvHQ0pNi4iDwRGLyFHDyFeLlNPYyRvfkMVBioyQkhnACFADCgjJCgLF0Y1dQEKZ1JiQ1d0dnl3WRRaLyAVFHMCJR9Be2UrNQgVQzgnAhp9RD8CQXtlfGZNT1gkJxUCc19vSFpjOg==|~1626442453854~1~20201218~eyJ2aXdlIjoiMCIsImJhaW4iOnt9fQ==~2~386~2pl0|551tj-3t,94,,;754-,,,;35b-3t,95,13,l;b5z-3t,95,13,l;057-3t,95,13,l;doei:,1,0,0,0,0,1000,-1000,1000,-1000;dmei:,1,0,0,1000,-1000,1000,-1000,1000,-1000;emc:,5:1;emmm:;emcf:,5:1;ivli:;iivl:;ivcvj:;scvje:;ewhi:,5:179-44;1626442451433,1626442453853,0,1,5,5,0,1,0,0,0;ghuv","referer":"-1","frontendInitStatus":"s","packetId":"771e7201ab684d8dbceb4f7c68010b31-amRfNDY0YTJkNWRlY2M5Yw!!","helperStatus":"0"}&_ste=1&_stk=appid,body,client,clientVersion,functionId,t&h5st=20210716213413857;1825487558127162;10005;tk01w99d91b9aa8naWRuY2d5RFh2Ryyk9GOHsc+L4UqGKO3fDeUkMg9pFuY+YUDbVpkk7COFE8IBK6dj9Nncbm4OdKyR;8dcaa72b9c035da4aa5543a78281c6b0039f93b28c8c2f711914e43b66b2b27a`
+ body: `functionId=helpCoinDozer&appid=station-soa-h5&client=H5&clientVersion=1.0.0&t=1623120183787&body={"actId":"d5a8c7198ee54de093d2adb04089d3ec","channel":"coin_dozer","antiToken":"mmkajtm9eqonssy6xoi1623119406463ic84~NmZeSyVEbFNSd3V+dVNdA3pxAABkRHpTBiUjb35DFm5vLUROOBEzLUF7G28iAAFBKBgVFA1EPwIVKDclGENXbm8iVlQiAwpTTx1lKSsTCG5vfmsaDUR6LUEnG29+PU9ReSdSWTNTNxICI3V0dlYOV3p0Bwg3UW9IVnd+KSdUC1E3KQFkc0oKUwoyKhFmWzEQOTZCXQ1Eei1BKTQ5GENXbm80Qks5ATkdB28tKWoCAl8RZhtkcxY4LUF7G29rPU8eEWZHTA1EbC1BKTM5NBJXbm9oaxohDwpTWR1lf3RNWR56aAcUYUpnQFcdZTBmTU9XKSBEX3NcdEEFMDdvaEMOQW9+FV82CDAUAXhzfTEDXV07I0VUZx49F1MucyosBwIHeTFSDycPIlNPYyRvfkMDQCwiBFo1VWFHBzsuPnVZB185dQEKYlZkRFR3cnVxUAFFf3QVFHMCJR9Be2U3MwkVQC8nWBp9RD8CQXtlfGZNT1gkJxUCc19vSFpjOg==|~1623120183785~1~20201218~eyJ2aXdlIjoiMCIsImJhaW4iOnt9fQ==~2~281~1pl4|5563f-70,aa,,;751e-,,,;359-70,aa,40,u;b512-70,aa,40,u;058-70,aa,40,u;doei:,1,0,0,0,0,1000,-1000,1000,-1000;dmei:,1,0,0,1000,-1000,1000,-1000,1000,-1000;emc:,5:1;emmm:;emcf:,5:1;ivli:;iivl:;ivcvj:;scvje:;ewhi:,5:197-49;1623120175774,1623120183784,0,1,5,5,0,1,0,0,0;u5ge","referer":"-1","frontendInitStatus":"s","packetId":"${tytpacketId}","helperStatus":"0"}&_ste=1&_stk=appid,body,client,clientVersion,functionId,t&h5st=20210608104303790;8489907903583162;10005;tk01w89681aa9a8nZDdIanIyWnVuWFLK4gnqY+05WKcPY3NWU2dcfa73B7PBM7ufJEN0U+4MyHW5N2mT/RNMq72ycJxH;7e6b956f1a8a71b269a0038bbb4abd24bcfb834a88910818cf1bdfc55b7b96e5`,
+ headers: {
+ "Origin": "https://pushgold.jd.com",
+ "Host": "api.m.jd.com",
+ "Accept": "application/json, text/plain, */*",
+ "User-Agent": ua,
+ "Cookie": cookie,
+ }
+ }
+
+ $.post(options, async(err, resp, data) => {
+ try {
+ data = JSON.parse(data);
+
+ if (data.code == 0) {
+ // console.log("帮砍:" + data.data.amount)
+
+ } else if (data.msg.indexOf("完成") != -1) {
+ console.log("已完成砍价")
+ status = 1
+ } else {
+ // if (data.msg !== "need verify"){
+ // console.log(data.msg)
+ // }
+ // console.log(data.msg)
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve();
+ }
+ });
+ });
+}
+
+function randomString(e) {
+ e = e || 32;
+ let t = "abcdefhijkmnprstwxyz2345678",
+ a = t.length,
+ n = "";
+ for (i = 0; i < e; i++)
+ n += t.charAt(Math.floor(Math.random() * a));
+ return n
+}
+async function taskPostUrl(functionId, body) {
+ return {
+ url: `${JD_API_HOST}`,
+ body: `functionId=${functionId}&body=${escape(JSON.stringify(body))}&client=wh5&clientVersion=1.0.0&appid=content_ecology&uuid=6898c30638c55142969304c8e2167997fa59eb54&t=1622588448365`,
+ headers: {
+ 'Cookie': cookie,
+ 'Host': 'api.m.jd.com',
+ 'Connection': 'keep-alive',
+ 'Content-Type': 'application/x-www-form-urlencoded',
+ "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"),
+ 'Accept-Language': 'zh-cn',
+ 'Accept-Encoding': 'gzip, deflate, br',
+ }
+ }
+}
+
+
+async function TotalBean() {
+ return new Promise(async resolve => {
+ const options = {
+ "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
+ "headers": {
+ "Accept": "application/json,text/plain, */*",
+ "Content-Type": "application/x-www-form-urlencoded",
+ "Accept-Encoding": "gzip, deflate, br",
+ "Accept-Language": "zh-cn",
+ "Connection": "keep-alive",
+ "Cookie": cookie,
+ "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
+ "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.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")
+ }
+ }
+ $.post(options, (err, resp, data) => {
+ try {
+ if (err) {
+ // console.log(`${JSON.stringify(err)}`)
+ // console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (data) {
+ data = JSON.parse(data);
+ if (data["retcode"] === 13) {
+ $.isLogin = false; //cookie过期
+ return;
+ }
+ if (data["retcode"] === 0) {
+ $.nickName = (data["base"] && data["base"].nickname) || $.UserName;
+ } else {
+ $.nickName = $.UserName;
+ }
+ } else {
+ // console.log(`京东服务器返回空数据`)
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve();
+ }
+ })
+ })
+}
+async function safeGet(data) {
+ try {
+ if (typeof JSON.parse(data) == "object") {
+ return true;
+ }
+ } catch (e) {
+ // console.log(e);
+ // console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
+ return false;
+ }
+}
+
+function jsonParse(str) {
+ if (typeof str == "string") {
+ try {
+ return JSON.parse(str);
+ } catch (e) {
+ // console.log(e);
+ $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
+ return [];
+ }
+ }
+}
+// prettier-ignore
+
+function Env(t, e) {
+ "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0);
+ class s {
+ constructor(t) {
+ this.env = t
+ }
+ send(t, e = "GET") {
+ t = "string" == typeof t ? {
+ url: t
+ } : t;
+ let s = this.get;
+ return "POST" === e && (s = this.post), new Promise((e, i) => {
+ s.call(this, t, (t, s, r) => {
+ t ? i(t) : e(s)
+ })
+ })
+ }
+ get(t) {
+ return this.send.call(this.env, t)
+ }
+ post(t) {
+ return this.send.call(this.env, t, "POST")
+ }
+ }
+ return new class {
+ constructor(t, e) {
+ this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`)
+ }
+ isNode() {
+ return "undefined" != typeof module && !!module.exports
+ }
+ isQuanX() {
+ return "undefined" != typeof $task
+ }
+ isSurge() {
+ return "undefined" != typeof $httpClient && "undefined" == typeof $loon
+ }
+ isLoon() {
+ return "undefined" != typeof $loon
+ }
+ toObj(t, e = null) {
+ try {
+ return JSON.parse(t)
+ } catch {
+ return e
+ }
+ }
+ toStr(t, e = null) {
+ try {
+ return JSON.stringify(t)
+ } catch {
+ return e
+ }
+ }
+ getjson(t, e) {
+ let s = e;
+ const i = this.getdata(t);
+ if (i) try {
+ s = JSON.parse(this.getdata(t))
+ } catch {}
+ return s
+ }
+ setjson(t, e) {
+ try {
+ return this.setdata(JSON.stringify(t), e)
+ } catch {
+ return !1
+ }
+ }
+ getScript(t) {
+ return new Promise(e => {
+ this.get({
+ url: t
+ }, (t, s, i) => e(i))
+ })
+ }
+ runScript(t, e) {
+ return new Promise(s => {
+ let i = this.getdata("@chavy_boxjs_userCfgs.httpapi");
+ i = i ? i.replace(/\n/g, "").trim() : i;
+ let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");
+ r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r;
+ const [o, h] = i.split("@"), n = {
+ url: `http://${h}/v1/scripting/evaluate`,
+ body: {
+ script_text: t,
+ mock_type: "cron",
+ timeout: r
+ },
+ headers: {
+ "X-Key": o,
+ Accept: "*/*"
+ }
+ };
+ this.post(n, (t, e, i) => s(i))
+ }).catch(t => this.logErr(t))
+ }
+ loaddata() {
+ if (!this.isNode()) return {}; {
+ this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
+ const t = this.path.resolve(this.dataFile),
+ e = this.path.resolve(process.cwd(), this.dataFile),
+ s = this.fs.existsSync(t),
+ i = !s && this.fs.existsSync(e);
+ if (!s && !i) return {}; {
+ const i = s ? t : e;
+ try {
+ return JSON.parse(this.fs.readFileSync(i))
+ } catch (t) {
+ return {}
+ }
+ }
+ }
+ }
+ writedata() {
+ if (this.isNode()) {
+ this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
+ const t = this.path.resolve(this.dataFile),
+ e = this.path.resolve(process.cwd(), this.dataFile),
+ s = this.fs.existsSync(t),
+ i = !s && this.fs.existsSync(e),
+ r = JSON.stringify(this.data);
+ s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r)
+ }
+ }
+ lodash_get(t, e, s) {
+ const i = e.replace(/\[(\d+)\]/g, ".$1").split(".");
+ let r = t;
+ for (const t of i)
+ if (r = Object(r)[t], void 0 === r) return s;
+ return r
+ }
+ lodash_set(t, e, s) {
+ return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t)
+ }
+ getdata(t) {
+ let e = this.getval(t);
+ if (/^@/.test(t)) {
+ const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : "";
+ if (r) try {
+ const t = JSON.parse(r);
+ e = t ? this.lodash_get(t, i, "") : e
+ } catch (t) {
+ e = ""
+ }
+ }
+ return e
+ }
+ setdata(t, e) {
+ let s = !1;
+ if (/^@/.test(e)) {
+ const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}";
+ try {
+ const e = JSON.parse(h);
+ this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i)
+ } catch (e) {
+ const o = {};
+ this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i)
+ }
+ } else s = this.setval(t, e);
+ return s
+ }
+ getval(t) {
+ return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null
+ }
+ setval(t, e) {
+ return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null
+ }
+ initGotEnv(t) {
+ this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar))
+ }
+ get(t, e = (() => {})) {
+ t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, {
+ "X-Surge-Skip-Scripting": !1
+ })), $httpClient.get(t, (t, s, i) => {
+ !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i)
+ })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, {
+ hints: !1
+ })), $task.fetch(t).then(t => {
+ const {
+ statusCode: s,
+ statusCode: i,
+ headers: r,
+ body: o
+ } = t;
+ e(null, {
+ status: s,
+ statusCode: i,
+ headers: r,
+ body: o
+ }, o)
+ }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => {
+ try {
+ if (t.headers["set-cookie"]) {
+ const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();
+ s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar
+ }
+ } catch (t) {
+ this.logErr(t)
+ }
+ }).then(t => {
+ const {
+ statusCode: s,
+ statusCode: i,
+ headers: r,
+ body: o
+ } = t;
+ e(null, {
+ status: s,
+ statusCode: i,
+ headers: r,
+ body: o
+ }, o)
+ }, t => {
+ const {
+ message: s,
+ response: i
+ } = t;
+ e(s, i, i && i.body)
+ }))
+ }
+ post(t, e = (() => {})) {
+ if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, {
+ "X-Surge-Skip-Scripting": !1
+ })), $httpClient.post(t, (t, s, i) => {
+ !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i)
+ });
+ else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, {
+ hints: !1
+ })), $task.fetch(t).then(t => {
+ const {
+ statusCode: s,
+ statusCode: i,
+ headers: r,
+ body: o
+ } = t;
+ e(null, {
+ status: s,
+ statusCode: i,
+ headers: r,
+ body: o
+ }, o)
+ }, t => e(t));
+ else if (this.isNode()) {
+ this.initGotEnv(t);
+ const {
+ url: s,
+ ...i
+ } = t;
+ this.got.post(s, i).then(t => {
+ const {
+ statusCode: s,
+ statusCode: i,
+ headers: r,
+ body: o
+ } = t;
+ e(null, {
+ status: s,
+ statusCode: i,
+ headers: r,
+ body: o
+ }, o)
+ }, t => {
+ const {
+ message: s,
+ response: i
+ } = t;
+ e(s, i, i && i.body)
+ })
+ }
+ }
+ time(t, e = null) {
+ const s = e ? new Date(e) : new Date;
+ let i = {
+ "M+": s.getMonth() + 1,
+ "d+": s.getDate(),
+ "H+": s.getHours(),
+ "m+": s.getMinutes(),
+ "s+": s.getSeconds(),
+ "q+": Math.floor((s.getMonth() + 3) / 3),
+ S: s.getMilliseconds()
+ };
+ /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length)));
+ for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length)));
+ return t
+ }
+ msg(e = t, s = "", i = "", r) {
+ const o = t => {
+ if (!t) return t;
+ if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? {
+ "open-url": t
+ } : this.isSurge() ? {
+ url: t
+ } : void 0;
+ if ("object" == typeof t) {
+ if (this.isLoon()) {
+ let e = t.openUrl || t.url || t["open-url"],
+ s = t.mediaUrl || t["media-url"];
+ return {
+ openUrl: e,
+ mediaUrl: s
+ }
+ }
+ if (this.isQuanX()) {
+ let e = t["open-url"] || t.url || t.openUrl,
+ s = t["media-url"] || t.mediaUrl;
+ return {
+ "open-url": e,
+ "media-url": s
+ }
+ }
+ if (this.isSurge()) {
+ let e = t.url || t.openUrl || t["open-url"];
+ return {
+ url: e
+ }
+ }
+ }
+ };
+ if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) {
+ // let t = ["", "==============📣系统通知📣=============="];
+ // t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t)
+ }
+ }
+ log(...t) {
+ // t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator))
+ }
+ logErr(t, e) {
+ const s = !this.isSurge() && !this.isQuanX() && !this.isLoon();
+ s ? this.log("", `❗️${this.name}, 错误!`, t.stack) : this.log("", `❗️${this.name}, 错误!`, t)
+ }
+ wait(t) {
+ return new Promise(e => setTimeout(e, t))
+ }
+ done(t = {}) {
+ const e = (new Date).getTime(),
+ s = (e - this.startTime) / 1e3;
+ this.log("", `🔔${this.name}, 结束! 🕛 ${s} 秒`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t)
+ }
+ }(t, e)
+}
\ No newline at end of file
diff --git a/src/main/resources/test_lwq.js b/src/main/resources/test_lwq.js
deleted file mode 100644
index f4da1a7..0000000
--- a/src/main/resources/test_lwq.js
+++ /dev/null
@@ -1,2180 +0,0 @@
-/*
-京东资产变动通知脚本:https://jdsharedresourcescdn.azureedge.net/jdresource/jd_bean_change.js
-Modified time: 2021-05-17 15:25:41
-统计昨日京豆的变化情况,包括收入,支出,以及显示当前京豆数量,目前小问题:下单使用京豆后,退款重新购买,计算统计会出现异常
-统计红包以及过期红包
-网页查看地址 : https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean
-支持京东双账号
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-============QuantumultX==============
-[task_local]
-#京东资产变动通知
-2 9 * * * https://jdsharedresourcescdn.azureedge.net/jdresource/jd_bean_change.js, tag=京东资产变动通知, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
-================Loon===============
-[Script]
-cron "2 9 * * *" script-path=https://jdsharedresourcescdn.azureedge.net/jdresource/jd_bean_change.js, tag=京东资产变动通知
-=============Surge===========
-[Script]
-京东资产变动通知 = type=cron,cronexp="2 9 * * *",wake-system=1,timeout=3600,script-path=https://jdsharedresourcescdn.azureedge.net/jdresource/jd_bean_change.js
-============小火箭=========
-京东资产变动通知 = type=cron,script-path=https://jdsharedresourcescdn.azureedge.net/jdresource/jd_bean_change.js, cronexpr="2 9 * * *", timeout=3600, enable=true
- */
-let roleMap = {
- "好吧好吧5577":"wq_好吧好吧5577",
- "jd_qapvwBDaRqgW":"wgh_19970291531",
- "18070420956_p":"刘吴奇",
-}
-let dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=d2b6042cb38f0df63e20797c002208d2710104750c18a1dc84d54106a859a3f0"
-const $ = new Env('京东资产变动通知');
-let jdFruitShareArr = [], isBox = false, notify, newShareCodes;
-//助力好友分享码(最多4个,否则后面的助力失败),原因:动动农场每人每天只有四次助力机会
-//此此内容是IOS用户下载脚本到本地使用,填写互助码的地方,同一动动账号的好友互助码请使用@符号隔开。
-//下面给出两个账号的填写示例(iOS只支持2个动动账号)
-let shareCodes =
- [ // 这个列表填入你要助力的好友的shareCode
-]
-let subTitle = '', option = {}, isFruitFinished = false;
-const retainWater = 100;//保留水滴大于多少g,默认100g;
-let jdNotify = false;//是否关闭通知,false打开通知推送,true关闭通知推送
-let jdFruitBeanCard = false;//农场使用水滴换豆卡(如果出现限时活动时100g水换20豆,此时比浇水划算,推荐换豆),true表示换豆(不浇水),false表示不换豆(继续浇水),脚本默认是浇水
-let randomCount = $.isNode() ? 0 : 0;
-const JD_API_HOST = 'https://api.m.jd.com/client.action';
-const urlSchema = `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/3KSjXqQabiTuD1cJ28QskrpWoBKT/index.html%22%20%7D`;
-
-let allMessage = '';
-let message = "";
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-!(async () => {
- await requireConfig();
- message += "[通知] 资产变动 \n\n --- \n\n"
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
- return;
- }
- let count = 0
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
- $.index = i + 1;
- $.beanCount = 0;
- $.incomeBean = 0;
- $.expenseBean = 0;
- $.todayIncomeBean = 0;
- $.errorMsg = '';
- $.isLogin = true;
- $.nickName = '';
- $.balance = 0;
- $.expiredBalance = 0;
-
- username = $.UserName
- if (roleMap[username] == undefined){
- continue
- }
- username = roleMap[username]
-
- await TotalBean();
- //加上名称
- message = message + "【羊毛姐妹】" + username + `( ${$.nickName} )`+ " \n\n "
-
- console.log(`\n********开始【京东账号${$.index}】${$.nickName || $.UserName}******\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- }
- continue
- }
- await bean();
- await showMsg();
- await shareCodesFormat();
- await jdFruit();
- await jdWish()
- }
- message += "----\n\n"
- if( (count+1)%4 ==0 || i == cookiesArr.length -1 ){
- message = message + getPic()
- postToDingTalk(message)
- message = ""
- }
- count ++
- }
-
- if ($.isNode() && allMessage) {
- await notify.sendNotify(`${$.name}`, `${allMessage}`, { url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean` })
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- if (message != ""){
- postToDingTalk(message)
-
- }
- $.done();
- })
-
-
- function requireConfig() {
- return new Promise(resolve => {
- that.log('开始获取配置文件\n')
- notify = $.isNode() ? require('./sendNotify') : '';
- //Node.js用户请在jdCookie.js处填写动动ck;
- const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
- const jdFruitShareCodes = $.isNode() ? require('./jdFruitShareCodes.js') : '';
- //IOS等用户直接用NobyDa的jd cookie
- if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- if (jdCookieNode[item]) {
- cookiesArr.push(jdCookieNode[item])
- }
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') that.log = () => {};
- } else {
- let cookiesData = $.getdata('CookiesJD') || "[]";
- cookiesData = jsonParse(cookiesData);
- cookiesArr = cookiesData.map(item => item.cookie);
- cookiesArr.reverse();
- cookiesArr.push(...[$.getdata('CookieJD2'), $.getdata('CookieJD')]);
- cookiesArr.reverse();
- cookiesArr = cookiesArr.filter(item => item !== "" && item !== null && item !== undefined);
- }
- that.log(`共${cookiesArr.length}个动动账号\n`)
- resolve()
- })
- }
-
-async function showMsg() {
- // if ($.errorMsg) return
- allMessage += `账号${$.index}:${$.nickName || $.UserName}\n今日收入:${$.todayIncomeBean}京豆 🐶\n昨日收入:${$.incomeBean}京豆 🐶\n昨日支出:${$.expenseBean}京豆 🐶\n当前京豆:${$.beanCount}(今日将过期${$.expirejingdou})京豆 🐶${$.message}${$.index !== cookiesArr.length ? '\n\n' : ''}`;
- message += "" + `【总京豆】:${$.beanCount}( 今日将过期${$.expirejingdou} )京豆 🐶` +"\n\n"
- message += "" + `【今日收入】:${$.todayIncomeBean}京豆 🐶` +"\n\n"
- message += "" + `【昨日收入】:${$.incomeBean}京豆 🐶` +"\n\n"
- message += "" + `【昨日支出】:${$.expenseBean}京豆 🐶` +"\n\n"
-
-
-
- message += "" + `【当前总红包】:${$.balance}( 今日总过期${$.expiredBalance} )元 🧧` +"\n\n"
- message += "" + `【京喜红包】:${$.jxRed}( 今日将过期${$.jxRedExpire.toFixed(2)} )元 🧧` +"\n\n"
- message += "" + `【极速红包】:${$.jsRed}( 今日将过期${$.jsRedExpire.toFixed(2)} )元 🧧` +"\n\n"
- message += "" + `【京东红包】:${$.jdRed}( 今日将过期${$.jdRedExpire.toFixed(2)} )元 🧧` +"\n\n"
- message += "" + `【健康红包】:${$.jdhRed}( 今日将过期${$.jdhRedExpire.toFixed(2)} )元 🧧` +"\n\n"
- // if ($.isNode()) {
- // await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `账号${$.index}:${$.nickName || $.UserName}\n昨日收入:${$.incomeBean}京豆 🐶\n昨日支出:${$.expenseBean}京豆 🐶\n当前京豆:${$.beanCount}京豆 🐶${$.message}`, { url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean` })
- // }
- $.msg($.name, '', `账号${$.index}:${$.nickName || $.UserName}\n今日收入:${$.todayIncomeBean}京豆 🐶\n昨日收入:${$.incomeBean}京豆 🐶\n昨日支出:${$.expenseBean}京豆 🐶\n当前京豆:${$.beanCount}(今日将过期${$.expirejingdou})京豆🐶${$.message}`, {"open-url": "https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean"});
-}
-
-async function bean() {
- // console.log(`北京时间零点时间戳:${parseInt((Date.now() + 28800000) / 86400000) * 86400000 - 28800000}`);
- // console.log(`北京时间2020-10-28 06:16:05::${new Date("2020/10/28 06:16:05+08:00").getTime()}`)
- // 不管哪个时区。得到都是当前时刻北京时间的时间戳 new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000
-
- //前一天的0:0:0时间戳
- const tm = parseInt((Date.now() + 28800000) / 86400000) * 86400000 - 28800000 - (24 * 60 * 60 * 1000);
- // 今天0:0:0时间戳
- const tm1 = parseInt((Date.now() + 28800000) / 86400000) * 86400000 - 28800000;
- let page = 1, t = 0, yesterdayArr = [], todayArr = [];
- do {
- let response = await getJingBeanBalanceDetail(page);
- // console.log(`第${page}页: ${JSON.stringify(response)}`);
- if (response && response.code === "0") {
- page++;
- let detailList = response.detailList;
- if (detailList && detailList.length > 0) {
- for (let item of detailList) {
- const date = item.date.replace(/-/g, '/') + "+08:00";
- if (new Date(date).getTime() >= tm1 && (!item['eventMassage'].includes("退还") && !item['eventMassage'].includes('扣赠'))) {
- todayArr.push(item);
- } else if (tm <= new Date(date).getTime() && new Date(date).getTime() < tm1 && (!item['eventMassage'].includes("退还") && !item['eventMassage'].includes('扣赠'))) {
- //昨日的
- yesterdayArr.push(item);
- } else if (tm > new Date(date).getTime()) {
- //前天的
- t = 1;
- break;
- }
- }
- } else {
- $.errorMsg = `数据异常`;
- $.msg($.name, ``, `账号${$.index}:${$.nickName}\n${$.errorMsg}`);
- t = 1;
- }
- } else if (response && response.code === "3") {
- console.log(`cookie已过期,或者填写不规范,跳出`)
- t = 1;
- } else {
- console.log(`未知情况:${JSON.stringify(response)}`);
- console.log(`未知情况,跳出`)
- t = 1;
- }
- } while (t === 0);
- for (let item of yesterdayArr) {
- if (Number(item.amount) > 0) {
- $.incomeBean += Number(item.amount);
- } else if (Number(item.amount) < 0) {
- $.expenseBean += Number(item.amount);
- }
- }
- for (let item of todayArr) {
- if (Number(item.amount) > 0) {
- $.todayIncomeBean += Number(item.amount);
- }
- }
- await queryexpirejingdou();//过期京豆
- await redPacket();//过期红包
- // console.log(`昨日收入:${$.incomeBean}个京豆 🐶`);
- // console.log(`昨日支出:${$.expenseBean}个京豆 🐶`)
-}
-function TotalBean() {
- return new Promise(async resolve => {
- const options = {
- url: "https://me-api.jd.com/user_new/info/GetJDUserInfoUnion",
- headers: {
- Host: "me-api.jd.com",
- Accept: "*/*",
- Connection: "keep-alive",
- Cookie: cookie,
- "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"),
- "Accept-Language": "zh-cn",
- "Referer": "https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&",
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- $.logErr(err)
- } else {
- if (data) {
- data = JSON.parse(data);
- if (data['retcode'] === "1001") {
- $.isLogin = false; //cookie过期
- return;
- }
- if (data['retcode'] === "0" && data.data && data.data.hasOwnProperty("userInfo")) {
- $.nickName = data.data.userInfo.baseInfo.nickname;
- }
- if (data['retcode'] === '0' && data.data && data.data['assetInfo']) {
- $.beanCount = data.data && data.data['assetInfo']['beanNum'];
- }
- } else {
- $.log('京东服务器返回空数据');
- }
- }
- } catch (e) {
- $.logErr(e)
- } finally {
- resolve();
- }
- })
- })
-}
-function getJingBeanBalanceDetail(page) {
- return new Promise(async resolve => {
- const options = {
- "url": `https://api.m.jd.com/client.action?functionId=getJingBeanBalanceDetail`,
- "body": `body=${escape(JSON.stringify({"pageSize": "20", "page": page.toString()}))}&appid=ld`,
- "headers": {
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (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"),
- 'Host': 'api.m.jd.com',
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Cookie': cookie,
- }
- }
- $.post(options, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- data = JSON.parse(data);
- // console.log(data)
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function queryexpirejingdou() {
- return new Promise(async resolve => {
- const options = {
- "url": `https://wq.jd.com/activep3/singjd/queryexpirejingdou?_=${Date.now()}&g_login_type=1&sceneval=2`,
- "headers": {
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-cn",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "Host": "wq.jd.com",
- "Referer": "https://wqs.jd.com/promote/201801/bean/mybean.html",
- "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.1 Mobile/15E148 Safari/604.1"
- }
- }
- $.expirejingdou = 0;
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- // console.log(data)
- data = JSON.parse(data.slice(23, -13));
- // console.log(data)
- if (data.ret === 0) {
- data['expirejingdou'].map(item => {
- console.log(`${timeFormat(item['time'] * 1000)}日过期京豆:${item['expireamount']}\n`);
- })
- $.expirejingdou = data['expirejingdou'][0]['expireamount'];
- // if ($.expirejingdou > 0) {
- // $.message += `\n今日将过期:${$.expirejingdou}京豆 🐶`;
- // }
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function redPacket() {
- return new Promise(async resolve => {
- const options = {
- "url": `https://m.jingxi.com/user/info/QueryUserRedEnvelopesV2?type=1&orgFlag=JD_PinGou_New&page=1&cashRedType=1&redBalanceFlag=1&channel=1&_=${+new Date()}&sceneval=2&g_login_type=1&g_ty=ls`,
- "headers": {
- 'Host': 'm.jingxi.com',
- 'Accept': '*/*',
- 'Connection': 'keep-alive',
- 'Accept-Language': 'zh-cn',
- 'Referer': 'https://st.jingxi.com/my/redpacket.shtml?newPg=App&jxsid=16156262265849285961',
- 'Accept-Encoding': 'gzip, deflate, br',
- "Cookie": cookie,
- '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")
- }
- }
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- data = JSON.parse(data).data
- $.jxRed = 0, $.jsRed = 0, $.jdRed = 0, $.jdhRed = 0, $.jxRedExpire = 0, $.jsRedExpire = 0, $.jdRedExpire = 0, $.jdhRedExpire = 0;
- let t = new Date()
- t.setDate(t.getDate() + 1)
- t.setHours(0, 0, 0, 0)
- t = parseInt((t - 1) / 1000)
- for (let vo of data.useRedInfo.redList || []) {
- if (vo.orgLimitStr && vo.orgLimitStr.includes("京喜")) {
- $.jxRed += parseFloat(vo.balance)
- if (vo['endTime'] === t) {
- $.jxRedExpire += parseFloat(vo.balance)
- }
- } else if (vo.activityName.includes("极速版")) {
- $.jsRed += parseFloat(vo.balance)
- if (vo['endTime'] === t) {
- $.jsRedExpire += parseFloat(vo.balance)
- }
- } else if (vo.orgLimitStr && vo.orgLimitStr.includes("京东健康")) {
- $.jdhRed += parseFloat(vo.balance)
- if (vo['endTime'] === t) {
- $.jdhRedExpire += parseFloat(vo.balance)
- }
- } else {
- $.jdRed += parseFloat(vo.balance)
- if (vo['endTime'] === t) {
- $.jdRedExpire += parseFloat(vo.balance)
- }
- }
- }
- $.jxRed = $.jxRed.toFixed(2)
- $.jsRed = $.jsRed.toFixed(2)
- $.jdRed = $.jdRed.toFixed(2)
- $.jdhRed = $.jdhRed.toFixed(2)
- $.balance = data.balance
- $.expiredBalance = ($.jxRedExpire + $.jsRedExpire + $.jdRedExpire).toFixed(2)
- $.message += `\n当前总红包:${$.balance}(今日总过期${$.expiredBalance})元 🧧\n京喜红包:${$.jxRed}(今日将过期${$.jxRedExpire.toFixed(2)})元 🧧\n极速红包:${$.jsRed}(今日将过期${$.jsRedExpire.toFixed(2)})元 🧧\n京东红包:${$.jdRed}(今日将过期${$.jdRedExpire.toFixed(2)})元 🧧\n健康红包:${$.jdhRed}(今日将过期${$.jdhRedExpire.toFixed(2)})元 🧧`;
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function jsonParse(str) {
- if (typeof str == "string") {
- try {
- return JSON.parse(str);
- } catch (e) {
- console.log(e);
- $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
- return [];
- }
- }
-}
-function timeFormat(time) {
- let date;
- if (time) {
- date = new Date(time)
- } else {
- date = new Date();
- }
- return date.getFullYear() + '-' + ((date.getMonth() + 1) >= 10 ? (date.getMonth() + 1) : '0' + (date.getMonth() + 1)) + '-' + (date.getDate() >= 10 ? date.getDate() : '0' + date.getDate());
-}
-// prettier-ignore
-function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,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)}
-
-//农场代码
-
-async function jdFruit() {
- subTitle = `【动动账号${$.index}】${$.nickName}`;
- try {
- await initForFarm();
- if ($.farmInfo.farmUserPro) {
- // option['media-url'] = $.farmInfo.farmUserPro.goodsImage;
- message = message + "【水果名称】 " + `${$.farmInfo.farmUserPro.name}` + "\n\n";
- // message += "【已兑换水果】" + `${$.farmInfo.farmUserPro.winTimes}` + "次\n\n";
- that.log(`\n【动动账号${$.index}(${$.nickName || $.UserName})的${$.name}好友互助码】${$.farmInfo.farmUserPro.shareCode}\n`);
- that.log(`\n【已成功兑换水果】${$.farmInfo.farmUserPro.winTimes}次\n`);
- await getHelp();
- await masterHelpShare();//助力好友
- await setHelp();
- if ($.farmInfo.treeState === 2 || $.farmInfo.treeState === 3) {
- option['open-url'] = urlSchema;
- message = message + " " + $.UserName + "\n【提醒⏰】" + fruitName + "已可领取\n请去动动APP或微信小程序查看\n点击弹窗即达"
- $.msg($.name, ``, `【动动账号${$.index}】${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去动动APP或微信小程序查看\n点击弹窗即达`, option);
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}水果已可领取`, `【动动账号${$.index}】${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去动动APP或微信小程序查看`);
- }
- return
- } else if ($.farmInfo.treeState === 1) {
- that.log(`\n${$.farmInfo.farmUserPro.name}种植中...\n`)
- } else if ($.farmInfo.treeState === 0) {
- //已下单购买, 但未开始种植新的水果
- option['open-url'] = urlSchema;
- $.msg($.name, ``, `【动动账号${$.index}】 ${$.nickName || $.UserName}\n【提醒⏰】您忘了种植新的水果\n请去动动APP或微信小程序选购并种植新的水果\n点击弹窗即达`, option);
- message = message + " " + $.UserName + " \n【提醒⏰】您忘了种植新的水果\n请去动动APP或微信小程序选购并种植新的水果\n点击弹窗即达" + ""
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 您忘了种植新的水果`, `动动账号${$.index} ${$.nickName}\n【提醒⏰】您忘了种植新的水果\n请去动动APP或微信小程序选购并种植新的水果`);
- }
- return
- }
- await doDailyTask();
- await doTenWater();//浇水十次
- await getFirstWaterAward();//领取首次浇水奖励
- await getTenWaterAward();//领取10浇水奖励
- await getWaterFriendGotAward();//领取为2好友浇水奖励
- await duck();
- await doTenWaterAgain();//再次浇水
- await predictionFruit();//预测水果成熟时间
- } else {
- that.log(`初始化农场数据异常, 请登录动动 app查看农场0元水果功能是否正常,农场初始化数据: ${JSON.stringify($.farmInfo)}`);
- }
- } catch (e) {
- that.log(`任务执行异常,请检查执行日志 ‼️‼️`);
- $.logErr(e);
- }
- }
- async function doDailyTask() {
- await taskInitForFarm();
- that.log(`开始签到`);
- if (!$.farmTask.signInit.todaySigned) {
- await signForFarm(); //签到
- if ($.signResult.code === "0") {
- that.log(`【签到成功】获得${$.signResult.amount}g💧\\n`)
- //message += `【签到成功】获得${$.signResult.amount}g💧\n`//连续签到${signResult.signDay}天
- } else {
- // message += `签到失败,详询日志\n`;
- that.log(`签到结果: ${JSON.stringify($.signResult)}`);
- }
- } else {
- that.log(`今天已签到,连续签到${$.farmTask.signInit.totalSigned},下次签到可得${$.farmTask.signInit.signEnergyEachAmount}g\n`);
- }
- // 被水滴砸中
- that.log(`被水滴砸中: ${$.farmInfo.todayGotWaterGoalTask.canPop ? '是' : '否'}`);
- if ($.farmInfo.todayGotWaterGoalTask.canPop) {
- await gotWaterGoalTaskForFarm();
- if ($.goalResult.code === '0') {
- that.log(`【被水滴砸中】获得${$.goalResult.addEnergy}g💧\\n`);
- // message += `【被水滴砸中】获得${$.goalResult.addEnergy}g💧\n`
- }
- }
- that.log(`签到结束,开始广告浏览任务`);
- if (!$.farmTask.gotBrowseTaskAdInit.f) {
- let adverts = $.farmTask.gotBrowseTaskAdInit.userBrowseTaskAds
- let browseReward = 0
- let browseSuccess = 0
- let browseFail = 0
- for (let advert of adverts) { //开始浏览广告
- if (advert.limit <= advert.hadFinishedTimes) {
- // browseReward+=advert.reward
- that.log(`${advert.mainTitle}+ ' 已完成`);//,获得${advert.reward}g
- continue;
- }
- that.log('正在进行广告浏览任务: ' + advert.mainTitle);
- await browseAdTaskForFarm(advert.advertId, 0);
- if ($.browseResult.code === '0') {
- that.log(`${advert.mainTitle}浏览任务完成`);
- //领取奖励
- await browseAdTaskForFarm(advert.advertId, 1);
- if ($.browseRwardResult.code === '0') {
- that.log(`领取浏览${advert.mainTitle}广告奖励成功,获得${$.browseRwardResult.amount}g`)
- browseReward += $.browseRwardResult.amount
- browseSuccess++
- } else {
- browseFail++
- that.log(`领取浏览广告奖励结果: ${JSON.stringify($.browseRwardResult)}`)
- }
- } else {
- browseFail++
- that.log(`广告浏览任务结果: ${JSON.stringify($.browseResult)}`);
- }
- }
- if (browseFail > 0) {
- that.log(`【广告浏览】完成${browseSuccess}个,失败${browseFail},获得${browseReward}g💧\\n`);
- // message += `【广告浏览】完成${browseSuccess}个,失败${browseFail},获得${browseReward}g💧\n`;
- } else {
- that.log(`【广告浏览】完成${browseSuccess}个,获得${browseReward}g💧\n`);
- // message += `【广告浏览】完成${browseSuccess}个,获得${browseReward}g💧\n`;
- }
- } else {
- that.log(`今天已经做过浏览广告任务\n`);
- }
- //定时领水
- if (!$.farmTask.gotThreeMealInit.f) {
- //
- await gotThreeMealForFarm();
- if ($.threeMeal.code === "0") {
- that.log(`【定时领水】获得${$.threeMeal.amount}g💧\n`);
- // message += `【定时领水】获得${$.threeMeal.amount}g💧\n`;
- } else {
- // message += `【定时领水】失败,详询日志\n`;
- that.log(`定时领水成功结果: ${JSON.stringify($.threeMeal)}`);
- }
- } else {
- that.log('当前不在定时领水时间断或者已经领过\n')
- }
- //给好友浇水
- if (!$.farmTask.waterFriendTaskInit.f) {
- if ($.farmTask.waterFriendTaskInit.waterFriendCountKey < $.farmTask.waterFriendTaskInit.waterFriendMax) {
- await doFriendsWater();
- }
- } else {
- that.log(`给${$.farmTask.waterFriendTaskInit.waterFriendMax}个好友浇水任务已完成\n`)
- }
- // await Promise.all([
- // clockInIn(),//打卡领水
- // executeWaterRains(),//水滴雨
- // masterHelpShare(),//助力好友
- // getExtraAward(),//领取额外水滴奖励
- // turntableFarm()//天天抽奖得好礼
- // ])
- // await getAwardInviteFriend();
- await clockInIn();//打卡领水
- await executeWaterRains();//水滴雨
- await getExtraAward();//领取额外水滴奖励
- await turntableFarm()//天天抽奖得好礼
- }
- async function predictionFruit() {
- that.log('开始预测水果成熟时间\n');
- await initForFarm();
- await taskInitForFarm();
- let waterEveryDayT = $.farmTask.totalWaterTaskInit.totalWaterTaskTimes;//今天到到目前为止,浇了多少次水
- // message += "【今日共浇水】" + `${waterEveryDayT}` + "次 \n\n"
- message += "【剩余 水滴】" + `${$.farmInfo.farmUserPro.totalEnergy}` + "g💧 \n\n"
- message += "【水果🍉进度】" + `${(($.farmInfo.farmUserPro.treeEnergy /
- $.farmInfo.farmUserPro.treeTotalEnergy) * 100).toFixed(2)}` + "%,已浇水" +`${$.farmInfo.farmUserPro.treeEnergy / 10}` + "次,还需"+`${($.farmInfo.farmUserPro.treeTotalEnergy - $.farmInfo.farmUserPro.treeEnergy) / 10}` +"次 \n\n"
- if ($.farmInfo.toFlowTimes > ($.farmInfo.farmUserPro.treeEnergy / 10)) {
- message += "【水果🍉进度】" + `【开花进度】再浇水${$.farmInfo.toFlowTimes - $.farmInfo.farmUserPro.treeEnergy / 10}次开花\n\n` +"\n\n"
- } else if ($.farmInfo.toFruitTimes > ($.farmInfo.farmUserPro.treeEnergy / 10)) {
- message += "【水果🍉进度】" + `【结果进度】再浇水${$.farmInfo.toFruitTimes - $.farmInfo.farmUserPro.treeEnergy / 10}次结果\n\n` + "\n\n"
- }
- // 预测n天后水果课可兑换功能
- let waterTotalT = ($.farmInfo.farmUserPro.treeTotalEnergy - $.farmInfo.farmUserPro.treeEnergy - $.farmInfo.farmUserPro.totalEnergy) / 10;//一共还需浇多少次水
-
- let waterD = Math.ceil(waterTotalT / waterEveryDayT);
-
- message = message + "" + `【预测🍉收获时间】${waterD === 1 ? '明天' : waterD === 2 ? '后天' : waterD + '天之后'}(${timeFormat(24 * 60 * 60 * 1000 * waterD + Date.now())}日)可兑换水果🍉` +"\n\n";
- }
- //浇水十次
- async function doTenWater() {
- jdFruitBeanCard = $.getdata('jdFruitBeanCard') ? $.getdata('jdFruitBeanCard') : jdFruitBeanCard;
- if ($.isNode() && process.env.FRUIT_BEAN_CARD) {
- jdFruitBeanCard = process.env.FRUIT_BEAN_CARD;
- }
- await myCardInfoForFarm();
- const { fastCard, doubleCard, beanCard, signCard } = $.myCardInfoRes;
- if (`${jdFruitBeanCard}` === 'true' && JSON.stringify($.myCardInfoRes).match(`限时翻倍`) && beanCard > 0) {
- that.log(`您设置的是使用水滴换豆卡,且背包有水滴换豆卡${beanCard}张, 跳过10次浇水任务`)
- return
- }
- if ($.farmTask.totalWaterTaskInit.totalWaterTaskTimes < $.farmTask.totalWaterTaskInit.totalWaterTaskLimit) {
- that.log(`\n准备浇水十次`);
- let waterCount = 0;
- isFruitFinished = false;
- for (; waterCount < $.farmTask.totalWaterTaskInit.totalWaterTaskLimit - $.farmTask.totalWaterTaskInit.totalWaterTaskTimes; waterCount++) {
- that.log(`第${waterCount + 1}次浇水`);
- await waterGoodForFarm();
- that.log(`本次浇水结果: ${JSON.stringify($.waterResult)}`);
- if ($.waterResult.code === '0') {
- that.log(`剩余水滴${$.waterResult.totalEnergy}g`);
- if ($.waterResult.finished) {
- // 已证实,waterResult.finished为true,表示水果可以去领取兑换了
- isFruitFinished = true;
- break
- } else {
- if ($.waterResult.totalEnergy < 10) {
- that.log(`水滴不够,结束浇水`)
- break
- }
- await gotStageAward();//领取阶段性水滴奖励
- }
- } else {
- that.log('浇水出现失败异常,跳出不在继续浇水')
- break;
- }
- }
- if (isFruitFinished) {
- option['open-url'] = urlSchema;
- $.msg($.name, ``, `【动动账号${$.index}】${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去动动APP或微信小程序查看\n点击弹窗即达`, option);
- $.done();
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}水果已可领取`, `动动账号${$.index} ${$.nickName}\n${$.farmInfo.farmUserPro.name}已可领取`);
- }
- }
- } else {
- that.log('\n今日已完成10次浇水任务\n');
- }
- }
- //领取首次浇水奖励
- async function getFirstWaterAward() {
- await taskInitForFarm();
- //领取首次浇水奖励
- if (!$.farmTask.firstWaterInit.f && $.farmTask.firstWaterInit.totalWaterTimes > 0) {
- await firstWaterTaskForFarm();
- if ($.firstWaterReward.code === '0') {
- that.log(`【首次浇水奖励】获得${$.firstWaterReward.amount}g💧\n`);
- // message += `【首次浇水奖励】获得${$.firstWaterReward.amount}g💧\n`;
- } else {
- // message += '【首次浇水奖励】领取奖励失败,详询日志\n';
- that.log(`领取首次浇水奖励结果: ${JSON.stringify($.firstWaterReward)}`);
- }
- } else {
- that.log('首次浇水奖励已领取\n')
- }
- }
- //领取十次浇水奖励
- async function getTenWaterAward() {
- //领取10次浇水奖励
- if (!$.farmTask.totalWaterTaskInit.f && $.farmTask.totalWaterTaskInit.totalWaterTaskTimes >= $.farmTask.totalWaterTaskInit.totalWaterTaskLimit) {
- await totalWaterTaskForFarm();
- if ($.totalWaterReward.code === '0') {
- that.log(`【十次浇水奖励】获得${$.totalWaterReward.totalWaterTaskEnergy}g💧\n`);
- // message += `【十次浇水奖励】获得${$.totalWaterReward.totalWaterTaskEnergy}g💧\n`;
- } else {
- // message += '【十次浇水奖励】领取奖励失败,详询日志\n';
- that.log(`领取10次浇水奖励结果: ${JSON.stringify($.totalWaterReward)}`);
- }
- } else if ($.farmTask.totalWaterTaskInit.totalWaterTaskTimes < $.farmTask.totalWaterTaskInit.totalWaterTaskLimit) {
- // message += `【十次浇水奖励】任务未完成,今日浇水${$.farmTask.totalWaterTaskInit.totalWaterTaskTimes}次\n`;
- that.log(`【十次浇水奖励】任务未完成,今日浇水${$.farmTask.totalWaterTaskInit.totalWaterTaskTimes}次\n`);
- }
- that.log('finished 水果任务完成!');
- }
- //再次浇水
- async function doTenWaterAgain() {
- that.log('开始检查剩余水滴能否再次浇水再次浇水\n');
- await initForFarm();
- let totalEnergy = $.farmInfo.farmUserPro.totalEnergy;
- that.log(`剩余水滴${totalEnergy}g\n`);
- await myCardInfoForFarm();
- const { fastCard, doubleCard, beanCard, signCard } = $.myCardInfoRes;
- that.log(`背包已有道具:\n快速浇水卡:${fastCard === -1 ? '未解锁': fastCard + '张'}\n水滴翻倍卡:${doubleCard === -1 ? '未解锁': doubleCard + '张'}\n水滴换京豆卡:${beanCard === -1 ? '未解锁' : beanCard + '张'}\n加签卡:${signCard === -1 ? '未解锁' : signCard + '张'}\n`)
- if (totalEnergy >= 100 && doubleCard > 0) {
- //使用翻倍水滴卡
- for (let i = 0; i < new Array(doubleCard).fill('').length; i++) {
- await userMyCardForFarm('doubleCard');
- that.log(`使用翻倍水滴卡结果:${JSON.stringify($.userMyCardRes)}`);
- }
- await initForFarm();
- totalEnergy = $.farmInfo.farmUserPro.totalEnergy;
- }
- if (signCard > 0) {
- //使用加签卡
- for (let i = 0; i < new Array(signCard).fill('').length; i++) {
- await userMyCardForFarm('signCard');
- that.log(`使用加签卡结果:${JSON.stringify($.userMyCardRes)}`);
- }
- await initForFarm();
- totalEnergy = $.farmInfo.farmUserPro.totalEnergy;
- }
- jdFruitBeanCard = $.getdata('jdFruitBeanCard') ? $.getdata('jdFruitBeanCard') : jdFruitBeanCard;
- if ($.isNode() && process.env.FRUIT_BEAN_CARD) {
- jdFruitBeanCard = process.env.FRUIT_BEAN_CARD;
- }
- if (`${jdFruitBeanCard}` === 'true' && JSON.stringify($.myCardInfoRes).match('限时翻倍')) {
- that.log(`\n您设置的是水滴换豆功能,现在为您换豆`);
- if (totalEnergy >= 100 && $.myCardInfoRes.beanCard > 0) {
- //使用水滴换豆卡
- await userMyCardForFarm('beanCard');
- that.log(`使用水滴换豆卡结果:${JSON.stringify($.userMyCardRes)}`);
- if ($.userMyCardRes.code === '0') {
- // message +="【水果🍉进度】" + `【水滴换豆卡】获得${$.userMyCardRes.beanCount}个京豆\n` + "\n\n";
- return
- }
- } else {
- that.log(`您目前水滴:${totalEnergy}g,水滴换豆卡${$.myCardInfoRes.beanCard}张,暂不满足水滴换豆的条件,为您继续浇水`)
- }
- }
- // if (totalEnergy > 100 && $.myCardInfoRes.fastCard > 0) {
- // //使用快速浇水卡
- // await userMyCardForFarm('fastCard');
- // that.log(`使用快速浇水卡结果:${JSON.stringify($.userMyCardRes)}`);
- // if ($.userMyCardRes.code === '0') {
- // that.log(`已使用快速浇水卡浇水${$.userMyCardRes.waterEnergy}g`);
- // }
- // await initForFarm();
- // totalEnergy = $.farmInfo.farmUserPro.totalEnergy;
- // }
- // 所有的浇水(10次浇水)任务,获取水滴任务完成后,如果剩余水滴大于等于60g,则继续浇水(保留部分水滴是用于完成第二天的浇水10次的任务)
- let overageEnergy = totalEnergy - retainWater;
- if (totalEnergy >= ($.farmInfo.farmUserPro.treeTotalEnergy - $.farmInfo.farmUserPro.treeEnergy)) {
- //如果现有的水滴,大于水果可兑换所需的对滴(也就是把水滴浇完,水果就能兑换了)
- isFruitFinished = false;
- for (let i = 0; i < ($.farmInfo.farmUserPro.treeTotalEnergy - $.farmInfo.farmUserPro.treeEnergy) / 10; i++) {
- await waterGoodForFarm();
- that.log(`本次浇水结果(水果马上就可兑换了): ${JSON.stringify($.waterResult)}`);
- if ($.waterResult.code === '0') {
- that.log('\n浇水10g成功\n');
- if ($.waterResult.finished) {
- // 已证实,waterResult.finished为true,表示水果可以去领取兑换了
- isFruitFinished = true;
- break
- } else {
- that.log(`目前水滴【${$.waterResult.totalEnergy}】g,继续浇水,水果马上就可以兑换了`)
- }
- } else {
- that.log('浇水出现失败异常,跳出不在继续浇水')
- break;
- }
- }
- if (isFruitFinished) {
- option['open-url'] = urlSchema;
- $.msg($.name, ``, `【动动账号${$.index}】${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去动动APP或微信小程序查看\n点击弹窗即达`, option);
- $.done();
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}水果已可领取`, `动动账号${$.index} ${$.nickName}\n${$.farmInfo.farmUserPro.name}已可领取`);
- }
- }
- } else if (overageEnergy >= 10) {
- that.log("目前剩余水滴:【" + totalEnergy + "】g,可继续浇水");
- isFruitFinished = false;
- for (let i = 0; i < parseInt(overageEnergy / 10); i++) {
- await waterGoodForFarm();
- that.log(`本次浇水结果: ${JSON.stringify($.waterResult)}`);
- if ($.waterResult.code === '0') {
- that.log(`\n浇水10g成功,剩余${$.waterResult.totalEnergy}\n`)
- if ($.waterResult.finished) {
- // 已证实,waterResult.finished为true,表示水果可以去领取兑换了
- isFruitFinished = true;
- break
- } else {
- await gotStageAward()
- }
- } else {
- that.log('浇水出现失败异常,跳出不在继续浇水')
- break;
- }
- }
- if (isFruitFinished) {
- option['open-url'] = urlSchema;
- $.msg($.name, ``, `【动动账号${$.index}】${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去动动APP或微信小程序查看\n点击弹窗即达`, option);
- $.done();
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}水果已可领取`, `动动账号${$.index} ${$.nickName}\n${$.farmInfo.farmUserPro.name}已可领取`);
- }
- }
- } else {
- that.log("目前剩余水滴:【" + totalEnergy + "】g,不再继续浇水,保留部分水滴用于完成第二天【十次浇水得水滴】任务")
- }
- }
- //领取阶段性水滴奖励
- function gotStageAward() {
- return new Promise(async resolve => {
- if ($.waterResult.waterStatus === 0 && $.waterResult.treeEnergy === 10) {
- that.log('果树发芽了,奖励30g水滴');
- await gotStageAwardForFarm('1');
- that.log(`浇水阶段奖励1领取结果 ${JSON.stringify($.gotStageAwardForFarmRes)}`);
- if ($.gotStageAwardForFarmRes.code === '0') {
- // message += `【果树发芽了】奖励${$.gotStageAwardForFarmRes.addEnergy}\n`;
- that.log(`【果树发芽了】奖励${$.gotStageAwardForFarmRes.addEnergy}\n`);
- }
- } else if ($.waterResult.waterStatus === 1) {
- that.log('果树开花了,奖励40g水滴');
- await gotStageAwardForFarm('2');
- that.log(`浇水阶段奖励2领取结果 ${JSON.stringify($.gotStageAwardForFarmRes)}`);
- if ($.gotStageAwardForFarmRes.code === '0') {
- // message += `【果树开花了】奖励${$.gotStageAwardForFarmRes.addEnergy}g💧\n`;
- that.log(`【果树开花了】奖励${$.gotStageAwardForFarmRes.addEnergy}g💧\n`);
- }
- } else if ($.waterResult.waterStatus === 2) {
- that.log('果树长出小果子啦, 奖励50g水滴');
- await gotStageAwardForFarm('3');
- that.log(`浇水阶段奖励3领取结果 ${JSON.stringify($.gotStageAwardForFarmRes)}`)
- if ($.gotStageAwardForFarmRes.code === '0') {
- // message += `【果树结果了】奖励${$.gotStageAwardForFarmRes.addEnergy}g💧\n`;
- that.log(`【果树结果了】奖励${$.gotStageAwardForFarmRes.addEnergy}g💧\n`);
- }
- }
- resolve()
- })
- }
- //天天抽奖活动
- async function turntableFarm() {
- await initForTurntableFarm();
- if ($.initForTurntableFarmRes.code === '0') {
- //领取定时奖励 //4小时一次
- let {timingIntervalHours, timingLastSysTime, sysTime, timingGotStatus, remainLotteryTimes, turntableInfos} = $.initForTurntableFarmRes;
-
- if (!timingGotStatus) {
- that.log(`是否到了领取免费赠送的抽奖机会----${sysTime > (timingLastSysTime + 60*60*timingIntervalHours*1000)}`)
- if (sysTime > (timingLastSysTime + 60*60*timingIntervalHours*1000)) {
- await timingAwardForTurntableFarm();
- that.log(`领取定时奖励结果${JSON.stringify($.timingAwardRes)}`);
- await initForTurntableFarm();
- remainLotteryTimes = $.initForTurntableFarmRes.remainLotteryTimes;
- } else {
- that.log(`免费赠送的抽奖机会未到时间`)
- }
- } else {
- that.log('4小时候免费赠送的抽奖机会已领取')
- }
- if ($.initForTurntableFarmRes.turntableBrowserAds && $.initForTurntableFarmRes.turntableBrowserAds.length > 0) {
- for (let index = 0; index < $.initForTurntableFarmRes.turntableBrowserAds.length; index++) {
- if (!$.initForTurntableFarmRes.turntableBrowserAds[index].status) {
- that.log(`开始浏览天天抽奖的第${index + 1}个逛会场任务`)
- await browserForTurntableFarm(1, $.initForTurntableFarmRes.turntableBrowserAds[index].adId);
- if ($.browserForTurntableFarmRes.code === '0' && $.browserForTurntableFarmRes.status) {
- that.log(`第${index + 1}个逛会场任务完成,开始领取水滴奖励\n`)
- await browserForTurntableFarm(2, $.initForTurntableFarmRes.turntableBrowserAds[index].adId);
- if ($.browserForTurntableFarmRes.code === '0') {
- that.log(`第${index + 1}个逛会场任务领取水滴奖励完成\n`)
- await initForTurntableFarm();
- remainLotteryTimes = $.initForTurntableFarmRes.remainLotteryTimes;
- }
- }
- } else {
- that.log(`浏览天天抽奖的第${index + 1}个逛会场任务已完成`)
- }
- }
- }
- //天天抽奖助力
- that.log('开始天天抽奖--好友助力--每人每天只有三次助力机会.')
- for (let code of newShareCodes) {
- if (code === $.farmInfo.farmUserPro.shareCode) {
- that.log('天天抽奖-不能自己给自己助力\n')
- continue
- }
- await lotteryMasterHelp(code);
- // that.log('天天抽奖助力结果',lotteryMasterHelpRes.helpResult)
- if ($.lotteryMasterHelpRes.helpResult.code === '0') {
- that.log(`天天抽奖-助力${$.lotteryMasterHelpRes.helpResult.masterUserInfo.nickName}成功\n`)
- } else if ($.lotteryMasterHelpRes.helpResult.code === '11') {
- that.log(`天天抽奖-不要重复助力${$.lotteryMasterHelpRes.helpResult.masterUserInfo.nickName}\n`)
- } else if ($.lotteryMasterHelpRes.helpResult.code === '13') {
- that.log(`天天抽奖-助力${$.lotteryMasterHelpRes.helpResult.masterUserInfo.nickName}失败,助力次数耗尽\n`);
- break;
- }
- }
- that.log(`---天天抽奖次数remainLotteryTimes----${remainLotteryTimes}次`)
- //抽奖
- if (remainLotteryTimes > 0) {
- that.log('开始抽奖')
- let lotteryResult = '';
- for (let i = 0; i < new Array(remainLotteryTimes).fill('').length; i++) {
- await lotteryForTurntableFarm()
- that.log(`第${i + 1}次抽奖结果${JSON.stringify($.lotteryRes)}`);
- if ($.lotteryRes.code === '0') {
- turntableInfos.map((item) => {
- if (item.type === $.lotteryRes.type) {
- that.log(`lotteryRes.type${$.lotteryRes.type}`);
- if ($.lotteryRes.type.match(/bean/g) && $.lotteryRes.type.match(/bean/g)[0] === 'bean') {
- lotteryResult += `${item.name}个,`;
- } else if ($.lotteryRes.type.match(/water/g) && $.lotteryRes.type.match(/water/g)[0] === 'water') {
- lotteryResult += `${item.name},`;
- } else {
- lotteryResult += `${item.name},`;
- }
- }
- })
- //没有次数了
- if ($.lotteryRes.remainLotteryTimes === 0) {
- break
- }
- }
- }
- if (lotteryResult) {
- that.log(`【天天抽奖】${lotteryResult.substr(0, lotteryResult.length - 1)}\n`)
- // message += `【天天抽奖】${lotteryResult.substr(0, lotteryResult.length - 1)}\n`;
- }
- } else {
- that.log('天天抽奖--抽奖机会为0次')
- }
- } else {
- that.log('初始化天天抽奖得好礼失败')
- }
- }
- //领取额外奖励水滴
- async function getExtraAward() {
- await masterHelpTaskInitForFarm();
- if ($.masterHelpResult.code === '0') {
- if ($.masterHelpResult.masterHelpPeoples && $.masterHelpResult.masterHelpPeoples.length >= 5) {
- // 已有五人助力。领取助力后的奖励
- if (!$.masterHelpResult.masterGotFinal) {
- await masterGotFinishedTaskForFarm();
- if ($.masterGotFinished.code === '0') {
- that.log(`已成功领取好友助力奖励:【${$.masterGotFinished.amount}】g水`);
- // message += "【额外奖励】" + `${$.masterGotFinished.amount}` + "g水领取成功\n\n";
- }
- } else {
- that.log("已经领取过5好友助力额外奖励");
- // message += "【水果🍉进度】" + `【额外奖励】已被领取过\n` + "\n\n";
- }
- } else {
- that.log("助力好友未达到5个");
- // message += "【额外奖励】领取失败,原因:给您助力的人未达5个\n\n";
- }
- if ($.masterHelpResult.masterHelpPeoples && $.masterHelpResult.masterHelpPeoples.length > 0) {
- let str = '';
- $.masterHelpResult.masterHelpPeoples.map((item, index) => {
- if (index === ($.masterHelpResult.masterHelpPeoples.length - 1)) {
- str += item.nickName || "匿名用户";
- } else {
- str += (item.nickName || "匿名用户") + ',';
- }
- let date = new Date(item.time);
- let time = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getMinutes();
- that.log(`\n动动昵称【${item.nickName || "匿名用户"}】 在 ${time} 给您助过力\n`);
- })
- // message += "【助力您的好友】 " + `${str}` + "\n\n"
- }
- that.log('领取额外奖励水滴结束\n');
- }
- }
-
- function getHelp() {
- newShareCodes = [];
- return new Promise(resolve => {
- $.get({
- url: "http://api.tyh52.com/act/get/jd_fruit/3"
- }, (err, resp, data) => {
- try {
- if (data) {
- data = JSON.parse(data);
- if (data.code == 1) {
- let list = data.data;
- if (!(list instanceof Array)) {
- list = JSON.parse(list);
- }
- if (list.length > 0) {
- for (var i in list) {
- newShareCodes.push(list[i]);
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- });
- }
-
- function setHelp() {
- return new Promise(resolve => {
- if ($.farmInfo.farmUserPro.shareCode) {
- $.get({
- url: "http://api.tyh52.com/act/set/jd_fruit/" + $.farmInfo.farmUserPro.shareCode
- }, (err, resp, data) => {
- try {
- if (data) {
- data = JSON.parse(data);
- if (data.code == 1) {
- that.log("提交自己的邀請碼成功");
- } else {
- that.log("提交邀请码失败," + data.message);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- } else {
- resolve();
- }
-
- });
- }
-
- //助力好友
- async function masterHelpShare() {
- that.log('开始助力好友')
- let salveHelpAddWater = 0;
- let remainTimes = 4;//今日剩余助力次数,默认4次(动动农场每人每天4次助力机会)。
- let helpSuccessPeoples = '';//成功助力好友
- that.log(`格式化后的助力码::${JSON.stringify(newShareCodes)}\n`);
-
- for (let code of newShareCodes) {
- that.log(`开始助力动动账号${$.index} - ${$.nickName}的好友: ${code}`);
- if (!code) continue;
- if (code === $.farmInfo.farmUserPro.shareCode) {
- that.log('不能为自己助力哦,跳过自己的shareCode\n')
- continue
- }
- await masterHelp(code);
- if ($.helpResult.code === '0') {
- if ($.helpResult.helpResult.code === '0') {
- //助力成功
- salveHelpAddWater += $.helpResult.helpResult.salveHelpAddWater;
- that.log(`【助力好友结果】: 已成功给【${$.helpResult.helpResult.masterUserInfo.nickName}】助力`);
- that.log(`给好友【${$.helpResult.helpResult.masterUserInfo.nickName}】助力获得${$.helpResult.helpResult.salveHelpAddWater}g水滴`)
- helpSuccessPeoples += ($.helpResult.helpResult.masterUserInfo.nickName || '匿名用户') + ',';
- } else if ($.helpResult.helpResult.code === '8') {
- that.log(`【助力好友结果】: 助力【${$.helpResult.helpResult.masterUserInfo.nickName}】失败,您今天助力次数已耗尽`);
- } else if ($.helpResult.helpResult.code === '9') {
- that.log(`【助力好友结果】: 之前给【${$.helpResult.helpResult.masterUserInfo.nickName}】助力过了`);
- } else if ($.helpResult.helpResult.code === '10') {
- that.log(`【助力好友结果】: 好友【${$.helpResult.helpResult.masterUserInfo.nickName}】已满五人助力`);
- } else {
- that.log(`助力其他情况:${JSON.stringify($.helpResult.helpResult)}`);
- }
- that.log(`【今日助力次数还剩】${$.helpResult.helpResult.remainTimes}次\n`);
- remainTimes = $.helpResult.helpResult.remainTimes;
- if ($.helpResult.helpResult.remainTimes === 0) {
- that.log(`您当前助力次数已耗尽,跳出助力`);
- break
- }
- } else {
- that.log(`助力失败::${JSON.stringify($.helpResult)}`);
- }
- }
- if (helpSuccessPeoples && helpSuccessPeoples.length > 0) {
- // message += " " + `【您助力的好友👬】${helpSuccessPeoples.substr(0, helpSuccessPeoples.length - 1)}\n` + "\n\n";
- }
- if (salveHelpAddWater > 0) {
- // message += `【助力好友👬】获得${salveHelpAddWater}g💧\n`;
- that.log(`【助力好友👬】获得${salveHelpAddWater}g💧\n`);
- }
- // message += "" + `【今日剩余助力👬】${remainTimes}次\n` + "\n\n";
- that.log('助力好友结束,即将开始领取额外水滴奖励\n');
- }
- //水滴雨
- async function executeWaterRains() {
- let executeWaterRain = !$.farmTask.waterRainInit.f;
- if (executeWaterRain) {
- that.log(`水滴雨任务,每天两次,最多可得10g水滴`);
- that.log(`两次水滴雨任务是否全部完成:${$.farmTask.waterRainInit.f ? '是' : '否'}`);
- if ($.farmTask.waterRainInit.lastTime) {
- if (Date.now() < ($.farmTask.waterRainInit.lastTime + 3 * 60 * 60 * 1000)) {
- executeWaterRain = false;
- // message += `【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】未到时间,请${new Date($.farmTask.waterRainInit.lastTime + 3 * 60 * 60 * 1000).toLocaleTimeString()}再试\n`;
- that.log(`\`【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】未到时间,请${new Date($.farmTask.waterRainInit.lastTime + 3 * 60 * 60 * 1000).toLocaleTimeString()}再试\n`);
- }
- }
- if (executeWaterRain) {
- that.log(`开始水滴雨任务,这是第${$.farmTask.waterRainInit.winTimes + 1}次,剩余${2 - ($.farmTask.waterRainInit.winTimes + 1)}次`);
- await waterRainForFarm();
- that.log('水滴雨waterRain');
- if ($.waterRain.code === '0') {
- that.log('水滴雨任务执行成功,获得水滴:' + $.waterRain.addEnergy + 'g');
- that.log(`【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】获得${$.waterRain.addEnergy}g水滴\n`);
- // message += `【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】获得${$.waterRain.addEnergy}g水滴\n`;
- }
- }
- } else {
- // message += `【水滴雨】已全部完成,获得20g💧\n`;
- }
- }
- //打卡领水活动
- async function clockInIn() {
- that.log('开始打卡领水活动(签到,关注,领券)');
- await clockInInitForFarm();
- if ($.clockInInit.code === '0') {
- // 签到得水滴
- if (!$.clockInInit.todaySigned) {
- that.log('开始今日签到');
- await clockInForFarm();
- that.log(`打卡结果${JSON.stringify($.clockInForFarmRes)}`);
- if ($.clockInForFarmRes.code === '0') {
- // message += `【第${$.clockInForFarmRes.signDay}天签到】获得${$.clockInForFarmRes.amount}g💧\n`;
- that.log(`【第${$.clockInForFarmRes.signDay}天签到】获得${$.clockInForFarmRes.amount}g💧\n`)
- if ($.clockInForFarmRes.signDay === 7) {
- //可以领取惊喜礼包
- that.log('开始领取--惊喜礼包38g水滴');
- await gotClockInGift();
- if ($.gotClockInGiftRes.code === '0') {
- // message += `【惊喜礼包】获得${$.gotClockInGiftRes.amount}g💧\n`;
- that.log(`【惊喜礼包】获得${$.gotClockInGiftRes.amount}g💧\n`);
- }
- }
- }
- }
- if ($.clockInInit.todaySigned && $.clockInInit.totalSigned === 7) {
- that.log('开始领取--惊喜礼包38g水滴');
- await gotClockInGift();
- if ($.gotClockInGiftRes.code === '0') {
- // message += `【惊喜礼包】获得${$.gotClockInGiftRes.amount}g💧\n`;
- that.log(`【惊喜礼包】获得${$.gotClockInGiftRes.amount}g💧\n`);
- }
- }
- // 限时关注得水滴
- if ($.clockInInit.themes && $.clockInInit.themes.length > 0) {
- for (let item of $.clockInInit.themes) {
- if (!item.hadGot) {
- that.log(`关注ID${item.id}`);
- await clockInFollowForFarm(item.id, "theme", "1");
- that.log(`themeStep1--结果${JSON.stringify($.themeStep1)}`);
- if ($.themeStep1.code === '0') {
- await clockInFollowForFarm(item.id, "theme", "2");
- that.log(`themeStep2--结果${JSON.stringify($.themeStep2)}`);
- if ($.themeStep2.code === '0') {
- that.log(`关注${item.name},获得水滴${$.themeStep2.amount}g`);
- }
- }
- }
- }
- }
- // 限时领券得水滴
- if ($.clockInInit.venderCoupons && $.clockInInit.venderCoupons.length > 0) {
- for (let item of $.clockInInit.venderCoupons) {
- if (!item.hadGot) {
- that.log(`领券的ID${item.id}`);
- await clockInFollowForFarm(item.id, "venderCoupon", "1");
- that.log(`venderCouponStep1--结果${JSON.stringify($.venderCouponStep1)}`);
- if ($.venderCouponStep1.code === '0') {
- await clockInFollowForFarm(item.id, "venderCoupon", "2");
- if ($.venderCouponStep2.code === '0') {
- that.log(`venderCouponStep2--结果${JSON.stringify($.venderCouponStep2)}`);
- that.log(`从${item.name}领券,获得水滴${$.venderCouponStep2.amount}g`);
- }
- }
- }
- }
- }
- }
- that.log('开始打卡领水活动(签到,关注,领券)结束\n');
- }
- //
- async function getAwardInviteFriend() {
- await friendListInitForFarm();//查询好友列表
- that.log(`查询好友列表数据:\n`)
- if ($.friendList) {
- that.log(`\n今日已邀请好友${$.friendList.inviteFriendCount}个 / 每日邀请上限${$.friendList.inviteFriendMax}个`);
- that.log(`开始删除${$.friendList.friends && $.friendList.friends.length}个好友,可拿每天的邀请奖励`);
- if ($.friendList.friends && $.friendList.friends.length > 0) {
- for (let friend of $.friendList.friends) {
- that.log(`\n开始删除好友 [${friend.shareCode}]`);
- const deleteFriendForFarm = await request('deleteFriendForFarm', { "shareCode": `${friend.shareCode}`,"version":8,"channel":1 });
- if (deleteFriendForFarm && deleteFriendForFarm.code === '0') {
- that.log(`删除好友 [${friend.shareCode}] 成功\n`);
- }
- }
- }
- await receiveFriendInvite();//为他人助力,接受邀请成为别人的好友
- if ($.friendList.inviteFriendCount > 0) {
- if ($.friendList.inviteFriendCount > $.friendList.inviteFriendGotAwardCount) {
- that.log('开始领取邀请好友的奖励');
- await awardInviteFriendForFarm();
- that.log(`领取邀请好友的奖励结果::${JSON.stringify($.awardInviteFriendRes)}`);
- }
- } else {
- that.log('今日未邀请过好友')
- }
- } else {
- that.log(`查询好友列表失败\n`);
- }
- }
- //给好友浇水
- async function doFriendsWater() {
- await friendListInitForFarm();
- that.log('开始给好友浇水...');
- await taskInitForFarm();
- const { waterFriendCountKey, waterFriendMax } = $.farmTask.waterFriendTaskInit;
- that.log(`今日已给${waterFriendCountKey}个好友浇水`);
- if (waterFriendCountKey < waterFriendMax) {
- let needWaterFriends = [];
- if ($.friendList.friends && $.friendList.friends.length > 0) {
- $.friendList.friends.map((item, index) => {
- if (item.friendState === 1) {
- if (needWaterFriends.length < (waterFriendMax - waterFriendCountKey)) {
- needWaterFriends.push(item.shareCode);
- }
- }
- });
- //TODO ,发现bug,github action运行发现有些账号第一次没有给3个好友浇水
- that.log(`需要浇水的好友列表shareCodes:${JSON.stringify(needWaterFriends)}`);
- let waterFriendsCount = 0, cardInfoStr = '';
- for (let index = 0; index < needWaterFriends.length; index ++) {
- await waterFriendForFarm(needWaterFriends[index]);
- that.log(`为第${index+1}个好友浇水结果:${JSON.stringify($.waterFriendForFarmRes)}\n`)
- if ($.waterFriendForFarmRes.code === '0') {
- waterFriendsCount ++;
- if ($.waterFriendForFarmRes.cardInfo) {
- that.log('为好友浇水获得道具了');
- if ($.waterFriendForFarmRes.cardInfo.type === 'beanCard') {
- that.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
- cardInfoStr += `水滴换豆卡,`;
- } else if ($.waterFriendForFarmRes.cardInfo.type === 'fastCard') {
- that.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
- cardInfoStr += `快速浇水卡,`;
- } else if ($.waterFriendForFarmRes.cardInfo.type === 'doubleCard') {
- that.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
- cardInfoStr += `水滴翻倍卡,`;
- } else if ($.waterFriendForFarmRes.cardInfo.type === 'signCard') {
- that.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
- cardInfoStr += `加签卡,`;
- }
- }
- } else if ($.waterFriendForFarmRes.code === '11') {
- that.log('水滴不够,跳出浇水')
- }
- }
- // message += `【好友浇水】已给${waterFriendsCount}个好友浇水,消耗${waterFriendsCount * 10}g水\n`;
- that.log(`【好友浇水】已给${waterFriendsCount}个好友浇水,消耗${waterFriendsCount * 10}g水\n`);
- if (cardInfoStr && cardInfoStr.length > 0) {
- // message += `【好友浇水奖励】${cardInfoStr.substr(0, cardInfoStr.length - 1)}\n`;
- that.log(`【好友浇水奖励】${cardInfoStr.substr(0, cardInfoStr.length - 1)}\n`);
- }
- } else {
- that.log('您的好友列表暂无好友,快去邀请您的好友吧!')
- }
- } else {
- that.log(`今日已为好友浇水量已达${waterFriendMax}个`)
- }
- }
- //领取给3个好友浇水后的奖励水滴
- async function getWaterFriendGotAward() {
- await taskInitForFarm();
- const { waterFriendCountKey, waterFriendMax, waterFriendSendWater, waterFriendGotAward } = $.farmTask.waterFriendTaskInit
- if (waterFriendCountKey >= waterFriendMax) {
- if (!waterFriendGotAward) {
- await waterFriendGotAwardForFarm();
- that.log(`领取给${waterFriendMax}个好友浇水后的奖励水滴::${JSON.stringify($.waterFriendGotAwardRes)}`)
- if ($.waterFriendGotAwardRes.code === '0') {
- // message += `【给${waterFriendMax}好友浇水】奖励${$.waterFriendGotAwardRes.addWater}g水滴\n`;
- that.log(`【给${waterFriendMax}好友浇水】奖励${$.waterFriendGotAwardRes.addWater}g水滴\n`);
- }
- } else {
- that.log(`给好友浇水的${waterFriendSendWater}g水滴奖励已领取\n`);
- // message += `【给${waterFriendMax}好友浇水】奖励${waterFriendSendWater}g水滴已领取\n`;
- }
- } else {
- that.log(`暂未给${waterFriendMax}个好友浇水\n`);
- }
- }
- //接收成为对方好友的邀请
- async function receiveFriendInvite() {
- for (let code of newShareCodes) {
- if (code === $.farmInfo.farmUserPro.shareCode) {
- that.log('自己不能邀请自己成为好友噢\n')
- continue
- }
- await inviteFriend(code);
- // that.log(`接收邀请成为好友结果:${JSON.stringify($.inviteFriendRes.helpResult)}`)
- if ($.inviteFriendRes.helpResult.code === '0') {
- that.log(`接收邀请成为好友结果成功,您已成为${$.inviteFriendRes.helpResult.masterUserInfo.nickName}的好友`)
- } else if ($.inviteFriendRes.helpResult.code === '17') {
- that.log(`接收邀请成为好友结果失败,对方已是您的好友`)
- }
- }
- // that.log(`开始接受6fbd26cc27ac44d6a7fed34092453f77的邀请\n`)
- // await inviteFriend('6fbd26cc27ac44d6a7fed34092453f77');
- // that.log(`接收邀请成为好友结果:${JSON.stringify($.inviteFriendRes.helpResult)}`)
- // if ($.inviteFriendRes.helpResult.code === '0') {
- // that.log(`您已成为${$.inviteFriendRes.helpResult.masterUserInfo.nickName}的好友`)
- // } else if ($.inviteFriendRes.helpResult.code === '17') {
- // that.log(`对方已是您的好友`)
- // }
- }
- async function duck() {
- for (let i = 0; i < 10; i++) {
- //这里循环十次
- await getFullCollectionReward();
- if ($.duckRes.code === '0') {
- if (!$.duckRes.hasLimit) {
- that.log(`小鸭子游戏:${$.duckRes.title}`);
- // if ($.duckRes.type !== 3) {
- // that.log(`${$.duckRes.title}`);
- // if ($.duckRes.type === 1) {
- // message += `【小鸭子】为你带回了水滴\n`;
- // } else if ($.duckRes.type === 2) {
- // message += `【小鸭子】为你带回快速浇水卡\n`
- // }
- // }
- } else {
- that.log(`${$.duckRes.title}`)
- break;
- }
- } else if ($.duckRes.code === '10') {
- that.log(`小鸭子游戏达到上限`)
- break;
- }
- }
- }
- // ========================API调用接口========================
- //鸭子,点我有惊喜
- async function getFullCollectionReward() {
- return new Promise(resolve => {
- const body = {"type": 2, "version": 6, "channel": 2};
- $.post(taskUrl("getFullCollectionReward", body), (err, resp, data) => {
- try {
- if (err) {
- that.log('\n动动农场: API查询请求失败 ‼️‼️');
- that.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- $.duckRes = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
- }
-
- /**
- * 领取10次浇水奖励API
- */
- async function totalWaterTaskForFarm() {
- const functionId = 'totalWaterTaskForFarm';
- $.totalWaterReward = await request(functionId);
- }
- //领取首次浇水奖励API
- async function firstWaterTaskForFarm() {
- const functionId = 'firstWaterTaskForFarm';
- $.firstWaterReward = await request(functionId);
- }
- //领取给3个好友浇水后的奖励水滴API
- async function waterFriendGotAwardForFarm() {
- const functionId = 'waterFriendGotAwardForFarm';
- $.waterFriendGotAwardRes = await request(functionId, {"version": 4, "channel": 1});
- }
- // 查询背包道具卡API
- async function myCardInfoForFarm() {
- const functionId = 'myCardInfoForFarm';
- $.myCardInfoRes = await request(functionId, {"version": 5, "channel": 1});
- }
- //使用道具卡API
- async function userMyCardForFarm(cardType) {
- const functionId = 'userMyCardForFarm';
- $.userMyCardRes = await request(functionId, {"cardType": cardType});
- }
- /**
- * 领取浇水过程中的阶段性奖励
- * @param type
- * @returns {Promise}
- */
- async function gotStageAwardForFarm(type) {
- $.gotStageAwardForFarmRes = await request('gotStageAwardForFarm', {'type': type});
- }
- //浇水API
- async function waterGoodForFarm() {
- await $.wait(1000);
- that.log('等待了1秒');
-
- const functionId = 'waterGoodForFarm';
- $.waterResult = await request(functionId);
- }
- // 初始化集卡抽奖活动数据API
- async function initForTurntableFarm() {
- $.initForTurntableFarmRes = await request('initForTurntableFarm', {version: 4, channel: 1});
- }
- async function lotteryForTurntableFarm() {
- await $.wait(2000);
- that.log('等待了2秒');
- $.lotteryRes = await request('lotteryForTurntableFarm', {type: 1, version: 4, channel: 1});
- }
-
- async function timingAwardForTurntableFarm() {
- $.timingAwardRes = await request('timingAwardForTurntableFarm', {version: 4, channel: 1});
- }
-
- async function browserForTurntableFarm(type, adId) {
- if (type === 1) {
- that.log('浏览爆品会场');
- }
- if (type === 2) {
- that.log('天天抽奖浏览任务领取水滴');
- }
- const body = {"type": type,"adId": adId,"version":4,"channel":1};
- $.browserForTurntableFarmRes = await request('browserForTurntableFarm', body);
- // 浏览爆品会场8秒
- }
- //天天抽奖浏览任务领取水滴API
- async function browserForTurntableFarm2(type) {
- const body = {"type":2,"adId": type,"version":4,"channel":1};
- $.browserForTurntableFarm2Res = await request('browserForTurntableFarm', body);
- }
- /**
- * 天天抽奖拿好礼-助力API(每人每天三次助力机会)
- */
- async function lotteryMasterHelp() {
- $.lotteryMasterHelpRes = await request(`initForFarm`, {
- imageUrl: "",
- nickName: "",
- shareCode: arguments[0] + '-3',
- babelChannel: "3",
- version: 4,
- channel: 1
- });
- }
-
- //领取5人助力后的额外奖励API
- async function masterGotFinishedTaskForFarm() {
- const functionId = 'masterGotFinishedTaskForFarm';
- $.masterGotFinished = await request(functionId);
- }
- //助力好友信息API
- async function masterHelpTaskInitForFarm() {
- const functionId = 'masterHelpTaskInitForFarm';
- $.masterHelpResult = await request(functionId);
- }
- //接受对方邀请,成为对方好友的API
- async function inviteFriend() {
- $.inviteFriendRes = await request(`initForFarm`, {
- imageUrl: "",
- nickName: "",
- shareCode: arguments[0] + '-inviteFriend',
- version: 4,
- channel: 2
- });
- }
- // 助力好友API
- async function masterHelp() {
- $.helpResult = await request(`initForFarm`, {
- imageUrl: "",
- nickName: "",
- shareCode: arguments[0],
- babelChannel: "3",
- version: 2,
- channel: 1
- });
- }
- /**
- * 水滴雨API
- */
- async function waterRainForFarm() {
- const functionId = 'waterRainForFarm';
- const body = {"type": 1, "hongBaoTimes": 100, "version": 3};
- $.waterRain = await request(functionId, body);
- }
- /**
- * 打卡领水API
- */
- async function clockInInitForFarm() {
- const functionId = 'clockInInitForFarm';
- $.clockInInit = await request(functionId);
- }
-
- // 连续签到API
- async function clockInForFarm() {
- const functionId = 'clockInForFarm';
- $.clockInForFarmRes = await request(functionId, {"type": 1});
- }
-
- //关注,领券等API
- async function clockInFollowForFarm(id, type, step) {
- const functionId = 'clockInFollowForFarm';
- let body = {
- id,
- type,
- step
- }
- if (type === 'theme') {
- if (step === '1') {
- $.themeStep1 = await request(functionId, body);
- } else if (step === '2') {
- $.themeStep2 = await request(functionId, body);
- }
- } else if (type === 'venderCoupon') {
- if (step === '1') {
- $.venderCouponStep1 = await request(functionId, body);
- } else if (step === '2') {
- $.venderCouponStep2 = await request(functionId, body);
- }
- }
- }
-
- // 领取连续签到7天的惊喜礼包API
- async function gotClockInGift() {
- $.gotClockInGiftRes = await request('clockInForFarm', {"type": 2})
- }
-
- //定时领水API
- async function gotThreeMealForFarm() {
- const functionId ='gotThreeMealForFarm';
- $.threeMeal = await request(functionId);
- }
- /**
- * 浏览广告任务API
- * type为0时, 完成浏览任务
- * type为1时, 领取浏览任务奖励
- */
- async function browseAdTaskForFarm(advertId, type) {
- const functionId = 'browseAdTaskForFarm';
- if (type === 0) {
- $.browseResult = await request(functionId, {advertId, type});
- } else if (type === 1) {
- $.browseRwardResult = await request(functionId, {advertId, type});
- }
- }
- // 被水滴砸中API
- async function gotWaterGoalTaskForFarm() {
- $.goalResult = await request('gotWaterGoalTaskForFarm', {type: 3});
- }
- //签到API
- async function signForFarm() {
- const functionId = 'signForFarm';
- $.signResult = await request(functionId);
- }
- /**
- * 初始化农场, 可获取果树及用户信息API
- */
- async function initForFarm() {
- return new Promise(resolve => {
- const option = {
- url: `${JD_API_HOST}?functionId=initForFarm`,
- body: `body=${escape(JSON.stringify({"version":4}))}&appid=wh5&clientVersion=9.1.0`,
- headers: {
- "accept": "*/*",
- "accept-encoding": "gzip, deflate, br",
- "accept-language": "zh-CN,zh;q=0.9",
- "cache-control": "no-cache",
- "cookie": cookie,
- "origin": "https://home.m.jd.com",
- "pragma": "no-cache",
- "referer": "https://home.m.jd.com/myJd/newhome.action",
- "sec-fetch-dest": "empty",
- "sec-fetch-mode": "cors",
- "sec-fetch-site": "same-site",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
- "Content-Type": "application/x-www-form-urlencoded"
- },
- timeout: 10000,
- };
- $.post(option, (err, resp, data) => {
- try {
- if (err) {
- that.log('\n动动农场: API查询请求失败 ‼️‼️');
- that.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- $.farmInfo = JSON.parse(data)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
- }
-
- // 初始化任务列表API
- async function taskInitForFarm() {
- that.log('\n初始化任务列表')
- const functionId = 'taskInitForFarm';
- $.farmTask = await request(functionId);
- }
- //获取好友列表API
- async function friendListInitForFarm() {
- $.friendList = await request('friendListInitForFarm', {"version": 4, "channel": 1});
- // that.log('aa', aa);
- }
- // 领取邀请好友的奖励API
- async function awardInviteFriendForFarm() {
- $.awardInviteFriendRes = await request('awardInviteFriendForFarm');
- }
- //为好友浇水API
- async function waterFriendForFarm(shareCode) {
- const body = {"shareCode": shareCode, "version": 6, "channel": 1}
- $.waterFriendForFarmRes = await request('waterFriendForFarm', body);
- }
-
-
- function readShareCode() {
- return new Promise(async resolve => {
- $.get({url: `http://jd.turinglabs.net/api/v2/jd/farm/read/${randomCount}/`, timeout: 10000,}, (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- that.log(`随机取个${randomCount}码放到您固定的互助码后面(不影响已有固定互助)`)
- data = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- await $.wait(10000);
- resolve()
- })
- }
- function shareCodesFormat() {
- return new Promise(async resolve => {
- // that.log(`第${$.index}个动动账号的助力码:::${jdFruitShareArr[$.index - 1]}`)
- newShareCodes = [];
- // if (jdFruitShareArr[$.index - 1]) {
- // newShareCodes = jdFruitShareArr[$.index - 1].split('@');
- // } else {
- // that.log(`由于您第${$.index}个动动账号未提供shareCode,将采纳本脚本自带的助力码\n`)
- // const tempIndex = $.index > shareCodes.length ? (shareCodes.length - 1) : ($.index - 1);
- // newShareCodes = shareCodes[tempIndex].split('@');
- // }
- // const readShareCodeRes = await readShareCode();
- // if (readShareCodeRes && readShareCodeRes.code === 200) {
- // // newShareCodes = newShareCodes.concat(readShareCodeRes.data || []);
- // newShareCodes = [...new Set([...newShareCodes, ...(readShareCodeRes.data || [])])];
- // }
- // that.log(`第${$.index}个动动账号将要助力的好友${JSON.stringify(newShareCodes)}`)
- resolve();
- })
- }
-
- function request(function_id, body = {}, timeout = 1000){
- return new Promise(resolve => {
- setTimeout(() => {
- $.get(taskUrl(function_id, body), (err, resp, data) => {
- try {
- if (err) {
- that.log('\n动动农场: API查询请求失败 ‼️‼️')
- that.log(JSON.stringify(err));
- that.log(`function_id:${function_id}`)
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- }, timeout)
- })
- }
- function safeGet(data) {
- try {
- if (typeof JSON.parse(data) == "object") {
- return true;
- }
- } catch (e) {
- that.log(e);
- that.log(`动动服务器访问数据为空,请检查自身设备网络情况`);
- return false;
- }
- }
- function taskUrl(function_id, body = {}) {
- return {
- url: `${JD_API_HOST}?functionId=${function_id}&appid=wh5&body=${escape(JSON.stringify(body))}`,
- headers: {
- Cookie: cookie,
- UserAgent: $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
- },
- timeout: 10000,
- }
- }
- //-------------------------------------------------东东赚赚------------------------------------------------------------
-
-
-async function jdWish() {
- $.bean = 0
- $.tuan = null
- $.hasOpen = false
- await getTaskList(true)
- await getUserTuanInfo()
- if (!$.tuan) {
- await openTuan()
- if ($.hasOpen) await getUserTuanInfo()
- }
- if ($.tuan) $.tuanList.push($.tuan)
- await helpFriends()
- await getUserInfo()
- $.nowBean = parseInt($.totalBeanNum)
- $.nowNum = parseInt($.totalNum)
- for (let i = 0; i < $.taskList.length; ++i) {
- let task = $.taskList[i]
- if (task['taskId'] === 1 && task['status'] !== 2) {
- that.log(`去做任务:${task.taskName}`)
- await doTask({"taskId": task['taskId'],"mpVersion":"3.4.0"})
- } else if (task['taskId'] !== 3 && task['status'] !== 2) {
- that.log(`去做任务:${task.taskName}`)
- if(task['itemId'])
- await doTask({"itemId":task['itemId'],"taskId":task['taskId'],"mpVersion":"3.4.0"})
- else
- await doTask({"taskId": task['taskId'],"mpVersion":"3.4.0"})
- await $.wait(3000)
- }
- }
- await getTaskList();
- await showMsg1();
- }
-
-
- function helpFriendTuan(body) {
- return new Promise(resolve => {
- $.get(taskTuanUrl("vvipclub_distributeBean_assist", body), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- if (data.success) {
- that.log('助力成功')
- } else {
- if (data.resultCode === '9200008') that.log('不能助力自己')
- else if (data.resultCode === '9200011') that.log('已经助力过')
- else if (data.resultCode === '2400205') that.log('团已满')
- else if (data.resultCode === '2400203') {that.log('助力次数已耗尽');$.canHelp = false}
- else that.log(`未知错误`)
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
- }
-
- function getUserTuanInfo() {
- let body = {"paramData": {"channel": "FISSION_BEAN"}}
- return new Promise(resolve => {
- $.get(taskTuanUrl("distributeBeanActivityInfo", body), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- if (data.data && !data.data.canStartNewAssist) {
- $.tuan = {
- "activityIdEncrypted": data.data.id,
- "assistStartRecordId": data.data.assistStartRecordId,
- "assistedPinEncrypted": data.data.encPin,
- "channel": "FISSION_BEAN"
- }
- $.tuanActId = data.data.id
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
- }
-
- function openTuan() {
- let body = {"activityIdEncrypted": $.tuanActId, "channel": "FISSION_BEAN"}
- return new Promise(resolve => {
- $.get(taskTuanUrl("vvipclub_distributeBean_startAssist", body), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- if (data['success']) {
- $.hasOpen = true
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
- }
-
- function getUserInfo() {
- return new Promise(resolve => {
- $.get(taskUrl1("interactIndex"), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- // if (data.data.shareTaskRes) {
- // that.log(`\n【动动账号${$.index}(${$.nickName || $.UserName})的${$.name}好友互助码】${data.data.shareTaskRes.itemId}\n`);
- // } else {
- // that.log(`\n\n已满5人助力或助力功能已下线,故暂时无${$.name}好友助力码\n\n`)
- // }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
- }
-
- function getTaskList(flag = false) {
- return new Promise(resolve => {
- $.get(taskUrl1("interactTaskIndex"), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- $.taskList = data.data.taskDetailResList
- $.totalNum = data.data.totalNum
- $.totalBeanNum = data.data.totalBeanNum
- if (flag && $.taskList.filter(item => !!item && item['taskId']=== 3) && $.taskList.filter(item => !!item && item['taskId']=== 3).length) {
- $.shareId=$.taskList.filter(item => !!item && item['taskId']=== 3)[0]['itemId'];
- that.log(`\n【动动账号${$.index}(${$.nickName || $.UserName})的${$.name}好友互助码】${$.taskList.filter(item => !!item && item['taskId']=== 3)[0]['itemId']}\n`);
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
- }
-
- // 完成
- function doTask(body, func = "doInteractTask") {
- // that.log(taskUrl("doInteractTask", body))
- return new Promise(resolve => {
- $.get(taskUrl1(func, body), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- // that.log(data)
- if (func === "doInteractTask") {
- if (data.subCode === "S000") {
- that.log(`任务完成,获得 ${data.data.taskDetailResList[0].incomeAmountConf} 金币,${data.data.taskDetailResList[0].beanNum} 京豆`)
- $.bean += parseInt(data.data.taskDetailResList[0].beanNum)
- } else {
- that.log(`任务失败,错误信息:${data.message}`)
- }
- } else {
- that.log(`${data.data.helpResDesc}`)
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
- }
-
- async function helpFriends() {
- await getHelp();
- for (let code of $.newShareCodes) {
- if (!code) continue
- await doTask({"itemId": code, "taskId": "3", "mpVersion": "3.4.0"}, "doHelpTask")
- }
- await setHelp();
- }
-
- function getHelp() {
- $.newShareCodes = [];
- return new Promise(resolve => {
- $.get({
- url: "http://api.tyh52.com/act/get/jdzz/3"
- }, (err, resp, data) => {
- try {
- if (data) {
- data = JSON.parse(data);
- if (data.code == 1) {
- let list = data.data;
- if (!(list instanceof Array)) {
- list = JSON.parse(list);
- }
- if (list.length > 0) {
- for (var i in list) {
- $.newShareCodes.push(list[i]);
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- });
- }
-
- function setHelp() {
- return new Promise(resolve => {
- if ($.shareId) {
- $.get({
- url: "http://api.tyh52.com/act/set/jdzz/" + $.shareId
- }, (err, resp, data) => {
- try {
- if (data) {
- data = JSON.parse(data);
- if (data.code == 1) {
- that.log("提交自己的邀請碼成功");
- } else {
- that.log("提交邀请码失败," + data.message);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- } else {
- resolve();
- }
-
- });
- }
-
- function getHelpTuan() {
- $.tuanList = [];
- return new Promise(resolve => {
- $.get({
- url: "http://api.tyh52.com/act/get/jdzzTuan/3"
- }, (err, resp, data) => {
- try {
- if (data) {
- data = JSON.parse(data);
- if (data.code == 1) {
- let list = data.data;
- if (!(list instanceof Array)) {
- list = JSON.parse(list);
- }
- if (list.length > 0) {
- for (var item of list) {
- let its=item.split('@');
- if(its.length==2){
- let tuan={
- "activityIdEncrypted": $.tuanActId,
- "assistStartRecordId": its[0],
- "assistedPinEncrypted": its[1],
- "channel": "FISSION_BEAN"
- }
- $.tuanList.push(tuan);
- }
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- });
- }
-
- function setHelpTuan() {
- return new Promise(resolve => {
- if ($.tuan) {
- $.get({
- url: "http://api.tyh52.com/act/set/jdzzTuan/" + $.tuan.assistStartRecordId+'@'+$.tuan.assistedPinEncrypted
- }, (err, resp, data) => {
- try {
- if (data) {
- that.log(data);
- data = JSON.parse(data);
- if (data.code == 1) {
- that.log("提交自己的开团碼成功");
- }else{
- that.log("提交开团码失败," + data.message);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- } else {
- resolve();
- }
-
- });
- }
-
- function taskUrl1(functionId, body = {}) {
- return {
- url: `${JD_API_HOST}?functionId=${functionId}&body=${escape(JSON.stringify(body))}&client=wh5&clientVersion=9.1.0`,
- headers: {
- 'Cookie': cookie,
- 'Host': 'api.m.jd.com',
- 'Connection': 'keep-alive',
- 'Content-Type': 'application/json',
- 'Referer': 'http://wq.jd.com/wxapp/pages/hd-interaction/index/index',
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
- 'Accept-Language': 'zh-cn',
- 'Accept-Encoding': 'gzip, deflate, br',
- }
- }
- }
-
- function taskTuanUrl(function_id, body = {}) {
- return {
- url: `${JD_API_HOST}?functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=swat_miniprogram&osVersion=5.0.0&clientVersion=3.1.3&fromType=wxapp×tamp=${new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000}`,
- headers: {
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-cn",
- "Connection": "keep-alive",
- "Content-Type": "application/x-www-form-urlencoded",
- "Host": "api.m.jd.com",
- "Referer": "https://servicewechat.com/wxa5bf5ee667d91626/108/page-frame.html",
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
- }
- }
- }
-
-
-
- function showMsg1() {
- return new Promise(async resolve => {
- that.log( "" + `本次获得${parseInt($.totalBeanNum) - $.nowBean}京豆,${parseInt($.totalNum) - $.nowNum}金币\n` + "\n\n")
- message += "" + `累计获得${$.totalBeanNum}京豆,${$.totalNum}金币\n可兑换${$.totalNum / 10000}元无门槛红包` + "\n\n"
- if (parseInt($.totalBeanNum) - $.nowBean > 0) {
- $.msg($.name, '', `动动账号${$.index} ${$.nickName}\n${message}`);
- } else {
- $.log(message)
- }
- // 云端大于10元无门槛红包时进行通知推送
- if ($.isNode() && $.totalNum >= 1000000) await notify.sendNotify(`${$.name} - 动动账号${$.index} - ${$.nickName}`, `动动账号${$.index} ${$.nickName}\n当前金币:${$.totalNum}个\n可兑换无门槛红包:${parseInt($.totalNum) / 10000}元\n`,)
- resolve();
- })
- }
-
-
-
-
-
-//我加的函数
-function postToDingTalk(messgae) {
- const message1 = "" + messgae
- that.log(messgae)
-
- const body = {
- "msgtype": "markdown",
- "markdown": {
- "title":"资产变动",
- "text": message1
- },
- "at": {
- "atMobiles": [],
- "isAtAll": false
- }
- }
-
-
- $.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
- try {
- that.log(resp)
- that.log(data)
- if (err) {
- that.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- $.duckRes = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- },"json")
-}
-
-
-function toDingtalk(urlmain, bodyMain) {
- return {
- url: urlmain,
- body:bodyMain,
- headers: { 'Content-Type': 'application/json;charset=utf-8' },
- timeout: 10000,
- }
-}
-function getPic(){
- let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
- let address = "\n\n )
- address = address + code[pos] + ")"
- return address
-}
\ No newline at end of file
diff --git a/src/main/resources/test_money_money.js b/src/main/resources/test_money_money.js
deleted file mode 100644
index 9ba1c6d..0000000
--- a/src/main/resources/test_money_money.js
+++ /dev/null
@@ -1,711 +0,0 @@
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写动动ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-let helpAuthor=true; // 帮助作者
-const randomCount = $.isNode() ? 0 : 5;
-let jdNotify = true; // 是否关闭通知,false打开通知推送,true关闭通知推送
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '', message = "";
-let dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=d2b6042cb38f0df63e20797c002208d2710104750c18a1dc84d54106a859a3f0"
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') that.log = () => {
- };
-} else {
- cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
-}
-const JD_API_HOST = 'https://api.m.jd.com/client.action';
-const inviteCodes = [
-]
-!(async () => {
- message += "[通知] 动动赚赚 \n\n --- \n\n"
- $.tuanList = []
- await requireConfig();
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取动动账号一cookie\n直接使用NobyDa的动动签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- await $.wait(Math.floor(Math.random() * (600000) + 5000));
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await TotalBean();
-
- username = $.UserName
- if ($.UserName == "jd_66ea783827d30"){
- username = "跑腿小弟"
- }
- if ($.UserName == "jd_4521b375ebb5d"){
- username = "锟锟"
- }
- if ($.UserName == "jd_542c10c0222bc"){
- username = "康康"
- }
- //加上名称
- message = message + "【羊毛姐妹】" + username + " \n\n "
-
- that.log(`\n******开始【动动账号${$.index}】${$.nickName || $.UserName}*********\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `动动账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `动动账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- }
- continue
- }
- await shareCodesFormat()
- await jdWish()
- }
- message += "----\n\n"
- }
-
- for (let i = 0; i < cookiesArr.length; i++) {
- $.canHelp = true
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- await getUserTuanInfo()
- await getHelpTuan();
- for (let j = 0; j < $.tuanList.length; ++j) {
- await helpFriendTuan($.tuanList[j])
- if(!$.canHelp) break
- }
- await setHelpTuan();
- }
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- message = message + getPic()
- that.log(message)
- postToDingTalk(message)
- $.done();
- })
-
-async function jdWish() {
- $.bean = 0
- $.tuan = null
- $.hasOpen = false
- await getTaskList(true)
- await getUserTuanInfo()
- if (!$.tuan) {
- await openTuan()
- if ($.hasOpen) await getUserTuanInfo()
- }
- if ($.tuan) $.tuanList.push($.tuan)
- await helpFriends()
- await getUserInfo()
- $.nowBean = parseInt($.totalBeanNum)
- $.nowNum = parseInt($.totalNum)
- for (let i = 0; i < $.taskList.length; ++i) {
- let task = $.taskList[i]
- if (task['taskId'] === 1 && task['status'] !== 2) {
- that.log(`去做任务:${task.taskName}`)
- await doTask({"taskId": task['taskId'],"mpVersion":"3.4.0"})
- } else if (task['taskId'] !== 3 && task['status'] !== 2) {
- that.log(`去做任务:${task.taskName}`)
- if(task['itemId'])
- await doTask({"itemId":task['itemId'],"taskId":task['taskId'],"mpVersion":"3.4.0"})
- else
- await doTask({"taskId": task['taskId'],"mpVersion":"3.4.0"})
- await $.wait(3000)
- }
- }
- await getTaskList();
- await showMsg();
-}
-
-function showMsg() {
- return new Promise(async resolve => {
- message += "" + `本次获得${parseInt($.totalBeanNum) - $.nowBean}京豆,${parseInt($.totalNum) - $.nowNum}金币\n` + "\n\n"
- message += "" + `累计获得${$.totalBeanNum}京豆,${$.totalNum}金币\n可兑换${$.totalNum / 10000}元无门槛红包` + "\n\n"
- if (parseInt($.totalBeanNum) - $.nowBean > 0) {
- $.msg($.name, '', `动动账号${$.index} ${$.nickName}\n${message}`);
- } else {
- $.log(message)
- }
- // 云端大于10元无门槛红包时进行通知推送
- if ($.isNode() && $.totalNum >= 1000000) await notify.sendNotify(`${$.name} - 动动账号${$.index} - ${$.nickName}`, `动动账号${$.index} ${$.nickName}\n当前金币:${$.totalNum}个\n可兑换无门槛红包:${parseInt($.totalNum) / 10000}元\n`,)
- resolve();
- })
-}
-// function getAuthorShareCode(url) {
-// return new Promise(resolve => {
-// $.get({url: `${url}?${new Date()}`,
-// headers:{
-// "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"
-// }}, async (err, resp, data) => {
-// try {
-// if (err) {
-// } else {
-// $.tuanList = $.tuanList.concat(JSON.parse(data))
-// that.log(`作者助力码获取成功`)
-// }
-// } catch (e) {
-// $.logErr(e, resp)
-// } finally {
-// resolve();
-// }
-// })
-// })
-// }
-function helpFriendTuan(body) {
- return new Promise(resolve => {
- $.get(taskTuanUrl("vvipclub_distributeBean_assist", body), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- if (data.success) {
- that.log('助力成功')
- } else {
- if (data.resultCode === '9200008') that.log('不能助力自己')
- else if (data.resultCode === '9200011') that.log('已经助力过')
- else if (data.resultCode === '2400205') that.log('团已满')
- else if (data.resultCode === '2400203') {that.log('助力次数已耗尽');$.canHelp = false}
- else that.log(`未知错误`)
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-
-function getUserTuanInfo() {
- let body = {"paramData": {"channel": "FISSION_BEAN"}}
- return new Promise(resolve => {
- $.get(taskTuanUrl("distributeBeanActivityInfo", body), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- if (data.data && !data.data.canStartNewAssist) {
- $.tuan = {
- "activityIdEncrypted": data.data.id,
- "assistStartRecordId": data.data.assistStartRecordId,
- "assistedPinEncrypted": data.data.encPin,
- "channel": "FISSION_BEAN"
- }
- $.tuanActId = data.data.id
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-
-function openTuan() {
- let body = {"activityIdEncrypted": $.tuanActId, "channel": "FISSION_BEAN"}
- return new Promise(resolve => {
- $.get(taskTuanUrl("vvipclub_distributeBean_startAssist", body), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- if (data['success']) {
- $.hasOpen = true
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-
-function getUserInfo() {
- return new Promise(resolve => {
- $.get(taskUrl("interactIndex"), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- // if (data.data.shareTaskRes) {
- // that.log(`\n【动动账号${$.index}(${$.nickName || $.UserName})的${$.name}好友互助码】${data.data.shareTaskRes.itemId}\n`);
- // } else {
- // that.log(`\n\n已满5人助力或助力功能已下线,故暂时无${$.name}好友助力码\n\n`)
- // }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-
-function getTaskList(flag = false) {
- return new Promise(resolve => {
- $.get(taskUrl("interactTaskIndex"), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- $.taskList = data.data.taskDetailResList
- $.totalNum = data.data.totalNum
- $.totalBeanNum = data.data.totalBeanNum
- if (flag && $.taskList.filter(item => !!item && item['taskId']=== 3) && $.taskList.filter(item => !!item && item['taskId']=== 3).length) {
- $.shareId=$.taskList.filter(item => !!item && item['taskId']=== 3)[0]['itemId'];
- that.log(`\n【动动账号${$.index}(${$.nickName || $.UserName})的${$.name}好友互助码】${$.taskList.filter(item => !!item && item['taskId']=== 3)[0]['itemId']}\n`);
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-
-// 完成
-function doTask(body, func = "doInteractTask") {
- // that.log(taskUrl("doInteractTask", body))
- return new Promise(resolve => {
- $.get(taskUrl(func, body), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- // that.log(data)
- if (func === "doInteractTask") {
- if (data.subCode === "S000") {
- that.log(`任务完成,获得 ${data.data.taskDetailResList[0].incomeAmountConf} 金币,${data.data.taskDetailResList[0].beanNum} 京豆`)
- $.bean += parseInt(data.data.taskDetailResList[0].beanNum)
- } else {
- that.log(`任务失败,错误信息:${data.message}`)
- }
- } else {
- that.log(`${data.data.helpResDesc}`)
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-
-async function helpFriends() {
- await getHelp();
- for (let code of $.newShareCodes) {
- if (!code) continue
- await doTask({"itemId": code, "taskId": "3", "mpVersion": "3.4.0"}, "doHelpTask")
- }
- await setHelp();
-}
-// function readShareCode() {
-// that.log(`开始`)
-// return new Promise(async resolve => {
-// $.get({url: `https://code.chiang.fun/api/v1/jd/jdzz/read/${randomCount}/`, 'timeout': 10000}, (err, resp, data) => {
-// try {
-// if (err) {
-// that.log(`${JSON.stringify(err)}`)
-// that.log(`${$.name} API请求失败,请检查网路重试`)
-// } else {
-// if (data) {
-// that.log(`随机取${randomCount}个码放到您固定的互助码后面(不影响已有固定互助)`)
-// data = JSON.parse(data);
-// }
-// }
-// } catch (e) {
-// $.logErr(e, resp)
-// } finally {
-// resolve(data);
-// }
-// })
-// await $.wait(10000);
-// resolve()
-// })
-// }
-function getHelp() {
- $.newShareCodes = [];
- return new Promise(resolve => {
- $.get({
- url: "http://api.tyh52.com/act/get/jdzz/3"
- }, (err, resp, data) => {
- try {
- if (data) {
- data = JSON.parse(data);
- if (data.code == 1) {
- let list = data.data;
- if (!(list instanceof Array)) {
- list = JSON.parse(list);
- }
- if (list.length > 0) {
- for (var i in list) {
- $.newShareCodes.push(list[i]);
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- });
- }
-
- function setHelp() {
- return new Promise(resolve => {
- if ($.shareId) {
- $.get({
- url: "http://api.tyh52.com/act/set/jdzz/" + $.shareId
- }, (err, resp, data) => {
- try {
- if (data) {
- data = JSON.parse(data);
- if (data.code == 1) {
- that.log("提交自己的邀請碼成功");
- } else {
- that.log("提交邀请码失败," + data.message);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- } else {
- resolve();
- }
-
- });
- }
-
- function getHelpTuan() {
- $.tuanList = [];
- return new Promise(resolve => {
- $.get({
- url: "http://api.tyh52.com/act/get/jdzzTuan/3"
- }, (err, resp, data) => {
- try {
- if (data) {
- data = JSON.parse(data);
- if (data.code == 1) {
- let list = data.data;
- if (!(list instanceof Array)) {
- list = JSON.parse(list);
- }
- if (list.length > 0) {
- for (var item of list) {
- let its=item.split('@');
- if(its.length==2){
- let tuan={
- "activityIdEncrypted": $.tuanActId,
- "assistStartRecordId": its[0],
- "assistedPinEncrypted": its[1],
- "channel": "FISSION_BEAN"
- }
- $.tuanList.push(tuan);
- }
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- });
- }
-
- function setHelpTuan() {
- return new Promise(resolve => {
- if ($.tuan) {
- $.get({
- url: "http://api.tyh52.com/act/set/jdzzTuan/" + $.tuan.assistStartRecordId+'@'+$.tuan.assistedPinEncrypted
- }, (err, resp, data) => {
- try {
- if (data) {
- that.log(data);
- data = JSON.parse(data);
- if (data.code == 1) {
- that.log("提交自己的开团碼成功");
- }else{
- that.log("提交开团码失败," + data.message);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- } else {
- resolve();
- }
-
- });
- }
-//格式化助力码
-function shareCodesFormat() {
- return new Promise(async resolve => {
- // that.log(`第${$.index}个动动账号的助力码:::${$.shareCodesArr[$.index - 1]}`)
- $.newShareCodes = [];
- // if ($.shareCodesArr[$.index - 1]) {
- // $.newShareCodes = $.shareCodesArr[$.index - 1].split('@');
- // } else {
- // that.log(`由于您第${$.index}个动动账号未提供shareCode,将采纳本脚本自带的助力码\n`)
- // const tempIndex = $.index > inviteCodes.length ? (inviteCodes.length - 1) : ($.index - 1);
- // $.newShareCodes = inviteCodes[tempIndex].split('@');
- // }
- // const readShareCodeRes = await readShareCode();
- // if (readShareCodeRes && readShareCodeRes.code === 200) {
- // $.newShareCodes = [...new Set([...$.newShareCodes, ...(readShareCodeRes.data || [])])];
- // }
- // that.log(`第${$.index}个动动账号将要助力的好友${JSON.stringify($.newShareCodes)}`)
- resolve();
- })
-}
-
-function requireConfig() {
- return new Promise(resolve => {
- that.log(`开始获取${$.name}配置文件\n`);
- //Node.js用户请在jdCookie.js处填写动动ck;
- let shareCodes = [];
- if ($.isNode()) {
- if (process.env.JDZZ_SHARECODES) {
- if (process.env.JDZZ_SHARECODES.indexOf('\n') > -1) {
- shareCodes = process.env.JDZZ_SHARECODES.split('\n');
- } else {
- shareCodes = process.env.JDZZ_SHARECODES.split('&');
- }
- }
- }
- that.log(`共${cookiesArr.length}个动动账号\n`);
- $.shareCodesArr = [];
- if ($.isNode()) {
- Object.keys(shareCodes).forEach((item) => {
- if (shareCodes[item]) {
- $.shareCodesArr.push(shareCodes[item])
- }
- })
- }
- that.log(`您提供了${$.shareCodesArr.length}个账号的${$.name}助力码\n`);
- resolve()
- })
-}
-
-function taskUrl(functionId, body = {}) {
- return {
- url: `${JD_API_HOST}?functionId=${functionId}&body=${escape(JSON.stringify(body))}&client=wh5&clientVersion=9.1.0`,
- headers: {
- 'Cookie': cookie,
- 'Host': 'api.m.jd.com',
- 'Connection': 'keep-alive',
- 'Content-Type': 'application/json',
- 'Referer': 'http://wq.jd.com/wxapp/pages/hd-interaction/index/index',
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
- 'Accept-Language': 'zh-cn',
- 'Accept-Encoding': 'gzip, deflate, br',
- }
- }
-}
-
-function taskTuanUrl(function_id, body = {}) {
- return {
- url: `${JD_API_HOST}?functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=swat_miniprogram&osVersion=5.0.0&clientVersion=3.1.3&fromType=wxapp×tamp=${new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000}`,
- headers: {
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-cn",
- "Connection": "keep-alive",
- "Content-Type": "application/x-www-form-urlencoded",
- "Host": "api.m.jd.com",
- "Referer": "https://servicewechat.com/wxa5bf5ee667d91626/108/page-frame.html",
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
- }
- }
-}
-
-function taskPostUrl(function_id, body = {}) {
- return {
- url: `${JD_API_HOST}?functionId=${function_id}`,
- body: body,
- headers: {
- "Cookie": cookie,
- 'Content-Type': 'application/x-www-form-urlencoded',
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
- }
- }
-}
-
-function TotalBean() {
- return new Promise(async resolve => {
- const options = {
- "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
- "headers": {
- "Accept": "application/json,text/plain, */*",
- "Content-Type": "application/x-www-form-urlencoded",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-cn",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0")
- }
- }
- $.post(options, (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- data = JSON.parse(data);
- if (data['retcode'] === 13) {
- $.isLogin = false; //cookie过期
- return
- }
- if (data['retcode'] === 0) {
- $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
- } else {
- $.nickName = $.UserName
- }
- } else {
- that.log(`动动服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-
-function safeGet(data) {
- try {
- if (typeof JSON.parse(data) == "object") {
- return true;
- }
- } catch (e) {
- that.log(e);
- that.log(`动动服务器访问数据为空,请检查自身设备网络情况`);
- return false;
- }
-}
-
-function jsonParse(str) {
- if (typeof str == "string") {
- try {
- return JSON.parse(str);
- } catch (e) {
- that.log(e);
- $.msg($.name, '', '不要在BoxJS手动复制粘贴修改cookie')
- return [];
- }
- }
-}
-
-
-
-//我加的函数
-function postToDingTalk(messgae) {
-
- const message1 = "" + messgae
- that.log(messgae)
-
- const body = {
- "msgtype": "markdown",
- "markdown": {
- "title":"动动赚赚",
- "text": message1
- },
- "at": {
- "atMobiles": [],
- "isAtAll": false
- }
- }
-
-
- $.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
- try {
- that.log(resp)
- that.log(data)
- if (err) {
- that.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- $.duckRes = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- },"json")
-}
-
-
-function toDingtalk(urlmain, bodyMain) {
- return {
- url: urlmain,
- body:bodyMain,
- headers: { 'Content-Type': 'application/json;charset=utf-8' },
- timeout: 10000,
- }
-}
-
-function getPic(){
- let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
- let address = "\n\n )
- address = address + code[pos] + ")"
- return address
-}
\ No newline at end of file
diff --git a/src/main/resources/test_our.js b/src/main/resources/test_our.js
deleted file mode 100644
index 1f09910..0000000
--- a/src/main/resources/test_our.js
+++ /dev/null
@@ -1,2162 +0,0 @@
-/*
-京东资产变动通知脚本:https://jdsharedresourcescdn.azureedge.net/jdresource/jd_bean_change.js
-Modified time: 2021-05-17 15:25:41
-统计昨日京豆的变化情况,包括收入,支出,以及显示当前京豆数量,目前小问题:下单使用京豆后,退款重新购买,计算统计会出现异常
-统计红包以及过期红包
-网页查看地址 : https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean
-支持京东双账号
-脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
-============QuantumultX==============
-[task_local]
-#京东资产变动通知
-2 9 * * * https://jdsharedresourcescdn.azureedge.net/jdresource/jd_bean_change.js, tag=京东资产变动通知, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
-================Loon===============
-[Script]
-cron "2 9 * * *" script-path=https://jdsharedresourcescdn.azureedge.net/jdresource/jd_bean_change.js, tag=京东资产变动通知
-=============Surge===========
-[Script]
-京东资产变动通知 = type=cron,cronexp="2 9 * * *",wake-system=1,timeout=3600,script-path=https://jdsharedresourcescdn.azureedge.net/jdresource/jd_bean_change.js
-============小火箭=========
-京东资产变动通知 = type=cron,script-path=https://jdsharedresourcescdn.azureedge.net/jdresource/jd_bean_change.js, cronexpr="2 9 * * *", timeout=3600, enable=true
- */
-let roleMap = {
- "jd_66ea783827d30":"军军酱",
- "jd_4311ac0ff4456":"居居酱"
-}
-let dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=d2b6042cb38f0df63e20797c002208d2710104750c18a1dc84d54106a859a3f0"
-const $ = new Env('京东资产变动通知');
-let jdFruitShareArr = [], isBox = false, notify, newShareCodes;
-//助力好友分享码(最多4个,否则后面的助力失败),原因:动动农场每人每天只有四次助力机会
-//此此内容是IOS用户下载脚本到本地使用,填写互助码的地方,同一动动账号的好友互助码请使用@符号隔开。
-//下面给出两个账号的填写示例(iOS只支持2个动动账号)
-let shareCodes =
- [ // 这个列表填入你要助力的好友的shareCode
-]
-let subTitle = '', option = {}, isFruitFinished = false;
-const retainWater = 100;//保留水滴大于多少g,默认100g;
-let jdNotify = false;//是否关闭通知,false打开通知推送,true关闭通知推送
-let jdFruitBeanCard = false;//农场使用水滴换豆卡(如果出现限时活动时100g水换20豆,此时比浇水划算,推荐换豆),true表示换豆(不浇水),false表示不换豆(继续浇水),脚本默认是浇水
-let randomCount = $.isNode() ? 0 : 0;
-const JD_API_HOST = 'https://api.m.jd.com/client.action';
-const urlSchema = `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/3KSjXqQabiTuD1cJ28QskrpWoBKT/index.html%22%20%7D`;
-
-let allMessage = '';
-let message = "";
-//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-!(async () => {
- await requireConfig();
- message += "[通知] 资产变动 \n\n --- \n\n"
- if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
- return;
- }
- for (let i = 0; i < cookiesArr.length; i++) {
- if (cookiesArr[i]) {
- cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
- $.index = i + 1;
- $.beanCount = 0;
- $.incomeBean = 0;
- $.expenseBean = 0;
- $.todayIncomeBean = 0;
- $.errorMsg = '';
- $.isLogin = true;
- $.nickName = '';
- $.balance = 0;
- $.expiredBalance = 0;
-
- username = $.UserName
- if (roleMap[username] == undefined){
- continue
- }
- username = roleMap[username]
-
- await TotalBean();
- //加上名称
- message = message + "【羊毛姐妹】" + username + `( ${$.nickName} )`+ " \n\n "
-
- console.log(`\n********开始【京东账号${$.index}】${$.nickName || $.UserName}******\n`);
- if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
-
- if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- }
- continue
- }
- await bean();
- await showMsg();
- await shareCodesFormat();
- await jdFruit();
- await jdWish()
- }
- message += "----\n\n"
- }
-
- if ($.isNode() && allMessage) {
- await notify.sendNotify(`${$.name}`, `${allMessage}`, { url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean` })
- }
-})()
- .catch((e) => {
- $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- })
- .finally(() => {
- message = message
- postToDingTalk(message)
- $.done();
- })
-
-
- function requireConfig() {
- return new Promise(resolve => {
- that.log('开始获取配置文件\n')
- notify = $.isNode() ? require('./sendNotify') : '';
- //Node.js用户请在jdCookie.js处填写动动ck;
- const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
- const jdFruitShareCodes = $.isNode() ? require('./jdFruitShareCodes.js') : '';
- //IOS等用户直接用NobyDa的jd cookie
- if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- if (jdCookieNode[item]) {
- cookiesArr.push(jdCookieNode[item])
- }
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') that.log = () => {};
- } else {
- let cookiesData = $.getdata('CookiesJD') || "[]";
- cookiesData = jsonParse(cookiesData);
- cookiesArr = cookiesData.map(item => item.cookie);
- cookiesArr.reverse();
- cookiesArr.push(...[$.getdata('CookieJD2'), $.getdata('CookieJD')]);
- cookiesArr.reverse();
- cookiesArr = cookiesArr.filter(item => item !== "" && item !== null && item !== undefined);
- }
- that.log(`共${cookiesArr.length}个动动账号\n`)
- resolve()
- })
- }
-
-async function showMsg() {
- // if ($.errorMsg) return
- allMessage += `账号${$.index}:${$.nickName || $.UserName}\n今日收入:${$.todayIncomeBean}京豆 🐶\n昨日收入:${$.incomeBean}京豆 🐶\n昨日支出:${$.expenseBean}京豆 🐶\n当前京豆:${$.beanCount}(今日将过期${$.expirejingdou})京豆 🐶${$.message}${$.index !== cookiesArr.length ? '\n\n' : ''}`;
- message += "" + `【总京豆】:${$.beanCount}( 今日将过期${$.expirejingdou} )京豆 🐶` +"\n\n"
- message += "" + `【今日收入】:${$.todayIncomeBean}京豆 🐶` +"\n\n"
- message += "" + `【昨日收入】:${$.incomeBean}京豆 🐶` +"\n\n"
- message += "" + `【昨日支出】:${$.expenseBean}京豆 🐶` +"\n\n"
-
-
-
- message += "" + `【当前总红包】:${$.balance}( 今日总过期${$.expiredBalance} )元 🧧` +"\n\n"
- message += "" + `【京喜红包】:${$.jxRed}( 今日将过期${$.jxRedExpire.toFixed(2)} )元 🧧` +"\n\n"
- message += "" + `【极速红包】:${$.jsRed}( 今日将过期${$.jsRedExpire.toFixed(2)} )元 🧧` +"\n\n"
- message += "" + `【京东红包】:${$.jdRed}( 今日将过期${$.jdRedExpire.toFixed(2)} )元 🧧` +"\n\n"
- message += "" + `【健康红包】:${$.jdhRed}( 今日将过期${$.jdhRedExpire.toFixed(2)} )元 🧧` +"\n\n"
- // if ($.isNode()) {
- // await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `账号${$.index}:${$.nickName || $.UserName}\n昨日收入:${$.incomeBean}京豆 🐶\n昨日支出:${$.expenseBean}京豆 🐶\n当前京豆:${$.beanCount}京豆 🐶${$.message}`, { url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean` })
- // }
- $.msg($.name, '', `账号${$.index}:${$.nickName || $.UserName}\n今日收入:${$.todayIncomeBean}京豆 🐶\n昨日收入:${$.incomeBean}京豆 🐶\n昨日支出:${$.expenseBean}京豆 🐶\n当前京豆:${$.beanCount}(今日将过期${$.expirejingdou})京豆🐶${$.message}`, {"open-url": "https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean"});
-}
-
-async function bean() {
- // console.log(`北京时间零点时间戳:${parseInt((Date.now() + 28800000) / 86400000) * 86400000 - 28800000}`);
- // console.log(`北京时间2020-10-28 06:16:05::${new Date("2020/10/28 06:16:05+08:00").getTime()}`)
- // 不管哪个时区。得到都是当前时刻北京时间的时间戳 new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000
-
- //前一天的0:0:0时间戳
- const tm = parseInt((Date.now() + 28800000) / 86400000) * 86400000 - 28800000 - (24 * 60 * 60 * 1000);
- // 今天0:0:0时间戳
- const tm1 = parseInt((Date.now() + 28800000) / 86400000) * 86400000 - 28800000;
- let page = 1, t = 0, yesterdayArr = [], todayArr = [];
- do {
- let response = await getJingBeanBalanceDetail(page);
- // console.log(`第${page}页: ${JSON.stringify(response)}`);
- if (response && response.code === "0") {
- page++;
- let detailList = response.detailList;
- if (detailList && detailList.length > 0) {
- for (let item of detailList) {
- const date = item.date.replace(/-/g, '/') + "+08:00";
- if (new Date(date).getTime() >= tm1 && (!item['eventMassage'].includes("退还") && !item['eventMassage'].includes('扣赠'))) {
- todayArr.push(item);
- } else if (tm <= new Date(date).getTime() && new Date(date).getTime() < tm1 && (!item['eventMassage'].includes("退还") && !item['eventMassage'].includes('扣赠'))) {
- //昨日的
- yesterdayArr.push(item);
- } else if (tm > new Date(date).getTime()) {
- //前天的
- t = 1;
- break;
- }
- }
- } else {
- $.errorMsg = `数据异常`;
- $.msg($.name, ``, `账号${$.index}:${$.nickName}\n${$.errorMsg}`);
- t = 1;
- }
- } else if (response && response.code === "3") {
- console.log(`cookie已过期,或者填写不规范,跳出`)
- t = 1;
- } else {
- console.log(`未知情况:${JSON.stringify(response)}`);
- console.log(`未知情况,跳出`)
- t = 1;
- }
- } while (t === 0);
- for (let item of yesterdayArr) {
- if (Number(item.amount) > 0) {
- $.incomeBean += Number(item.amount);
- } else if (Number(item.amount) < 0) {
- $.expenseBean += Number(item.amount);
- }
- }
- for (let item of todayArr) {
- if (Number(item.amount) > 0) {
- $.todayIncomeBean += Number(item.amount);
- }
- }
- await queryexpirejingdou();//过期京豆
- await redPacket();//过期红包
- // console.log(`昨日收入:${$.incomeBean}个京豆 🐶`);
- // console.log(`昨日支出:${$.expenseBean}个京豆 🐶`)
-}
-function TotalBean() {
- return new Promise(async resolve => {
- const options = {
- url: "https://me-api.jd.com/user_new/info/GetJDUserInfoUnion",
- headers: {
- Host: "me-api.jd.com",
- Accept: "*/*",
- Connection: "keep-alive",
- Cookie: cookie,
- "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"),
- "Accept-Language": "zh-cn",
- "Referer": "https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&",
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- $.logErr(err)
- } else {
- if (data) {
- data = JSON.parse(data);
- if (data['retcode'] === "1001") {
- $.isLogin = false; //cookie过期
- return;
- }
- if (data['retcode'] === "0" && data.data && data.data.hasOwnProperty("userInfo")) {
- $.nickName = data.data.userInfo.baseInfo.nickname;
- }
- if (data['retcode'] === '0' && data.data && data.data['assetInfo']) {
- $.beanCount = data.data && data.data['assetInfo']['beanNum'];
- }
- } else {
- $.log('京东服务器返回空数据');
- }
- }
- } catch (e) {
- $.logErr(e)
- } finally {
- resolve();
- }
- })
- })
-}
-function getJingBeanBalanceDetail(page) {
- return new Promise(async resolve => {
- const options = {
- "url": `https://api.m.jd.com/client.action?functionId=getJingBeanBalanceDetail`,
- "body": `body=${escape(JSON.stringify({"pageSize": "20", "page": page.toString()}))}&appid=ld`,
- "headers": {
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (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"),
- 'Host': 'api.m.jd.com',
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Cookie': cookie,
- }
- }
- $.post(options, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- data = JSON.parse(data);
- // console.log(data)
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function queryexpirejingdou() {
- return new Promise(async resolve => {
- const options = {
- "url": `https://wq.jd.com/activep3/singjd/queryexpirejingdou?_=${Date.now()}&g_login_type=1&sceneval=2`,
- "headers": {
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-cn",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "Host": "wq.jd.com",
- "Referer": "https://wqs.jd.com/promote/201801/bean/mybean.html",
- "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.1 Mobile/15E148 Safari/604.1"
- }
- }
- $.expirejingdou = 0;
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- // console.log(data)
- data = JSON.parse(data.slice(23, -13));
- // console.log(data)
- if (data.ret === 0) {
- data['expirejingdou'].map(item => {
- console.log(`${timeFormat(item['time'] * 1000)}日过期京豆:${item['expireamount']}\n`);
- })
- $.expirejingdou = data['expirejingdou'][0]['expireamount'];
- // if ($.expirejingdou > 0) {
- // $.message += `\n今日将过期:${$.expirejingdou}京豆 🐶`;
- // }
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
-}
-function redPacket() {
- return new Promise(async resolve => {
- const options = {
- "url": `https://m.jingxi.com/user/info/QueryUserRedEnvelopesV2?type=1&orgFlag=JD_PinGou_New&page=1&cashRedType=1&redBalanceFlag=1&channel=1&_=${+new Date()}&sceneval=2&g_login_type=1&g_ty=ls`,
- "headers": {
- 'Host': 'm.jingxi.com',
- 'Accept': '*/*',
- 'Connection': 'keep-alive',
- 'Accept-Language': 'zh-cn',
- 'Referer': 'https://st.jingxi.com/my/redpacket.shtml?newPg=App&jxsid=16156262265849285961',
- 'Accept-Encoding': 'gzip, deflate, br',
- "Cookie": cookie,
- '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")
- }
- }
- $.get(options, (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- data = JSON.parse(data).data
- $.jxRed = 0, $.jsRed = 0, $.jdRed = 0, $.jdhRed = 0, $.jxRedExpire = 0, $.jsRedExpire = 0, $.jdRedExpire = 0, $.jdhRedExpire = 0;
- let t = new Date()
- t.setDate(t.getDate() + 1)
- t.setHours(0, 0, 0, 0)
- t = parseInt((t - 1) / 1000)
- for (let vo of data.useRedInfo.redList || []) {
- if (vo.orgLimitStr && vo.orgLimitStr.includes("京喜")) {
- $.jxRed += parseFloat(vo.balance)
- if (vo['endTime'] === t) {
- $.jxRedExpire += parseFloat(vo.balance)
- }
- } else if (vo.activityName.includes("极速版")) {
- $.jsRed += parseFloat(vo.balance)
- if (vo['endTime'] === t) {
- $.jsRedExpire += parseFloat(vo.balance)
- }
- } else if (vo.orgLimitStr && vo.orgLimitStr.includes("京东健康")) {
- $.jdhRed += parseFloat(vo.balance)
- if (vo['endTime'] === t) {
- $.jdhRedExpire += parseFloat(vo.balance)
- }
- } else {
- $.jdRed += parseFloat(vo.balance)
- if (vo['endTime'] === t) {
- $.jdRedExpire += parseFloat(vo.balance)
- }
- }
- }
- $.jxRed = $.jxRed.toFixed(2)
- $.jsRed = $.jsRed.toFixed(2)
- $.jdRed = $.jdRed.toFixed(2)
- $.jdhRed = $.jdhRed.toFixed(2)
- $.balance = data.balance
- $.expiredBalance = ($.jxRedExpire + $.jsRedExpire + $.jdRedExpire).toFixed(2)
- $.message += `\n当前总红包:${$.balance}(今日总过期${$.expiredBalance})元 🧧\n京喜红包:${$.jxRed}(今日将过期${$.jxRedExpire.toFixed(2)})元 🧧\n极速红包:${$.jsRed}(今日将过期${$.jsRedExpire.toFixed(2)})元 🧧\n京东红包:${$.jdRed}(今日将过期${$.jdRedExpire.toFixed(2)})元 🧧\n健康红包:${$.jdhRed}(今日将过期${$.jdhRedExpire.toFixed(2)})元 🧧`;
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function jsonParse(str) {
- if (typeof str == "string") {
- try {
- return JSON.parse(str);
- } catch (e) {
- console.log(e);
- $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
- return [];
- }
- }
-}
-function timeFormat(time) {
- let date;
- if (time) {
- date = new Date(time)
- } else {
- date = new Date();
- }
- return date.getFullYear() + '-' + ((date.getMonth() + 1) >= 10 ? (date.getMonth() + 1) : '0' + (date.getMonth() + 1)) + '-' + (date.getDate() >= 10 ? date.getDate() : '0' + date.getDate());
-}
-// prettier-ignore
-function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,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)}
-
-//农场代码
-
-async function jdFruit() {
- subTitle = `【动动账号${$.index}】${$.nickName}`;
- try {
- await initForFarm();
- if ($.farmInfo.farmUserPro) {
- // option['media-url'] = $.farmInfo.farmUserPro.goodsImage;
- message = message + "【水果名称】 " + `${$.farmInfo.farmUserPro.name}` + "\n\n";
- // message += "【已兑换水果】" + `${$.farmInfo.farmUserPro.winTimes}` + "次\n\n";
- that.log(`\n【动动账号${$.index}(${$.nickName || $.UserName})的${$.name}好友互助码】${$.farmInfo.farmUserPro.shareCode}\n`);
- that.log(`\n【已成功兑换水果】${$.farmInfo.farmUserPro.winTimes}次\n`);
- await getHelp();
- await masterHelpShare();//助力好友
- await setHelp();
- if ($.farmInfo.treeState === 2 || $.farmInfo.treeState === 3) {
- option['open-url'] = urlSchema;
- message = message + " " + $.UserName + "\n【提醒⏰】" + fruitName + "已可领取\n请去动动APP或微信小程序查看\n点击弹窗即达"
- $.msg($.name, ``, `【动动账号${$.index}】${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去动动APP或微信小程序查看\n点击弹窗即达`, option);
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}水果已可领取`, `【动动账号${$.index}】${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去动动APP或微信小程序查看`);
- }
- return
- } else if ($.farmInfo.treeState === 1) {
- that.log(`\n${$.farmInfo.farmUserPro.name}种植中...\n`)
- } else if ($.farmInfo.treeState === 0) {
- //已下单购买, 但未开始种植新的水果
- option['open-url'] = urlSchema;
- $.msg($.name, ``, `【动动账号${$.index}】 ${$.nickName || $.UserName}\n【提醒⏰】您忘了种植新的水果\n请去动动APP或微信小程序选购并种植新的水果\n点击弹窗即达`, option);
- message = message + " " + $.UserName + " \n【提醒⏰】您忘了种植新的水果\n请去动动APP或微信小程序选购并种植新的水果\n点击弹窗即达" + ""
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 您忘了种植新的水果`, `动动账号${$.index} ${$.nickName}\n【提醒⏰】您忘了种植新的水果\n请去动动APP或微信小程序选购并种植新的水果`);
- }
- return
- }
- await doDailyTask();
- await doTenWater();//浇水十次
- await getFirstWaterAward();//领取首次浇水奖励
- await getTenWaterAward();//领取10浇水奖励
- await getWaterFriendGotAward();//领取为2好友浇水奖励
- await duck();
- await doTenWaterAgain();//再次浇水
- await predictionFruit();//预测水果成熟时间
- } else {
- that.log(`初始化农场数据异常, 请登录动动 app查看农场0元水果功能是否正常,农场初始化数据: ${JSON.stringify($.farmInfo)}`);
- }
- } catch (e) {
- that.log(`任务执行异常,请检查执行日志 ‼️‼️`);
- $.logErr(e);
- }
- }
- async function doDailyTask() {
- await taskInitForFarm();
- that.log(`开始签到`);
- if (!$.farmTask.signInit.todaySigned) {
- await signForFarm(); //签到
- if ($.signResult.code === "0") {
- that.log(`【签到成功】获得${$.signResult.amount}g💧\\n`)
- //message += `【签到成功】获得${$.signResult.amount}g💧\n`//连续签到${signResult.signDay}天
- } else {
- // message += `签到失败,详询日志\n`;
- that.log(`签到结果: ${JSON.stringify($.signResult)}`);
- }
- } else {
- that.log(`今天已签到,连续签到${$.farmTask.signInit.totalSigned},下次签到可得${$.farmTask.signInit.signEnergyEachAmount}g\n`);
- }
- // 被水滴砸中
- that.log(`被水滴砸中: ${$.farmInfo.todayGotWaterGoalTask.canPop ? '是' : '否'}`);
- if ($.farmInfo.todayGotWaterGoalTask.canPop) {
- await gotWaterGoalTaskForFarm();
- if ($.goalResult.code === '0') {
- that.log(`【被水滴砸中】获得${$.goalResult.addEnergy}g💧\\n`);
- // message += `【被水滴砸中】获得${$.goalResult.addEnergy}g💧\n`
- }
- }
- that.log(`签到结束,开始广告浏览任务`);
- if (!$.farmTask.gotBrowseTaskAdInit.f) {
- let adverts = $.farmTask.gotBrowseTaskAdInit.userBrowseTaskAds
- let browseReward = 0
- let browseSuccess = 0
- let browseFail = 0
- for (let advert of adverts) { //开始浏览广告
- if (advert.limit <= advert.hadFinishedTimes) {
- // browseReward+=advert.reward
- that.log(`${advert.mainTitle}+ ' 已完成`);//,获得${advert.reward}g
- continue;
- }
- that.log('正在进行广告浏览任务: ' + advert.mainTitle);
- await browseAdTaskForFarm(advert.advertId, 0);
- if ($.browseResult.code === '0') {
- that.log(`${advert.mainTitle}浏览任务完成`);
- //领取奖励
- await browseAdTaskForFarm(advert.advertId, 1);
- if ($.browseRwardResult.code === '0') {
- that.log(`领取浏览${advert.mainTitle}广告奖励成功,获得${$.browseRwardResult.amount}g`)
- browseReward += $.browseRwardResult.amount
- browseSuccess++
- } else {
- browseFail++
- that.log(`领取浏览广告奖励结果: ${JSON.stringify($.browseRwardResult)}`)
- }
- } else {
- browseFail++
- that.log(`广告浏览任务结果: ${JSON.stringify($.browseResult)}`);
- }
- }
- if (browseFail > 0) {
- that.log(`【广告浏览】完成${browseSuccess}个,失败${browseFail},获得${browseReward}g💧\\n`);
- // message += `【广告浏览】完成${browseSuccess}个,失败${browseFail},获得${browseReward}g💧\n`;
- } else {
- that.log(`【广告浏览】完成${browseSuccess}个,获得${browseReward}g💧\n`);
- // message += `【广告浏览】完成${browseSuccess}个,获得${browseReward}g💧\n`;
- }
- } else {
- that.log(`今天已经做过浏览广告任务\n`);
- }
- //定时领水
- if (!$.farmTask.gotThreeMealInit.f) {
- //
- await gotThreeMealForFarm();
- if ($.threeMeal.code === "0") {
- that.log(`【定时领水】获得${$.threeMeal.amount}g💧\n`);
- // message += `【定时领水】获得${$.threeMeal.amount}g💧\n`;
- } else {
- // message += `【定时领水】失败,详询日志\n`;
- that.log(`定时领水成功结果: ${JSON.stringify($.threeMeal)}`);
- }
- } else {
- that.log('当前不在定时领水时间断或者已经领过\n')
- }
- //给好友浇水
- if (!$.farmTask.waterFriendTaskInit.f) {
- if ($.farmTask.waterFriendTaskInit.waterFriendCountKey < $.farmTask.waterFriendTaskInit.waterFriendMax) {
- await doFriendsWater();
- }
- } else {
- that.log(`给${$.farmTask.waterFriendTaskInit.waterFriendMax}个好友浇水任务已完成\n`)
- }
- // await Promise.all([
- // clockInIn(),//打卡领水
- // executeWaterRains(),//水滴雨
- // masterHelpShare(),//助力好友
- // getExtraAward(),//领取额外水滴奖励
- // turntableFarm()//天天抽奖得好礼
- // ])
- // await getAwardInviteFriend();
- await clockInIn();//打卡领水
- await executeWaterRains();//水滴雨
- await getExtraAward();//领取额外水滴奖励
- await turntableFarm()//天天抽奖得好礼
- }
- async function predictionFruit() {
- that.log('开始预测水果成熟时间\n');
- await initForFarm();
- await taskInitForFarm();
- let waterEveryDayT = $.farmTask.totalWaterTaskInit.totalWaterTaskTimes;//今天到到目前为止,浇了多少次水
- // message += "【今日共浇水】" + `${waterEveryDayT}` + "次 \n\n"
- message += "【剩余 水滴】" + `${$.farmInfo.farmUserPro.totalEnergy}` + "g💧 \n\n"
- message += "【水果🍉进度】" + `${(($.farmInfo.farmUserPro.treeEnergy /
- $.farmInfo.farmUserPro.treeTotalEnergy) * 100).toFixed(2)}` + "%,已浇水" +`${$.farmInfo.farmUserPro.treeEnergy / 10}` + "次,还需"+`${($.farmInfo.farmUserPro.treeTotalEnergy - $.farmInfo.farmUserPro.treeEnergy) / 10}` +"次 \n\n"
- if ($.farmInfo.toFlowTimes > ($.farmInfo.farmUserPro.treeEnergy / 10)) {
- message += "【水果🍉进度】" + `【开花进度】再浇水${$.farmInfo.toFlowTimes - $.farmInfo.farmUserPro.treeEnergy / 10}次开花\n\n` +"\n\n"
- } else if ($.farmInfo.toFruitTimes > ($.farmInfo.farmUserPro.treeEnergy / 10)) {
- message += "【水果🍉进度】" + `【结果进度】再浇水${$.farmInfo.toFruitTimes - $.farmInfo.farmUserPro.treeEnergy / 10}次结果\n\n` + "\n\n"
- }
- // 预测n天后水果课可兑换功能
- let waterTotalT = ($.farmInfo.farmUserPro.treeTotalEnergy - $.farmInfo.farmUserPro.treeEnergy - $.farmInfo.farmUserPro.totalEnergy) / 10;//一共还需浇多少次水
-
- let waterD = Math.ceil(waterTotalT / waterEveryDayT);
-
- message = message + "" + `【预测🍉收获时间】${waterD === 1 ? '明天' : waterD === 2 ? '后天' : waterD + '天之后'}(${timeFormat(24 * 60 * 60 * 1000 * waterD + Date.now())}日)可兑换水果🍉` +"\n\n";
- }
- //浇水十次
- async function doTenWater() {
- jdFruitBeanCard = $.getdata('jdFruitBeanCard') ? $.getdata('jdFruitBeanCard') : jdFruitBeanCard;
- if ($.isNode() && process.env.FRUIT_BEAN_CARD) {
- jdFruitBeanCard = process.env.FRUIT_BEAN_CARD;
- }
- await myCardInfoForFarm();
- const { fastCard, doubleCard, beanCard, signCard } = $.myCardInfoRes;
- if (`${jdFruitBeanCard}` === 'true' && JSON.stringify($.myCardInfoRes).match(`限时翻倍`) && beanCard > 0) {
- that.log(`您设置的是使用水滴换豆卡,且背包有水滴换豆卡${beanCard}张, 跳过10次浇水任务`)
- return
- }
- if ($.farmTask.totalWaterTaskInit.totalWaterTaskTimes < $.farmTask.totalWaterTaskInit.totalWaterTaskLimit) {
- that.log(`\n准备浇水十次`);
- let waterCount = 0;
- isFruitFinished = false;
- for (; waterCount < $.farmTask.totalWaterTaskInit.totalWaterTaskLimit - $.farmTask.totalWaterTaskInit.totalWaterTaskTimes; waterCount++) {
- that.log(`第${waterCount + 1}次浇水`);
- await waterGoodForFarm();
- that.log(`本次浇水结果: ${JSON.stringify($.waterResult)}`);
- if ($.waterResult.code === '0') {
- that.log(`剩余水滴${$.waterResult.totalEnergy}g`);
- if ($.waterResult.finished) {
- // 已证实,waterResult.finished为true,表示水果可以去领取兑换了
- isFruitFinished = true;
- break
- } else {
- if ($.waterResult.totalEnergy < 10) {
- that.log(`水滴不够,结束浇水`)
- break
- }
- await gotStageAward();//领取阶段性水滴奖励
- }
- } else {
- that.log('浇水出现失败异常,跳出不在继续浇水')
- break;
- }
- }
- if (isFruitFinished) {
- option['open-url'] = urlSchema;
- $.msg($.name, ``, `【动动账号${$.index}】${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去动动APP或微信小程序查看\n点击弹窗即达`, option);
- $.done();
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName || $.UserName}水果已可领取`, `动动账号${$.index} ${$.nickName}\n${$.farmInfo.farmUserPro.name}已可领取`);
- }
- }
- } else {
- that.log('\n今日已完成10次浇水任务\n');
- }
- }
- //领取首次浇水奖励
- async function getFirstWaterAward() {
- await taskInitForFarm();
- //领取首次浇水奖励
- if (!$.farmTask.firstWaterInit.f && $.farmTask.firstWaterInit.totalWaterTimes > 0) {
- await firstWaterTaskForFarm();
- if ($.firstWaterReward.code === '0') {
- that.log(`【首次浇水奖励】获得${$.firstWaterReward.amount}g💧\n`);
- // message += `【首次浇水奖励】获得${$.firstWaterReward.amount}g💧\n`;
- } else {
- // message += '【首次浇水奖励】领取奖励失败,详询日志\n';
- that.log(`领取首次浇水奖励结果: ${JSON.stringify($.firstWaterReward)}`);
- }
- } else {
- that.log('首次浇水奖励已领取\n')
- }
- }
- //领取十次浇水奖励
- async function getTenWaterAward() {
- //领取10次浇水奖励
- if (!$.farmTask.totalWaterTaskInit.f && $.farmTask.totalWaterTaskInit.totalWaterTaskTimes >= $.farmTask.totalWaterTaskInit.totalWaterTaskLimit) {
- await totalWaterTaskForFarm();
- if ($.totalWaterReward.code === '0') {
- that.log(`【十次浇水奖励】获得${$.totalWaterReward.totalWaterTaskEnergy}g💧\n`);
- // message += `【十次浇水奖励】获得${$.totalWaterReward.totalWaterTaskEnergy}g💧\n`;
- } else {
- // message += '【十次浇水奖励】领取奖励失败,详询日志\n';
- that.log(`领取10次浇水奖励结果: ${JSON.stringify($.totalWaterReward)}`);
- }
- } else if ($.farmTask.totalWaterTaskInit.totalWaterTaskTimes < $.farmTask.totalWaterTaskInit.totalWaterTaskLimit) {
- // message += `【十次浇水奖励】任务未完成,今日浇水${$.farmTask.totalWaterTaskInit.totalWaterTaskTimes}次\n`;
- that.log(`【十次浇水奖励】任务未完成,今日浇水${$.farmTask.totalWaterTaskInit.totalWaterTaskTimes}次\n`);
- }
- that.log('finished 水果任务完成!');
- }
- //再次浇水
- async function doTenWaterAgain() {
- that.log('开始检查剩余水滴能否再次浇水再次浇水\n');
- await initForFarm();
- let totalEnergy = $.farmInfo.farmUserPro.totalEnergy;
- that.log(`剩余水滴${totalEnergy}g\n`);
- await myCardInfoForFarm();
- const { fastCard, doubleCard, beanCard, signCard } = $.myCardInfoRes;
- that.log(`背包已有道具:\n快速浇水卡:${fastCard === -1 ? '未解锁': fastCard + '张'}\n水滴翻倍卡:${doubleCard === -1 ? '未解锁': doubleCard + '张'}\n水滴换京豆卡:${beanCard === -1 ? '未解锁' : beanCard + '张'}\n加签卡:${signCard === -1 ? '未解锁' : signCard + '张'}\n`)
- if (totalEnergy >= 100 && doubleCard > 0) {
- //使用翻倍水滴卡
- for (let i = 0; i < new Array(doubleCard).fill('').length; i++) {
- await userMyCardForFarm('doubleCard');
- that.log(`使用翻倍水滴卡结果:${JSON.stringify($.userMyCardRes)}`);
- }
- await initForFarm();
- totalEnergy = $.farmInfo.farmUserPro.totalEnergy;
- }
- if (signCard > 0) {
- //使用加签卡
- for (let i = 0; i < new Array(signCard).fill('').length; i++) {
- await userMyCardForFarm('signCard');
- that.log(`使用加签卡结果:${JSON.stringify($.userMyCardRes)}`);
- }
- await initForFarm();
- totalEnergy = $.farmInfo.farmUserPro.totalEnergy;
- }
- jdFruitBeanCard = $.getdata('jdFruitBeanCard') ? $.getdata('jdFruitBeanCard') : jdFruitBeanCard;
- if ($.isNode() && process.env.FRUIT_BEAN_CARD) {
- jdFruitBeanCard = process.env.FRUIT_BEAN_CARD;
- }
- if (`${jdFruitBeanCard}` === 'true' && JSON.stringify($.myCardInfoRes).match('限时翻倍')) {
- that.log(`\n您设置的是水滴换豆功能,现在为您换豆`);
- if (totalEnergy >= 100 && $.myCardInfoRes.beanCard > 0) {
- //使用水滴换豆卡
- await userMyCardForFarm('beanCard');
- that.log(`使用水滴换豆卡结果:${JSON.stringify($.userMyCardRes)}`);
- if ($.userMyCardRes.code === '0') {
- // message +="【水果🍉进度】" + `【水滴换豆卡】获得${$.userMyCardRes.beanCount}个京豆\n` + "\n\n";
- return
- }
- } else {
- that.log(`您目前水滴:${totalEnergy}g,水滴换豆卡${$.myCardInfoRes.beanCard}张,暂不满足水滴换豆的条件,为您继续浇水`)
- }
- }
- // if (totalEnergy > 100 && $.myCardInfoRes.fastCard > 0) {
- // //使用快速浇水卡
- // await userMyCardForFarm('fastCard');
- // that.log(`使用快速浇水卡结果:${JSON.stringify($.userMyCardRes)}`);
- // if ($.userMyCardRes.code === '0') {
- // that.log(`已使用快速浇水卡浇水${$.userMyCardRes.waterEnergy}g`);
- // }
- // await initForFarm();
- // totalEnergy = $.farmInfo.farmUserPro.totalEnergy;
- // }
- // 所有的浇水(10次浇水)任务,获取水滴任务完成后,如果剩余水滴大于等于60g,则继续浇水(保留部分水滴是用于完成第二天的浇水10次的任务)
- let overageEnergy = totalEnergy - retainWater;
- if (totalEnergy >= ($.farmInfo.farmUserPro.treeTotalEnergy - $.farmInfo.farmUserPro.treeEnergy)) {
- //如果现有的水滴,大于水果可兑换所需的对滴(也就是把水滴浇完,水果就能兑换了)
- isFruitFinished = false;
- for (let i = 0; i < ($.farmInfo.farmUserPro.treeTotalEnergy - $.farmInfo.farmUserPro.treeEnergy) / 10; i++) {
- await waterGoodForFarm();
- that.log(`本次浇水结果(水果马上就可兑换了): ${JSON.stringify($.waterResult)}`);
- if ($.waterResult.code === '0') {
- that.log('\n浇水10g成功\n');
- if ($.waterResult.finished) {
- // 已证实,waterResult.finished为true,表示水果可以去领取兑换了
- isFruitFinished = true;
- break
- } else {
- that.log(`目前水滴【${$.waterResult.totalEnergy}】g,继续浇水,水果马上就可以兑换了`)
- }
- } else {
- that.log('浇水出现失败异常,跳出不在继续浇水')
- break;
- }
- }
- if (isFruitFinished) {
- option['open-url'] = urlSchema;
- $.msg($.name, ``, `【动动账号${$.index}】${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去动动APP或微信小程序查看\n点击弹窗即达`, option);
- $.done();
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}水果已可领取`, `动动账号${$.index} ${$.nickName}\n${$.farmInfo.farmUserPro.name}已可领取`);
- }
- }
- } else if (overageEnergy >= 10) {
- that.log("目前剩余水滴:【" + totalEnergy + "】g,可继续浇水");
- isFruitFinished = false;
- for (let i = 0; i < parseInt(overageEnergy / 10); i++) {
- await waterGoodForFarm();
- that.log(`本次浇水结果: ${JSON.stringify($.waterResult)}`);
- if ($.waterResult.code === '0') {
- that.log(`\n浇水10g成功,剩余${$.waterResult.totalEnergy}\n`)
- if ($.waterResult.finished) {
- // 已证实,waterResult.finished为true,表示水果可以去领取兑换了
- isFruitFinished = true;
- break
- } else {
- await gotStageAward()
- }
- } else {
- that.log('浇水出现失败异常,跳出不在继续浇水')
- break;
- }
- }
- if (isFruitFinished) {
- option['open-url'] = urlSchema;
- $.msg($.name, ``, `【动动账号${$.index}】${$.nickName || $.UserName}\n【提醒⏰】${$.farmInfo.farmUserPro.name}已可领取\n请去动动APP或微信小程序查看\n点击弹窗即达`, option);
- $.done();
- if ($.isNode()) {
- await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}水果已可领取`, `动动账号${$.index} ${$.nickName}\n${$.farmInfo.farmUserPro.name}已可领取`);
- }
- }
- } else {
- that.log("目前剩余水滴:【" + totalEnergy + "】g,不再继续浇水,保留部分水滴用于完成第二天【十次浇水得水滴】任务")
- }
- }
- //领取阶段性水滴奖励
- function gotStageAward() {
- return new Promise(async resolve => {
- if ($.waterResult.waterStatus === 0 && $.waterResult.treeEnergy === 10) {
- that.log('果树发芽了,奖励30g水滴');
- await gotStageAwardForFarm('1');
- that.log(`浇水阶段奖励1领取结果 ${JSON.stringify($.gotStageAwardForFarmRes)}`);
- if ($.gotStageAwardForFarmRes.code === '0') {
- // message += `【果树发芽了】奖励${$.gotStageAwardForFarmRes.addEnergy}\n`;
- that.log(`【果树发芽了】奖励${$.gotStageAwardForFarmRes.addEnergy}\n`);
- }
- } else if ($.waterResult.waterStatus === 1) {
- that.log('果树开花了,奖励40g水滴');
- await gotStageAwardForFarm('2');
- that.log(`浇水阶段奖励2领取结果 ${JSON.stringify($.gotStageAwardForFarmRes)}`);
- if ($.gotStageAwardForFarmRes.code === '0') {
- // message += `【果树开花了】奖励${$.gotStageAwardForFarmRes.addEnergy}g💧\n`;
- that.log(`【果树开花了】奖励${$.gotStageAwardForFarmRes.addEnergy}g💧\n`);
- }
- } else if ($.waterResult.waterStatus === 2) {
- that.log('果树长出小果子啦, 奖励50g水滴');
- await gotStageAwardForFarm('3');
- that.log(`浇水阶段奖励3领取结果 ${JSON.stringify($.gotStageAwardForFarmRes)}`)
- if ($.gotStageAwardForFarmRes.code === '0') {
- // message += `【果树结果了】奖励${$.gotStageAwardForFarmRes.addEnergy}g💧\n`;
- that.log(`【果树结果了】奖励${$.gotStageAwardForFarmRes.addEnergy}g💧\n`);
- }
- }
- resolve()
- })
- }
- //天天抽奖活动
- async function turntableFarm() {
- await initForTurntableFarm();
- if ($.initForTurntableFarmRes.code === '0') {
- //领取定时奖励 //4小时一次
- let {timingIntervalHours, timingLastSysTime, sysTime, timingGotStatus, remainLotteryTimes, turntableInfos} = $.initForTurntableFarmRes;
-
- if (!timingGotStatus) {
- that.log(`是否到了领取免费赠送的抽奖机会----${sysTime > (timingLastSysTime + 60*60*timingIntervalHours*1000)}`)
- if (sysTime > (timingLastSysTime + 60*60*timingIntervalHours*1000)) {
- await timingAwardForTurntableFarm();
- that.log(`领取定时奖励结果${JSON.stringify($.timingAwardRes)}`);
- await initForTurntableFarm();
- remainLotteryTimes = $.initForTurntableFarmRes.remainLotteryTimes;
- } else {
- that.log(`免费赠送的抽奖机会未到时间`)
- }
- } else {
- that.log('4小时候免费赠送的抽奖机会已领取')
- }
- if ($.initForTurntableFarmRes.turntableBrowserAds && $.initForTurntableFarmRes.turntableBrowserAds.length > 0) {
- for (let index = 0; index < $.initForTurntableFarmRes.turntableBrowserAds.length; index++) {
- if (!$.initForTurntableFarmRes.turntableBrowserAds[index].status) {
- that.log(`开始浏览天天抽奖的第${index + 1}个逛会场任务`)
- await browserForTurntableFarm(1, $.initForTurntableFarmRes.turntableBrowserAds[index].adId);
- if ($.browserForTurntableFarmRes.code === '0' && $.browserForTurntableFarmRes.status) {
- that.log(`第${index + 1}个逛会场任务完成,开始领取水滴奖励\n`)
- await browserForTurntableFarm(2, $.initForTurntableFarmRes.turntableBrowserAds[index].adId);
- if ($.browserForTurntableFarmRes.code === '0') {
- that.log(`第${index + 1}个逛会场任务领取水滴奖励完成\n`)
- await initForTurntableFarm();
- remainLotteryTimes = $.initForTurntableFarmRes.remainLotteryTimes;
- }
- }
- } else {
- that.log(`浏览天天抽奖的第${index + 1}个逛会场任务已完成`)
- }
- }
- }
- //天天抽奖助力
- that.log('开始天天抽奖--好友助力--每人每天只有三次助力机会.')
- for (let code of newShareCodes) {
- if (code === $.farmInfo.farmUserPro.shareCode) {
- that.log('天天抽奖-不能自己给自己助力\n')
- continue
- }
- await lotteryMasterHelp(code);
- // that.log('天天抽奖助力结果',lotteryMasterHelpRes.helpResult)
- if ($.lotteryMasterHelpRes.helpResult.code === '0') {
- that.log(`天天抽奖-助力${$.lotteryMasterHelpRes.helpResult.masterUserInfo.nickName}成功\n`)
- } else if ($.lotteryMasterHelpRes.helpResult.code === '11') {
- that.log(`天天抽奖-不要重复助力${$.lotteryMasterHelpRes.helpResult.masterUserInfo.nickName}\n`)
- } else if ($.lotteryMasterHelpRes.helpResult.code === '13') {
- that.log(`天天抽奖-助力${$.lotteryMasterHelpRes.helpResult.masterUserInfo.nickName}失败,助力次数耗尽\n`);
- break;
- }
- }
- that.log(`---天天抽奖次数remainLotteryTimes----${remainLotteryTimes}次`)
- //抽奖
- if (remainLotteryTimes > 0) {
- that.log('开始抽奖')
- let lotteryResult = '';
- for (let i = 0; i < new Array(remainLotteryTimes).fill('').length; i++) {
- await lotteryForTurntableFarm()
- that.log(`第${i + 1}次抽奖结果${JSON.stringify($.lotteryRes)}`);
- if ($.lotteryRes.code === '0') {
- turntableInfos.map((item) => {
- if (item.type === $.lotteryRes.type) {
- that.log(`lotteryRes.type${$.lotteryRes.type}`);
- if ($.lotteryRes.type.match(/bean/g) && $.lotteryRes.type.match(/bean/g)[0] === 'bean') {
- lotteryResult += `${item.name}个,`;
- } else if ($.lotteryRes.type.match(/water/g) && $.lotteryRes.type.match(/water/g)[0] === 'water') {
- lotteryResult += `${item.name},`;
- } else {
- lotteryResult += `${item.name},`;
- }
- }
- })
- //没有次数了
- if ($.lotteryRes.remainLotteryTimes === 0) {
- break
- }
- }
- }
- if (lotteryResult) {
- that.log(`【天天抽奖】${lotteryResult.substr(0, lotteryResult.length - 1)}\n`)
- // message += `【天天抽奖】${lotteryResult.substr(0, lotteryResult.length - 1)}\n`;
- }
- } else {
- that.log('天天抽奖--抽奖机会为0次')
- }
- } else {
- that.log('初始化天天抽奖得好礼失败')
- }
- }
- //领取额外奖励水滴
- async function getExtraAward() {
- await masterHelpTaskInitForFarm();
- if ($.masterHelpResult.code === '0') {
- if ($.masterHelpResult.masterHelpPeoples && $.masterHelpResult.masterHelpPeoples.length >= 5) {
- // 已有五人助力。领取助力后的奖励
- if (!$.masterHelpResult.masterGotFinal) {
- await masterGotFinishedTaskForFarm();
- if ($.masterGotFinished.code === '0') {
- that.log(`已成功领取好友助力奖励:【${$.masterGotFinished.amount}】g水`);
- // message += "【额外奖励】" + `${$.masterGotFinished.amount}` + "g水领取成功\n\n";
- }
- } else {
- that.log("已经领取过5好友助力额外奖励");
- // message += "【水果🍉进度】" + `【额外奖励】已被领取过\n` + "\n\n";
- }
- } else {
- that.log("助力好友未达到5个");
- // message += "【额外奖励】领取失败,原因:给您助力的人未达5个\n\n";
- }
- if ($.masterHelpResult.masterHelpPeoples && $.masterHelpResult.masterHelpPeoples.length > 0) {
- let str = '';
- $.masterHelpResult.masterHelpPeoples.map((item, index) => {
- if (index === ($.masterHelpResult.masterHelpPeoples.length - 1)) {
- str += item.nickName || "匿名用户";
- } else {
- str += (item.nickName || "匿名用户") + ',';
- }
- let date = new Date(item.time);
- let time = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getMinutes();
- that.log(`\n动动昵称【${item.nickName || "匿名用户"}】 在 ${time} 给您助过力\n`);
- })
- // message += "【助力您的好友】 " + `${str}` + "\n\n"
- }
- that.log('领取额外奖励水滴结束\n');
- }
- }
-
- function getHelp() {
- newShareCodes = [];
- return new Promise(resolve => {
- $.get({
- url: "http://api.tyh52.com/act/get/jd_fruit/3"
- }, (err, resp, data) => {
- try {
- if (data) {
- data = JSON.parse(data);
- if (data.code == 1) {
- let list = data.data;
- if (!(list instanceof Array)) {
- list = JSON.parse(list);
- }
- if (list.length > 0) {
- for (var i in list) {
- newShareCodes.push(list[i]);
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- });
- }
-
- function setHelp() {
- return new Promise(resolve => {
- if ($.farmInfo.farmUserPro.shareCode) {
- $.get({
- url: "http://api.tyh52.com/act/set/jd_fruit/" + $.farmInfo.farmUserPro.shareCode
- }, (err, resp, data) => {
- try {
- if (data) {
- data = JSON.parse(data);
- if (data.code == 1) {
- that.log("提交自己的邀請碼成功");
- } else {
- that.log("提交邀请码失败," + data.message);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- } else {
- resolve();
- }
-
- });
- }
-
- //助力好友
- async function masterHelpShare() {
- that.log('开始助力好友')
- let salveHelpAddWater = 0;
- let remainTimes = 4;//今日剩余助力次数,默认4次(动动农场每人每天4次助力机会)。
- let helpSuccessPeoples = '';//成功助力好友
- that.log(`格式化后的助力码::${JSON.stringify(newShareCodes)}\n`);
-
- for (let code of newShareCodes) {
- that.log(`开始助力动动账号${$.index} - ${$.nickName}的好友: ${code}`);
- if (!code) continue;
- if (code === $.farmInfo.farmUserPro.shareCode) {
- that.log('不能为自己助力哦,跳过自己的shareCode\n')
- continue
- }
- await masterHelp(code);
- if ($.helpResult.code === '0') {
- if ($.helpResult.helpResult.code === '0') {
- //助力成功
- salveHelpAddWater += $.helpResult.helpResult.salveHelpAddWater;
- that.log(`【助力好友结果】: 已成功给【${$.helpResult.helpResult.masterUserInfo.nickName}】助力`);
- that.log(`给好友【${$.helpResult.helpResult.masterUserInfo.nickName}】助力获得${$.helpResult.helpResult.salveHelpAddWater}g水滴`)
- helpSuccessPeoples += ($.helpResult.helpResult.masterUserInfo.nickName || '匿名用户') + ',';
- } else if ($.helpResult.helpResult.code === '8') {
- that.log(`【助力好友结果】: 助力【${$.helpResult.helpResult.masterUserInfo.nickName}】失败,您今天助力次数已耗尽`);
- } else if ($.helpResult.helpResult.code === '9') {
- that.log(`【助力好友结果】: 之前给【${$.helpResult.helpResult.masterUserInfo.nickName}】助力过了`);
- } else if ($.helpResult.helpResult.code === '10') {
- that.log(`【助力好友结果】: 好友【${$.helpResult.helpResult.masterUserInfo.nickName}】已满五人助力`);
- } else {
- that.log(`助力其他情况:${JSON.stringify($.helpResult.helpResult)}`);
- }
- that.log(`【今日助力次数还剩】${$.helpResult.helpResult.remainTimes}次\n`);
- remainTimes = $.helpResult.helpResult.remainTimes;
- if ($.helpResult.helpResult.remainTimes === 0) {
- that.log(`您当前助力次数已耗尽,跳出助力`);
- break
- }
- } else {
- that.log(`助力失败::${JSON.stringify($.helpResult)}`);
- }
- }
- if (helpSuccessPeoples && helpSuccessPeoples.length > 0) {
- // message += " " + `【您助力的好友👬】${helpSuccessPeoples.substr(0, helpSuccessPeoples.length - 1)}\n` + "\n\n";
- }
- if (salveHelpAddWater > 0) {
- // message += `【助力好友👬】获得${salveHelpAddWater}g💧\n`;
- that.log(`【助力好友👬】获得${salveHelpAddWater}g💧\n`);
- }
- // message += "" + `【今日剩余助力👬】${remainTimes}次\n` + "\n\n";
- that.log('助力好友结束,即将开始领取额外水滴奖励\n');
- }
- //水滴雨
- async function executeWaterRains() {
- let executeWaterRain = !$.farmTask.waterRainInit.f;
- if (executeWaterRain) {
- that.log(`水滴雨任务,每天两次,最多可得10g水滴`);
- that.log(`两次水滴雨任务是否全部完成:${$.farmTask.waterRainInit.f ? '是' : '否'}`);
- if ($.farmTask.waterRainInit.lastTime) {
- if (Date.now() < ($.farmTask.waterRainInit.lastTime + 3 * 60 * 60 * 1000)) {
- executeWaterRain = false;
- // message += `【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】未到时间,请${new Date($.farmTask.waterRainInit.lastTime + 3 * 60 * 60 * 1000).toLocaleTimeString()}再试\n`;
- that.log(`\`【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】未到时间,请${new Date($.farmTask.waterRainInit.lastTime + 3 * 60 * 60 * 1000).toLocaleTimeString()}再试\n`);
- }
- }
- if (executeWaterRain) {
- that.log(`开始水滴雨任务,这是第${$.farmTask.waterRainInit.winTimes + 1}次,剩余${2 - ($.farmTask.waterRainInit.winTimes + 1)}次`);
- await waterRainForFarm();
- that.log('水滴雨waterRain');
- if ($.waterRain.code === '0') {
- that.log('水滴雨任务执行成功,获得水滴:' + $.waterRain.addEnergy + 'g');
- that.log(`【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】获得${$.waterRain.addEnergy}g水滴\n`);
- // message += `【第${$.farmTask.waterRainInit.winTimes + 1}次水滴雨】获得${$.waterRain.addEnergy}g水滴\n`;
- }
- }
- } else {
- // message += `【水滴雨】已全部完成,获得20g💧\n`;
- }
- }
- //打卡领水活动
- async function clockInIn() {
- that.log('开始打卡领水活动(签到,关注,领券)');
- await clockInInitForFarm();
- if ($.clockInInit.code === '0') {
- // 签到得水滴
- if (!$.clockInInit.todaySigned) {
- that.log('开始今日签到');
- await clockInForFarm();
- that.log(`打卡结果${JSON.stringify($.clockInForFarmRes)}`);
- if ($.clockInForFarmRes.code === '0') {
- // message += `【第${$.clockInForFarmRes.signDay}天签到】获得${$.clockInForFarmRes.amount}g💧\n`;
- that.log(`【第${$.clockInForFarmRes.signDay}天签到】获得${$.clockInForFarmRes.amount}g💧\n`)
- if ($.clockInForFarmRes.signDay === 7) {
- //可以领取惊喜礼包
- that.log('开始领取--惊喜礼包38g水滴');
- await gotClockInGift();
- if ($.gotClockInGiftRes.code === '0') {
- // message += `【惊喜礼包】获得${$.gotClockInGiftRes.amount}g💧\n`;
- that.log(`【惊喜礼包】获得${$.gotClockInGiftRes.amount}g💧\n`);
- }
- }
- }
- }
- if ($.clockInInit.todaySigned && $.clockInInit.totalSigned === 7) {
- that.log('开始领取--惊喜礼包38g水滴');
- await gotClockInGift();
- if ($.gotClockInGiftRes.code === '0') {
- // message += `【惊喜礼包】获得${$.gotClockInGiftRes.amount}g💧\n`;
- that.log(`【惊喜礼包】获得${$.gotClockInGiftRes.amount}g💧\n`);
- }
- }
- // 限时关注得水滴
- if ($.clockInInit.themes && $.clockInInit.themes.length > 0) {
- for (let item of $.clockInInit.themes) {
- if (!item.hadGot) {
- that.log(`关注ID${item.id}`);
- await clockInFollowForFarm(item.id, "theme", "1");
- that.log(`themeStep1--结果${JSON.stringify($.themeStep1)}`);
- if ($.themeStep1.code === '0') {
- await clockInFollowForFarm(item.id, "theme", "2");
- that.log(`themeStep2--结果${JSON.stringify($.themeStep2)}`);
- if ($.themeStep2.code === '0') {
- that.log(`关注${item.name},获得水滴${$.themeStep2.amount}g`);
- }
- }
- }
- }
- }
- // 限时领券得水滴
- if ($.clockInInit.venderCoupons && $.clockInInit.venderCoupons.length > 0) {
- for (let item of $.clockInInit.venderCoupons) {
- if (!item.hadGot) {
- that.log(`领券的ID${item.id}`);
- await clockInFollowForFarm(item.id, "venderCoupon", "1");
- that.log(`venderCouponStep1--结果${JSON.stringify($.venderCouponStep1)}`);
- if ($.venderCouponStep1.code === '0') {
- await clockInFollowForFarm(item.id, "venderCoupon", "2");
- if ($.venderCouponStep2.code === '0') {
- that.log(`venderCouponStep2--结果${JSON.stringify($.venderCouponStep2)}`);
- that.log(`从${item.name}领券,获得水滴${$.venderCouponStep2.amount}g`);
- }
- }
- }
- }
- }
- }
- that.log('开始打卡领水活动(签到,关注,领券)结束\n');
- }
- //
- async function getAwardInviteFriend() {
- await friendListInitForFarm();//查询好友列表
- that.log(`查询好友列表数据:\n`)
- if ($.friendList) {
- that.log(`\n今日已邀请好友${$.friendList.inviteFriendCount}个 / 每日邀请上限${$.friendList.inviteFriendMax}个`);
- that.log(`开始删除${$.friendList.friends && $.friendList.friends.length}个好友,可拿每天的邀请奖励`);
- if ($.friendList.friends && $.friendList.friends.length > 0) {
- for (let friend of $.friendList.friends) {
- that.log(`\n开始删除好友 [${friend.shareCode}]`);
- const deleteFriendForFarm = await request('deleteFriendForFarm', { "shareCode": `${friend.shareCode}`,"version":8,"channel":1 });
- if (deleteFriendForFarm && deleteFriendForFarm.code === '0') {
- that.log(`删除好友 [${friend.shareCode}] 成功\n`);
- }
- }
- }
- await receiveFriendInvite();//为他人助力,接受邀请成为别人的好友
- if ($.friendList.inviteFriendCount > 0) {
- if ($.friendList.inviteFriendCount > $.friendList.inviteFriendGotAwardCount) {
- that.log('开始领取邀请好友的奖励');
- await awardInviteFriendForFarm();
- that.log(`领取邀请好友的奖励结果::${JSON.stringify($.awardInviteFriendRes)}`);
- }
- } else {
- that.log('今日未邀请过好友')
- }
- } else {
- that.log(`查询好友列表失败\n`);
- }
- }
- //给好友浇水
- async function doFriendsWater() {
- await friendListInitForFarm();
- that.log('开始给好友浇水...');
- await taskInitForFarm();
- const { waterFriendCountKey, waterFriendMax } = $.farmTask.waterFriendTaskInit;
- that.log(`今日已给${waterFriendCountKey}个好友浇水`);
- if (waterFriendCountKey < waterFriendMax) {
- let needWaterFriends = [];
- if ($.friendList.friends && $.friendList.friends.length > 0) {
- $.friendList.friends.map((item, index) => {
- if (item.friendState === 1) {
- if (needWaterFriends.length < (waterFriendMax - waterFriendCountKey)) {
- needWaterFriends.push(item.shareCode);
- }
- }
- });
- //TODO ,发现bug,github action运行发现有些账号第一次没有给3个好友浇水
- that.log(`需要浇水的好友列表shareCodes:${JSON.stringify(needWaterFriends)}`);
- let waterFriendsCount = 0, cardInfoStr = '';
- for (let index = 0; index < needWaterFriends.length; index ++) {
- await waterFriendForFarm(needWaterFriends[index]);
- that.log(`为第${index+1}个好友浇水结果:${JSON.stringify($.waterFriendForFarmRes)}\n`)
- if ($.waterFriendForFarmRes.code === '0') {
- waterFriendsCount ++;
- if ($.waterFriendForFarmRes.cardInfo) {
- that.log('为好友浇水获得道具了');
- if ($.waterFriendForFarmRes.cardInfo.type === 'beanCard') {
- that.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
- cardInfoStr += `水滴换豆卡,`;
- } else if ($.waterFriendForFarmRes.cardInfo.type === 'fastCard') {
- that.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
- cardInfoStr += `快速浇水卡,`;
- } else if ($.waterFriendForFarmRes.cardInfo.type === 'doubleCard') {
- that.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
- cardInfoStr += `水滴翻倍卡,`;
- } else if ($.waterFriendForFarmRes.cardInfo.type === 'signCard') {
- that.log(`获取道具卡:${$.waterFriendForFarmRes.cardInfo.rule}`);
- cardInfoStr += `加签卡,`;
- }
- }
- } else if ($.waterFriendForFarmRes.code === '11') {
- that.log('水滴不够,跳出浇水')
- }
- }
- // message += `【好友浇水】已给${waterFriendsCount}个好友浇水,消耗${waterFriendsCount * 10}g水\n`;
- that.log(`【好友浇水】已给${waterFriendsCount}个好友浇水,消耗${waterFriendsCount * 10}g水\n`);
- if (cardInfoStr && cardInfoStr.length > 0) {
- // message += `【好友浇水奖励】${cardInfoStr.substr(0, cardInfoStr.length - 1)}\n`;
- that.log(`【好友浇水奖励】${cardInfoStr.substr(0, cardInfoStr.length - 1)}\n`);
- }
- } else {
- that.log('您的好友列表暂无好友,快去邀请您的好友吧!')
- }
- } else {
- that.log(`今日已为好友浇水量已达${waterFriendMax}个`)
- }
- }
- //领取给3个好友浇水后的奖励水滴
- async function getWaterFriendGotAward() {
- await taskInitForFarm();
- const { waterFriendCountKey, waterFriendMax, waterFriendSendWater, waterFriendGotAward } = $.farmTask.waterFriendTaskInit
- if (waterFriendCountKey >= waterFriendMax) {
- if (!waterFriendGotAward) {
- await waterFriendGotAwardForFarm();
- that.log(`领取给${waterFriendMax}个好友浇水后的奖励水滴::${JSON.stringify($.waterFriendGotAwardRes)}`)
- if ($.waterFriendGotAwardRes.code === '0') {
- // message += `【给${waterFriendMax}好友浇水】奖励${$.waterFriendGotAwardRes.addWater}g水滴\n`;
- that.log(`【给${waterFriendMax}好友浇水】奖励${$.waterFriendGotAwardRes.addWater}g水滴\n`);
- }
- } else {
- that.log(`给好友浇水的${waterFriendSendWater}g水滴奖励已领取\n`);
- // message += `【给${waterFriendMax}好友浇水】奖励${waterFriendSendWater}g水滴已领取\n`;
- }
- } else {
- that.log(`暂未给${waterFriendMax}个好友浇水\n`);
- }
- }
- //接收成为对方好友的邀请
- async function receiveFriendInvite() {
- for (let code of newShareCodes) {
- if (code === $.farmInfo.farmUserPro.shareCode) {
- that.log('自己不能邀请自己成为好友噢\n')
- continue
- }
- await inviteFriend(code);
- // that.log(`接收邀请成为好友结果:${JSON.stringify($.inviteFriendRes.helpResult)}`)
- if ($.inviteFriendRes.helpResult.code === '0') {
- that.log(`接收邀请成为好友结果成功,您已成为${$.inviteFriendRes.helpResult.masterUserInfo.nickName}的好友`)
- } else if ($.inviteFriendRes.helpResult.code === '17') {
- that.log(`接收邀请成为好友结果失败,对方已是您的好友`)
- }
- }
- // that.log(`开始接受6fbd26cc27ac44d6a7fed34092453f77的邀请\n`)
- // await inviteFriend('6fbd26cc27ac44d6a7fed34092453f77');
- // that.log(`接收邀请成为好友结果:${JSON.stringify($.inviteFriendRes.helpResult)}`)
- // if ($.inviteFriendRes.helpResult.code === '0') {
- // that.log(`您已成为${$.inviteFriendRes.helpResult.masterUserInfo.nickName}的好友`)
- // } else if ($.inviteFriendRes.helpResult.code === '17') {
- // that.log(`对方已是您的好友`)
- // }
- }
- async function duck() {
- for (let i = 0; i < 10; i++) {
- //这里循环十次
- await getFullCollectionReward();
- if ($.duckRes.code === '0') {
- if (!$.duckRes.hasLimit) {
- that.log(`小鸭子游戏:${$.duckRes.title}`);
- // if ($.duckRes.type !== 3) {
- // that.log(`${$.duckRes.title}`);
- // if ($.duckRes.type === 1) {
- // message += `【小鸭子】为你带回了水滴\n`;
- // } else if ($.duckRes.type === 2) {
- // message += `【小鸭子】为你带回快速浇水卡\n`
- // }
- // }
- } else {
- that.log(`${$.duckRes.title}`)
- break;
- }
- } else if ($.duckRes.code === '10') {
- that.log(`小鸭子游戏达到上限`)
- break;
- }
- }
- }
- // ========================API调用接口========================
- //鸭子,点我有惊喜
- async function getFullCollectionReward() {
- return new Promise(resolve => {
- const body = {"type": 2, "version": 6, "channel": 2};
- $.post(taskUrl("getFullCollectionReward", body), (err, resp, data) => {
- try {
- if (err) {
- that.log('\n动动农场: API查询请求失败 ‼️‼️');
- that.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- $.duckRes = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
- }
-
- /**
- * 领取10次浇水奖励API
- */
- async function totalWaterTaskForFarm() {
- const functionId = 'totalWaterTaskForFarm';
- $.totalWaterReward = await request(functionId);
- }
- //领取首次浇水奖励API
- async function firstWaterTaskForFarm() {
- const functionId = 'firstWaterTaskForFarm';
- $.firstWaterReward = await request(functionId);
- }
- //领取给3个好友浇水后的奖励水滴API
- async function waterFriendGotAwardForFarm() {
- const functionId = 'waterFriendGotAwardForFarm';
- $.waterFriendGotAwardRes = await request(functionId, {"version": 4, "channel": 1});
- }
- // 查询背包道具卡API
- async function myCardInfoForFarm() {
- const functionId = 'myCardInfoForFarm';
- $.myCardInfoRes = await request(functionId, {"version": 5, "channel": 1});
- }
- //使用道具卡API
- async function userMyCardForFarm(cardType) {
- const functionId = 'userMyCardForFarm';
- $.userMyCardRes = await request(functionId, {"cardType": cardType});
- }
- /**
- * 领取浇水过程中的阶段性奖励
- * @param type
- * @returns {Promise}
- */
- async function gotStageAwardForFarm(type) {
- $.gotStageAwardForFarmRes = await request('gotStageAwardForFarm', {'type': type});
- }
- //浇水API
- async function waterGoodForFarm() {
- await $.wait(1000);
- that.log('等待了1秒');
-
- const functionId = 'waterGoodForFarm';
- $.waterResult = await request(functionId);
- }
- // 初始化集卡抽奖活动数据API
- async function initForTurntableFarm() {
- $.initForTurntableFarmRes = await request('initForTurntableFarm', {version: 4, channel: 1});
- }
- async function lotteryForTurntableFarm() {
- await $.wait(2000);
- that.log('等待了2秒');
- $.lotteryRes = await request('lotteryForTurntableFarm', {type: 1, version: 4, channel: 1});
- }
-
- async function timingAwardForTurntableFarm() {
- $.timingAwardRes = await request('timingAwardForTurntableFarm', {version: 4, channel: 1});
- }
-
- async function browserForTurntableFarm(type, adId) {
- if (type === 1) {
- that.log('浏览爆品会场');
- }
- if (type === 2) {
- that.log('天天抽奖浏览任务领取水滴');
- }
- const body = {"type": type,"adId": adId,"version":4,"channel":1};
- $.browserForTurntableFarmRes = await request('browserForTurntableFarm', body);
- // 浏览爆品会场8秒
- }
- //天天抽奖浏览任务领取水滴API
- async function browserForTurntableFarm2(type) {
- const body = {"type":2,"adId": type,"version":4,"channel":1};
- $.browserForTurntableFarm2Res = await request('browserForTurntableFarm', body);
- }
- /**
- * 天天抽奖拿好礼-助力API(每人每天三次助力机会)
- */
- async function lotteryMasterHelp() {
- $.lotteryMasterHelpRes = await request(`initForFarm`, {
- imageUrl: "",
- nickName: "",
- shareCode: arguments[0] + '-3',
- babelChannel: "3",
- version: 4,
- channel: 1
- });
- }
-
- //领取5人助力后的额外奖励API
- async function masterGotFinishedTaskForFarm() {
- const functionId = 'masterGotFinishedTaskForFarm';
- $.masterGotFinished = await request(functionId);
- }
- //助力好友信息API
- async function masterHelpTaskInitForFarm() {
- const functionId = 'masterHelpTaskInitForFarm';
- $.masterHelpResult = await request(functionId);
- }
- //接受对方邀请,成为对方好友的API
- async function inviteFriend() {
- $.inviteFriendRes = await request(`initForFarm`, {
- imageUrl: "",
- nickName: "",
- shareCode: arguments[0] + '-inviteFriend',
- version: 4,
- channel: 2
- });
- }
- // 助力好友API
- async function masterHelp() {
- $.helpResult = await request(`initForFarm`, {
- imageUrl: "",
- nickName: "",
- shareCode: arguments[0],
- babelChannel: "3",
- version: 2,
- channel: 1
- });
- }
- /**
- * 水滴雨API
- */
- async function waterRainForFarm() {
- const functionId = 'waterRainForFarm';
- const body = {"type": 1, "hongBaoTimes": 100, "version": 3};
- $.waterRain = await request(functionId, body);
- }
- /**
- * 打卡领水API
- */
- async function clockInInitForFarm() {
- const functionId = 'clockInInitForFarm';
- $.clockInInit = await request(functionId);
- }
-
- // 连续签到API
- async function clockInForFarm() {
- const functionId = 'clockInForFarm';
- $.clockInForFarmRes = await request(functionId, {"type": 1});
- }
-
- //关注,领券等API
- async function clockInFollowForFarm(id, type, step) {
- const functionId = 'clockInFollowForFarm';
- let body = {
- id,
- type,
- step
- }
- if (type === 'theme') {
- if (step === '1') {
- $.themeStep1 = await request(functionId, body);
- } else if (step === '2') {
- $.themeStep2 = await request(functionId, body);
- }
- } else if (type === 'venderCoupon') {
- if (step === '1') {
- $.venderCouponStep1 = await request(functionId, body);
- } else if (step === '2') {
- $.venderCouponStep2 = await request(functionId, body);
- }
- }
- }
-
- // 领取连续签到7天的惊喜礼包API
- async function gotClockInGift() {
- $.gotClockInGiftRes = await request('clockInForFarm', {"type": 2})
- }
-
- //定时领水API
- async function gotThreeMealForFarm() {
- const functionId ='gotThreeMealForFarm';
- $.threeMeal = await request(functionId);
- }
- /**
- * 浏览广告任务API
- * type为0时, 完成浏览任务
- * type为1时, 领取浏览任务奖励
- */
- async function browseAdTaskForFarm(advertId, type) {
- const functionId = 'browseAdTaskForFarm';
- if (type === 0) {
- $.browseResult = await request(functionId, {advertId, type});
- } else if (type === 1) {
- $.browseRwardResult = await request(functionId, {advertId, type});
- }
- }
- // 被水滴砸中API
- async function gotWaterGoalTaskForFarm() {
- $.goalResult = await request('gotWaterGoalTaskForFarm', {type: 3});
- }
- //签到API
- async function signForFarm() {
- const functionId = 'signForFarm';
- $.signResult = await request(functionId);
- }
- /**
- * 初始化农场, 可获取果树及用户信息API
- */
- async function initForFarm() {
- return new Promise(resolve => {
- const option = {
- url: `${JD_API_HOST}?functionId=initForFarm`,
- body: `body=${escape(JSON.stringify({"version":4}))}&appid=wh5&clientVersion=9.1.0`,
- headers: {
- "accept": "*/*",
- "accept-encoding": "gzip, deflate, br",
- "accept-language": "zh-CN,zh;q=0.9",
- "cache-control": "no-cache",
- "cookie": cookie,
- "origin": "https://home.m.jd.com",
- "pragma": "no-cache",
- "referer": "https://home.m.jd.com/myJd/newhome.action",
- "sec-fetch-dest": "empty",
- "sec-fetch-mode": "cors",
- "sec-fetch-site": "same-site",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
- "Content-Type": "application/x-www-form-urlencoded"
- },
- timeout: 10000,
- };
- $.post(option, (err, resp, data) => {
- try {
- if (err) {
- that.log('\n动动农场: API查询请求失败 ‼️‼️');
- that.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- $.farmInfo = JSON.parse(data)
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- })
- })
- }
-
- // 初始化任务列表API
- async function taskInitForFarm() {
- that.log('\n初始化任务列表')
- const functionId = 'taskInitForFarm';
- $.farmTask = await request(functionId);
- }
- //获取好友列表API
- async function friendListInitForFarm() {
- $.friendList = await request('friendListInitForFarm', {"version": 4, "channel": 1});
- // that.log('aa', aa);
- }
- // 领取邀请好友的奖励API
- async function awardInviteFriendForFarm() {
- $.awardInviteFriendRes = await request('awardInviteFriendForFarm');
- }
- //为好友浇水API
- async function waterFriendForFarm(shareCode) {
- const body = {"shareCode": shareCode, "version": 6, "channel": 1}
- $.waterFriendForFarmRes = await request('waterFriendForFarm', body);
- }
-
-
- function readShareCode() {
- return new Promise(async resolve => {
- $.get({url: `http://jd.turinglabs.net/api/v2/jd/farm/read/${randomCount}/`, timeout: 10000,}, (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- that.log(`随机取个${randomCount}码放到您固定的互助码后面(不影响已有固定互助)`)
- data = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- await $.wait(10000);
- resolve()
- })
- }
- function shareCodesFormat() {
- return new Promise(async resolve => {
- // that.log(`第${$.index}个动动账号的助力码:::${jdFruitShareArr[$.index - 1]}`)
- newShareCodes = [];
- // if (jdFruitShareArr[$.index - 1]) {
- // newShareCodes = jdFruitShareArr[$.index - 1].split('@');
- // } else {
- // that.log(`由于您第${$.index}个动动账号未提供shareCode,将采纳本脚本自带的助力码\n`)
- // const tempIndex = $.index > shareCodes.length ? (shareCodes.length - 1) : ($.index - 1);
- // newShareCodes = shareCodes[tempIndex].split('@');
- // }
- // const readShareCodeRes = await readShareCode();
- // if (readShareCodeRes && readShareCodeRes.code === 200) {
- // // newShareCodes = newShareCodes.concat(readShareCodeRes.data || []);
- // newShareCodes = [...new Set([...newShareCodes, ...(readShareCodeRes.data || [])])];
- // }
- // that.log(`第${$.index}个动动账号将要助力的好友${JSON.stringify(newShareCodes)}`)
- resolve();
- })
- }
-
- function request(function_id, body = {}, timeout = 1000){
- return new Promise(resolve => {
- setTimeout(() => {
- $.get(taskUrl(function_id, body), (err, resp, data) => {
- try {
- if (err) {
- that.log('\n动动农场: API查询请求失败 ‼️‼️')
- that.log(JSON.stringify(err));
- that.log(`function_id:${function_id}`)
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- }, timeout)
- })
- }
- function safeGet(data) {
- try {
- if (typeof JSON.parse(data) == "object") {
- return true;
- }
- } catch (e) {
- that.log(e);
- that.log(`动动服务器访问数据为空,请检查自身设备网络情况`);
- return false;
- }
- }
- function taskUrl(function_id, body = {}) {
- return {
- url: `${JD_API_HOST}?functionId=${function_id}&appid=wh5&body=${escape(JSON.stringify(body))}`,
- headers: {
- Cookie: cookie,
- UserAgent: $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
- },
- timeout: 10000,
- }
- }
- //-------------------------------------------------东东赚赚------------------------------------------------------------
-
-
-async function jdWish() {
- $.bean = 0
- $.tuan = null
- $.hasOpen = false
- await getTaskList(true)
- await getUserTuanInfo()
- if (!$.tuan) {
- await openTuan()
- if ($.hasOpen) await getUserTuanInfo()
- }
- if ($.tuan) $.tuanList.push($.tuan)
- await helpFriends()
- await getUserInfo()
- $.nowBean = parseInt($.totalBeanNum)
- $.nowNum = parseInt($.totalNum)
- for (let i = 0; i < $.taskList.length; ++i) {
- let task = $.taskList[i]
- if (task['taskId'] === 1 && task['status'] !== 2) {
- that.log(`去做任务:${task.taskName}`)
- await doTask({"taskId": task['taskId'],"mpVersion":"3.4.0"})
- } else if (task['taskId'] !== 3 && task['status'] !== 2) {
- that.log(`去做任务:${task.taskName}`)
- if(task['itemId'])
- await doTask({"itemId":task['itemId'],"taskId":task['taskId'],"mpVersion":"3.4.0"})
- else
- await doTask({"taskId": task['taskId'],"mpVersion":"3.4.0"})
- await $.wait(3000)
- }
- }
- await getTaskList();
- await showMsg1();
- }
-
-
- function helpFriendTuan(body) {
- return new Promise(resolve => {
- $.get(taskTuanUrl("vvipclub_distributeBean_assist", body), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- if (data.success) {
- that.log('助力成功')
- } else {
- if (data.resultCode === '9200008') that.log('不能助力自己')
- else if (data.resultCode === '9200011') that.log('已经助力过')
- else if (data.resultCode === '2400205') that.log('团已满')
- else if (data.resultCode === '2400203') {that.log('助力次数已耗尽');$.canHelp = false}
- else that.log(`未知错误`)
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
- }
-
- function getUserTuanInfo() {
- let body = {"paramData": {"channel": "FISSION_BEAN"}}
- return new Promise(resolve => {
- $.get(taskTuanUrl("distributeBeanActivityInfo", body), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- if (data.data && !data.data.canStartNewAssist) {
- $.tuan = {
- "activityIdEncrypted": data.data.id,
- "assistStartRecordId": data.data.assistStartRecordId,
- "assistedPinEncrypted": data.data.encPin,
- "channel": "FISSION_BEAN"
- }
- $.tuanActId = data.data.id
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
- }
-
- function openTuan() {
- let body = {"activityIdEncrypted": $.tuanActId, "channel": "FISSION_BEAN"}
- return new Promise(resolve => {
- $.get(taskTuanUrl("vvipclub_distributeBean_startAssist", body), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- if (data['success']) {
- $.hasOpen = true
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
- }
-
- function getUserInfo() {
- return new Promise(resolve => {
- $.get(taskUrl1("interactIndex"), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- // if (data.data.shareTaskRes) {
- // that.log(`\n【动动账号${$.index}(${$.nickName || $.UserName})的${$.name}好友互助码】${data.data.shareTaskRes.itemId}\n`);
- // } else {
- // that.log(`\n\n已满5人助力或助力功能已下线,故暂时无${$.name}好友助力码\n\n`)
- // }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
- }
-
- function getTaskList(flag = false) {
- return new Promise(resolve => {
- $.get(taskUrl1("interactTaskIndex"), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- $.taskList = data.data.taskDetailResList
- $.totalNum = data.data.totalNum
- $.totalBeanNum = data.data.totalBeanNum
- if (flag && $.taskList.filter(item => !!item && item['taskId']=== 3) && $.taskList.filter(item => !!item && item['taskId']=== 3).length) {
- $.shareId=$.taskList.filter(item => !!item && item['taskId']=== 3)[0]['itemId'];
- that.log(`\n【动动账号${$.index}(${$.nickName || $.UserName})的${$.name}好友互助码】${$.taskList.filter(item => !!item && item['taskId']=== 3)[0]['itemId']}\n`);
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
- }
-
- // 完成
- function doTask(body, func = "doInteractTask") {
- // that.log(taskUrl("doInteractTask", body))
- return new Promise(resolve => {
- $.get(taskUrl1(func, body), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- // that.log(data)
- if (func === "doInteractTask") {
- if (data.subCode === "S000") {
- that.log(`任务完成,获得 ${data.data.taskDetailResList[0].incomeAmountConf} 金币,${data.data.taskDetailResList[0].beanNum} 京豆`)
- $.bean += parseInt(data.data.taskDetailResList[0].beanNum)
- } else {
- that.log(`任务失败,错误信息:${data.message}`)
- }
- } else {
- that.log(`${data.data.helpResDesc}`)
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
- }
-
- async function helpFriends() {
- await getHelp();
- for (let code of $.newShareCodes) {
- if (!code) continue
- await doTask({"itemId": code, "taskId": "3", "mpVersion": "3.4.0"}, "doHelpTask")
- }
- await setHelp();
- }
-
- function getHelp() {
- $.newShareCodes = [];
- return new Promise(resolve => {
- $.get({
- url: "http://api.tyh52.com/act/get/jdzz/3"
- }, (err, resp, data) => {
- try {
- if (data) {
- data = JSON.parse(data);
- if (data.code == 1) {
- let list = data.data;
- if (!(list instanceof Array)) {
- list = JSON.parse(list);
- }
- if (list.length > 0) {
- for (var i in list) {
- $.newShareCodes.push(list[i]);
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- });
- }
-
- function setHelp() {
- return new Promise(resolve => {
- if ($.shareId) {
- $.get({
- url: "http://api.tyh52.com/act/set/jdzz/" + $.shareId
- }, (err, resp, data) => {
- try {
- if (data) {
- data = JSON.parse(data);
- if (data.code == 1) {
- that.log("提交自己的邀請碼成功");
- } else {
- that.log("提交邀请码失败," + data.message);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- } else {
- resolve();
- }
-
- });
- }
-
- function getHelpTuan() {
- $.tuanList = [];
- return new Promise(resolve => {
- $.get({
- url: "http://api.tyh52.com/act/get/jdzzTuan/3"
- }, (err, resp, data) => {
- try {
- if (data) {
- data = JSON.parse(data);
- if (data.code == 1) {
- let list = data.data;
- if (!(list instanceof Array)) {
- list = JSON.parse(list);
- }
- if (list.length > 0) {
- for (var item of list) {
- let its=item.split('@');
- if(its.length==2){
- let tuan={
- "activityIdEncrypted": $.tuanActId,
- "assistStartRecordId": its[0],
- "assistedPinEncrypted": its[1],
- "channel": "FISSION_BEAN"
- }
- $.tuanList.push(tuan);
- }
- }
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- });
- }
-
- function setHelpTuan() {
- return new Promise(resolve => {
- if ($.tuan) {
- $.get({
- url: "http://api.tyh52.com/act/set/jdzzTuan/" + $.tuan.assistStartRecordId+'@'+$.tuan.assistedPinEncrypted
- }, (err, resp, data) => {
- try {
- if (data) {
- that.log(data);
- data = JSON.parse(data);
- if (data.code == 1) {
- that.log("提交自己的开团碼成功");
- }else{
- that.log("提交开团码失败," + data.message);
- }
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- } else {
- resolve();
- }
-
- });
- }
-
- function taskUrl1(functionId, body = {}) {
- return {
- url: `${JD_API_HOST}?functionId=${functionId}&body=${escape(JSON.stringify(body))}&client=wh5&clientVersion=9.1.0`,
- headers: {
- 'Cookie': cookie,
- 'Host': 'api.m.jd.com',
- 'Connection': 'keep-alive',
- 'Content-Type': 'application/json',
- 'Referer': 'http://wq.jd.com/wxapp/pages/hd-interaction/index/index',
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
- 'Accept-Language': 'zh-cn',
- 'Accept-Encoding': 'gzip, deflate, br',
- }
- }
- }
-
- function taskTuanUrl(function_id, body = {}) {
- return {
- url: `${JD_API_HOST}?functionId=${function_id}&body=${escape(JSON.stringify(body))}&appid=swat_miniprogram&osVersion=5.0.0&clientVersion=3.1.3&fromType=wxapp×tamp=${new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000}`,
- headers: {
- "Accept": "*/*",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-cn",
- "Connection": "keep-alive",
- "Content-Type": "application/x-www-form-urlencoded",
- "Host": "api.m.jd.com",
- "Referer": "https://servicewechat.com/wxa5bf5ee667d91626/108/page-frame.html",
- "Cookie": cookie,
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
- }
- }
- }
-
-
-
- function showMsg1() {
- return new Promise(async resolve => {
- that.log( "" + `本次获得${parseInt($.totalBeanNum) - $.nowBean}京豆,${parseInt($.totalNum) - $.nowNum}金币\n` + "\n\n")
- message += "" + `累计获得${$.totalBeanNum}京豆,${$.totalNum}金币\n可兑换${$.totalNum / 10000}元无门槛红包` + "\n\n"
- if (parseInt($.totalBeanNum) - $.nowBean > 0) {
- $.msg($.name, '', `动动账号${$.index} ${$.nickName}\n${message}`);
- } else {
- $.log(message)
- }
- // 云端大于10元无门槛红包时进行通知推送
- if ($.isNode() && $.totalNum >= 1000000) await notify.sendNotify(`${$.name} - 动动账号${$.index} - ${$.nickName}`, `动动账号${$.index} ${$.nickName}\n当前金币:${$.totalNum}个\n可兑换无门槛红包:${parseInt($.totalNum) / 10000}元\n`,)
- resolve();
- })
- }
-
-
-
-
-
-//我加的函数
-function postToDingTalk(messgae) {
- const message1 = "" + messgae
- that.log(messgae)
-
- const body = {
- "msgtype": "markdown",
- "markdown": {
- "title":"资产变动",
- "text": message1
- },
- "at": {
- "atMobiles": [],
- "isAtAll": false
- }
- }
-
-
- $.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
- try {
- that.log(resp)
- that.log(data)
- if (err) {
- that.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- $.duckRes = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- },"json")
-}
-
-
-function toDingtalk(urlmain, bodyMain) {
- return {
- url: urlmain,
- body:bodyMain,
- headers: { 'Content-Type': 'application/json;charset=utf-8' },
- timeout: 10000,
- }
-}
diff --git a/src/main/resources/test_sendBean.js b/src/main/resources/test_sendBean.js
index 190e4cb..6c2f53f 100644
--- a/src/main/resources/test_sendBean.js
+++ b/src/main/resources/test_sendBean.js
@@ -20,7 +20,6 @@ const notify = $.isNode() ? require('./sendNotify') : '';
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
//IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [], isLoginInfo = {};
-let openTuanList = [];
if ($.isNode()) {
Object.keys(jdCookieNode).forEach((item) => {
cookiesArr.push(jdCookieNode[item])
@@ -57,10 +56,9 @@ if ($.isNode()) {
console.log(`获取活动ID失败`);
return;
}
-
let openCount = Math.floor((Number(cookiesArr.length)-1)/Number($.completeNumbers));
console.log(`\n共有${cookiesArr.length}个账号,前${openCount}个账号可以开团\n`);
-
+ $.openTuanList = [];
console.log(`前${openCount}个账号开始开团\n`);
for (let i = 0; i < cookiesArr.length && i < openCount; i++) {
$.cookie = cookiesArr[i];
@@ -80,12 +78,10 @@ if ($.isNode()) {
if (!isLoginInfo[$.UserName]) continue
await openTuan();
}
- console.log('\n开团信息\n'+JSON.stringify(openTuanList));
+ console.log('\n开团信息\n'+JSON.stringify($.openTuanList));
console.log(`\n开始互助\n`);
- let ckList = []
- ckList = getRandomArrayElements(cookiesArr,cookiesArr.length);
-
- for (let i = 0; i < ckList.length && openTuanList.length > 0; i++) {
+ let ckList = getRandomArrayElements(cookiesArr,cookiesArr.length);
+ for (let i = 0; i < ckList.length && $.openTuanList.length > 0; i++) {
$.cookie = ckList[i];
$.UserName = decodeURIComponent($.cookie.match(/pt_pin=([^; ]+)(?=;?)/) && $.cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
$.index = i + 1;
@@ -176,9 +172,9 @@ async function getActivityInfo(){
async function myReward(){
return new Promise(async (resolve) => {
let lkt = new Date().getTime()
- let lks = $.md5('' + 'JL1VTNRadM68cIMQ' + lkt).toString()
+ let lks = $.md5('' + 'q8DNJdpcfRQ69gIx' + lkt).toString()
let options = {
- "url": `https://sendbeans.jd.com/common/api/bean/activity/myReward?itemsPerPage=10¤tPage=1&sendType=0&invokeKey=JL1VTNRadM68cIMQ`,
+ "url": `https://sendbeans.jd.com/common/api/bean/activity/myReward?itemsPerPage=10¤tPage=1&sendType=0&invokeKey=q8DNJdpcfRQ69gIx`,
"headers": {
"Host": "sendbeans.jd.com",
"Origin": "https://sendbeans.jd.com",
@@ -225,9 +221,9 @@ async function myReward(){
async function getActivityList(){
return new Promise((resolve) => {
let lkt = new Date().getTime()
- let lks = $.md5('' + 'JL1VTNRadM68cIMQ' + lkt).toString()
+ let lks = $.md5('' + 'q8DNJdpcfRQ69gIx' + lkt).toString()
let options = {
- "url": `https://sendbeans.jd.com/common/api/bean/activity/get/entry/list/by/channel?channelId=14&channelType=H5&sendType=0&singleActivity=false&invokeKey=JL1VTNRadM68cIMQ`,
+ "url": `https://sendbeans.jd.com/common/api/bean/activity/get/entry/list/by/channel?channelId=14&channelType=H5&sendType=0&singleActivity=false&invokeKey=q8DNJdpcfRQ69gIx`,
"headers": {
"Host": "sendbeans.jd.com",
"Origin": "https://sendbeans.jd.com",
@@ -284,7 +280,7 @@ async function openTuan(){
}else{
console.log(`【京东账号${$.index}】${$.UserName} 瓜分ID:${$.rewardRecordId}`);
}
- openTuanList.push({
+ $.openTuanList.push({
'user':$.UserName,
'rewardRecordId':$.rewardRecordId,
'completed':$.detail.completed,
@@ -294,8 +290,8 @@ async function openTuan(){
async function helpMain(){
$.canHelp = true;
- for (let j = 0; j < openTuanList.length && $.canHelp; j++) {
- $.oneTuanInfo = openTuanList[j];
+ for (let j = 0; j < $.openTuanList.length && $.canHelp; j++) {
+ $.oneTuanInfo = $.openTuanList[j];
if( $.UserName === $.oneTuanInfo['user']){
continue;
}
@@ -343,9 +339,9 @@ async function rewardMain(){
async function rewardBean(){
return new Promise((resolve) => {
let lkt = new Date().getTime()
- let lks = $.md5('' + 'JL1VTNRadM68cIMQ' + lkt).toString()
+ let lks = $.md5('' + 'q8DNJdpcfRQ69gIx' + lkt).toString()
let options = {
- "url": `https://draw.jdfcloud.com/common/api/bean/activity/sendBean?rewardRecordId=${$.rewardRecordId}&jdChannelId=&userSource=mp&appId=wxccb5c536b0ecd1bf&invokeKey=JL1VTNRadM68cIMQ`,
+ "url": `https://draw.jdfcloud.com/common/api/bean/activity/sendBean?rewardRecordId=${$.rewardRecordId}&jdChannelId=&userSource=mp&appId=wxccb5c536b0ecd1bf&invokeKey=q8DNJdpcfRQ69gIx`,
"headers": {
'content-type' : `application/json`,
'Connection' : `keep-alive`,
@@ -392,9 +388,9 @@ function getRandomArrayElements(arr, count) {
async function help() {
await new Promise((resolve) => {
let lkt = new Date().getTime()
- let lks = $.md5('' + 'JL1VTNRadM68cIMQ' + lkt + $.activityCode).toString()
+ let lks = $.md5('' + 'q8DNJdpcfRQ69gIx' + lkt + $.activityCode).toString()
let options = {
- "url": `https://draw.jdfcloud.com/common/api/bean/activity/participate?activityCode=${$.activityCode}&activityId=${$.activityId}&inviteUserPin=${encodeURIComponent($.oneTuanInfo['user'])}&invokeKey=JL1VTNRadM68cIMQ×tap=${Date.now()}`,
+ "url": `https://draw.jdfcloud.com/common/api/bean/activity/participate?activityCode=${$.activityCode}&activityId=${$.activityId}&inviteUserPin=${encodeURIComponent($.oneTuanInfo['user'])}&invokeKey=q8DNJdpcfRQ69gIx×tap=${Date.now()}`,
"headers": {
'content-type' : `application/json`,
'Connection' : `keep-alive`,
@@ -432,8 +428,8 @@ async function help() {
async function invite() {
let lkt = new Date().getTime()
- let lks = $.md5('' + 'JL1VTNRadM68cIMQ' + lkt + $.activityCode).toString()
- const url = `https://draw.jdfcloud.com/common/api/bean/activity/invite?activityCode=${$.activityCode}&openId=&activityId=${$.activityId}&userSource=mp&formId=123&jdChannelId=&fp=&appId=wxccb5c536b0ecd1bf&invokeKey=JL1VTNRadM68cIMQ`;
+ let lks = $.md5('' + 'q8DNJdpcfRQ69gIx' + lkt + $.activityCode).toString()
+ const url = `https://draw.jdfcloud.com/common/api/bean/activity/invite?activityCode=${$.activityCode}&openId=&activityId=${$.activityId}&userSource=mp&formId=123&jdChannelId=&fp=&appId=wxccb5c536b0ecd1bf&invokeKey=q8DNJdpcfRQ69gIx`;
const method = `POST`;
const headers = {
'content-type' : `application/json`,
@@ -477,8 +473,8 @@ async function invite() {
async function getActivityDetail() {
let lkt = new Date().getTime()
- let lks = $.md5('' + 'JL1VTNRadM68cIMQ' + lkt + $.activityCode).toString()
- const url = `https://draw.jdfcloud.com/common/api/bean/activity/detail?activityCode=${$.activityCode}&activityId=${$.activityId}&userOpenId=×tap=${Date.now()}&userSource=mp&jdChannelId=&appId=wxccb5c536b0ecd1bf&invokeKey=JL1VTNRadM68cIMQ`;
+ let lks = $.md5('' + 'q8DNJdpcfRQ69gIx' + lkt + $.activityCode).toString()
+ const url = `https://draw.jdfcloud.com/common/api/bean/activity/detail?activityCode=${$.activityCode}&activityId=${$.activityId}&userOpenId=×tap=${Date.now()}&userSource=mp&jdChannelId=&appId=wxccb5c536b0ecd1bf&invokeKey=q8DNJdpcfRQ69gIx`;
const method = `GET`;
const headers = {
'cookie' : $.cookie,
@@ -556,4 +552,4 @@ function TotalBean() {
// md5
!function(n){function t(n,t){var r=(65535&n)+(65535&t);return(n>>16)+(t>>16)+(r>>16)<<16|65535&r}function r(n,t){return n<>>32-t}function e(n,e,o,u,c,f){return t(r(t(t(e,n),t(u,f)),c),o)}function o(n,t,r,o,u,c,f){return e(t&r|~t&o,n,t,u,c,f)}function u(n,t,r,o,u,c,f){return e(t&o|r&~o,n,t,u,c,f)}function c(n,t,r,o,u,c,f){return e(t^r^o,n,t,u,c,f)}function f(n,t,r,o,u,c,f){return e(r^(t|~o),n,t,u,c,f)}function i(n,r){n[r>>5]|=128<>>9<<4)]=r;var e,i,a,d,h,l=1732584193,g=-271733879,v=-1732584194,m=271733878;for(e=0;e>5]>>>t%32&255)}return r}function d(n){var t,r=[];for(r[(n.length>>2)-1]=void 0,t=0;t>5]|=(255&n.charCodeAt(t/8))<16&&(o=i(o,8*n.length)),r=0;r<16;r+=1){u[r]=909522486^o[r],c[r]=1549556828^o[r]}return e=i(u.concat(d(t)),512+8*t.length),a(i(c.concat(e),640))}function g(n){var t,r,e="";for(r=0;r>>4&15)+"0123456789abcdef".charAt(15&t)}return e}function v(n){return unescape(encodeURIComponent(n))}function m(n){return h(v(n))}function p(n){return g(m(n))}function s(n,t){return l(v(n),v(t))}function C(n,t){return g(s(n,t))}function A(n,t,r){return t?r?s(t,n):C(t,n):r?m(n):p(n)}$.md5=A}(this);
// prettier-ignore
-function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(n,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)}
+function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(n,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)}
\ No newline at end of file
diff --git a/src/main/resources/test_shop.js b/src/main/resources/test_shop.js
index e969b28..fff20db 100644
--- a/src/main/resources/test_shop.js
+++ b/src/main/resources/test_shop.js
@@ -1,128 +1,340 @@
-const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写动动ck;
-const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-
+/*
+东东超市
+Last Modified time: 2021-3-4 21:22:37
+活动入口:京东APP首页-京东超市-底部东东超市
+Some Functions Modified From https://github.com/Zero-S1/JD_tools/blob/master/JD_superMarket.py
+东东超市兑换奖品请使用此脚本 jd_blueCoin.js
+脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
+=================QuantumultX==============
+[task_local]
+#东东超市
+11 * * * * jd_superMarket.js, tag=东东超市, img-url=https://raw.githubusercontent.com/58xinian/icon/master/jxc.png, enabled=true
+===========Loon===============
+[Script]
+cron "11 * * * *" script-path=jd_superMarket.js,tag=东东超市
+=======Surge===========
+东东超市 = type=cron,cronexp="11 * * * *",wake-system=1,timeout=3600,script-path=jd_superMarket.js
+==============小火箭=============
+东东超市 = type=cron,script-path=jd_superMarket.js, cronexpr="11 * * * *", timeout=3600, enable=true
+ */
+const $ = new Env('东东超市');
+//Node.js用户请在jdCookie.js处填写京东ck;
//IOS等用户直接用NobyDa的jd cookie
-let cookiesArr = [], cookie = '';
-if ($.isNode()) {
- Object.keys(jdCookieNode).forEach((item) => {
- cookiesArr.push(jdCookieNode[item])
- })
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') that.log = () => {};
-} else {
- let cookiesData = $.getdata('CookiesJD') || "[]";
- cookiesData = jsonParse(cookiesData);
- cookiesArr = cookiesData.map(item => item.cookie);
- cookiesArr.reverse();
- cookiesArr.push(...[$.getdata('CookieJD2'), $.getdata('CookieJD')]);
- cookiesArr.reverse();
- cookiesArr = cookiesArr.filter(item => item !== "" && item !== null && item !== undefined);
-}
-let message = '', subTitle = '';
+let cookiesArr = [], cookie = '', jdSuperMarketShareArr = [], notify, newShareCodes;
+let helpAu = false;//给作者助力 免费拿,省钱大赢家等活动.默认true是,false不助力.
+helpAu = $.isNode() ? (process.env.HELP_AUTHOR ? process.env.HELP_AUTHOR === 'true' : helpAu) : helpAu;
+let jdNotify = true;//用来是否关闭弹窗通知,true表示关闭,false表示开启。
+let superMarketUpgrade = true;//自动升级,顺序:解锁升级商品、升级货架,true表示自动升级,false表示关闭自动升级
+let businessCircleJump = true;//小于对方300热力值自动更换商圈队伍,true表示运行,false表示禁止
+let drawLotteryFlag = false;//是否用500蓝币去抽奖,true表示开启,false表示关闭。默认关闭
+let joinPkTeam = true;//是否自动加入PK队伍
+let message = '', subTitle;
+const JD_API_HOST = 'https://api.m.jd.com/api';
+
+//助力好友分享码
+//此此内容是IOS用户下载脚本到本地使用,填写互助码的地方,同一京东账号的好友互助码请使用@符号隔开。
+//下面给出两个账号的填写示例(iOS只支持2个京东账号)
+let shareCodes = []
-const JD_API_HOST = 'https://api.m.jd.com/client.action';
!(async () => {
-
- message += "[通知] 动动超市 \n\n --- \n\n"
+ await requireConfig();
if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取动动账号一cookie\n直接使用NobyDa的动动签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
- return;
+ $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
}
for (let i = 0; i < cookiesArr.length; i++) {
if (cookiesArr[i]) {
cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
+ $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
$.index = i + 1;
+ $.coincount = 0;//收取了多少个蓝币
+ $.coinerr = "";
+ $.blueCionTimes = 0;
$.isLogin = true;
$.nickName = '';
await TotalBean();
-
- username = $.UserName
- if ($.UserName == "jd_66ea783827d30"){
- username = "跑腿小弟"
- }
- if ($.UserName == "jd_4521b375ebb5d"){
- username = "锟锟"
- }
- if ($.UserName == "jd_542c10c0222bc"){
- username = "康康"
- }
- //加上名称
- message = message + "【羊毛姐妹】" + username + " \n\n "
- that.log(`\n开始【动动账号${$.index}】${$.nickName || $.UserName}\n`);
+ console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `动动账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
+ $.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"});
if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `动动账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
+ await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
}
continue
}
+ message = '';
subTitle = '';
- await jdShop();
+ //await shareCodesFormat();//格式化助力码
+ await jdSuperMarket();
+ await showMsg();
+ // await businessCircleActivity();
}
- message += "----\n\n"
}
})()
.catch((e) => {
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
- message = message + "" +`❌ ${$.name}, 失败! 原因: ${e}!` + "\n\n"
})
.finally(() => {
- message += getPic()
- that.log(message)
- // postToDingTalk(message)
$.done();
})
-async function jdShop() {
- const taskData = await getTask();
- if (taskData.code === '0') {
- if (!taskData.data.taskList) {
- that.log(`${taskData.data.taskErrorTips}\n`);
- $.msg($.name, '', `动动账号 ${$.index} ${$.nickName}\n${taskData.data.taskErrorTips}`);
- message += "" + `${taskData.data.taskErrorTips}` + "\n\n"
- } else {
- const { taskList } = taskData.data;
- let beanCount = 0;
- for (let item of taskList) {
- if (item.taskStatus === 3) {
- that.log(`${item.shopName} 已拿到2京豆\n`)
- message += "" + `成功领取${beanCount}京豆` + "\n\n"
- } else {
- that.log(`taskId::${item.taskId}`)
- const doTaskRes = await doTask(item.taskId);
- if (doTaskRes.code === '0') {
- beanCount += 2;
- }
+async function jdSuperMarket() {
+ try {
+ await smtgHome();
+ // await receiveGoldCoin();//收金币
+ // await businessCircleActivity();//商圈活动
+ await receiveBlueCoin();//收蓝币(小费)
+ // await receiveLimitProductBlueCoin();//收限时商品的蓝币
+ await daySign();//每日签到
+ await BeanSign()//
+ await doDailyTask();//做日常任务,分享,关注店铺,
+ // await help();//商圈助力
+ //await smtgQueryPkTask();//做商品PK任务
+ await drawLottery();//抽奖功能(招财进宝)
+ // await myProductList();//货架
+ // await upgrade();//升级货架和商品
+ // await manageProduct();
+ // await limitTimeProduct();
+ await smtg_shopIndex();
+ await smtgHome();
+ await receiveUserUpgradeBlue();
+ await Home();
+ if (helpAu === true) {
+ await helpAuthor();
+ }
+ } catch (e) {
+ $.logErr(e)
+ }
+}
+function showMsg() {
+ $.log(`【京东账号${$.index}】${$.nickName}\n${message}`);
+ jdNotify = $.getdata('jdSuperMarketNotify') ? $.getdata('jdSuperMarketNotify') : jdNotify;
+ if (!jdNotify || jdNotify === 'false') {
+ $.msg($.name, subTitle ,`【京东账号${$.index}】${$.nickName}\n${message}`);
+ }
+}
+//抽奖功能(招财进宝)
+async function drawLottery() {
+ console.log(`\n注意⚠:东东超市抽奖已改版,花费500蓝币抽奖一次,现在脚本默认已关闭抽奖功能\n`);
+ drawLotteryFlag = $.getdata('jdSuperMarketLottery') ? $.getdata('jdSuperMarketLottery') : drawLotteryFlag;
+ if ($.isNode() && process.env.SUPERMARKET_LOTTERY) {
+ drawLotteryFlag = process.env.SUPERMARKET_LOTTERY;
+ }
+ if (`${drawLotteryFlag}` === 'true') {
+ const smtg_lotteryIndexRes = await smtg_lotteryIndex();
+ if (smtg_lotteryIndexRes && smtg_lotteryIndexRes.data.bizCode === 0) {
+ const { result } = smtg_lotteryIndexRes.data
+ if (result.blueCoins > result.costCoins && result.remainedDrawTimes > 0) {
+ const drawLotteryRes = await smtg_drawLottery();
+ console.log(`\n花费${result.costCoins}蓝币抽奖结果${JSON.stringify(drawLotteryRes)}`);
+ await drawLottery();
+ } else {
+ console.log(`\n抽奖失败:已抽奖或者蓝币不足`);
+ console.log(`失败详情:\n现有蓝币:${result.blueCoins},抽奖次数:${result.remainedDrawTimes}`)
+ }
+ }
+ } else {
+ console.log(`设置的为不抽奖\n`)
+ }
+}
+async function help() {
+ return
+ console.log(`\n开始助力好友`);
+ for (let code of newShareCodes) {
+ if (!code) continue;
+ const res = await smtgDoAssistPkTask(code);
+ console.log(`助力好友${JSON.stringify(res)}`);
+ }
+}
+async function doDailyTask() {
+ const smtgQueryShopTaskRes = await smtgQueryShopTask();
+ if (smtgQueryShopTaskRes.code === 0 && smtgQueryShopTaskRes.data.success) {
+ const taskList = smtgQueryShopTaskRes.data.result.taskList;
+ console.log(`\n日常赚钱任务 完成状态`)
+ for (let item of taskList) {
+ console.log(` ${item['title'].length < 4 ? item['title']+`\xa0` : item['title'].slice(-4)} ${item['finishNum'] === item['targetNum'] ? '已完成':'未完成'} ${item['finishNum']}/${item['targetNum']}`)
+ }
+ for (let item of taskList) {
+ //领奖
+ if (item.taskStatus === 1 && item.prizeStatus === 1) {
+ const res = await smtgObtainShopTaskPrize(item.taskId);
+ console.log(`\n领取做完任务的奖励${JSON.stringify(res)}\n`)
+ }
+ //做任务
+ if ((item.type === 1 || item.type === 11) && item.taskStatus === 0) {
+ // 分享任务
+ const res = await smtgDoShopTask(item.taskId);
+ console.log(`${item.subTitle}结果${JSON.stringify(res)}`)
+ }
+ if (item.type === 2) {
+ //逛会场
+ if (item.taskStatus === 0) {
+ console.log('开始逛会场')
+ const itemId = item.content[item.type].itemId;
+ const res = await smtgDoShopTask(item.taskId, itemId);
+ console.log(`${item.subTitle}结果${JSON.stringify(res)}`);
}
}
- that.log(`beanCount::${beanCount}`);
- message += "" + `成功领取${beanCount}京豆` + "\n\n"
- $.msg($.name, '', `动动账号 ${$.index} ${$.nickName}\n成功领取${beanCount}京豆`);
+ if (item.type === 8) {
+ //关注店铺
+ if (item.taskStatus === 0) {
+ console.log('开始关注店铺')
+ const itemId = item.content[item.type].itemId;
+ const res = await smtgDoShopTask(item.taskId, itemId);
+ console.log(`${item.subTitle}结果${JSON.stringify(res)}`);
+ }
+ }
+ if (item.type === 9) {
+ //开卡领蓝币任务
+ if (item.taskStatus === 0) {
+ console.log('开始开卡领蓝币任务')
+ const itemId = item.content[item.type].itemId;
+ const res = await smtgDoShopTask(item.taskId, itemId);
+ console.log(`${item.subTitle}结果${JSON.stringify(res)}`);
+ }
+ }
+ if (item.type === 10) {
+ //关注商品领蓝币
+ if (item.taskStatus === 0) {
+ console.log('关注商品')
+ const itemId = item.content[item.type].itemId;
+ const res = await smtgDoShopTask(item.taskId, itemId);
+ console.log(`${item.subTitle}结果${JSON.stringify(res)}`);
+ }
+ }
+ if ((item.type === 8 || item.type === 2 || item.type === 10) && item.taskStatus === 0) {
+ // await doDailyTask();
+ }
}
}
}
-function doTask(taskId) {
- that.log(`doTask-taskId::${taskId}`)
- return new Promise(resolve => {
- const body = { 'taskId': `${taskId}` };
- const options = {
- url: `${JD_API_HOST}`,
- body: `functionId=takeTask&body=${escape(JSON.stringify(body))}&appid=ld`,
- headers: {
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
- 'Host': 'api.m.jd.com',
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Cookie': cookie,
- }
- }
- $.post(options, (err, resp, data) => {
+async function receiveGoldCoin() {
+ const options = taskUrl("smtg_newHome", {
+ "shareId": "",
+ "channel": "4",
+ });
+ $.get(options, (err, resp, data) => {});
+ $.goldCoinData = await smtgReceiveCoin({"type":0});
+ if ($.goldCoinData.data && $.goldCoinData.data.bizCode === 0) {
+ console.log(`领取金币成功:${$.goldCoinData.data.result.receivedGold}`);
+ message += `【领取金币】${$.goldCoinData.data.result.receivedGold}个\n`;
+ } else {
+ console.log($.goldCoinData.data && $.goldCoinData.data.bizMsg);
+ }
+}
+
+function smtgHome() {
+ return new Promise((resolve) => {
+ const options = taskUrl("smtg_newHome", {
+ "shareId": "",
+ "channel": "4",
+ });
+ $.get(options, (err, resp, data) => {});
+ $.get(taskUrl("smtg_newHome", {"shopType":"0","channel":"18"}), (err, resp, data) => {
try {
if (err) {
- that.log('\n进店领豆: API查询请求失败 ‼️‼️')
- $.logErr(err);
+ console.log("\n东东超市: API查询请求失败 ‼️‼️");
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ if (data.code === 0 && data.data.success) {
+ const { result } = data.data;
+ const {
+ shopName,
+ totalBlue,
+ userUpgradeBlueVos,
+ turnoverProgress,
+ currentShopId
+ } = result;
+ $.currentShopId = currentShopId
+ $.userUpgradeBlueVos = userUpgradeBlueVos;
+ $.turnoverProgress = turnoverProgress;
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+
+//领限时商品的蓝币
+async function receiveLimitProductBlueCoin() {
+ const res = await smtgReceiveCoin({ "type": 1 });
+ console.log(`\n限时商品领蓝币结果:[${res.data.bizMsg}]\n`);
+ if (res.data.bizCode === 0) {
+ message += `【限时商品】获得${res.data.result.receivedBlue}个蓝币\n`;
+ }
+}
+
+//领蓝币
+function receiveBlueCoin(timeout = 0) {
+ return new Promise((resolve) => {
+ setTimeout( ()=>{
+ $.get(taskUrl('smtg_receiveCoin', {"type": 4, "shopId": $.currentShopId, "channel": "18"}), async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ $.data = data;
+ if ($.data.data.bizCode !== 0 && $.data.data.bizCode !== 809) {
+ $.coinerr = `${$.data.data.bizMsg}`;
+ message += `【收取小费】${$.data.data.bizMsg}\n`;
+ console.log(`收取蓝币失败:${$.data.data.bizMsg}`)
+ return
+ }
+ if ($.data.data.bizCode === 0) {
+ $.coincount += $.data.data.result.receivedBlue;
+ $.blueCionTimes ++;
+ console.log(`【京东账号${$.index}】${$.nickName} 第${$.blueCionTimes}次领蓝币成功,获得${$.data.data.result.receivedBlue}个\n`)
+ if (!$.data.data.result.isNextReceived) {
+ message += `【收取小费】${$.coincount}个\n`;
+ return
+ }
+ }
+ await receiveBlueCoin(3000);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve()
+ }
+ })
+ },timeout)
+ })
+}
+async function daySign() {
+ const signDataRes = await smtgSign({"shareId":"QcSH6BqSXysv48bMoRfTBz7VBqc5P6GodDUBAt54d8598XAUtNoGd4xWVuNtVVwNO1dSKcoaY3sX_13Z-b3BoSW1W7NnqD36nZiNuwrtyO-gXbjIlsOBFpgIPMhpiVYKVAaNiHmr2XOJptu14d8uW-UWJtefjG9fUGv0Io7NwAQ","channel":"4"});
+ await smtgSign({"shareId":"TBj0jH-x7iMvCMGsHfc839Tfnco6UarNx1r3wZVIzTZiLdWMRrmoocTbXrUOFn0J6UIir16A2PPxF50_Eoo7PW_NQVOiM-3R16jjlT20TNPHpbHnmqZKUDaRajnseEjVb-SYi6DQqlSOioRc27919zXTEB6_llab2CW2aDok36g","channel":"4"});
+ if (signDataRes && signDataRes.code === 0) {
+ const signList = await smtgSignList();
+ if (signList.data.bizCode === 0) {
+ $.todayDay = signList.data.result.todayDay;
+ }
+ if (signDataRes.code === 0 && signDataRes.data.success) {
+ message += `【第${$.todayDay}日签到】成功,奖励${signDataRes.data.result.rewardBlue}蓝币\n`
+ } else {
+ message += `【第${$.todayDay}日签到】${signDataRes.data.bizMsg}\n`
+ }
+ }
+}
+async function BeanSign() {
+ const beanSignRes = await smtgSign({"channel": "1"});
+ if (beanSignRes && beanSignRes.data['bizCode'] === 0) {
+ console.log(`每天从指定入口进入游戏,可获得额外奖励:${JSON.stringify(beanSignRes)}`)
+ }
+}
+//每日签到
+function smtgSign(body) {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_sign', body), async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
} else {
- // that.log(data)
data = JSON.parse(data);
}
} catch (e) {
@@ -133,71 +345,558 @@ function doTask(taskId) {
})
})
}
-function getTask(body = {}) {
- return new Promise(resolve => {
- const options = {
- url: `${JD_API_HOST}`,
- body: `functionId=queryTaskIndex&body=${escape(JSON.stringify(body))}&appid=ld`,
- headers: {
- 'User-Agent': $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0"),
- 'Host': 'api.m.jd.com',
- 'Content-Type': 'application/x-www-form-urlencoded',
- 'Cookie': cookie,
- }
- }
- $.post(options, (err, resp, data) => {
- try {
- if (err) {
- that.log('\n进店领豆: API查询请求失败 ‼️‼️')
- $.logErr(err);
- } else {
- // that.log(data)
- data = JSON.parse(data);
- }
- } catch (e) {
- $.logErr(e, resp);
- } finally {
- resolve(data);
- }
- })
- })
-}
-function TotalBean() {
- return new Promise(async resolve => {
- const options = {
- "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
- "headers": {
- "Accept": "application/json,text/plain, */*",
- "Content-Type": "application/x-www-form-urlencoded",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-cn",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0")
+
+// 商圈活动
+async function businessCircleActivity() {
+ // console.log(`\n商圈PK奖励,次日商圈大战开始的时候自动领领取\n`)
+ joinPkTeam = $.isNode() ? (process.env.JOIN_PK_TEAM ? process.env.JOIN_PK_TEAM : `${joinPkTeam}`) : ($.getdata('JOIN_PK_TEAM') ? $.getdata('JOIN_PK_TEAM') : `${joinPkTeam}`);
+ const smtg_getTeamPkDetailInfoRes = await smtg_getTeamPkDetailInfo();
+ if (smtg_getTeamPkDetailInfoRes && smtg_getTeamPkDetailInfoRes.data.bizCode === 0) {
+ const { joinStatus, pkStatus, inviteCount, inviteCode, currentUserPkInfo, pkUserPkInfo, prizeInfo, pkActivityId, teamId } = smtg_getTeamPkDetailInfoRes.data.result;
+ console.log(`\njoinStatus:${joinStatus}`);
+ console.log(`pkStatus:${pkStatus}\n`);
+ console.log(`pkActivityId:${pkActivityId}\n`);
+
+ if (joinStatus === 0) {
+ if (joinPkTeam === 'true') {
+ console.log(`\n注:PK会在每天的七点自动随机加入作者创建的队伍\n`)
+ await updatePkActivityIdCDN('');
+ console.log(`\nupdatePkActivityId[pkActivityId]:::${$.updatePkActivityIdRes && $.updatePkActivityIdRes.pkActivityId}`);
+ console.log(`\n京东服务器返回的[pkActivityId] ${pkActivityId}`);
+ if ($.updatePkActivityIdRes && ($.updatePkActivityIdRes.pkActivityId === pkActivityId)) {
+ await getTeam();
+ let Teams = []
+ Teams = $.updatePkActivityIdRes['Teams'] || Teams;
+ if ($.getTeams && $.getTeams.length) {
+ Teams = [...Teams, ...$.getTeams.filter(item => item['pkActivityId'] === `${pkActivityId}`)];
+ }
+ const randomNum = randomNumber(0, Teams.length);
+
+ const res = await smtg_joinPkTeam(Teams[randomNum] && Teams[randomNum].teamId, Teams[randomNum] && Teams[randomNum].inviteCode, pkActivityId);
+ if (res && res.data.bizCode === 0) {
+ console.log(`加入战队成功`)
+ } else if (res && res.data.bizCode === 229) {
+ console.log(`加入战队失败,该战队已满\n无法加入`)
+ } else {
+ console.log(`加入战队其他未知情况:${JSON.stringify(res)}`)
+ }
+ } else {
+ console.log('\nupdatePkActivityId请求返回的pkActivityId与京东服务器返回不一致,暂时不加入战队')
+ }
+ }
+ } else if (joinStatus === 1) {
+ if (teamId) {
+ console.log(`inviteCode: [${inviteCode}]`);
+ console.log(`PK队伍teamId: [${teamId}]`);
+ console.log(`PK队伍名称: [${currentUserPkInfo && currentUserPkInfo.teamName}]`);
+ console.log(`我邀请的人数:${inviteCount}\n`)
+ console.log(`\n我方战队战队 [${currentUserPkInfo && currentUserPkInfo.teamName}]/【${currentUserPkInfo && currentUserPkInfo.teamCount}】`);
+ console.log(`对方战队战队 [${pkUserPkInfo && pkUserPkInfo.teamName}]/【${pkUserPkInfo && pkUserPkInfo.teamCount}】\n`);
}
}
- $.post(options, (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (data) {
- data = JSON.parse(data);
- if (data['retcode'] === 13) {
- $.isLogin = false; //cookie过期
- return
+ if (pkStatus === 1) {
+ console.log(`商圈PK进行中\n`)
+ if (!teamId) {
+ const receivedPkTeamPrize = await smtg_receivedPkTeamPrize();
+ console.log(`商圈PK奖励领取结果:${JSON.stringify(receivedPkTeamPrize)}\n`)
+ if (receivedPkTeamPrize.data.bizCode === 0) {
+ if (receivedPkTeamPrize.data.result.pkResult === 1) {
+ const { pkTeamPrizeInfoVO } = receivedPkTeamPrize.data.result;
+ message += `【商圈PK奖励】${pkTeamPrizeInfoVO.blueCoin}蓝币领取成功\n`;
+ if ($.isNode()) {
+ await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}】 ${$.nickName}\n【商圈队伍】PK获胜\n【奖励】${pkTeamPrizeInfoVO.blueCoin}蓝币领取成功`)
}
- if (data['retcode'] === 0) {
- $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
+ } else if (receivedPkTeamPrize.data.result.pkResult === 2) {
+ if ($.isNode()) {
+ await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}】 ${$.nickName}\n【商圈队伍】PK失败`)
+ }
+ }
+ }
+ }
+ } else if (pkStatus === 2) {
+ console.log(`商圈PK结束了`)
+ if (prizeInfo.pkPrizeStatus === 2) {
+ console.log(`开始领取商圈PK奖励`);
+ // const receivedPkTeamPrize = await smtg_receivedPkTeamPrize();
+ // console.log(`商圈PK奖励领取结果:${JSON.stringify(receivedPkTeamPrize)}`)
+ // if (receivedPkTeamPrize.data.bizCode === 0) {
+ // if (receivedPkTeamPrize.data.result.pkResult === 1) {
+ // const { pkTeamPrizeInfoVO } = receivedPkTeamPrize.data.result;
+ // message += `【商圈PK奖励】${pkTeamPrizeInfoVO.blueCoin}蓝币领取成功\n`;
+ // if ($.isNode()) {
+ // await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}】 ${$.nickName}\n【商圈队伍】PK获胜\n【奖励】${pkTeamPrizeInfoVO.blueCoin}蓝币领取成功`)
+ // }
+ // } else if (receivedPkTeamPrize.data.result.pkResult === 2) {
+ // if ($.isNode()) {
+ // await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}】 ${$.nickName}\n【商圈队伍】PK失败`)
+ // }
+ // }
+ // }
+ } else if (prizeInfo.pkPrizeStatus === 1) {
+ console.log(`商圈PK奖励已经领取\n`)
+ }
+ } else if (pkStatus === 3) {
+ console.log(`商圈PK暂停中\n`)
+ }
+ } else {
+ console.log(`\n${JSON.stringify(smtg_getTeamPkDetailInfoRes)}\n`)
+ }
+ return
+ const businessCirclePKDetailRes = await smtg_businessCirclePKDetail();
+ if (businessCirclePKDetailRes && businessCirclePKDetailRes.data.bizCode === 0) {
+ const { businessCircleVO, otherBusinessCircleVO, inviteCode, pkSettleTime } = businessCirclePKDetailRes.data.result;
+ console.log(`\n【您的商圈inviteCode互助码】:\n${inviteCode}\n\n`);
+ const businessCircleIndexRes = await smtg_businessCircleIndex();
+ const { result } = businessCircleIndexRes.data;
+ const { pkPrizeStatus, pkStatus } = result;
+ if (pkPrizeStatus === 2) {
+ console.log(`开始领取商圈PK奖励`);
+ const getPkPrizeRes = await smtg_getPkPrize();
+ console.log(`商圈PK奖励领取结果:${JSON.stringify(getPkPrizeRes)}`)
+ if (getPkPrizeRes.data.bizCode === 0) {
+ const { pkPersonPrizeInfoVO, pkTeamPrizeInfoVO } = getPkPrizeRes.data.result;
+ message += `【商圈PK奖励】${pkPersonPrizeInfoVO.blueCoin + pkTeamPrizeInfoVO.blueCoin}蓝币领取成功\n`;
+ }
+ }
+ console.log(`我方商圈人气值/对方商圈人气值:${businessCircleVO.hotPoint}/${otherBusinessCircleVO.hotPoint}`);
+ console.log(`我方商圈成员数量/对方商圈成员数量:${businessCircleVO.memberCount}/${otherBusinessCircleVO.memberCount}`);
+ message += `【我方商圈】${businessCircleVO.memberCount}/${businessCircleVO.hotPoint}\n`;
+ message += `【对方商圈】${otherBusinessCircleVO.memberCount}/${otherBusinessCircleVO.hotPoint}\n`;
+ // message += `【我方商圈人气值】${businessCircleVO.hotPoint}\n`;
+ // message += `【对方商圈人气值】${otherBusinessCircleVO.hotPoint}\n`;
+ businessCircleJump = $.getdata('jdBusinessCircleJump') ? $.getdata('jdBusinessCircleJump') : businessCircleJump;
+ if ($.isNode() && process.env.jdBusinessCircleJump) {
+ businessCircleJump = process.env.jdBusinessCircleJump;
+ }
+ if (`${businessCircleJump}` === 'false') {
+ console.log(`\n小于对方300热力值自动更换商圈队伍: 您设置的是禁止自动更换商圈队伍\n`);
+ return
+ }
+ if (otherBusinessCircleVO.hotPoint - businessCircleVO.hotPoint > 300 && (Date.now() > (pkSettleTime - 24 * 60 * 60 * 1000))) {
+ //退出该商圈
+ if (inviteCode === '-4msulYas0O2JsRhE-2TA5XZmBQ') return;
+ console.log(`商圈PK已过1天,对方商圈人气值还大于我方商圈人气值300,退出该商圈重新加入`);
+ await smtg_quitBusinessCircle();
+ } else if (otherBusinessCircleVO.hotPoint > businessCircleVO.hotPoint && (Date.now() > (pkSettleTime - 24 * 60 * 60 * 1000 * 2))) {
+ //退出该商圈
+ if (inviteCode === '-4msulYas0O2JsRhE-2TA5XZmBQ') return;
+ console.log(`商圈PK已过2天,对方商圈人气值还大于我方商圈人气值,退出该商圈重新加入`);
+ await smtg_quitBusinessCircle();
+ }
+ } else if (businessCirclePKDetailRes && businessCirclePKDetailRes.data.bizCode === 222) {
+ console.log(`${businessCirclePKDetailRes.data.bizMsg}`);
+ console.log(`开始领取商圈PK奖励`);
+ const getPkPrizeRes = await smtg_getPkPrize();
+ console.log(`商圈PK奖励领取结果:${JSON.stringify(getPkPrizeRes)}`)
+ if (getPkPrizeRes && getPkPrizeRes.data.bizCode === 0) {
+ const { pkPersonPrizeInfoVO, pkTeamPrizeInfoVO } = getPkPrizeRes.data.result;
+ $.msg($.name, '', `【京东账号${$.index}】 ${$.nickName}\n【商圈PK奖励】${pkPersonPrizeInfoVO.blueCoin + pkTeamPrizeInfoVO.blueCoin}蓝币领取成功`)
+ if ($.isNode()) {
+ await notify.sendNotify(`${$.name} - 账号${$.index} - ${$.nickName}`, `【京东账号${$.index}】 ${$.nickName}\n【商圈PK奖励】${pkPersonPrizeInfoVO.blueCoin + pkTeamPrizeInfoVO.blueCoin}蓝币领取成功`)
+ }
+ }
+ } else if (businessCirclePKDetailRes && businessCirclePKDetailRes.data.bizCode === 206) {
+ console.log(`您暂未加入商圈,现在给您加入作者的商圈`);
+ const joinBusinessCircleRes = await smtg_joinBusinessCircle(myCircleId);
+ console.log(`参加商圈结果:${JSON.stringify(joinBusinessCircleRes)}`)
+ if (joinBusinessCircleRes.data.bizCode !== 0) {
+ console.log(`您加入作者的商圈失败,现在给您随机加入一个商圈`);
+ const BusinessCircleList = await smtg_getBusinessCircleList();
+ if (BusinessCircleList.data.bizCode === 0) {
+ const { businessCircleVOList } = BusinessCircleList.data.result;
+ const { circleId } = businessCircleVOList[randomNumber(0, businessCircleVOList.length)];
+ const joinBusinessCircleRes = await smtg_joinBusinessCircle(circleId);
+ console.log(`随机加入商圈结果:${JSON.stringify(joinBusinessCircleRes)}`)
+ }
+ }
+ } else {
+ console.log(`访问商圈详情失败:${JSON.stringify(businessCirclePKDetailRes)}`);
+ }
+}
+//我的货架
+async function myProductList() {
+ const shelfListRes = await smtg_shelfList();
+ if (shelfListRes.data.bizCode === 0) {
+ const { shelfList } = shelfListRes.data.result;
+ console.log(`\n货架数量:${shelfList && shelfList.length}`)
+ for (let item of shelfList) {
+ console.log(`\nshelfId/name : ${item.shelfId}/${item.name}`);
+ console.log(`货架等级 level ${item.level}/${item.maxLevel}`);
+ console.log(`上架状态 groundStatus ${item.groundStatus}`);
+ console.log(`解锁状态 unlockStatus ${item.unlockStatus}`);
+ console.log(`升级状态 upgradeStatus ${item.upgradeStatus}`);
+ if (item.unlockStatus === 0) {
+ console.log(`${item.name}不可解锁`)
+ } else if (item.unlockStatus === 1) {
+ console.log(`${item.name}可解锁`);
+ await smtg_unlockShelf(item.shelfId);
+ } else if (item.unlockStatus === 2) {
+ console.log(`${item.name}已经解锁`)
+ }
+ if (item.groundStatus === 1) {
+ console.log(`${item.name}可上架`);
+ const productListRes = await smtg_shelfProductList(item.shelfId);
+ if (productListRes.data.bizCode === 0) {
+ const { productList } = productListRes.data.result;
+ if (productList && productList.length > 0) {
+ // 此处限时商品未分配才会出现
+ let limitTimeProduct = [];
+ for (let item of productList) {
+ if (item.productType === 2) {
+ limitTimeProduct.push(item);
+ }
+ }
+ if (limitTimeProduct && limitTimeProduct.length > 0) {
+ //上架限时商品
+ await smtg_ground(limitTimeProduct[0].productId, item.shelfId);
} else {
- $.nickName = $.UserName
+ await smtg_ground(productList[productList.length - 1].productId, item.shelfId);
}
} else {
- that.log(`动动服务器返回空数据`)
+ console.log("无可上架产品");
+ await unlockProductByCategory(item.shelfId.split('-')[item.shelfId.split('-').length - 1])
}
}
+ } else if (item.groundStatus === 2 || item.groundStatus === 3) {
+ if (item.productInfo.productType === 2) {
+ console.log(`[${item.name}][限时商品]`)
+ } else if (item.productInfo.productType === 1){
+ console.log(`[${item.name}]`)
+ } else {
+ console.log(`[${item.name}][productType:${item.productInfo.productType}]`)
+ }
+ }
+ }
+ }
+}
+//根据类型解锁一个商品,货架可上架商品时调用
+async function unlockProductByCategory(category) {
+ const smtgProductListRes = await smtg_productList();
+ if (smtgProductListRes.data.bizCode === 0) {
+ let productListByCategory = [];
+ const { productList } = smtgProductListRes.data.result;
+ for (let item of productList) {
+ if (item['unlockStatus'] === 1 && item['shelfCategory'].toString() === category) {
+ productListByCategory.push(item);
+ }
+ }
+ if (productListByCategory && productListByCategory.length > 0) {
+ console.log(`待解锁的商品数量:${productListByCategory.length}`);
+ await smtg_unlockProduct(productListByCategory[productListByCategory.length - 1]['productId']);
+ } else {
+ console.log("该类型商品暂时无法解锁");
+ }
+ }
+}
+//升级货架和商品
+async function upgrade() {
+ superMarketUpgrade = $.getdata('jdSuperMarketUpgrade') ? $.getdata('jdSuperMarketUpgrade') : superMarketUpgrade;
+ if ($.isNode() && process.env.SUPERMARKET_UPGRADE) {
+ superMarketUpgrade = process.env.SUPERMARKET_UPGRADE;
+ }
+ if (`${superMarketUpgrade}` === 'false') {
+ console.log(`\n自动升级: 您设置的是关闭自动升级\n`);
+ return
+ }
+ console.log(`\n*************开始检测升级商品,如遇到商品能解锁,则优先解锁***********`)
+ console.log('目前没有平稳升级,只取倒数几个商品进行升级,普通货架取倒数4个商品,冰柜货架取倒数3个商品,水果货架取倒数2个商品')
+ const smtgProductListRes = await smtg_productList();
+ if (smtgProductListRes.data.bizCode === 0) {
+ let productType1 = [], shelfCategory_1 = [], shelfCategory_2 = [], shelfCategory_3 = [];
+ const { productList } = smtgProductListRes.data.result;
+ for (let item of productList) {
+ if (item['productType'] === 1) {
+ productType1.push(item);
+ }
+ }
+ for (let item2 of productType1) {
+ if (item2['shelfCategory'] === 1) {
+ shelfCategory_1.push(item2);
+ }
+ if (item2['shelfCategory'] === 2) {
+ shelfCategory_2.push(item2);
+ }
+ if (item2['shelfCategory'] === 3) {
+ shelfCategory_3.push(item2);
+ }
+ }
+ shelfCategory_1 = shelfCategory_1.slice(-4);
+ shelfCategory_2 = shelfCategory_2.slice(-3);
+ shelfCategory_3 = shelfCategory_3.slice(-2);
+ const shelfCategorys = shelfCategory_1.concat(shelfCategory_2).concat(shelfCategory_3);
+ console.log(`\n商品名称 归属货架 目前等级 解锁状态 可升级状态`)
+ for (let item of shelfCategorys) {
+ console.log(` ${item["name"].length<3?item["name"]+`\xa0`:item["name"]} ${item['shelfCategory'] === 1 ? '普通货架' : item['shelfCategory'] === 2 ? '冰柜货架' : item['shelfCategory'] === 3 ? '水果货架':'未知货架'} ${item["unlockStatus"] === 0 ? '---' : item["level"]+'级'} ${item["unlockStatus"] === 0 ? '未解锁' : '已解锁'} ${item["upgradeStatus"] === 1 ? '可以升级' : item["upgradeStatus"] === 0 ? '不可升级':item["upgradeStatus"]}`)
+ }
+ shelfCategorys.sort(sortSyData);
+ for (let item of shelfCategorys) {
+ if (item['unlockStatus'] === 1) {
+ console.log(`\n开始解锁商品:${item['name']}`)
+ await smtg_unlockProduct(item['productId']);
+ break;
+ }
+ if (item['upgradeStatus'] === 1) {
+ console.log(`\n开始升级商品:${item['name']}`)
+ await smtg_upgradeProduct(item['productId']);
+ break;
+ }
+ }
+ }
+ console.log('\n**********开始检查能否升级货架***********');
+ const shelfListRes = await smtg_shelfList();
+ if (shelfListRes.data.bizCode === 0) {
+ const { shelfList } = shelfListRes.data.result;
+ let shelfList_upgrade = [];
+ for (let item of shelfList) {
+ if (item['upgradeStatus'] === 1) {
+ shelfList_upgrade.push(item);
+ }
+ }
+ console.log(`待升级货架数量${shelfList_upgrade.length}个`);
+ if (shelfList_upgrade && shelfList_upgrade.length > 0) {
+ shelfList_upgrade.sort(sortSyData);
+ console.log("\n可升级货架名 等级 升级所需金币");
+ for (let item of shelfList_upgrade) {
+ console.log(` [${item["name"]}] ${item["level"]}/${item["maxLevel"]} ${item["upgradeCostGold"]}`);
+ }
+ console.log(`开始升级[${shelfList_upgrade[0].name}]货架,当前等级${shelfList_upgrade[0].level},所需金币${shelfList_upgrade[0].upgradeCostGold}\n`);
+ await smtg_upgradeShelf(shelfList_upgrade[0].shelfId);
+ }
+ }
+}
+async function manageProduct() {
+ console.log(`安排上货(单价最大商品)`);
+ const shelfListRes = await smtg_shelfList();
+ if (shelfListRes.data.bizCode === 0) {
+ const { shelfList } = shelfListRes.data.result;
+ console.log(`我的货架数量:${shelfList && shelfList.length}`);
+ let shelfListUnlock = [];//可以上架的货架
+ for (let item of shelfList) {
+ if (item['groundStatus'] === 1 || item['groundStatus'] === 2) {
+ shelfListUnlock.push(item);
+ }
+ }
+ for (let item of shelfListUnlock) {
+ const productListRes = await smtg_shelfProductList(item.shelfId);//查询该货架可以上架的商品
+ if (productListRes.data.bizCode === 0) {
+ const { productList } = productListRes.data.result;
+ let productNow = [], productList2 = [];
+ for (let item1 of productList) {
+ if (item1['groundStatus'] === 2) {
+ productNow.push(item1);
+ }
+ if (item1['productType'] === 1) {
+ productList2.push(item1);
+ }
+ }
+ // console.log(`productNow${JSON.stringify(productNow)}`)
+ // console.log(`productList2${JSON.stringify(productList2)}`)
+ if (productList2 && productList2.length > 0) {
+ productList2.sort(sortTotalPriceGold);
+ // console.log(productList2)
+ if (productNow && productNow.length > 0) {
+ if (productList2.slice(-1)[0]['productId'] === productNow[0]['productId']) {
+ console.log(`货架[${item.shelfId}]${productNow[0]['name']}已上架\n`)
+ continue;
+ }
+ }
+ await smtg_ground(productList2.slice(-1)[0]['productId'], item['shelfId'])
+ }
+ }
+ }
+ }
+}
+async function limitTimeProduct() {
+ const smtgProductListRes = await smtg_productList();
+ if (smtgProductListRes.data.bizCode === 0) {
+ const { productList } = smtgProductListRes.data.result;
+ let productList2 = [];
+ for (let item of productList) {
+ if (item['productType'] === 2 && item['groundStatus'] === 1) {
+ //未上架并且限时商品
+ console.log(`出现限时商品[${item.name}]`)
+ productList2.push(item);
+ }
+ }
+ if (productList2 && productList2.length > 0) {
+ for (let item2 of productList2) {
+ const { shelfCategory } = item2;
+ const shelfListRes = await smtg_shelfList();
+ if (shelfListRes.data.bizCode === 0) {
+ const { shelfList } = shelfListRes.data.result;
+ let shelfList2 = [];
+ for (let item3 of shelfList) {
+ if (item3['shelfCategory'] === shelfCategory && (item3['groundStatus'] === 1 || item3['groundStatus'] === 2)) {
+ shelfList2.push(item3['shelfId']);
+ }
+ }
+ if (shelfList2 && shelfList2.length > 0) {
+ const groundRes = await smtg_ground(item2['productId'], shelfList2.slice(-1)[0]);
+ if (groundRes.data.bizCode === 0) {
+ console.log(`限时商品上架成功`);
+ message += `【限时商品】上架成功\n`;
+ }
+ }
+ }
+ }
+ } else {
+ console.log(`限时商品已经上架或暂无限时商品`);
+ }
+ }
+}
+//领取店铺升级的蓝币奖励
+async function receiveUserUpgradeBlue() {
+ $.receiveUserUpgradeBlue = 0;
+ if ($.userUpgradeBlueVos && $.userUpgradeBlueVos.length > 0) {
+ for (let item of $.userUpgradeBlueVos) {
+ const receiveCoin = await smtgReceiveCoin({ "id": item.id, "type": 5 })
+ // $.log(`\n${JSON.stringify(receiveCoin)}`)
+ if (receiveCoin && receiveCoin.data['bizCode'] === 0) {
+ $.receiveUserUpgradeBlue += receiveCoin.data.result['receivedBlue']
+ }
+ }
+ $.log(`店铺升级奖励获取:${$.receiveUserUpgradeBlue}蓝币\n`)
+ }
+ const res = await smtgReceiveCoin({"type": 4, "channel": "18"})
+ // $.log(`${JSON.stringify(res)}\n`)
+ if (res && res.data['bizCode'] === 0) {
+ console.log(`\n收取营业额:获得 ${res.data.result['receivedTurnover']}\n`);
+ }
+}
+async function Home() {
+ const homeRes = await smtgHome();
+ if (homeRes && homeRes.data['bizCode'] === 0) {
+ const { result } = homeRes.data;
+ const { shopName, totalBlue } = result;
+ subTitle = shopName;
+ message += `【总蓝币】${totalBlue}个\n`;
+ }
+}
+//=============================================脚本使用到的京东API=====================================
+
+//===新版本
+
+//查询有哪些货架
+function smtg_shopIndex() {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_shopIndex', { "channel": 1 }), async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ if (data && data.data['bizCode'] === 0) {
+ const { shopId, shelfList, merchandiseList, level } = data.data['result'];
+ message += `【店铺等级】${level}\n`;
+ if (shelfList && shelfList.length > 0) {
+ for (let item of shelfList) {
+ //status: 2可解锁,1可升级,-1不可解锁
+ if (item['status'] === 2) {
+ $.log(`${item['name']}可解锁\n`)
+ await smtg_shelfUnlock({ shopId, "shelfId": item['id'], "channel": 1 })
+ } else if (item['status'] === 1) {
+ $.log(`${item['name']}可升级\n`)
+ await smtg_shelfUpgrade({ shopId, "shelfId": item['id'], "channel": 1, "targetLevel": item['level'] + 1 });
+ } else if (item['status'] === -1) {
+ $.log(`[${item['name']}] 未解锁`)
+ } else if (item['status'] === 0) {
+ $.log(`[${item['name']}] 已解锁,当前等级:${item['level']}级`)
+ } else {
+ $.log(`未知店铺状态(status):${item['status']}\n`)
+ }
+ }
+ }
+ if (data.data['result']['forSaleMerchandise']) {
+ $.log(`\n限时商品${data.data['result']['forSaleMerchandise']['name']}已上架`)
+ } else {
+ if (merchandiseList && merchandiseList.length > 0) {
+ for (let item of merchandiseList) {
+ console.log(`发现限时商品${item.name}\n`);
+ await smtg_sellMerchandise({"shopId": shopId,"merchandiseId": item['id'],"channel":"18"})
+ }
+ }
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//解锁店铺
+function smtg_shelfUnlock(body) {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_shelfUnlock', body), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ $.log(`解锁店铺结果:${data}\n`)
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function smtg_shelfUpgrade(body) {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_shelfUpgrade', body), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ $.log(`店铺升级结果:${data}\n`)
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//售卖限时商品API
+function smtg_sellMerchandise(body) {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_sellMerchandise', body), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ $.log(`限时商品售卖结果:${data}\n`)
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//新版东东超市
+function updatePkActivityId(url = 'https://raw.githubusercontent.com/xxx/updateTeam/master/jd_updateTeam.json') {
+ return new Promise(resolve => {
+ $.get({url}, async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ // console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ $.updatePkActivityIdRes = JSON.parse(data);
+ }
} catch (e) {
$.logErr(e, resp)
} finally {
@@ -206,74 +905,849 @@ function TotalBean() {
})
})
}
+function updatePkActivityIdCDN(url) {
+ return new Promise(async resolve => {
+ const headers = {
+ "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"
+ }
+ $.get({ url, headers, timeout: 10000, }, async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ $.updatePkActivityIdRes = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve();
+ }
+ })
+ await $.wait(10000)
+ resolve();
+ })
+}
+function smtgDoShopTask(taskId, itemId) {
+ return new Promise((resolve) => {
+ const body = {
+ "taskId": taskId,
+ "channel": "18"
+ }
+ if (itemId) {
+ body.itemId = itemId;
+ }
+ $.get(taskUrl('smtg_doShopTask', body), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function smtgObtainShopTaskPrize(taskId) {
+ return new Promise((resolve) => {
+ const body = {
+ "taskId": taskId
+ }
+ $.get(taskUrl('smtg_obtainShopTaskPrize', body), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function smtgQueryShopTask() {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_queryShopTask'), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function smtgSignList() {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_signList', { "channel": "18" }), (err, resp, data) => {
+ try {
+ // console.log('ddd----ddd', data)
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//查询商圈任务列表
+function smtgQueryPkTask() {
+ return new Promise( (resolve) => {
+ $.get(taskUrl('smtg_queryPkTask'), async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ if (data.code === 0) {
+ if (data.data.bizCode === 0) {
+ const { taskList } = data.data.result;
+ console.log(`\n 商圈任务 状态`)
+ for (let item of taskList) {
+ if (item.taskStatus === 1) {
+ if (item.prizeStatus === 1) {
+ //任务已做完,但未领取奖励, 现在为您领取奖励
+ await smtgObtainPkTaskPrize(item.taskId);
+ } else if (item.prizeStatus === 0) {
+ console.log(`[${item.title}] 已做完 ${item.finishNum}/${item.targetNum}`);
+ }
+ } else {
+ console.log(`[${item.title}] 未做完 ${item.finishNum}/${item.targetNum}`)
+ if (item.content) {
+ const { itemId } = item.content[item.type];
+ console.log('itemId', itemId)
+ await smtgDoPkTask(item.taskId, itemId);
+ }
+ }
+ }
+ } else {
+ console.log(`${data.data.bizMsg}`)
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//PK邀请好友
+function smtgDoAssistPkTask(code) {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_doAssistPkTask', {"inviteCode": code}), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function smtgReceiveCoin(body) {
+ $.goldCoinData = {};
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_receiveCoin', body), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//领取PK任务做完后的奖励
+function smtgObtainPkTaskPrize(taskId) {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_obtainPkTaskPrize', {"taskId": taskId}), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function smtgDoPkTask(taskId, itemId) {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_doPkTask', {"taskId": taskId, "itemId": itemId}), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function smtg_joinPkTeam(teamId, inviteCode, sharePkActivityId) {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_joinPkTeam', { teamId, inviteCode, "channel": "3", sharePkActivityId }), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function smtg_getTeamPkDetailInfo() {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_getTeamPkDetailInfo'), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function smtg_businessCirclePKDetail() {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_businessCirclePKDetail'), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function smtg_getBusinessCircleList() {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_getBusinessCircleList'), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//加入商圈API
+function smtg_joinBusinessCircle(circleId) {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_joinBusinessCircle', { circleId }), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function smtg_businessCircleIndex() {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_businessCircleIndex'), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function smtg_receivedPkTeamPrize() {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_receivedPkTeamPrize', {"channel": "1"}), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//领取商圈PK奖励
+function smtg_getPkPrize() {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_getPkPrize'), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function smtg_quitBusinessCircle() {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_quitBusinessCircle'), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//我的货架
+function smtg_shelfList() {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_shelfList'), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//检查某个货架可以上架的商品列表
+function smtg_shelfProductList(shelfId) {
+ return new Promise((resolve) => {
+ console.log(`开始检查货架[${shelfId}] 可上架产品`)
+ $.get(taskUrl('smtg_shelfProductList', { shelfId }), (err, resp, data) => {
+ try {
+ // console.log(`检查货架[${shelfId}] 可上架产品结果:${data}`)
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//升级商品
+function smtg_upgradeProduct(productId) {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_upgradeProduct', { productId }), (err, resp, data) => {
+ try {
+ // console.log(`升级商品productId[${productId}]结果:${data}`);
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ console.log(`升级商品结果\n${data}`);
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//解锁商品
+function smtg_unlockProduct(productId) {
+ return new Promise((resolve) => {
+ console.log(`开始解锁商品`)
+ $.get(taskUrl('smtg_unlockProduct', { productId }), (err, resp, data) => {
+ try {
+ // console.log(`解锁商品productId[${productId}]结果:${data}`);
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//升级货架
+function smtg_upgradeShelf(shelfId) {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_upgradeShelf', { shelfId }), (err, resp, data) => {
+ try {
+ // console.log(`升级货架shelfId[${shelfId}]结果:${data}`);
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ console.log(`升级货架结果\n${data}`)
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//解锁货架
+function smtg_unlockShelf(shelfId) {
+ return new Promise((resolve) => {
+ console.log(`开始解锁货架`)
+ $.get(taskUrl('smtg_unlockShelf', { shelfId }), (err, resp, data) => {
+ try {
+ // console.log(`解锁货架shelfId[${shelfId}]结果:${data}`);
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function smtg_ground(productId, shelfId) {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_ground', { productId, shelfId }), (err, resp, data) => {
+ try {
+ // console.log(`上架商品结果:${data}`);
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function smtg_productList() {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_productList'), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function smtg_lotteryIndex() {
+ return new Promise((resolve) => {
+ $.get(taskUrl('smtg_lotteryIndex', {"costType":1,"channel":1}), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function smtg_drawLottery() {
+ return new Promise(async (resolve) => {
+ await $.wait(1000);
+ $.get(taskUrl('smtg_drawLottery', {"costType":1,"channel":1}), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log('\n东东超市: API查询请求失败 ‼️‼️')
+ console.log(JSON.stringify(err));
+ } else {
+ data = JSON.parse(data);
+ }
+ } catch (e) {
+ $.logErr(e, resp);
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function sortSyData(a, b) {
+ return a['upgradeCostGold'] - b['upgradeCostGold']
+}
+function sortTotalPriceGold(a, b) {
+ return a['previewTotalPriceGold'] - b['previewTotalPriceGold']
+}
+//格式化助力码
+function shareCodesFormat() {
+ return new Promise(resolve => {
+ console.log(`第${$.index}个京东账号的助力码:::${jdSuperMarketShareArr[$.index - 1]}`)
+ if (jdSuperMarketShareArr[$.index - 1]) {
+ newShareCodes = jdSuperMarketShareArr[$.index - 1].split('@');
+ } else {
+ console.log(`由于您未提供与京京东账号相对应的shareCode,下面助力将采纳本脚本自带的助力码\n`)
+ const tempIndex = $.index > shareCodes.length ? (shareCodes.length - 1) : ($.index - 1);
+ newShareCodes = shareCodes[tempIndex].split('@');
+ }
+ console.log(`格式化后第${$.index}个京东账号的助力码${JSON.stringify(newShareCodes)}`)
+ resolve();
+ })
+}
+function requireConfig() {
+ return new Promise(resolve => {
+ // console.log('\n开始获取东东超市配置文件\n')
+ notify = $.isNode() ? require('./sendNotify') : '';
+ //Node.js用户请在jdCookie.js处填写京东ck;
+ const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
+ //IOS等用户直接用NobyDa的jd cookie
+ if ($.isNode()) {
+ Object.keys(jdCookieNode).forEach((item) => {
+ if (jdCookieNode[item]) {
+ cookiesArr.push(jdCookieNode[item])
+ }
+ })
+ if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
+ } else {
+ cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
+ }
+ console.log(`共${cookiesArr.length}个京东账号\n`);
+ // console.log(`东东超市已改版,目前暂不用助力, 故无助力码`)
+ // console.log(`\n东东超市商圈助力码::${JSON.stringify(jdSuperMarketShareArr)}`);
+ // console.log(`您提供了${jdSuperMarketShareArr.length}个账号的助力码\n`);
+ resolve()
+ })
+}
+function TotalBean() {
+ return new Promise(async resolve => {
+ const options = {
+ url: "https://wq.jd.com/user_new/info/GetJDUserInfoUnion?sceneval=2",
+ headers: {
+ Host: "wq.jd.com",
+ Accept: "*/*",
+ Connection: "keep-alive",
+ Cookie: cookie,
+ "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"),
+ "Accept-Language": "zh-cn",
+ "Referer": "https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&",
+ "Accept-Encoding": "gzip, deflate, br"
+ }
+ }
+ $.get(options, (err, resp, data) => {
+ try {
+ if (err) {
+ $.logErr(err)
+ } else {
+ if (data) {
+ data = JSON.parse(data);
+ if (data['retcode'] === 1001) {
+ $.isLogin = false; //cookie过期
+ return;
+ }
+ if (data['retcode'] === 0 && data.data && data.data.hasOwnProperty("userInfo")) {
+ $.nickName = data.data.userInfo.baseInfo.nickname;
+ }
+ } else {
+ console.log('京东服务器返回空数据');
+ }
+ }
+ } catch (e) {
+ $.logErr(e)
+ } finally {
+ resolve();
+ }
+ })
+ })
+}
+function getTeam() {
+ return new Promise(async resolve => {
+ $.getTeams = [];
+ $.get({url: `http://jd.turinglabs.net/api/v2/jd/supermarket/read/100000/`, timeout: 100000}, (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} supermarket/read/ API请求失败,请检查网路重试`)
+ } else {
+ data = JSON.parse(data);
+ $.getTeams = data && data['data'];
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve();
+ }
+ })
+ await $.wait(10000);
+ resolve()
+ })
+}
+
+function taskUrl(function_id, body = {}) {
+ return {
+ url: `${JD_API_HOST}?appid=jdsupermarket&functionId=${function_id}&clientVersion=8.0.0&client=m&body=${encodeURIComponent(JSON.stringify(body))}&t=${Date.now()}`,
+ headers: {
+ "Host": "api.m.jd.com",
+ "Accept": "application/json, text/plain, */*",
+ "Origin": "https://jdsupermarket.jd.com",
+ "Accept-Encoding": "gzip, deflate, br",
+ "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"),
+ "Accept-Language": "zh-CN,zh-Hans;q=0.9",
+ "Referer": "https://jdsupermarket.jd.com/",
+ "Cookie": cookie
+ }
+ }
+}
+/**
+ * 生成随机数字
+ * @param {number} min 最小值(包含)
+ * @param {number} max 最大值(不包含)
+ */
+function randomNumber(min = 0, max = 100) {
+ return Math.min(Math.floor(min + Math.random() * (max - min)), max);
+}
function jsonParse(str) {
if (typeof str == "string") {
try {
return JSON.parse(str);
} catch (e) {
- that.log(e);
+ console.log(e);
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
return [];
}
}
}
-
-
-//我加的函数
-function postToDingTalk(messgae) {
- const dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=fa87e34729eaa6113fddfa857efebb477dea0a433d6eecfe93b1d3f5e24847b9"
-
- const message1 = "" + messgae
- that.log(messgae)
-
- const body = {
- "msgtype": "markdown",
- "markdown": {
- "title":"动动超市",
- "text": message1
- },
- "at": {
- "atMobiles": [],
- "isAtAll": false
- }
- }
-
-
- $.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
- try {
- that.log(resp)
- that.log(data)
- if (err) {
- that.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- $.duckRes = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- },"json")
+//==========================以下是给作者助力 免费拿,省钱大赢家等活动======================
+async function helpAuthor() {
+ await barGain();//免费拿
+ await bigWinner();//省钱大赢家
+}
+async function barGain() {
+ let res = await getAuthorShareCode2('')
+ if (!res) {
+ $.http.get({url: ''}).then((resp) => {}).catch((e) => $.log('刷新CDN异常', e));
+ await $.wait(1000)
+ res = await getAuthorShareCode2('')
+ }
+ $.inBargaining = [...(res && res['inBargaining'] || [])]
+ $.inBargaining = getRandomArrayElements($.inBargaining, $.inBargaining.length > 3 ? 6 : $.inBargaining.length);
+ for (let item of $.inBargaining) {
+ if (!item['activityId']) continue;
+ const options = {
+ url: `https://api.m.jd.com/client.action`,
+ headers: {
+ 'Host': 'api.m.jd.com',
+ 'Content-Type': 'application/x-www-form-urlencoded',
+ 'Origin': 'https://h5.m.jd.com',
+ 'Accept-Encoding': 'gzip, deflate, br',
+ 'Cookie': cookie,
+ 'Connection': 'keep-alive',
+ 'Accept': 'application/json, text/plain, */*',
+ 'User-Agent': 'jdapp;iPhone;9.4.0;14.3;;network/wifi;ADID/;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone10,3;addressid/;supportBestPay/0;appBuild/167541;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
+ 'Referer': `https://h5.m.jd.com/babelDiy/Zeus/4ZK4ZpvoSreRB92RRo8bpJAQNoTq/index.html`,
+ 'Accept-Language': 'zh-cn',
+ },
+ body: `functionId=cutPriceByUser&body={"activityId": ${item['activityId']},"userName":"","followShop":1,"shopId": ${item['shopId']},"userPic":""}&client=wh5&clientVersion=1.0.0`
+ };
+ await $.post(options, (err, ersp, data) => {})
+ }
}
-
-function toDingtalk(urlmain, bodyMain) {
- return {
- url: urlmain,
- body:bodyMain,
- headers: { 'Content-Type': 'application/json;charset=utf-8' },
- timeout: 10000,
- }
+async function bigWinner() {
+ let res = await getAuthorShareCode2('')
+ if (!res) {
+ $.http.get({url: ''}).then((resp) => {}).catch((e) => $.log('刷新CDN异常', e));
+ await $.wait(1000)
+ res = await getAuthorShareCode2('')
+ }
+ $.codeList = getRandomArrayElements([...(res || [])], [...(res || [])].length);
+ for (let vo of $.codeList) {
+ if (!vo['inviter']) continue
+ await _618(vo['redEnvelopeId'], vo['inviter'], '1');
+ await _618(vo['redEnvelopeId'],vo['inviter'], '2')
+ }
}
-function getPic(){
- let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
- let address = "\n\n )
- address = address + code[pos] + ")"
- return address
-}
\ No newline at end of file
+function _618(redEnvelopeId, inviter, helpType = '1', linkId = 'PFbUR7wtwUcQ860Sn8WRfw') {
+ return new Promise(resolve => {
+ $.get({
+ url: `https://api.m.jd.com/?functionId=openRedEnvelopeInteract&body={%22linkId%22:%22${linkId}%22,%22redEnvelopeId%22:%22${redEnvelopeId}%22,%22inviter%22:%22${inviter}%22,%22helpType%22:%22${helpType}%22}&t=${+new Date()}&appid=activities_platform&clientVersion=3.5.0`,
+ headers: {
+ 'Host': 'api.m.jd.com',
+ 'accept': 'application/json, text/plain, */*',
+ 'origin': 'https://618redpacket.jd.com',
+ 'user-agent': 'jdltapp;iPhone;3.5.0;14.2;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone10,2;hasOCPay/0;appBuild/1066;supportBestPay/0;pv/7.0;apprpd/;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
+ 'accept-language': 'zh-cn',
+ 'referer': `https://618redpacket.jd.com/?activityId=${linkId}&redEnvelopeId=${redEnvelopeId}&inviterId=${inviter}&helpType=1&lng=&lat=&sid=`,
+ 'Cookie': cookie
+ }
+ }, (err, resp, data) => {
+ resolve()
+ })
+ })
+}
+function getAuthorShareCode2(url) {
+ return new Promise(async resolve => {
+ const options = {
+ url: `${url}?${new Date()}`, "timeout": 10000, headers: {
+ "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"
+ }
+ };
+ if ($.isNode() && process.env.TG_PROXY_HOST && process.env.TG_PROXY_PORT) {
+ const tunnel = require("tunnel");
+ const agent = {
+ https: tunnel.httpsOverHttp({
+ proxy: {
+ host: process.env.TG_PROXY_HOST,
+ port: process.env.TG_PROXY_PORT * 1
+ }
+ })
+ }
+ Object.assign(options, { agent })
+ }
+ $.get(options, async (err, resp, data) => {
+ try {
+ if (err) {
+ } else {
+ if (data) data = JSON.parse(data)
+ }
+ } catch (e) {
+ // $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ await $.wait(10000)
+ resolve();
+ })
+}
+function getRandomArrayElements(arr, count) {
+ let shuffled = arr.slice(0), i = arr.length, min = i - count, temp, index;
+ while (i-- > min) {
+ index = Math.floor((i + 1) * Math.random());
+ temp = shuffled[index];
+ shuffled[index] = shuffled[i];
+ shuffled[i] = temp;
+ }
+ return shuffled.slice(min);
+}
+// prettier-ignore
+function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(n,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)}
\ No newline at end of file
diff --git a/src/main/resources/test_small_home.js b/src/main/resources/test_small_home.js
new file mode 100644
index 0000000..278f665
--- /dev/null
+++ b/src/main/resources/test_small_home.js
@@ -0,0 +1,929 @@
+/*
+东东小窝 jd_small_home.js
+Last Modified time: 2021-6-27 13:27:20
+现有功能:
+做日常任务任务,每日抽奖(有机会活动京豆,使用的是免费机会,不消耗WO币)
+自动使用WO币购买装饰品可以获得京豆,分别可获得5,20,50,100,200,400,700,1200京豆)
+
+注:目前使用此脚本会给脚本内置的两个码进行助力,请知晓
+
+活动入口:京东APP我的-游戏与更多-东东小窝
+或 京东APP首页-搜索 玩一玩-DIY理想家
+微信小程序入口:
+来客有礼 - > 首页 -> 东东小窝
+网页入口(注:进入后不能再此刷新,否则会有问题,需重新输入此链接进入)
+https://h5.m.jd.com/babelDiy/Zeus/2HFSytEAN99VPmMGZ6V4EYWus1x/index.html
+
+已支持IOS双京东账号,Node.js支持N个京东账号
+脚本兼容: QuantumultX, Surge, Loon, 小火箭,JSBox, Node.js
+===============Quantumultx===============
+[task_local]
+#东东小窝
+16 22 * * * jd_small_home.js, tag=东东小窝, img-url=https://raw.githubusercontent.com/58xinian/icon/master/ddxw.png, enabled=true
+
+================Loon==============
+[Script]
+cron "16 22 * * *" script-path=jd_small_home.js, tag=东东小窝
+
+===============Surge=================
+东东小窝 = type=cron,cronexp="16 22 * * *",wake-system=1,timeout=3600,script-path=jd_small_home.js
+
+============小火箭=========
+东东小窝 = type=cron,script-path=jd_small_home.js, cronexpr="16 22 * * *", timeout=3600, enable=true
+ */
+const $ = new Env('东东小窝');
+const notify = $.isNode() ? require('./sendNotify') : '';
+//Node.js用户请在jdCookie.js处填写京东ck;
+const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
+
+//IOS等用户直接用NobyDa的jd cookie
+let cookiesArr = [], cookie = '', message = '';
+let isPurchaseShops = false;//是否一键加购商品到购物车,默认不加购
+$.helpToken = [];
+if ($.isNode()) {
+ Object.keys(jdCookieNode).forEach((item) => {
+ cookiesArr.push(jdCookieNode[item])
+ })
+ if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
+} else {
+ cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
+}
+$.newShareCodes = [];
+const JD_API_HOST = 'https://lkyl.dianpusoft.cn/api';
+
+!(async () => {
+ if (!cookiesArr[0]) {
+ $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
+ return;
+ }
+ for (let i = 0; i < cookiesArr.length; i++) {
+ if (cookiesArr[i]) {
+ cookie = cookiesArr[i];
+ $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
+ $.index = i + 1;
+ $.isLogin = true;
+ $.nickName = '';
+ message = '';
+ await TotalBean();
+ console.log(`\n*******开始【京东账号${$.index}】${$.nickName || $.UserName}********\n`);
+ if (!$.isLogin) {
+ $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
+
+ if ($.isNode()) {
+ await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
+ }
+ continue
+ }
+ await smallHome();
+ }
+ }
+ $.inviteCodes = await getAuthorShareCode('')
+ if (!$.inviteCodes) {
+ $.http.get({url: ''}).then((resp) => {}).catch((e) => $.log('刷新CDN异常', e));
+ await $.wait(1000)
+ $.inviteCodes = await getAuthorShareCode('')
+ }
+ for (let i = 0; i < cookiesArr.length; i++) {
+ if (cookiesArr[i]) {
+ cookie = cookiesArr[i];
+ $.token = $.helpToken[i];
+ $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
+ if ($.newShareCodes.length > 1) {
+ // console.log('----', (i + 1) % $.newShareCodes.length)
+ let code = $.newShareCodes[(i + 1) % $.newShareCodes.length]['code']
+ console.log(`\n${$.UserName} 去给自己的下一账号 ${decodeURIComponent($.newShareCodes[(i + 1) % $.newShareCodes.length]['cookie'].match(/pt_pin=([^; ]+)(?=;?)/) && $.newShareCodes[(i + 1) % $.newShareCodes.length]['cookie'].match(/pt_pin=([^; ]+)(?=;?)/)[1])}助力,助力码为 ${code}`)
+ await createAssistUser(code, $.createAssistUserID);
+ }
+ await helpFriends();
+ }
+ }
+})()
+ .catch((e) => {
+ $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
+ })
+ .finally(() => {
+ $.done();
+ })
+async function smallHome() {
+ try {
+ await loginHome();
+ await ssjjRooms();
+ // await helpFriends();
+ if (!$.isUnLock) return;
+ await createInviteUser();
+ await queryDraw();
+ await lottery();
+ await doAllTask();
+ await queryByUserId();
+ await queryFurnituresCenterList();
+ await showMsg();
+ } catch (e) {
+ $.logErr(e)
+ }
+}
+function showMsg() {
+ return new Promise(resolve => {
+ $.msg($.name, '', `【京东账号${$.index}】${$.nickName}\n${message}`);
+ resolve()
+ })
+}
+async function lottery() {
+ if ($.freeDrawCount > 0) {
+ await drawRecord($.lotteryId);
+ } else {
+ console.log(`免费抽奖机会今日已使用\n`)
+ }
+}
+
+async function doChannelsListTask(taskId, taskType) {
+ await queryChannelsList(taskId);
+ for (let item of $.queryChannelsList) {
+ if (item.showOrder === 1) {
+ await $.wait(1000)
+ await followChannel(taskId, item.id)
+ await queryDoneTaskRecord(taskId, taskType);
+ }
+ }
+}
+async function helpFriends() {
+ // await updateInviteCode();
+ // if (!$.inviteCodes) await updateInviteCodeCDN();
+ if ($.inviteCodes && $.inviteCodes['inviteCode'] && $.inviteCodes['inviteCode'].length) {
+ console.log(`\n去帮助作者\n`)
+ for (let item of $.inviteCodes.inviteCode) {
+ if (!item) continue
+ await createAssistUser(item, $.createAssistUserID);
+ }
+ }
+}
+async function doAllTask() {
+ await queryAllTaskInfo();//获取任务详情列表$.taskList
+ console.log(` 任务名称 完成进度 `)
+ for (let item of $.taskList) {
+ console.log(`${item.ssjjTaskInfo.name} ${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum || (item.ssjjTaskInfo.type === 1 ? 4: 1)}`)
+ }
+ for (let item of $.taskList) {
+ if (item.ssjjTaskInfo.type === 1) {
+ //邀请好友助力自己
+ $.createAssistUserID = item.ssjjTaskInfo.id;
+ // console.log(`createAssistUserID:${item.ssjjTaskInfo.id}`)
+ console.log(`\n\n助力您的好友:${item.doneNum}人\n\n`);
+ }
+ if (item.ssjjTaskInfo.type === 2) {
+ //每日打卡
+ if (item.doneNum >= (item.ssjjTaskInfo.awardOfDayNum || 1)) {
+ console.log(`${item.ssjjTaskInfo.name}已完成[${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum || 1}]`)
+ continue
+ }
+ await clock(item.ssjjTaskInfo.id, item.ssjjTaskInfo.awardWoB)
+ }
+ // 限时连连看
+ if (item.ssjjTaskInfo.type === 3) {
+ if (item.doneNum >= item.ssjjTaskInfo.awardOfDayNum) {
+ console.log(`${item.ssjjTaskInfo.name}已完成[${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum}]`)
+ continue
+ }
+ for (let i = 0; i < new Array(item.ssjjTaskInfo.awardOfDayNum || 1).fill('').length; i++) {
+ await game(item.ssjjTaskInfo.id, item.doneNum);
+ }
+ }
+ if (item.ssjjTaskInfo.type === 4) {
+ //关注店铺
+ if (item.doneNum >= item.ssjjTaskInfo.awardOfDayNum) {
+ console.log(`${item.ssjjTaskInfo.name}已完成[${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum}]`)
+ continue
+ }
+ for (let i = 0; i < new Array(item.ssjjTaskInfo.awardOfDayNum).fill('').length; i++) {
+ await followShops('followShops', item.ssjjTaskInfo.id);//一键关注店铺
+ await queryDoneTaskRecord(item.ssjjTaskInfo.id, item.ssjjTaskInfo.type);
+ }
+ }
+ if (item.ssjjTaskInfo.type === 5) {
+ //浏览店铺
+ if (item.doneNum >= item.ssjjTaskInfo.awardOfDayNum) {
+ console.log(`${item.ssjjTaskInfo.name}已完成[${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum}]`)
+ continue
+ }
+ for (let i = 0; i < new Array(item.ssjjTaskInfo.awardOfDayNum).fill('').length; i++) {
+ await browseChannels('browseShops', item.ssjjTaskInfo.id, item.browseId);
+ }
+ }
+ if (item.ssjjTaskInfo.type === 6) {
+ //关注4个频道
+ if (item.doneNum >= item.ssjjTaskInfo.awardOfDayNum) {
+ console.log(`${item.ssjjTaskInfo.name}已完成[${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum}]`)
+ continue
+ }
+ await doChannelsListTask(item.ssjjTaskInfo.id, item.ssjjTaskInfo.type)
+ }
+ if (item.ssjjTaskInfo.type === 7) {
+ //浏览3个频道
+ if (item.doneNum >= item.ssjjTaskInfo.awardOfDayNum) {
+ console.log(`${item.ssjjTaskInfo.name}已完成[${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum}]`)
+ continue
+ }
+ for (let i = 0; i < new Array(item.ssjjTaskInfo.awardOfDayNum || 1).fill('').length; i++) {
+ await browseChannels('browseChannels', item.ssjjTaskInfo.id, item.browseId);
+ }
+ }
+ isPurchaseShops = $.isNode() ? (process.env.PURCHASE_SHOPS ? process.env.PURCHASE_SHOPS : isPurchaseShops) : ($.getdata("isPurchaseShops") ? $.getdata("isPurchaseShops") : isPurchaseShops);
+ if (isPurchaseShops && item.ssjjTaskInfo.type === 9) {
+ //加购商品
+ if (item.doneNum >= item.ssjjTaskInfo.awardOfDayNum) {
+ console.log(`${item.ssjjTaskInfo.name}已完成[${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum}]`)
+ continue
+ }
+ for (let i = 0; i < new Array(item.ssjjTaskInfo.awardOfDayNum).fill('').length; i++) {
+ await followShops('purchaseCommodities', item.ssjjTaskInfo.id);//一键加购商品
+ await queryDoneTaskRecord(item.ssjjTaskInfo.id, item.ssjjTaskInfo.type);
+ }
+ }
+ if (item.ssjjTaskInfo.type === 10) {
+ //浏览商品
+ if (item.doneNum >= item.ssjjTaskInfo.awardOfDayNum) {
+ console.log(`${item.ssjjTaskInfo.name}已完成[${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum}]`)
+ continue
+ }
+ for (let i = 0; i < new Array(item.ssjjTaskInfo.awardOfDayNum).fill('').length; i++) {
+ await browseChannels('browseCommodities', item.ssjjTaskInfo.id, item.browseId);
+ }
+ }
+ if (item.ssjjTaskInfo.type === 11) {
+ //浏览会场
+ if (item.doneNum >= item.ssjjTaskInfo.awardOfDayNum) {
+ console.log(`${item.ssjjTaskInfo.name}已完成[${item.doneNum}/${item.ssjjTaskInfo.awardOfDayNum}]`)
+ continue
+ }
+ for (let i = 0; i < new Array(item.ssjjTaskInfo.awardOfDayNum || 1).fill('').length; i++) {
+ await browseChannels('browseMeetings' ,item.ssjjTaskInfo.id, item.browseId);
+ }
+ // await browseChannels('browseMeetings' ,item.ssjjTaskInfo.id, item.browseId);
+ // await doAllTask();
+ }
+ }
+}
+function queryFurnituresCenterList() {
+ return new Promise(resolve => {
+ $.get(taskUrl(`ssjj-furnitures-center/queryFurnituresCenterList`), async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.head.code === 200) {
+ if (data.body) {
+ let { buy, list } = data.body;
+ $.canBuyList = [];
+ list.map((item, index) => {
+ if (buy.some((buyItem) => buyItem === item.id)) return
+ $.canBuyList.push(item);
+ })
+ $.canBuyList.sort(sortByjdBeanNum);
+ if ($.canBuyList[0].needWoB <= $.woB) {
+ await furnituresCenterPurchase($.canBuyList[0].id, $.canBuyList[0].jdBeanNum);
+ } else {
+ console.log(`\n兑换${$.canBuyList[0].jdBeanNum}京豆失败:当前wo币${$.woB}不够兑换所需的${$.canBuyList[0].needWoB}WO币`)
+ message += `【装饰领京豆】兑换${$.canBuyList[0].jdBeanNum}京豆失败,原因:WO币不够\n`;
+ }
+ // for (let canBuyItem of $.canBuyList) {
+ // if (canBuyItem.needWoB <= $.woB) {
+ // await furnituresCenterPurchase(canBuyItem.id, canBuyItem.jdBeanNum);
+ // break
+ // }
+ // }
+ }
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//装饰领京豆
+function furnituresCenterPurchase(id, jdBeanNum) {
+ return new Promise(resolve => {
+ $.post(taskPostUrl(`ssjj-furnitures-center/furnituresCenterPurchase/${id}`), async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.head.code === 200) {
+ message += `【装饰领京豆】${jdBeanNum}兑换成功\n`;
+ await notify.sendNotify($.name, `【京东账号 ${$.index}】 ${$.UserName || $.nickName}\n【装饰领京豆】${jdBeanNum}兑换成功`)
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+
+//获取详情
+function queryByUserId() {
+ return new Promise(resolve => {
+ $.get(taskUrl(`ssjj-wo-home-info/queryByUserId/2`), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.head.code === 200) {
+ if (data.body) {
+ message += `【小窝名】${data.body.name}\n`;
+ $.woB = data.body.woB;
+ message += `【当前WO币】${data.body.woB}\n`;
+ }
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//获取需要关注的频道列表
+function queryChannelsList(taskId) {
+ return new Promise(resolve => {
+ $.get(taskUrl(`ssjj-task-channels/queryChannelsList/${taskId}`), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.head.code === 200) {
+ if (data.body) {
+ $.queryChannelsList = data.body;
+ }
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+
+//浏览频道,浏览会场,浏览商品,浏览店铺API
+function browseChannels(functionID ,taskId, browseId) {
+ return new Promise(resolve => {
+ $.get(taskUrl(`/ssjj-task-record/${functionID}/${taskId}/${browseId}`), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ console.log(`${functionID === 'browseChannels' ? '浏览频道' : functionID === 'browseMeetings' ? '浏览会场' : functionID === 'browseShops' ? '浏览店铺' : '浏览商品'}`, data)
+ data = JSON.parse(data);
+ if (data.head.code === 200) {
+ if (data.body) {
+ // message += `【限时连连看】成功,活动${awardWoB}WO币\n`;
+ }
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//记录已关注的频道
+function queryDoneTaskRecord(taskId, taskType) {
+ return new Promise(resolve => {
+ $.get(taskUrl(`/ssjj-task-record/queryDoneTaskRecord/${taskType}/${taskId}`), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.head.code === 200) {
+ if (data.body) {
+ // message += `【限时连连看】成功,活动${awardWoB}WO币\n`;
+ }
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//一键关注店铺,一键加购商品API
+function followShops(functionID, taskId) {
+ return new Promise(async resolve => {
+ $.get(taskUrl(`/ssjj-task-record/${functionID}/${taskId}`), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.head.code === 200) {
+ if (data.body) {
+ console.log(`${functionID === 'followShops'? '一键关注店铺': '一键加购商品'}结果:${data.head.msg}`);
+ // message += `【限时连连看】成功,活动${awardWoB}WO币\n`;
+ }
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//关注频道API
+function followChannel(taskId, channelId) {
+ return new Promise(async resolve => {
+ $.get(taskUrl(`/ssjj-task-record/followChannel/${channelId}/${taskId}`), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.head.code === 200) {
+ if (data.body) {
+ // message += `【限时连连看】成功,活动${awardWoB}WO币\n`;
+ }
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function createInviteUser() {
+ return new Promise(resolve => {
+ $.get(taskUrl(`/ssjj-task-record/createInviteUser`), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.head.code === 200) {
+ if (data.body) {
+ if (data.body.id) {
+ console.log(`\n您的${$.name}shareCode(每天都是变化的):【${data.body.id}】\n`);
+ $.shareCode = data.body.id;
+ $.newShareCodes.push({ 'code': data.body.id, 'token': $.token, cookie });
+ }
+ }
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+
+function createAssistUser(inviteId, taskId) {
+ // console.log(`${inviteId}, ${taskId}`, `${cookie}`);
+ return new Promise(resolve => {
+ $.get(taskUrl(`/ssjj-task-record/createAssistUser/${inviteId}/${taskId}`), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.head.code === 200) {
+ if (data.body) {
+ console.log(`给好友${data.body.inviteId}:【${data.head.msg}】\n`)
+ }
+ } else {
+ console.log(`助力失败${JSON.stringify(data)}\n`);
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function game(taskId, index, awardWoB = 100) {
+ return new Promise(resolve => {
+ $.get(taskUrl(`/ssjj-task-record/game/${index}/${taskId}`), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.head.code === 200) {
+ if (data.body) {
+ message += `【限时连连看】成功,活动${awardWoB}WO币\n`;
+ }
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function clock(taskId, awardWoB) {
+ return new Promise(resolve => {
+ $.get(taskUrl(`/ssjj-task-record/clock/${taskId}`), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.head.code === 200) {
+ if (data.body) {
+ message += `【每日打卡】成功,活动${awardWoB}WO币\n`;
+ }
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function queryAllTaskInfo() {
+ return new Promise(resolve => {
+ $.get(taskUrl(`ssjj-task-info/queryAllTaskInfo/2`), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.head.code === 200) {
+ if (data.body) {
+ $.taskList = data.body;
+ }
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve();
+ }
+ })
+ })
+}
+//免费抽奖
+function drawRecord(id) {
+ return new Promise(resolve => {
+ $.get(taskUrl(`ssjj-draw-record/draw/${id}`), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.head.code === 200) {
+ if (data.body) {
+ message += `【免费抽奖】获得:${data.body.name}\n`;
+ } else {
+ message += `【免费抽奖】未中奖\n`;
+ }
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//查询免费抽奖机会
+function queryDraw() {
+ return new Promise(resolve => {
+ $.get(taskUrl("ssjj-draw-center/queryDraw"), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.head.code === 200) {
+ $.freeDrawCount = data.body.freeDrawCount;//免费抽奖次数
+ $.lotteryId = data.body.center.id;
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+//查询是否开启了此活动
+function ssjjRooms() {
+ return new Promise(resolve => {
+ $.get(taskUrl("ssjj-rooms/info/%E5%AE%A2%E5%8E%85"), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.head.code === 200) {
+ $.isUnLock = data.body.isUnLock;
+ if (!$.isUnLock) {
+ console.log(`京东账号${$.index}${$.nickName}未开启此活动\n`);
+ //$.msg($.name, '', `京东账号${$.index}${$.nickName}未开启此活动\n点击弹窗去开启此活动( ̄▽ ̄)"`, {"open-url": "openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/2HFSytEAN99VPmMGZ6V4EYWus1x/index.html%22%20%7D"});
+ }
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function loginHome() {
+ return new Promise(resolve => {
+ const options = {
+ "url": "https://jdhome.m.jd.com/saas/framework/encrypt/pin?appId=6d28460967bda11b78e077b66751d2b0",
+ "headers": {
+ "Accept": "*/*",
+ "Accept-Encoding": "gzip, deflate, br",
+ "Accept-Language": "zh-cn",
+ "Connection": "keep-alive",
+ "Content-Length": "0",
+ "Content-Type": "application/json",
+ "Cookie": cookie,
+ "Host": "jdhome.m.jd.com",
+ "Origin": "https://jdhome.m.jd.com",
+ "Referer": "https://jdhome.m.jd.com/dist/taro/index.html/",
+ "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (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"),
+ }
+ }
+ $.post(options, async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} encrypt/pin API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.success) {
+ await login(data.data.lkEPin);
+ } else {
+ console.log(`异常:${JSON.stringify(data)}\n`)
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve()
+ }
+ })
+ })
+}
+function login(userName) {
+ return new Promise(resolve => {
+ const body = {
+ "body": {
+ "client": 2,
+ userName
+ }
+ };
+ const options = {
+ "url": `${JD_API_HOST}/user-info/login`,
+ "body": JSON.stringify(body),
+ "headers": {
+ "Accept": "*/*",
+ "Accept-Encoding": "gzip, deflate, br",
+ "Accept-Language": "zh-cn",
+ "Connection": "keep-alive",
+ "Content-Type": "application/json",
+ "Host": "lkyl.dianpusoft.cn",
+ "Origin": "https://lkyl.dianpusoft.cn",
+ "Referer": "https://h5.m.jd.com/babelDiy/Zeus/2HFSytEAN99VPmMGZ6V4EYWus1x/index.html",
+ "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (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"),
+ }
+ }
+ $.post(options, async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ data = JSON.parse(data);
+ if (data.head.code === 200) {
+ $.token = data.head.token;
+ $.helpToken.push(data.head.token)
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function getAuthorShareCode(url) {
+ return new Promise(resolve => {
+ const options = {
+ url: `${url}?${new Date()}`, "timeout": 10000, headers: {
+ "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"
+ }
+ };
+ if ($.isNode() && process.env.TG_PROXY_HOST && process.env.TG_PROXY_PORT) {
+ const tunnel = require("tunnel");
+ const agent = {
+ https: tunnel.httpsOverHttp({
+ proxy: {
+ host: process.env.TG_PROXY_HOST,
+ port: process.env.TG_PROXY_PORT * 1
+ }
+ })
+ }
+ Object.assign(options, { agent })
+ }
+ $.get(options, async (err, resp, data) => {
+ try {
+ if (err) {
+ // console.log(`${JSON.stringify(err)}`)
+ // console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (data) data = JSON.parse(data)
+ }
+ } catch (e) {
+ // $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function taskUrl(url, body = {}) {
+ return {
+ url: `${JD_API_HOST}/${url}?body=${escape(body)}`,
+ timeout: 10000,
+ headers: {
+ "Accept": "*/*",
+ "Accept-Encoding": "gzip, deflate, br",
+ "Accept-Language": "zh-CN,zh;q=0.9",
+ "Connection": "keep-alive",
+ "content-type": "application/json",
+ "Host": "lkyl.dianpusoft.cn",
+ "Referer": "https://h5.m.jd.com/babelDiy/Zeus/2HFSytEAN99VPmMGZ6V4EYWus1x/index.html",
+ "token": $.token,
+ "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (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")
+ }
+ }
+}
+function taskPostUrl(url) {
+ return {
+ url: `${JD_API_HOST}/${url}`,
+ timeout: 10000,
+ headers: {
+ "Accept": "*/*",
+ "Accept-Encoding": "gzip, deflate, br",
+ "Accept-Language": "zh-CN,zh;q=0.9",
+ "Connection": "keep-alive",
+ "content-type": "application/json",
+ "Host": "lkyl.dianpusoft.cn",
+ "Referer": "https://h5.m.jd.com/babelDiy/Zeus/2HFSytEAN99VPmMGZ6V4EYWus1x/index.html",
+ "token": $.token,
+ "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (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")
+ }
+ }
+}
+function sortByjdBeanNum(a, b) {
+ return a['jdBeanNum'] - b['jdBeanNum'];
+}
+function TotalBean() {
+ return new Promise(async resolve => {
+ const options = {
+ url: "https://wq.jd.com/user_new/info/GetJDUserInfoUnion?sceneval=2",
+ headers: {
+ Host: "wq.jd.com",
+ Accept: "*/*",
+ Connection: "keep-alive",
+ Cookie: cookie,
+ "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"),
+ "Accept-Language": "zh-cn",
+ "Referer": "https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&",
+ "Accept-Encoding": "gzip, deflate, br"
+ }
+ }
+ $.get(options, (err, resp, data) => {
+ try {
+ if (err) {
+ $.logErr(err)
+ } else {
+ if (data) {
+ data = JSON.parse(data);
+ if (data['retcode'] === 1001) {
+ $.isLogin = false; //cookie过期
+ return;
+ }
+ if (data['retcode'] === 0 && data.data && data.data.hasOwnProperty("userInfo")) {
+ $.nickName = data.data.userInfo.baseInfo.nickname;
+ }
+ } else {
+ console.log('京东服务器返回空数据');
+ }
+ }
+ } catch (e) {
+ $.logErr(e)
+ } finally {
+ resolve();
+ }
+ })
+ })
+}
+function safeGet(data) {
+ try {
+ if (typeof JSON.parse(data) == "object") {
+ return true;
+ }
+ } catch (e) {
+ console.log(e);
+ console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
+ return false;
+ }
+}
+function jsonParse(str) {
+ if (typeof str == "string") {
+ try {
+ return JSON.parse(str);
+ } catch (e) {
+ console.log(e);
+ $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
+ return [];
+ }
+ }
+}
+// prettier-ignore
+function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(n,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)}
\ No newline at end of file
diff --git a/src/main/resources/test_speed_sign.js b/src/main/resources/test_speed_sign.js
index 8ca99eb..2650ae1 100644
--- a/src/main/resources/test_speed_sign.js
+++ b/src/main/resources/test_speed_sign.js
@@ -1,105 +1,94 @@
+/*
+京东极速版签到+赚现金任务
+每日9毛左右,满3,10,50可兑换无门槛红包
+⚠️⚠️⚠️一个号需要运行40分钟左右
+
+活动时间:长期
+活动入口:京东极速版app-现金签到
+已支持IOS双京东账号,Node.js支持N个京东账号
+脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
+============Quantumultx===============
+[task_local]
+#京东极速版
+21 3,8 * * * https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_speed_sign.js, tag=京东极速版, img-url=https://raw.githubusercontent.com/Orz-3/task/master/jd.png, enabled=true
+
+================Loon==============
+[Script]
+cron "21 3,8 * * *" script-path=https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_speed_sign.js,tag=京东极速版
+
+===============Surge=================
+京东极速版 = type=cron,cronexp="21 3,8 * * *",wake-system=1,timeout=33600,script-path=https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_speed_sign.js
+
+============小火箭=========
+京东极速版 = type=cron,script-path=https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_speed_sign.js, cronexpr="21 3,8 * * *", timeout=33600, enable=true
+*/
+const $ = new Env('京东极速版');
const notify = $.isNode() ? require('./sendNotify') : '';
-//Node.js用户请在jdCookie.js处填写动动ck;
+//Node.js用户请在jdCookie.js处填写京东ck;
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
-let CryptoJS=$.CryptoJS;
-$.toObj = (t, e = null) => {
- try {
- return JSON.parse(t)
- } catch {
- return e
- }
-}
-$.toStr = (t, e = null) => {
- try {
- return JSON.stringify(t)
- } catch {
- return e
- }
-}
-const linkId = "AkOULcXbUA_8EAPbYLLMgg";
-const signLinkId = '9WA12jYGulArzWS7vcrwhw';
-let cookiesArr = [], cookie = '';
-let message = ""
+let cookiesArr = [], cookie = '', message;
if ($.isNode()) {
Object.keys(jdCookieNode).forEach((item) => {
cookiesArr.push(jdCookieNode[item])
})
- if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') that.log = () => {
+ if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {
};
} else {
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
}
-
const JD_API_HOST = 'https://api.m.jd.com/', actCode = 'visa-card-001';
-
-
!(async () => {
if (!cookiesArr[0]) {
- $.msg($.name, '【提示】请先获取动动账号一cookie\n直接使用NobyDa的动动签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
+ $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
return;
}
- message += "[通知] 极速签到挣金币 \n\n --- \n\n"
for (let i = 0; i < cookiesArr.length; i++) {
if (cookiesArr[i]) {
- await $.wait(Math.floor(Math.random() * (1200000) + 5000));
cookie = cookiesArr[i];
- $.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
+ $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
$.index = i + 1;
$.isLogin = true;
$.nickName = '';
-
- username = $.UserName
- if ($.UserName == "jd_66ea783827d30"){
- username = "跑腿小弟"
- }
- if ($.UserName == "jd_4521b375ebb5d"){
- username = "锟锟"
- }
- if ($.UserName == "jd_542c10c0222bc"){
- username = "康康"
- }
- //加上名称
- message = message + "【羊毛姐妹】" + username + " \n\n "
-
+ message = '';
await TotalBean();
- that.log(`\n******开始【动动账号${$.index}】${$.nickName || $.UserName}*********\n`);
+ console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`);
if (!$.isLogin) {
- $.msg($.name, `【提示】cookie已失效`, `动动账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
+ $.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"});
if ($.isNode()) {
- await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `动动账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
+ await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
}
continue
}
await jdGlobal()
+ await $.wait(2*1000)
}
- message = message +"----\n"
-}
-
+ }
})()
.catch((e) => {
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
})
.finally(() => {
- message += getPic()
- taht.log(message)
- postToDingTalk(message)
$.done();
})
async function jdGlobal() {
try {
- await signInit()
- await sign()
- await getPacketList();//领红包提现
- await signPrizeDetailList();
+ await richManIndex()
+
+ await wheelsHome()
+ await apTaskList()
+ await wheelsHome()
+
+ // await signInit()
+ // await sign()
await invite()
await invite2()
$.score = 0
$.total = 0
await taskList()
await queryJoy()
- await signInit()
+ // await signInit()
await cash()
await showMsg()
} catch (e) {
@@ -110,76 +99,27 @@ async function jdGlobal() {
function showMsg() {
return new Promise(resolve => {
- message += "" + `本次运行获得${$.score}金币,共计${$.total}金币` + "\n\n"
- $.msg($.name, '', `动动账号${$.index}${$.nickName}\n${message}`);
+ message += `本次运行获得${$.score}金币,共计${$.total}金币\n可兑换 ${($.total/10000).toFixed(2)} 元京东红包\n兑换入口:京东极速版->我的->金币`
+ $.msg($.name, '', `京东账号${$.index}${$.nickName}\n${message}`);
resolve()
})
}
-async function sign() {
+async function signInit() {
return new Promise(resolve => {
- const body = {"linkId":signLinkId,"serviceName":"dayDaySignGetRedEnvelopeSignService","business":1};
- const options = {
- url: `https://api.m.jd.com`,
- body: `functionId=apSignIn_day&body=${escape(JSON.stringify(body))}&_t=${+new Date()}&appid=activities_platform`,
- headers: {
- 'Cookie': cookie,
- "Host": "api.m.jd.com",
- 'Origin': 'https://daily-redpacket.jd.com',
- "Content-Type": "application/x-www-form-urlencoded",
- "Accept": "*/*",
- "Connection": "keep-alive",
- "User-Agent": "jdltapp;iPhone;3.3.2;14.5.1network/wifi;hasUPPay/0;pushNoticeIsOpen/1;lang/zh_CN;model/iPhone13,2;addressid/137923973;hasOCPay/0;appBuild/1047;supportBestPay/0;pv/467.11;apprpd/MyJD_Main;",
- "Accept-Language": "zh-Hans-CN;q=1, en-CN;q=0.9, zh-Hant-CN;q=0.8",
- 'Referer': 'https://daily-redpacket.jd.com/?activityId=9WA12jYGulArzWS7vcrwhw',
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- $.post(options, async (err, resp, data) => {
+ $.get(taskUrl('speedSignInit', {
+ "activityId": "8a8fabf3cccb417f8e691b6774938bc2",
+ "kernelPlatform": "RN",
+ "inviterId":"U44jAghdpW58FKgfqPdotA=="
+ }), async (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = $.toObj(data);
- if (data.code === 0) {
- if (data.data.retCode === 0) {
- // message += `极速版签到提现:签到成功\n`;
- console.log(`极速版签到提现:签到成功\n`);
- } else {
- message += "" + `极速版签到提现:签到异常:${JSON.stringify(data)}\n` + "\n\n"
- console.log(`极速版签到提现:签到失败:${data.data.retMessage}\n`);
- }
- } else {
- message += "" + `极速版签到提现:签到异常:${JSON.stringify(data)}\n` + "\n\n"
- console.log(`极速版签到提现:签到异常:${JSON.stringify(data)}\n`);
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-async function signInit() {
- return new Promise(resolve => {
- $.get(taskUrl('speedSignInit', {
- "activityId": "8a8fabf3cccb417f8e691b6774938bc2",
- "kernelPlatform": "RN",
- "inviterId":"y3gfQAo9OlMun43uVNyOgQ=="
- }), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
- //that.log(data)
+ //console.log(data)
}
}
} catch (e) {
@@ -191,36 +131,36 @@ async function signInit() {
})
}
-// async function sign() {
-// return new Promise(resolve => {
-// $.get(taskUrl('speedSign', {
-// "kernelPlatform": "RN",
-// "activityId": "8a8fabf3cccb417f8e691b6774938bc2",
-// "noWaitPrize": "false"
-// }),
-// async (err, resp, data) => {
-// try {
-// if (err) {
-// that.log(`${JSON.stringify(err)}`)
-// that.log(`${$.name} API请求失败,请检查网路重试`)
-// } else {
-// if (safeGet(data)) {
-// data = JSON.parse(data);
-// if (data.subCode === 0) {
-// that.log(`签到获得${data.data.signAmount}现金,共计获得${data.data.cashDrawAmount}`)
-// } else {
-// that.log(`签到失败,${data.msg}`)
-// }
-// }
-// }
-// } catch (e) {
-// $.logErr(e, resp)
-// } finally {
-// resolve(data);
-// }
-// })
-// })
-// }
+async function sign() {
+ return new Promise(resolve => {
+ $.get(taskUrl('speedSign', {
+ "kernelPlatform": "RN",
+ "activityId": "8a8fabf3cccb417f8e691b6774938bc2",
+ "noWaitPrize": "false"
+ }),
+ async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.subCode === 0) {
+ console.log(`签到获得${data.data.signAmount}现金,共计获得${data.data.cashDrawAmount}`)
+ } else {
+ console.log(`签到失败,${data.msg}`)
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
async function taskList() {
return new Promise(resolve => {
@@ -232,8 +172,8 @@ async function taskList() {
async (err, resp, data) => {
try {
if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
@@ -254,7 +194,7 @@ async function taskList() {
}
}
} else {
- that.log(`${task.taskInfo.mainTitle}已完成`)
+ console.log(`${task.taskInfo.mainTitle}已完成`)
}
}
}
@@ -274,34 +214,6 @@ async function doTask(taskId) {
"method": "marketTaskRewardPayment",
"data": {"channel": 1, "clientTime": +new Date() + 0.588, "activeType": taskId}
}), async (err, resp, data) => {
- try {
- if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = JSON.parse(data);
- if (data.code === 0) {
- message +="" + `${data.data.taskInfo.mainTitle}任务完成成功,预计获得${data.data.reward}金币` + "\n\n"
- that.log(`${data.data.taskInfo.mainTitle}任务完成成功,预计获得${data.data.reward}金币`)
- } else {
- message +="" + `${data.data.taskInfo.mainTitle}任务发生异常${data.errMsg}` + "\n\n"
- that.log(`任务完成失败,${data.message}`)
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-
-function getPacketList() {
- return new Promise(resolve => {
- $.get(taskGetUrl("spring_reward_list",{"pageNum":1,"pageSize":100,linkId,"inviter":""}), async (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
@@ -310,173 +222,9 @@ function getPacketList() {
if (safeGet(data)) {
data = JSON.parse(data);
if (data.code === 0) {
- for(let item of data.data.items.filter(vo => vo.prizeType===4)){
- if(item.state===0){
- console.log(`去提现${item.amount}微信现金`)
- message +="" + `提现${item.amount}微信现金,` + "\n\n"
- await cashOut(item.id,item.poolBaseId,item.prizeGroupId,item.prizeBaseId)
- }
- }
+ console.log(`${data.data.taskInfo.mainTitle}任务完成成功,预计获得${data.data.reward}金币`)
} else {
- message +="" + `提现发生异常:${data.errMsg}` + "\n\n"
- console.log(data.errMsg)
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function signPrizeDetailList() {
- return new Promise(resolve => {
- const body = {"linkId":signLinkId,"serviceName":"dayDaySignGetRedEnvelopeSignService","business":1,"pageSize":20,"page":1};
- const options = {
- url: `https://api.m.jd.com`,
- body: `functionId=signPrizeDetailList&body=${escape(JSON.stringify(body))}&_t=${+new Date()}&appid=activities_platform`,
- headers: {
- 'Cookie': cookie,
- "Host": "api.m.jd.com",
- 'Origin': 'https://daily-redpacket.jd.com',
- "Content-Type": "application/x-www-form-urlencoded",
- "Accept": "*/*",
- "Connection": "keep-alive",
- "User-Agent": "jdltapp;iPhone;3.3.2;14.5.1network/wifi;hasUPPay/0;pushNoticeIsOpen/1;lang/zh_CN;model/iPhone13,2;addressid/137923973;hasOCPay/0;appBuild/1047;supportBestPay/0;pv/467.11;apprpd/MyJD_Main;",
- "Accept-Language": "zh-Hans-CN;q=1, en-CN;q=0.9, zh-Hant-CN;q=0.8",
- 'Referer': 'https://daily-redpacket.jd.com/?activityId=9WA12jYGulArzWS7vcrwhw',
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- $.post(options, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = $.toObj(data);
- if (data.code === 0) {
- if (data.data.code === 0) {
- const list = (data.data.prizeDrawBaseVoPageBean.items || []).filter(vo => vo['prizeType'] === 4 && vo['prizeStatus'] === 0);
- for (let code of list) {
- console.log(`极速版签到提现,去提现${code['prizeValue']}现金\n`);
- message += "" + `极速版签到提现,去提现${code['prizeValue']}微信现金,` + "\n\n"
- await apCashWithDraw(code['id'], code['poolBaseId'], code['prizeGroupId'], code['prizeBaseId']);
- }
- } else {
- console.log(`极速版签到查询奖品:失败:${JSON.stringify(data)}\n`);
- }
- } else {
- console.log(`极速版签到查询奖品:异常:${JSON.stringify(data)}\n`);
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function apCashWithDraw(id, poolBaseId, prizeGroupId, prizeBaseId) {
- return new Promise(resolve => {
- const body = {
- "linkId": signLinkId,
- "businessSource": "DAY_DAY_RED_PACKET_SIGN",
- "base": {
- "prizeType": 4,
- "business": "dayDayRedPacket",
- "id": id,
- "poolBaseId": poolBaseId,
- "prizeGroupId": prizeGroupId,
- "prizeBaseId": prizeBaseId
- }
- }
- const options = {
- url: `https://api.m.jd.com`,
- body: `functionId=apCashWithDraw&body=${escape(JSON.stringify(body))}&_t=${+new Date()}&appid=activities_platform`,
- headers: {
- 'Cookie': cookie,
- "Host": "api.m.jd.com",
- 'Origin': 'https://daily-redpacket.jd.com',
- "Content-Type": "application/x-www-form-urlencoded",
- "Accept": "*/*",
- "Connection": "keep-alive",
- "User-Agent": "jdltapp;iPhone;3.3.2;14.5.1network/wifi;hasUPPay/0;pushNoticeIsOpen/1;lang/zh_CN;model/iPhone13,2;addressid/137923973;hasOCPay/0;appBuild/1047;supportBestPay/0;pv/467.11;apprpd/MyJD_Main;",
- "Accept-Language": "zh-Hans-CN;q=1, en-CN;q=0.9, zh-Hant-CN;q=0.8",
- 'Referer': 'https://daily-redpacket.jd.com/?activityId=9WA12jYGulArzWS7vcrwhw',
- "Accept-Encoding": "gzip, deflate, br"
- }
- }
- $.post(options, async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- data = $.toObj(data);
- if (data.code === 0) {
- if (data.data.status === "310") {
- console.log(`极速版签到提现现金成功!`)
- // message += `极速版签到提现现金成功!`;
- } else {
- console.log(`极速版签到提现现金:失败:${JSON.stringify(data)}\n`);
- message +="" + `极速版签到提现现金:失败:${JSON.stringify(data)}\n` + "\n\n"
- }
- } else {
- message +="" + `极速版签到提现现金:失败:${JSON.stringify(data)}\n` + "\n\n"
- console.log(`极速版签到提现现金:异常:${JSON.stringify(data)}\n`);
- }
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve(data);
- }
- })
- })
-}
-function cashOut(id,poolBaseId,prizeGroupId,prizeBaseId,) {
- let body = {
- "businessSource": "SPRING_FESTIVAL_RED_ENVELOPE",
- "base": {
- "id": id,
- "business": null,
- "poolBaseId": poolBaseId,
- "prizeGroupId": prizeGroupId,
- "prizeBaseId": prizeBaseId,
- "prizeType": 4
- },
- linkId,
- "inviter": ""
- }
- return new Promise(resolve => {
- $.post(taskPostUrl("apCashWithDraw",body), async (err, resp, data) => {
- try {
- if (err) {
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if (safeGet(data)) {
- console.log(`提现零钱结果:${data}`)
- data = JSON.parse(data);
- if (data.code === 0) {
- if (data['data']['status'] === "310") {
- console.log(`提现成功!`)
- // message += `提现成功!\n`;
- } else {
- console.log(`提现失败:${data['data']['message']}`);
- message +="" + `提现失败:${data['data']['message']}` + "\n\n";
- }
- } else {
- message +="" + `提现失败:${data['data']['message']}` + "\n\n";
- console.log(`提现异常:${data['errMsg']}`);
+ console.log(`任务完成失败,${data.message}`)
}
}
}
@@ -495,8 +243,8 @@ async function queryJoy() {
async (err, resp, data) => {
try {
if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
@@ -524,16 +272,16 @@ async function rewardTask(id, taskId) {
}), async (err, resp, data) => {
try {
if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data.code === 0) {
$.score += data.data.reward
- that.log(`气泡收取成功,获得${data.data.reward}金币`)
+ console.log(`气泡收取成功,获得${data.data.reward}金币`)
} else {
- that.log(`气泡收取失败,${data.message}`)
+ console.log(`气泡收取失败,${data.message}`)
}
}
}
@@ -555,15 +303,15 @@ async function queryItem(activeType = 1) {
}), async (err, resp, data) => {
try {
if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data.code === 0 && data.data) {
await startItem(data.data.nextResource, activeType)
} else {
- that.log(`商品任务开启失败,${data.message}`)
+ console.log(`商品任务开启失败,${data.message}`)
$.canStartNewItem = false
}
}
@@ -591,8 +339,8 @@ async function startItem(activeId, activeType) {
}), async (err, resp, data) => {
try {
if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
@@ -601,16 +349,16 @@ async function startItem(activeId, activeType) {
let {videoBrowsing, taskCompletionProgress, taskCompletionLimit} = data.data.taskInfo
if (activeType !== 3)
videoBrowsing = activeType === 1 ? 5 : 10
- that.log(`【${taskCompletionProgress + 1}/${taskCompletionLimit}】浏览商品任务记录成功,等待${videoBrowsing}秒`)
+ console.log(`【${taskCompletionProgress + 1}/${taskCompletionLimit}】浏览商品任务记录成功,等待${videoBrowsing}秒`)
await $.wait(videoBrowsing * 1000)
await endItem(data.data.uuid, activeType, activeId, activeType === 3 ? videoBrowsing : "")
} else {
- that.log(`${$.taskName}任务已达上限`)
+ console.log(`${$.taskName}任务已达上限`)
$.canStartNewItem = false
}
} else {
$.canStartNewItem = false
- that.log(`${$.taskName}任务开启失败,${data.message}`)
+ console.log(`${$.taskName}任务开启失败,${data.message}`)
}
}
}
@@ -640,15 +388,15 @@ async function endItem(uuid, activeType, activeId = "", videoTimeLength = "") {
}), async (err, resp, data) => {
try {
if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data.code === 0 && data.isSuccess) {
await rewardItem(uuid, activeType, activeId, videoTimeLength)
} else {
- that.log(`${$.taskName}任务结束失败,${data.message}`)
+ console.log(`${$.taskName}任务结束失败,${data.message}`)
}
}
}
@@ -678,16 +426,16 @@ async function rewardItem(uuid, activeType, activeId = "", videoTimeLength = "")
}), async (err, resp, data) => {
try {
if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data.code === 0 && data.isSuccess) {
$.score += data.data.reward
- that.log(`${$.taskName}任务完成,获得${data.data.reward}金币`)
+ console.log(`${$.taskName}任务完成,获得${data.data.reward}金币`)
} else {
- that.log(`${$.taskName}任务失败,${data.message}`)
+ console.log(`${$.taskName}任务失败,${data.message}`)
}
}
}
@@ -707,8 +455,8 @@ async function cash() {
async (err, resp, data) => {
try {
if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
@@ -724,127 +472,181 @@ async function cash() {
})
}
-
-var __encode ='jsjiami.com',_a={}, _0xb483=["\x5F\x64\x65\x63\x6F\x64\x65","\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x73\x6F\x6A\x73\x6F\x6E\x2E\x63\x6F\x6D\x2F\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x6F\x62\x66\x75\x73\x63\x61\x74\x6F\x72\x2E\x68\x74\x6D\x6C"];(function(_0xd642x1){_0xd642x1[_0xb483[0]]= _0xb483[1]})(_a);var __Oxb24bc=["\x6C\x69\x74\x65\x2D\x61\x6E\x64\x72\x6F\x69\x64\x26","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x26\x61\x6E\x64\x72\x6F\x69\x64\x26\x33\x2E\x31\x2E\x30\x26","\x26","\x26\x38\x34\x36\x63\x34\x63\x33\x32\x64\x61\x65\x39\x31\x30\x65\x66","\x31\x32\x61\x65\x61\x36\x35\x38\x66\x37\x36\x65\x34\x35\x33\x66\x61\x66\x38\x30\x33\x64\x31\x35\x63\x34\x30\x61\x37\x32\x65\x30","\x69\x73\x4E\x6F\x64\x65","\x63\x72\x79\x70\x74\x6F\x2D\x6A\x73","","\x61\x70\x69\x3F\x66\x75\x6E\x63\x74\x69\x6F\x6E\x49\x64\x3D","\x26\x62\x6F\x64\x79\x3D","\x26\x61\x70\x70\x69\x64\x3D\x6C\x69\x74\x65\x2D\x61\x6E\x64\x72\x6F\x69\x64\x26\x63\x6C\x69\x65\x6E\x74\x3D\x61\x6E\x64\x72\x6F\x69\x64\x26\x75\x75\x69\x64\x3D\x38\x34\x36\x63\x34\x63\x33\x32\x64\x61\x65\x39\x31\x30\x65\x66\x26\x63\x6C\x69\x65\x6E\x74\x56\x65\x72\x73\x69\x6F\x6E\x3D\x33\x2E\x31\x2E\x30\x26\x74\x3D","\x26\x73\x69\x67\x6E\x3D","\x61\x70\x69\x2E\x6D\x2E\x6A\x64\x2E\x63\x6F\x6D","\x2A\x2F\x2A","\x52\x4E","\x4A\x44\x4D\x6F\x62\x69\x6C\x65\x4C\x69\x74\x65\x2F\x33\x2E\x31\x2E\x30\x20\x28\x69\x50\x61\x64\x3B\x20\x69\x4F\x53\x20\x31\x34\x2E\x34\x3B\x20\x53\x63\x61\x6C\x65\x2F\x32\x2E\x30\x30\x29","\x7A\x68\x2D\x48\x61\x6E\x73\x2D\x43\x4E\x3B\x71\x3D\x31\x2C\x20\x6A\x61\x2D\x43\x4E\x3B\x71\x3D\x30\x2E\x39","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x6C\x6F\x67","\u5220\u9664","\u7248\u672C\u53F7\uFF0C\x6A\x73\u4F1A\u5B9A","\u671F\u5F39\u7A97\uFF0C","\u8FD8\u8BF7\u652F\u6301\u6211\u4EEC\u7684\u5DE5\u4F5C","\x6A\x73\x6A\x69\x61","\x6D\x69\x2E\x63\x6F\x6D"];function taskUrl(_0x7683x2,_0x7683x3= {}){let _0x7683x4=+ new Date();let _0x7683x5=`${__Oxb24bc[0x0]}${JSON[__Oxb24bc[0x1]](_0x7683x3)}${__Oxb24bc[0x2]}${_0x7683x2}${__Oxb24bc[0x3]}${_0x7683x4}${__Oxb24bc[0x4]}`;let _0x7683x6=__Oxb24bc[0x5];const _0x7683x7=$[__Oxb24bc[0x6]]()?require(__Oxb24bc[0x7]):CryptoJS;let _0x7683x8=_0x7683x7.HmacSHA256(_0x7683x5,_0x7683x6).toString();return {url:`${__Oxb24bc[0x8]}${JD_API_HOST}${__Oxb24bc[0x9]}${_0x7683x2}${__Oxb24bc[0xa]}${escape(JSON[__Oxb24bc[0x1]](_0x7683x3))}${__Oxb24bc[0xb]}${_0x7683x4}${__Oxb24bc[0xc]}${_0x7683x8}${__Oxb24bc[0x8]}`,headers:{'\x48\x6F\x73\x74':__Oxb24bc[0xd],'\x61\x63\x63\x65\x70\x74':__Oxb24bc[0xe],'\x6B\x65\x72\x6E\x65\x6C\x70\x6C\x61\x74\x66\x6F\x72\x6D':__Oxb24bc[0xf],'\x75\x73\x65\x72\x2D\x61\x67\x65\x6E\x74':__Oxb24bc[0x10],'\x61\x63\x63\x65\x70\x74\x2D\x6C\x61\x6E\x67\x75\x61\x67\x65':__Oxb24bc[0x11],'\x43\x6F\x6F\x6B\x69\x65':cookie}}}(function(_0x7683x9,_0x7683xa,_0x7683xb,_0x7683xc,_0x7683xd,_0x7683xe){_0x7683xe= __Oxb24bc[0x12];_0x7683xc= function(_0x7683xf){if( typeof alert!== _0x7683xe){alert(_0x7683xf)};if( typeof that!== _0x7683xe){that[__Oxb24bc[0x13]](_0x7683xf)}};_0x7683xb= function(_0x7683x7,_0x7683x9){return _0x7683x7+ _0x7683x9};_0x7683xd= _0x7683xb(__Oxb24bc[0x14],_0x7683xb(_0x7683xb(__Oxb24bc[0x15],__Oxb24bc[0x16]),__Oxb24bc[0x17]));try{_0x7683x9= __encode;if(!( typeof _0x7683x9!== _0x7683xe&& _0x7683x9=== _0x7683xb(__Oxb24bc[0x18],__Oxb24bc[0x19]))){_0x7683xc(_0x7683xd)}}catch(e){_0x7683xc(_0x7683xd)}})({})
-
-function invite2() {
- let t = +new Date()
- var headers = {
- 'Host': 'api.m.jd.com',
- 'accept': 'application/json, text/plain, */*',
- 'content-type': 'application/x-www-form-urlencoded',
- 'origin': 'https://assignment.jd.com',
- 'accept-language': 'zh-cn',
- 'user-agent': 'jdltapp;iPad;3.1.0;14.4;a54abe779c8fbeb4e8e34f01fdc5cc4dd78173a2;network/wifi;ADID/BB69CC09-77D8-43A2-8645-CBC4CCE49911;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPad13,1;addressid/3438850002;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/14.9;apprpd/ProductCoupon_MergeMain;ref/FSPromListViewController;psq/0;ads/;psn/a54abe779c8fbeb4e8e34f01fdc5cc4dd78173a2|27;jdv/0|kong|t_1000170135|tuiguang|notset|1613101365448|1613101365;adk/;app_device/IOS;pap/JA2020_3112531|3.1.0|IOS 14.4;Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
- 'referer': 'https://assignment.jd.com/?inviterId=GaYxmFpHAG%2BJLi7W28KWYw==&lng=0.000000&lat=0.000000&sid=2131b85f0bcb82714e032402628cc2fw&un_area=12_904_50647_57886',
- 'Cookie': cookie
- };
-
- var dataString = `functionId=TaskInviteService&body={"method":"participateInviteTask","data":{"channel":"1","encryptionInviterPin":"GaYxmFpHAG%2BJLi7W28KWYw%3D%3D","type":1}}&appid=market-task-h5&uuid=&_t=${t}`;
-
- var options = {
- url: 'https://api.m.jd.com/',
- headers: headers,
- body: dataString
- }
- $.post(options, (err, resp, data) => {
- // that.log(data)
+// 大转盘
+function wheelsHome() {
+ return new Promise(resolve => {
+ $.get(taskGetUrl('wheelsHome',
+ {"linkId":"toxw9c5sy9xllGBr3QFdYg"}),
+ async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if(data.code ===0){
+ console.log(`【幸运大转盘】剩余抽奖机会:${data.data.lotteryChances}`)
+ while(data.data.lotteryChances--) {
+ await wheelsLottery()
+ await $.wait(500)
+ }
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
})
}
-
-function invite() {
- let t = +new Date()
- var headers = {
- 'Host': 'api.m.jd.com',
- 'accept': 'application/json, text/plain, */*',
- 'content-type': 'application/x-www-form-urlencoded',
- 'origin': 'https://invite-reward.jd.com',
- 'accept-language': 'zh-cn',
- 'user-agent': 'jdltapp;iPad;3.1.0;14.4;Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
- 'referer': 'https://invite-reward.jd.com/?lng=0.000000&lat=0.000000&sid=2131b85f0bcb82714e032402628cc2fw&un_area=12_904_50647_57886',
- 'Cookie': cookie
- };
-
- var dataString = `functionId=InviteFriendApiService&body={"method":"attendInviteActivity","data":{"inviterPin":"GaYxmFpHAG%2BJLi7W28KWYw%3D%3D","channel":1,"token":"","frontendInitStatus":""}}&referer=-1&eid=eidIf3dd8121b7sdmiBLGdxRR46OlWyh62kFAZogTJFnYqqRkwgr63%2BdGmMlcv7EQJ5v0HBic81xHXzXLwKM6fh3i963zIa7Ym2v5ehnwo2B7uDN92Q0&aid=&client=ios&clientVersion=14.4&networkType=wifi&fp=-1&appid=market-task-h5&_t=${t}`;
-
- var options = {
- url: 'https://api.m.jd.com/?t=1613645706861',
- headers: headers,
- body: dataString
- };
- $.post(options, (err, resp, data) => {
- // that.log(data)
+// 大转盘
+function wheelsLottery() {
+ return new Promise(resolve => {
+ $.get(taskGetUrl('wheelsLottery',
+ {"linkId":"toxw9c5sy9xllGBr3QFdYg"}),
+ async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if(data.data && data.data.rewardType){
+ console.log(`幸运大转盘抽奖获得:【${data.data.couponUsedValue}-${data.data.rewardValue}${data.data.couponDesc}】\n`)
+ message += `幸运大转盘抽奖获得:【${data.data.couponUsedValue}-${data.data.rewardValue}${data.data.couponDesc}】\n`
+ }else{
+ console.log(`幸运大转盘抽奖获得:空气`)
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
})
}
-
-function TotalBean() {
- return new Promise(async resolve => {
- const options = {
- "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
- "headers": {
- "Accept": "application/json,text/plain, */*",
- "Content-Type": "application/x-www-form-urlencoded",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-cn",
- "Connection": "keep-alive",
- "Cookie": cookie,
- "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0")
- }
- }
- $.post(options, (err, resp, data) => {
+// 大转盘任务
+function apTaskList() {
+ return new Promise(resolve => {
+ $.get(taskGetUrl('apTaskList',
+ {"linkId":"toxw9c5sy9xllGBr3QFdYg"}),
+ async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if(data.code ===0){
+ for(let task of data.data){
+ // {"linkId":"toxw9c5sy9xllGBr3QFdYg","taskType":"SIGN","taskId":67,"channel":4}
+ if(!task.taskFinished && ['SIGN','BROWSE_CHANNEL'].includes(task.taskType)){
+ console.log(`去做任务${task.taskTitle}`)
+ await apDoTask(task.taskType,task.id,4,task.taskSourceUrl)
+ }
+ }
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+// 大转盘做任务
+function apDoTask(taskType,taskId,channel,itemId) {
+ // console.log({"linkId":"toxw9c5sy9xllGBr3QFdYg","taskType":taskType,"taskId":taskId,"channel":channel,"itemId":itemId})
+ return new Promise(resolve => {
+ $.get(taskGetUrl('apDoTask',
+ {"linkId":"toxw9c5sy9xllGBr3QFdYg","taskType":taskType,"taskId":taskId,"channel":channel,"itemId":itemId}),
+ async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if(data.code ===0 && data.data && data.data.finished){
+ console.log(`任务完成成功`)
+ }else{
+ console.log(JSON.stringify(data))
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+// 红包大富翁
+function richManIndex() {
+ return new Promise(resolve => {
+ $.get(taskUrl('richManIndex', {"actId":"hbdfw","needGoldToast":"true"}), async (err, resp, data) => {
try {
if (err) {
- that.log(`${JSON.stringify(err)}`)
- that.log(`${$.name} API请求失败,请检查网路重试`)
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
} else {
- if (data) {
+ if (safeGet(data)) {
data = JSON.parse(data);
- if (data['retcode'] === 13) {
- $.isLogin = false; //cookie过期
- return
+ if(data.code ===0 && data.data && data.data.userInfo){
+ console.log(`用户当前位置:${data.data.userInfo.position},剩余机会:${data.data.userInfo.randomTimes}`)
+ while(data.data.userInfo.randomTimes--){
+ await shootRichManDice()
+ }
}
- if (data['retcode'] === 0) {
- $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
- } else {
- $.nickName = $.UserName
- }
- } else {
- that.log(`动动服务器返回空数据`)
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
- resolve();
+ resolve(data);
}
})
})
}
-
-function safeGet(data) {
- try {
- if (typeof JSON.parse(data) == "object") {
- return true;
- }
- } catch (e) {
- that.log(e);
- that.log(`动动服务器访问数据为空,请检查自身设备网络情况`);
- return false;
- }
-}
-
-function jsonParse(str) {
- if (typeof str == "string") {
- try {
- return JSON.parse(str);
- } catch (e) {
- that.log(e);
- $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
- return [];
- }
- }
+// 红包大富翁
+function shootRichManDice() {
+ return new Promise(resolve => {
+ $.get(taskUrl('shootRichManDice', {"actId":"hbdfw"}), async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if(data.code ===0 && data.data && data.data.rewardType && data.data.couponDesc){
+ message += `红包大富翁抽奖获得:【${data.data.couponUsedValue}-${data.data.rewardValue} ${data.data.poolName}】\n`
+ console.log(`红包大富翁抽奖获得:【${data.data.couponUsedValue}-${data.data.rewardValue} ${data.data.poolName}】`)
+ }else{
+ console.log(`红包大富翁抽奖:获得空气`)
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
}
+var __encode ='jsjiami.com',_a={}, _0xb483=["\x5F\x64\x65\x63\x6F\x64\x65","\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x73\x6F\x6A\x73\x6F\x6E\x2E\x63\x6F\x6D\x2F\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x6F\x62\x66\x75\x73\x63\x61\x74\x6F\x72\x2E\x68\x74\x6D\x6C"];(function(_0xd642x1){_0xd642x1[_0xb483[0]]= _0xb483[1]})(_a);var __Oxb24bc=["\x6C\x69\x74\x65\x2D\x61\x6E\x64\x72\x6F\x69\x64\x26","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x26\x61\x6E\x64\x72\x6F\x69\x64\x26\x33\x2E\x31\x2E\x30\x26","\x26","\x26\x38\x34\x36\x63\x34\x63\x33\x32\x64\x61\x65\x39\x31\x30\x65\x66","\x31\x32\x61\x65\x61\x36\x35\x38\x66\x37\x36\x65\x34\x35\x33\x66\x61\x66\x38\x30\x33\x64\x31\x35\x63\x34\x30\x61\x37\x32\x65\x30","\x69\x73\x4E\x6F\x64\x65","\x63\x72\x79\x70\x74\x6F\x2D\x6A\x73","","\x61\x70\x69\x3F\x66\x75\x6E\x63\x74\x69\x6F\x6E\x49\x64\x3D","\x26\x62\x6F\x64\x79\x3D","\x26\x61\x70\x70\x69\x64\x3D\x6C\x69\x74\x65\x2D\x61\x6E\x64\x72\x6F\x69\x64\x26\x63\x6C\x69\x65\x6E\x74\x3D\x61\x6E\x64\x72\x6F\x69\x64\x26\x75\x75\x69\x64\x3D\x38\x34\x36\x63\x34\x63\x33\x32\x64\x61\x65\x39\x31\x30\x65\x66\x26\x63\x6C\x69\x65\x6E\x74\x56\x65\x72\x73\x69\x6F\x6E\x3D\x33\x2E\x31\x2E\x30\x26\x74\x3D","\x26\x73\x69\x67\x6E\x3D","\x61\x70\x69\x2E\x6D\x2E\x6A\x64\x2E\x63\x6F\x6D","\x2A\x2F\x2A","\x52\x4E","\x4A\x44\x4D\x6F\x62\x69\x6C\x65\x4C\x69\x74\x65\x2F\x33\x2E\x31\x2E\x30\x20\x28\x69\x50\x61\x64\x3B\x20\x69\x4F\x53\x20\x31\x34\x2E\x34\x3B\x20\x53\x63\x61\x6C\x65\x2F\x32\x2E\x30\x30\x29","\x7A\x68\x2D\x48\x61\x6E\x73\x2D\x43\x4E\x3B\x71\x3D\x31\x2C\x20\x6A\x61\x2D\x43\x4E\x3B\x71\x3D\x30\x2E\x39","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x6C\x6F\x67","\u5220\u9664","\u7248\u672C\u53F7\uFF0C\x6A\x73\u4F1A\u5B9A","\u671F\u5F39\u7A97\uFF0C","\u8FD8\u8BF7\u652F\u6301\u6211\u4EEC\u7684\u5DE5\u4F5C","\x6A\x73\x6A\x69\x61","\x6D\x69\x2E\x63\x6F\x6D"];function taskUrl(_0x7683x2,_0x7683x3= {}){let _0x7683x4=+ new Date();let _0x7683x5=`${__Oxb24bc[0x0]}${JSON[__Oxb24bc[0x1]](_0x7683x3)}${__Oxb24bc[0x2]}${_0x7683x2}${__Oxb24bc[0x3]}${_0x7683x4}${__Oxb24bc[0x4]}`;let _0x7683x6=__Oxb24bc[0x5];const _0x7683x7=$[__Oxb24bc[0x6]]()?require(__Oxb24bc[0x7]):CryptoJS;let _0x7683x8=_0x7683x7.HmacSHA256(_0x7683x5,_0x7683x6).toString();return {url:`${__Oxb24bc[0x8]}${JD_API_HOST}${__Oxb24bc[0x9]}${_0x7683x2}${__Oxb24bc[0xa]}${escape(JSON[__Oxb24bc[0x1]](_0x7683x3))}${__Oxb24bc[0xb]}${_0x7683x4}${__Oxb24bc[0xc]}${_0x7683x8}${__Oxb24bc[0x8]}`,headers:{'\x48\x6F\x73\x74':__Oxb24bc[0xd],'\x61\x63\x63\x65\x70\x74':__Oxb24bc[0xe],'\x6B\x65\x72\x6E\x65\x6C\x70\x6C\x61\x74\x66\x6F\x72\x6D':__Oxb24bc[0xf],'\x75\x73\x65\x72\x2D\x61\x67\x65\x6E\x74':__Oxb24bc[0x10],'\x61\x63\x63\x65\x70\x74\x2D\x6C\x61\x6E\x67\x75\x61\x67\x65':__Oxb24bc[0x11],'\x43\x6F\x6F\x6B\x69\x65':cookie}}}(function(_0x7683x9,_0x7683xa,_0x7683xb,_0x7683xc,_0x7683xd,_0x7683xe){_0x7683xe= __Oxb24bc[0x12];_0x7683xc= function(_0x7683xf){if( typeof alert!== _0x7683xe){alert(_0x7683xf)};if( typeof console!== _0x7683xe){console[__Oxb24bc[0x13]](_0x7683xf)}};_0x7683xb= function(_0x7683x7,_0x7683x9){return _0x7683x7+ _0x7683x9};_0x7683xd= _0x7683xb(__Oxb24bc[0x14],_0x7683xb(_0x7683xb(__Oxb24bc[0x15],__Oxb24bc[0x16]),__Oxb24bc[0x17]));try{_0x7683x9= __encode;if(!( typeof _0x7683x9!== _0x7683xe&& _0x7683x9=== _0x7683xb(__Oxb24bc[0x18],__Oxb24bc[0x19]))){_0x7683xc(_0x7683xd)}}catch(e){_0x7683xc(_0x7683xd)}})({})
function taskGetUrl(function_id, body) {
return {
@@ -863,81 +665,149 @@ function taskGetUrl(function_id, body) {
}
}
-function taskPostUrl(function_id, body) {
- return {
- url: `https://api.m.jd.com/`,
- body: `appid=activities_platform&functionId=${function_id}&body=${escape(JSON.stringify(body))}&t=${+new Date()}`,
+function invite2() {
+ let t = +new Date()
+ let inviterIdArr = [
+ "5V7vHE23qh2EkdBHXRFDuA==",
+ "wXX9SjXOdYMWe5Ru/1+x9A==",
+ "mCvmrmFghpDCLcL3VZs53BkAhucziHAYn3HhPmURJJE=",
+ "4AVQao+eH8Q8kvmXnWmkG8ef/fNr5fdejnD9+9Ugbec=",
+ "jbGBRBPo5DmwB9ntTCSVOGXuh1YQyccCuZpWwb3PlIc=",
+ ]
+ let inviterId = inviterIdArr[Math.floor((Math.random() * inviterIdArr.length))]
+ let options = {
+ url: "https://api.m.jd.com/",
+ body: `functionId=TaskInviteService&body=${JSON.stringify({"method":"participateInviteTask","data":{"channel":"1","encryptionInviterPin":encodeURIComponent(inviterId),"type":1}})}&appid=market-task-h5&uuid=&_t=${t}`,
headers: {
- 'Cookie': cookie,
- 'Host': 'api.m.jd.com',
- 'Accept': '*/*',
- 'Connection': 'keep-alive',
- // 'user-agent': $.isNode() ? (process.env.JS_USER_AGENT ? process.env.JS_USER_AGENT : (require('./JS_USER_AGENTS').USER_AGENT)) : ($.getdata('JSUA') ? $.getdata('JSUA') : "'jdltapp;iPad;3.1.0;14.4;network/wifi;Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
- 'user-agent': "jdltapp;iPhone;3.3.2;14.3;b488010ad24c40885d846e66931abaf532ed26a5;network/4g;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone11,8;addressid/2005183373;hasOCPay/0;appBuild/1049;supportBestPay/0;pv/220.46;apprpd/;ref/JDLTSubMainPageViewController;psq/0;ads/;psn/b488010ad24c40885d846e66931abaf532ed26a5|520;jdv/0|iosapp|t_335139774|liteshare|CopyURL|1618673222002|1618673227;adk/;app_device/IOS;pap/JA2020_3112531|3.3.2|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1 ",
- 'Accept-Language': 'zh-Hans-CN;q=1,en-CN;q=0.9',
- 'Accept-Encoding': 'gzip, deflate, br',
- 'Content-Type': "application/x-www-form-urlencoded",
- "referer": "https://an.jd.com/babelDiy/Zeus/q1eB6WUB8oC4eH1BsCLWvQakVsX/index.html"
+ "Host": "api.m.jd.com",
+ "Accept": "application/json, text/plain, */*",
+ "Content-Type": "application/x-www-form-urlencoded",
+ "Origin": "https://gray.jd.com",
+ "Accept-Language": "zh-CN,zh-Hans;q=0.9",
+ "User-Agent": $.isNode() ? (process.env.JS_USER_AGENT ? process.env.JS_USER_AGENT : (require('./JS_USER_AGENTS').USER_AGENT)) : ($.getdata('JSUA') ? $.getdata('JSUA') : "'jdltapp;iPad;3.1.0;14.4;network/wifi;Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
+ "Referer": "https://gray.jd.com/",
+ "Accept-Encoding": "gzip, deflate, br",
+ "Cookie": cookie
+ }
+ }
+ $.post(options, (err, resp, data) => {
+ // console.log(data)
+ })
+}
+
+function invite() {
+ let t = +new Date()
+ let inviterIdArr = [
+ "5V7vHE23qh2EkdBHXRFDuA==",
+ "4AVQao+eH8Q8kvmXnWmkG8ef/fNr5fdejnD9+9Ugbec=",
+ "jbGBRBPo5DmwB9ntTCSVOGXuh1YQyccCuZpWwb3PlIc=",
+ "wXX9SjXOdYMWe5Ru/1+x9A==",
+ "mCvmrmFghpDCLcL3VZs53BkAhucziHAYn3HhPmURJJE=",
+ "E9EvSFNuA1pahSQT0uSsXkW1v0j+QOHQbk8+peJYc0I=",
+ "zPiP6uq7hi9AS7VecMnRvA==",
+ "YQ5wwbSWDzNIudDC2OWvSw==",
+ "+vbK7QKOtpHM4dsSRqUPPX/11g/P71iBYh46dyiMuKk=",
+ "w22w0sZEccp/OWxg1d20RtsryQGfghc94PsLIBqeX0E=",
+ "VdDrieI4oR6XwchWlxwfCQqEf6/k8cYvTG52R1ToSoQ=",
+ "D7QE/1ouU1wA14mAV0zGMg=="
+ ]
+ let inviterId = inviterIdArr[Math.floor((Math.random() * inviterIdArr.length))]
+ let options = {
+ url: `https://api.m.jd.com/?t=${t}`,
+ body: `functionId=InviteFriendChangeAssertsService&body=${JSON.stringify({"method":"attendInviteActivity","data":{"inviterPin":encodeURIComponent(inviterId),"channel":1,"token":"","frontendInitStatus":""}})}&referer=-1&eid=eidI9b2981202fsec83iRW1nTsOVzCocWda3YHPN471AY78%2FQBhYbXeWtdg%2F3TCtVTMrE1JjM8Sqt8f2TqF1Z5P%2FRPGlzA1dERP0Z5bLWdq5N5B2VbBO&aid=&client=ios&clientVersion=14.4.2&networkType=wifi&fp=-1&uuid=ab048084b47df24880613326feffdf7eee471488&osVersion=14.4.2&d_brand=iPhone&d_model=iPhone10,2&agent=-1&pageClickKey=-1&platform=3&lang=zh_CN&appid=market-task-h5&_t=${t}`,
+ headers: {
+ "Host": "api.m.jd.com",
+ "Accept": "application/json, text/plain, */*",
+ "Content-type": "application/x-www-form-urlencoded",
+ "Origin": "https://invite-reward.jd.com",
+ "Accept-Language": "zh-CN,zh-Hans;q=0.9",
+ "User-Agent": $.isNode() ? (process.env.JS_USER_AGENT ? process.env.JS_USER_AGENT : (require('./JS_USER_AGENTS').USER_AGENT)) : ($.getdata('JSUA') ? $.getdata('JSUA') : "'jdltapp;iPad;3.1.0;14.4;network/wifi;Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
+ "Referer": 'https://invite-reward.jd.com/',
+ "Accept-Encoding": "gzip, deflate, br",
+ "Cookie": cookie
+ }
+ }
+ $.post(options, (err, resp, data) => {
+ // console.log(data)
+ })
+}
+
+function TotalBean() {
+ return new Promise(async resolve => {
+ const options = {
+ "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
+ "headers": {
+ "Accept": "application/json,text/plain, */*",
+ "Content-Type": "application/x-www-form-urlencoded",
+ "Accept-Encoding": "gzip, deflate, br",
+ "Accept-Language": "zh-cn",
+ "Connection": "keep-alive",
+ "Cookie": cookie,
+ "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
+ "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (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")
+ }
+ }
+ $.post(options, (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (data) {
+ data = JSON.parse(data);
+ if (data['retcode'] === 13) {
+ $.isLogin = false; //cookie过期
+ return
+ }
+ if (data['retcode'] === 0) {
+ $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
+ } else {
+ $.nickName = $.UserName
+ }
+ } else {
+ console.log(`京东服务器返回空数据`)
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve();
+ }
+ })
+ })
+}
+
+function safeGet(data) {
+ try {
+ if (typeof JSON.parse(data) == "object") {
+ return true;
+ }
+ } catch (e) {
+ console.log(e);
+ console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
+ return false;
+ }
+}
+
+function jsonParse(str) {
+ if (typeof str == "string") {
+ try {
+ return JSON.parse(str);
+ } catch (e) {
+ console.log(e);
+ $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
+ return [];
}
}
}
+!function (t, r) { "object" == typeof exports ? module.exports = exports = r() : "function" == typeof define && define.amd ? define([], r) : t.CryptoJS = r() }(this, function () {
+ var t = t || function (t, r) { var e = Object.create || function () { function t() { } return function (r) { var e; return t.prototype = r, e = new t, t.prototype = null, e } }(), i = {}, n = i.lib = {}, o = n.Base = function () { return { extend: function (t) { var r = e(this); return t && r.mixIn(t), r.hasOwnProperty("init") && this.init !== r.init || (r.init = function () { r.$super.init.apply(this, arguments) }), r.init.prototype = r, r.$super = this, r }, create: function () { var t = this.extend(); return t.init.apply(t, arguments), t }, init: function () { }, mixIn: function (t) { for (var r in t) t.hasOwnProperty(r) && (this[r] = t[r]); t.hasOwnProperty("toString") && (this.toString = t.toString) }, clone: function () { return this.init.prototype.extend(this) } } }(), s = n.WordArray = o.extend({ init: function (t, e) { t = this.words = t || [], e != r ? this.sigBytes = e : this.sigBytes = 4 * t.length }, toString: function (t) { return (t || c).stringify(this) }, concat: function (t) { var r = this.words, e = t.words, i = this.sigBytes, n = t.sigBytes; if (this.clamp(), i % 4) for (var o = 0; o < n; o++) { var s = e[o >>> 2] >>> 24 - o % 4 * 8 & 255; r[i + o >>> 2] |= s << 24 - (i + o) % 4 * 8 } else for (var o = 0; o < n; o += 4)r[i + o >>> 2] = e[o >>> 2]; return this.sigBytes += n, this }, clamp: function () { var r = this.words, e = this.sigBytes; r[e >>> 2] &= 4294967295 << 32 - e % 4 * 8, r.length = t.ceil(e / 4) }, clone: function () { var t = o.clone.call(this); return t.words = this.words.slice(0), t }, random: function (r) { for (var e, i = [], n = function (r) { var r = r, e = 987654321, i = 4294967295; return function () { e = 36969 * (65535 & e) + (e >> 16) & i, r = 18e3 * (65535 & r) + (r >> 16) & i; var n = (e << 16) + r & i; return n /= 4294967296, n += .5, n * (t.random() > .5 ? 1 : -1) } }, o = 0; o < r; o += 4) { var a = n(4294967296 * (e || t.random())); e = 987654071 * a(), i.push(4294967296 * a() | 0) } return new s.init(i, r) } }), a = i.enc = {}, c = a.Hex = { stringify: function (t) { for (var r = t.words, e = t.sigBytes, i = [], n = 0; n < e; n++) { var o = r[n >>> 2] >>> 24 - n % 4 * 8 & 255; i.push((o >>> 4).toString(16)), i.push((15 & o).toString(16)) } return i.join("") }, parse: function (t) { for (var r = t.length, e = [], i = 0; i < r; i += 2)e[i >>> 3] |= parseInt(t.substr(i, 2), 16) << 24 - i % 8 * 4; return new s.init(e, r / 2) } }, h = a.Latin1 = { stringify: function (t) { for (var r = t.words, e = t.sigBytes, i = [], n = 0; n < e; n++) { var o = r[n >>> 2] >>> 24 - n % 4 * 8 & 255; i.push(String.fromCharCode(o)) } return i.join("") }, parse: function (t) { for (var r = t.length, e = [], i = 0; i < r; i++)e[i >>> 2] |= (255 & t.charCodeAt(i)) << 24 - i % 4 * 8; return new s.init(e, r) } }, l = a.Utf8 = { stringify: function (t) { try { return decodeURIComponent(escape(h.stringify(t))) } catch (t) { throw new Error("Malformed UTF-8 data") } }, parse: function (t) { return h.parse(unescape(encodeURIComponent(t))) } }, f = n.BufferedBlockAlgorithm = o.extend({ reset: function () { this._data = new s.init, this._nDataBytes = 0 }, _append: function (t) { "string" == typeof t && (t = l.parse(t)), this._data.concat(t), this._nDataBytes += t.sigBytes }, _process: function (r) { var e = this._data, i = e.words, n = e.sigBytes, o = this.blockSize, a = 4 * o, c = n / a; c = r ? t.ceil(c) : t.max((0 | c) - this._minBufferSize, 0); var h = c * o, l = t.min(4 * h, n); if (h) { for (var f = 0; f < h; f += o)this._doProcessBlock(i, f); var u = i.splice(0, h); e.sigBytes -= l } return new s.init(u, l) }, clone: function () { var t = o.clone.call(this); return t._data = this._data.clone(), t }, _minBufferSize: 0 }), u = (n.Hasher = f.extend({ cfg: o.extend(), init: function (t) { this.cfg = this.cfg.extend(t), this.reset() }, reset: function () { f.reset.call(this), this._doReset() }, update: function (t) { return this._append(t), this._process(), this }, finalize: function (t) { t && this._append(t); var r = this._doFinalize(); return r }, blockSize: 16, _createHelper: function (t) { return function (r, e) { return new t.init(e).finalize(r) } }, _createHmacHelper: function (t) { return function (r, e) { return new u.HMAC.init(t, e).finalize(r) } } }), i.algo = {}); return i }(Math); return function () { function r(t, r, e) { for (var i = [], o = 0, s = 0; s < r; s++)if (s % 4) { var a = e[t.charCodeAt(s - 1)] << s % 4 * 2, c = e[t.charCodeAt(s)] >>> 6 - s % 4 * 2; i[o >>> 2] |= (a | c) << 24 - o % 4 * 8, o++ } return n.create(i, o) } var e = t, i = e.lib, n = i.WordArray, o = e.enc; o.Base64 = { stringify: function (t) { var r = t.words, e = t.sigBytes, i = this._map; t.clamp(); for (var n = [], o = 0; o < e; o += 3)for (var s = r[o >>> 2] >>> 24 - o % 4 * 8 & 255, a = r[o + 1 >>> 2] >>> 24 - (o + 1) % 4 * 8 & 255, c = r[o + 2 >>> 2] >>> 24 - (o + 2) % 4 * 8 & 255, h = s << 16 | a << 8 | c, l = 0; l < 4 && o + .75 * l < e; l++)n.push(i.charAt(h >>> 6 * (3 - l) & 63)); var f = i.charAt(64); if (f) for (; n.length % 4;)n.push(f); return n.join("") }, parse: function (t) { var e = t.length, i = this._map, n = this._reverseMap; if (!n) { n = this._reverseMap = []; for (var o = 0; o < i.length; o++)n[i.charCodeAt(o)] = o } var s = i.charAt(64); if (s) { var a = t.indexOf(s); a !== -1 && (e = a) } return r(t, e, n) }, _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" } }(), function (r) { function e(t, r, e, i, n, o, s) { var a = t + (r & e | ~r & i) + n + s; return (a << o | a >>> 32 - o) + r } function i(t, r, e, i, n, o, s) { var a = t + (r & i | e & ~i) + n + s; return (a << o | a >>> 32 - o) + r } function n(t, r, e, i, n, o, s) { var a = t + (r ^ e ^ i) + n + s; return (a << o | a >>> 32 - o) + r } function o(t, r, e, i, n, o, s) { var a = t + (e ^ (r | ~i)) + n + s; return (a << o | a >>> 32 - o) + r } var s = t, a = s.lib, c = a.WordArray, h = a.Hasher, l = s.algo, f = []; !function () { for (var t = 0; t < 64; t++)f[t] = 4294967296 * r.abs(r.sin(t + 1)) | 0 }(); var u = l.MD5 = h.extend({ _doReset: function () { this._hash = new c.init([1732584193, 4023233417, 2562383102, 271733878]) }, _doProcessBlock: function (t, r) { for (var s = 0; s < 16; s++) { var a = r + s, c = t[a]; t[a] = 16711935 & (c << 8 | c >>> 24) | 4278255360 & (c << 24 | c >>> 8) } var h = this._hash.words, l = t[r + 0], u = t[r + 1], d = t[r + 2], v = t[r + 3], p = t[r + 4], _ = t[r + 5], y = t[r + 6], g = t[r + 7], B = t[r + 8], w = t[r + 9], k = t[r + 10], S = t[r + 11], m = t[r + 12], x = t[r + 13], b = t[r + 14], H = t[r + 15], z = h[0], A = h[1], C = h[2], D = h[3]; z = e(z, A, C, D, l, 7, f[0]), D = e(D, z, A, C, u, 12, f[1]), C = e(C, D, z, A, d, 17, f[2]), A = e(A, C, D, z, v, 22, f[3]), z = e(z, A, C, D, p, 7, f[4]), D = e(D, z, A, C, _, 12, f[5]), C = e(C, D, z, A, y, 17, f[6]), A = e(A, C, D, z, g, 22, f[7]), z = e(z, A, C, D, B, 7, f[8]), D = e(D, z, A, C, w, 12, f[9]), C = e(C, D, z, A, k, 17, f[10]), A = e(A, C, D, z, S, 22, f[11]), z = e(z, A, C, D, m, 7, f[12]), D = e(D, z, A, C, x, 12, f[13]), C = e(C, D, z, A, b, 17, f[14]), A = e(A, C, D, z, H, 22, f[15]), z = i(z, A, C, D, u, 5, f[16]), D = i(D, z, A, C, y, 9, f[17]), C = i(C, D, z, A, S, 14, f[18]), A = i(A, C, D, z, l, 20, f[19]), z = i(z, A, C, D, _, 5, f[20]), D = i(D, z, A, C, k, 9, f[21]), C = i(C, D, z, A, H, 14, f[22]), A = i(A, C, D, z, p, 20, f[23]), z = i(z, A, C, D, w, 5, f[24]), D = i(D, z, A, C, b, 9, f[25]), C = i(C, D, z, A, v, 14, f[26]), A = i(A, C, D, z, B, 20, f[27]), z = i(z, A, C, D, x, 5, f[28]), D = i(D, z, A, C, d, 9, f[29]), C = i(C, D, z, A, g, 14, f[30]), A = i(A, C, D, z, m, 20, f[31]), z = n(z, A, C, D, _, 4, f[32]), D = n(D, z, A, C, B, 11, f[33]), C = n(C, D, z, A, S, 16, f[34]), A = n(A, C, D, z, b, 23, f[35]), z = n(z, A, C, D, u, 4, f[36]), D = n(D, z, A, C, p, 11, f[37]), C = n(C, D, z, A, g, 16, f[38]), A = n(A, C, D, z, k, 23, f[39]), z = n(z, A, C, D, x, 4, f[40]), D = n(D, z, A, C, l, 11, f[41]), C = n(C, D, z, A, v, 16, f[42]), A = n(A, C, D, z, y, 23, f[43]), z = n(z, A, C, D, w, 4, f[44]), D = n(D, z, A, C, m, 11, f[45]), C = n(C, D, z, A, H, 16, f[46]), A = n(A, C, D, z, d, 23, f[47]), z = o(z, A, C, D, l, 6, f[48]), D = o(D, z, A, C, g, 10, f[49]), C = o(C, D, z, A, b, 15, f[50]), A = o(A, C, D, z, _, 21, f[51]), z = o(z, A, C, D, m, 6, f[52]), D = o(D, z, A, C, v, 10, f[53]), C = o(C, D, z, A, k, 15, f[54]), A = o(A, C, D, z, u, 21, f[55]), z = o(z, A, C, D, B, 6, f[56]), D = o(D, z, A, C, H, 10, f[57]), C = o(C, D, z, A, y, 15, f[58]), A = o(A, C, D, z, x, 21, f[59]), z = o(z, A, C, D, p, 6, f[60]), D = o(D, z, A, C, S, 10, f[61]), C = o(C, D, z, A, d, 15, f[62]), A = o(A, C, D, z, w, 21, f[63]), h[0] = h[0] + z | 0, h[1] = h[1] + A | 0, h[2] = h[2] + C | 0, h[3] = h[3] + D | 0 }, _doFinalize: function () { var t = this._data, e = t.words, i = 8 * this._nDataBytes, n = 8 * t.sigBytes; e[n >>> 5] |= 128 << 24 - n % 32; var o = r.floor(i / 4294967296), s = i; e[(n + 64 >>> 9 << 4) + 15] = 16711935 & (o << 8 | o >>> 24) | 4278255360 & (o << 24 | o >>> 8), e[(n + 64 >>> 9 << 4) + 14] = 16711935 & (s << 8 | s >>> 24) | 4278255360 & (s << 24 | s >>> 8), t.sigBytes = 4 * (e.length + 1), this._process(); for (var a = this._hash, c = a.words, h = 0; h < 4; h++) { var l = c[h]; c[h] = 16711935 & (l << 8 | l >>> 24) | 4278255360 & (l << 24 | l >>> 8) } return a }, clone: function () { var t = h.clone.call(this); return t._hash = this._hash.clone(), t } }); s.MD5 = h._createHelper(u), s.HmacMD5 = h._createHmacHelper(u) }(Math), function () { var r = t, e = r.lib, i = e.WordArray, n = e.Hasher, o = r.algo, s = [], a = o.SHA1 = n.extend({ _doReset: function () { this._hash = new i.init([1732584193, 4023233417, 2562383102, 271733878, 3285377520]) }, _doProcessBlock: function (t, r) { for (var e = this._hash.words, i = e[0], n = e[1], o = e[2], a = e[3], c = e[4], h = 0; h < 80; h++) { if (h < 16) s[h] = 0 | t[r + h]; else { var l = s[h - 3] ^ s[h - 8] ^ s[h - 14] ^ s[h - 16]; s[h] = l << 1 | l >>> 31 } var f = (i << 5 | i >>> 27) + c + s[h]; f += h < 20 ? (n & o | ~n & a) + 1518500249 : h < 40 ? (n ^ o ^ a) + 1859775393 : h < 60 ? (n & o | n & a | o & a) - 1894007588 : (n ^ o ^ a) - 899497514, c = a, a = o, o = n << 30 | n >>> 2, n = i, i = f } e[0] = e[0] + i | 0, e[1] = e[1] + n | 0, e[2] = e[2] + o | 0, e[3] = e[3] + a | 0, e[4] = e[4] + c | 0 }, _doFinalize: function () { var t = this._data, r = t.words, e = 8 * this._nDataBytes, i = 8 * t.sigBytes; return r[i >>> 5] |= 128 << 24 - i % 32, r[(i + 64 >>> 9 << 4) + 14] = Math.floor(e / 4294967296), r[(i + 64 >>> 9 << 4) + 15] = e, t.sigBytes = 4 * r.length, this._process(), this._hash }, clone: function () { var t = n.clone.call(this); return t._hash = this._hash.clone(), t } }); r.SHA1 = n._createHelper(a), r.HmacSHA1 = n._createHmacHelper(a) }(), function (r) { var e = t, i = e.lib, n = i.WordArray, o = i.Hasher, s = e.algo, a = [], c = []; !function () { function t(t) { for (var e = r.sqrt(t), i = 2; i <= e; i++)if (!(t % i)) return !1; return !0 } function e(t) { return 4294967296 * (t - (0 | t)) | 0 } for (var i = 2, n = 0; n < 64;)t(i) && (n < 8 && (a[n] = e(r.pow(i, .5))), c[n] = e(r.pow(i, 1 / 3)), n++), i++ }(); var h = [], l = s.SHA256 = o.extend({ _doReset: function () { this._hash = new n.init(a.slice(0)) }, _doProcessBlock: function (t, r) { for (var e = this._hash.words, i = e[0], n = e[1], o = e[2], s = e[3], a = e[4], l = e[5], f = e[6], u = e[7], d = 0; d < 64; d++) { if (d < 16) h[d] = 0 | t[r + d]; else { var v = h[d - 15], p = (v << 25 | v >>> 7) ^ (v << 14 | v >>> 18) ^ v >>> 3, _ = h[d - 2], y = (_ << 15 | _ >>> 17) ^ (_ << 13 | _ >>> 19) ^ _ >>> 10; h[d] = p + h[d - 7] + y + h[d - 16] } var g = a & l ^ ~a & f, B = i & n ^ i & o ^ n & o, w = (i << 30 | i >>> 2) ^ (i << 19 | i >>> 13) ^ (i << 10 | i >>> 22), k = (a << 26 | a >>> 6) ^ (a << 21 | a >>> 11) ^ (a << 7 | a >>> 25), S = u + k + g + c[d] + h[d], m = w + B; u = f, f = l, l = a, a = s + S | 0, s = o, o = n, n = i, i = S + m | 0 } e[0] = e[0] + i | 0, e[1] = e[1] + n | 0, e[2] = e[2] + o | 0, e[3] = e[3] + s | 0, e[4] = e[4] + a | 0, e[5] = e[5] + l | 0, e[6] = e[6] + f | 0, e[7] = e[7] + u | 0 }, _doFinalize: function () { var t = this._data, e = t.words, i = 8 * this._nDataBytes, n = 8 * t.sigBytes; return e[n >>> 5] |= 128 << 24 - n % 32, e[(n + 64 >>> 9 << 4) + 14] = r.floor(i / 4294967296), e[(n + 64 >>> 9 << 4) + 15] = i, t.sigBytes = 4 * e.length, this._process(), this._hash }, clone: function () { var t = o.clone.call(this); return t._hash = this._hash.clone(), t } }); e.SHA256 = o._createHelper(l), e.HmacSHA256 = o._createHmacHelper(l) }(Math), function () { function r(t) { return t << 8 & 4278255360 | t >>> 8 & 16711935 } var e = t, i = e.lib, n = i.WordArray, o = e.enc; o.Utf16 = o.Utf16BE = { stringify: function (t) { for (var r = t.words, e = t.sigBytes, i = [], n = 0; n < e; n += 2) { var o = r[n >>> 2] >>> 16 - n % 4 * 8 & 65535; i.push(String.fromCharCode(o)) } return i.join("") }, parse: function (t) { for (var r = t.length, e = [], i = 0; i < r; i++)e[i >>> 1] |= t.charCodeAt(i) << 16 - i % 2 * 16; return n.create(e, 2 * r) } }; o.Utf16LE = { stringify: function (t) { for (var e = t.words, i = t.sigBytes, n = [], o = 0; o < i; o += 2) { var s = r(e[o >>> 2] >>> 16 - o % 4 * 8 & 65535); n.push(String.fromCharCode(s)) } return n.join("") }, parse: function (t) { for (var e = t.length, i = [], o = 0; o < e; o++)i[o >>> 1] |= r(t.charCodeAt(o) << 16 - o % 2 * 16); return n.create(i, 2 * e) } } }(), function () { if ("function" == typeof ArrayBuffer) { var r = t, e = r.lib, i = e.WordArray, n = i.init, o = i.init = function (t) { if (t instanceof ArrayBuffer && (t = new Uint8Array(t)), (t instanceof Int8Array || "undefined" != typeof Uint8ClampedArray && t instanceof Uint8ClampedArray || t instanceof Int16Array || t instanceof Uint16Array || t instanceof Int32Array || t instanceof Uint32Array || t instanceof Float32Array || t instanceof Float64Array) && (t = new Uint8Array(t.buffer, t.byteOffset, t.byteLength)), t instanceof Uint8Array) { for (var r = t.byteLength, e = [], i = 0; i < r; i++)e[i >>> 2] |= t[i] << 24 - i % 4 * 8; n.call(this, e, r) } else n.apply(this, arguments) }; o.prototype = i } }(), function (r) { function e(t, r, e) { return t ^ r ^ e } function i(t, r, e) { return t & r | ~t & e } function n(t, r, e) { return (t | ~r) ^ e } function o(t, r, e) { return t & e | r & ~e } function s(t, r, e) { return t ^ (r | ~e) } function a(t, r) { return t << r | t >>> 32 - r } var c = t, h = c.lib, l = h.WordArray, f = h.Hasher, u = c.algo, d = l.create([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]), v = l.create([5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]), p = l.create([11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6]), _ = l.create([8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11]), y = l.create([0, 1518500249, 1859775393, 2400959708, 2840853838]), g = l.create([1352829926, 1548603684, 1836072691, 2053994217, 0]), B = u.RIPEMD160 = f.extend({ _doReset: function () { this._hash = l.create([1732584193, 4023233417, 2562383102, 271733878, 3285377520]) }, _doProcessBlock: function (t, r) { for (var c = 0; c < 16; c++) { var h = r + c, l = t[h]; t[h] = 16711935 & (l << 8 | l >>> 24) | 4278255360 & (l << 24 | l >>> 8) } var f, u, B, w, k, S, m, x, b, H, z = this._hash.words, A = y.words, C = g.words, D = d.words, R = v.words, E = p.words, M = _.words; S = f = z[0], m = u = z[1], x = B = z[2], b = w = z[3], H = k = z[4]; for (var F, c = 0; c < 80; c += 1)F = f + t[r + D[c]] | 0, F += c < 16 ? e(u, B, w) + A[0] : c < 32 ? i(u, B, w) + A[1] : c < 48 ? n(u, B, w) + A[2] : c < 64 ? o(u, B, w) + A[3] : s(u, B, w) + A[4], F |= 0, F = a(F, E[c]), F = F + k | 0, f = k, k = w, w = a(B, 10), B = u, u = F, F = S + t[r + R[c]] | 0, F += c < 16 ? s(m, x, b) + C[0] : c < 32 ? o(m, x, b) + C[1] : c < 48 ? n(m, x, b) + C[2] : c < 64 ? i(m, x, b) + C[3] : e(m, x, b) + C[4], F |= 0, F = a(F, M[c]), F = F + H | 0, S = H, H = b, b = a(x, 10), x = m, m = F; F = z[1] + B + b | 0, z[1] = z[2] + w + H | 0, z[2] = z[3] + k + S | 0, z[3] = z[4] + f + m | 0, z[4] = z[0] + u + x | 0, z[0] = F }, _doFinalize: function () { var t = this._data, r = t.words, e = 8 * this._nDataBytes, i = 8 * t.sigBytes; r[i >>> 5] |= 128 << 24 - i % 32, r[(i + 64 >>> 9 << 4) + 14] = 16711935 & (e << 8 | e >>> 24) | 4278255360 & (e << 24 | e >>> 8), t.sigBytes = 4 * (r.length + 1), this._process(); for (var n = this._hash, o = n.words, s = 0; s < 5; s++) { var a = o[s]; o[s] = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8) } return n }, clone: function () { var t = f.clone.call(this); return t._hash = this._hash.clone(), t } }); c.RIPEMD160 = f._createHelper(B), c.HmacRIPEMD160 = f._createHmacHelper(B) }(Math), function () { var r = t, e = r.lib, i = e.Base, n = r.enc, o = n.Utf8, s = r.algo; s.HMAC = i.extend({ init: function (t, r) { t = this._hasher = new t.init, "string" == typeof r && (r = o.parse(r)); var e = t.blockSize, i = 4 * e; r.sigBytes > i && (r = t.finalize(r)), r.clamp(); for (var n = this._oKey = r.clone(), s = this._iKey = r.clone(), a = n.words, c = s.words, h = 0; h < e; h++)a[h] ^= 1549556828, c[h] ^= 909522486; n.sigBytes = s.sigBytes = i, this.reset() }, reset: function () { var t = this._hasher; t.reset(), t.update(this._iKey) }, update: function (t) { return this._hasher.update(t), this }, finalize: function (t) { var r = this._hasher, e = r.finalize(t); r.reset(); var i = r.finalize(this._oKey.clone().concat(e)); return i } }) }(), function () { var r = t, e = r.lib, i = e.Base, n = e.WordArray, o = r.algo, s = o.SHA1, a = o.HMAC, c = o.PBKDF2 = i.extend({ cfg: i.extend({ keySize: 4, hasher: s, iterations: 1 }), init: function (t) { this.cfg = this.cfg.extend(t) }, compute: function (t, r) { for (var e = this.cfg, i = a.create(e.hasher, t), o = n.create(), s = n.create([1]), c = o.words, h = s.words, l = e.keySize, f = e.iterations; c.length < l;) { var u = i.update(r).finalize(s); i.reset(); for (var d = u.words, v = d.length, p = u, _ = 1; _ < f; _++) { p = i.finalize(p), i.reset(); for (var y = p.words, g = 0; g < v; g++)d[g] ^= y[g] } o.concat(u), h[0]++ } return o.sigBytes = 4 * l, o } }); r.PBKDF2 = function (t, r, e) { return c.create(e).compute(t, r) } }(), function () { var r = t, e = r.lib, i = e.Base, n = e.WordArray, o = r.algo, s = o.MD5, a = o.EvpKDF = i.extend({ cfg: i.extend({ keySize: 4, hasher: s, iterations: 1 }), init: function (t) { this.cfg = this.cfg.extend(t) }, compute: function (t, r) { for (var e = this.cfg, i = e.hasher.create(), o = n.create(), s = o.words, a = e.keySize, c = e.iterations; s.length < a;) { h && i.update(h); var h = i.update(t).finalize(r); i.reset(); for (var l = 1; l < c; l++)h = i.finalize(h), i.reset(); o.concat(h) } return o.sigBytes = 4 * a, o } }); r.EvpKDF = function (t, r, e) { return a.create(e).compute(t, r) } }(), function () { var r = t, e = r.lib, i = e.WordArray, n = r.algo, o = n.SHA256, s = n.SHA224 = o.extend({ _doReset: function () { this._hash = new i.init([3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428]) }, _doFinalize: function () { var t = o._doFinalize.call(this); return t.sigBytes -= 4, t } }); r.SHA224 = o._createHelper(s), r.HmacSHA224 = o._createHmacHelper(s) }(), function (r) { var e = t, i = e.lib, n = i.Base, o = i.WordArray, s = e.x64 = {}; s.Word = n.extend({ init: function (t, r) { this.high = t, this.low = r } }), s.WordArray = n.extend({ init: function (t, e) { t = this.words = t || [], e != r ? this.sigBytes = e : this.sigBytes = 8 * t.length }, toX32: function () { for (var t = this.words, r = t.length, e = [], i = 0; i < r; i++) { var n = t[i]; e.push(n.high), e.push(n.low) } return o.create(e, this.sigBytes) }, clone: function () { for (var t = n.clone.call(this), r = t.words = this.words.slice(0), e = r.length, i = 0; i < e; i++)r[i] = r[i].clone(); return t } }) }(), function (r) { var e = t, i = e.lib, n = i.WordArray, o = i.Hasher, s = e.x64, a = s.Word, c = e.algo, h = [], l = [], f = []; !function () { for (var t = 1, r = 0, e = 0; e < 24; e++) { h[t + 5 * r] = (e + 1) * (e + 2) / 2 % 64; var i = r % 5, n = (2 * t + 3 * r) % 5; t = i, r = n } for (var t = 0; t < 5; t++)for (var r = 0; r < 5; r++)l[t + 5 * r] = r + (2 * t + 3 * r) % 5 * 5; for (var o = 1, s = 0; s < 24; s++) { for (var c = 0, u = 0, d = 0; d < 7; d++) { if (1 & o) { var v = (1 << d) - 1; v < 32 ? u ^= 1 << v : c ^= 1 << v - 32 } 128 & o ? o = o << 1 ^ 113 : o <<= 1 } f[s] = a.create(c, u) } }(); var u = []; !function () { for (var t = 0; t < 25; t++)u[t] = a.create() }(); var d = c.SHA3 = o.extend({ cfg: o.cfg.extend({ outputLength: 512 }), _doReset: function () { for (var t = this._state = [], r = 0; r < 25; r++)t[r] = new a.init; this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32 }, _doProcessBlock: function (t, r) { for (var e = this._state, i = this.blockSize / 2, n = 0; n < i; n++) { var o = t[r + 2 * n], s = t[r + 2 * n + 1]; o = 16711935 & (o << 8 | o >>> 24) | 4278255360 & (o << 24 | o >>> 8), s = 16711935 & (s << 8 | s >>> 24) | 4278255360 & (s << 24 | s >>> 8); var a = e[n]; a.high ^= s, a.low ^= o } for (var c = 0; c < 24; c++) { for (var d = 0; d < 5; d++) { for (var v = 0, p = 0, _ = 0; _ < 5; _++) { var a = e[d + 5 * _]; v ^= a.high, p ^= a.low } var y = u[d]; y.high = v, y.low = p } for (var d = 0; d < 5; d++)for (var g = u[(d + 4) % 5], B = u[(d + 1) % 5], w = B.high, k = B.low, v = g.high ^ (w << 1 | k >>> 31), p = g.low ^ (k << 1 | w >>> 31), _ = 0; _ < 5; _++) { var a = e[d + 5 * _]; a.high ^= v, a.low ^= p } for (var S = 1; S < 25; S++) { var a = e[S], m = a.high, x = a.low, b = h[S]; if (b < 32) var v = m << b | x >>> 32 - b, p = x << b | m >>> 32 - b; else var v = x << b - 32 | m >>> 64 - b, p = m << b - 32 | x >>> 64 - b; var H = u[l[S]]; H.high = v, H.low = p } var z = u[0], A = e[0]; z.high = A.high, z.low = A.low; for (var d = 0; d < 5; d++)for (var _ = 0; _ < 5; _++) { var S = d + 5 * _, a = e[S], C = u[S], D = u[(d + 1) % 5 + 5 * _], R = u[(d + 2) % 5 + 5 * _]; a.high = C.high ^ ~D.high & R.high, a.low = C.low ^ ~D.low & R.low } var a = e[0], E = f[c]; a.high ^= E.high, a.low ^= E.low } }, _doFinalize: function () { var t = this._data, e = t.words, i = (8 * this._nDataBytes, 8 * t.sigBytes), o = 32 * this.blockSize; e[i >>> 5] |= 1 << 24 - i % 32, e[(r.ceil((i + 1) / o) * o >>> 5) - 1] |= 128, t.sigBytes = 4 * e.length, this._process(); for (var s = this._state, a = this.cfg.outputLength / 8, c = a / 8, h = [], l = 0; l < c; l++) { var f = s[l], u = f.high, d = f.low; u = 16711935 & (u << 8 | u >>> 24) | 4278255360 & (u << 24 | u >>> 8), d = 16711935 & (d << 8 | d >>> 24) | 4278255360 & (d << 24 | d >>> 8), h.push(d), h.push(u) } return new n.init(h, a) }, clone: function () { for (var t = o.clone.call(this), r = t._state = this._state.slice(0), e = 0; e < 25; e++)r[e] = r[e].clone(); return t } }); e.SHA3 = o._createHelper(d), e.HmacSHA3 = o._createHmacHelper(d) }(Math), function () { function r() { return s.create.apply(s, arguments) } var e = t, i = e.lib, n = i.Hasher, o = e.x64, s = o.Word, a = o.WordArray, c = e.algo, h = [r(1116352408, 3609767458), r(1899447441, 602891725), r(3049323471, 3964484399), r(3921009573, 2173295548), r(961987163, 4081628472), r(1508970993, 3053834265), r(2453635748, 2937671579), r(2870763221, 3664609560), r(3624381080, 2734883394), r(310598401, 1164996542), r(607225278, 1323610764), r(1426881987, 3590304994), r(1925078388, 4068182383), r(2162078206, 991336113), r(2614888103, 633803317), r(3248222580, 3479774868), r(3835390401, 2666613458), r(4022224774, 944711139), r(264347078, 2341262773), r(604807628, 2007800933), r(770255983, 1495990901), r(1249150122, 1856431235), r(1555081692, 3175218132), r(1996064986, 2198950837), r(2554220882, 3999719339), r(2821834349, 766784016), r(2952996808, 2566594879), r(3210313671, 3203337956), r(3336571891, 1034457026), r(3584528711, 2466948901), r(113926993, 3758326383), r(338241895, 168717936), r(666307205, 1188179964), r(773529912, 1546045734), r(1294757372, 1522805485), r(1396182291, 2643833823), r(1695183700, 2343527390), r(1986661051, 1014477480), r(2177026350, 1206759142), r(2456956037, 344077627), r(2730485921, 1290863460), r(2820302411, 3158454273), r(3259730800, 3505952657), r(3345764771, 106217008), r(3516065817, 3606008344), r(3600352804, 1432725776), r(4094571909, 1467031594), r(275423344, 851169720), r(430227734, 3100823752), r(506948616, 1363258195), r(659060556, 3750685593), r(883997877, 3785050280), r(958139571, 3318307427), r(1322822218, 3812723403), r(1537002063, 2003034995), r(1747873779, 3602036899), r(1955562222, 1575990012), r(2024104815, 1125592928), r(2227730452, 2716904306), r(2361852424, 442776044), r(2428436474, 593698344), r(2756734187, 3733110249), r(3204031479, 2999351573), r(3329325298, 3815920427), r(3391569614, 3928383900), r(3515267271, 566280711), r(3940187606, 3454069534), r(4118630271, 4000239992), r(116418474, 1914138554), r(174292421, 2731055270), r(289380356, 3203993006), r(460393269, 320620315), r(685471733, 587496836), r(852142971, 1086792851), r(1017036298, 365543100), r(1126000580, 2618297676), r(1288033470, 3409855158), r(1501505948, 4234509866), r(1607167915, 987167468), r(1816402316, 1246189591)], l = []; !function () { for (var t = 0; t < 80; t++)l[t] = r() }(); var f = c.SHA512 = n.extend({ _doReset: function () { this._hash = new a.init([new s.init(1779033703, 4089235720), new s.init(3144134277, 2227873595), new s.init(1013904242, 4271175723), new s.init(2773480762, 1595750129), new s.init(1359893119, 2917565137), new s.init(2600822924, 725511199), new s.init(528734635, 4215389547), new s.init(1541459225, 327033209)]) }, _doProcessBlock: function (t, r) { for (var e = this._hash.words, i = e[0], n = e[1], o = e[2], s = e[3], a = e[4], c = e[5], f = e[6], u = e[7], d = i.high, v = i.low, p = n.high, _ = n.low, y = o.high, g = o.low, B = s.high, w = s.low, k = a.high, S = a.low, m = c.high, x = c.low, b = f.high, H = f.low, z = u.high, A = u.low, C = d, D = v, R = p, E = _, M = y, F = g, P = B, W = w, O = k, U = S, I = m, K = x, X = b, L = H, j = z, N = A, T = 0; T < 80; T++) { var Z = l[T]; if (T < 16) var q = Z.high = 0 | t[r + 2 * T], G = Z.low = 0 | t[r + 2 * T + 1]; else { var J = l[T - 15], $ = J.high, Q = J.low, V = ($ >>> 1 | Q << 31) ^ ($ >>> 8 | Q << 24) ^ $ >>> 7, Y = (Q >>> 1 | $ << 31) ^ (Q >>> 8 | $ << 24) ^ (Q >>> 7 | $ << 25), tt = l[T - 2], rt = tt.high, et = tt.low, it = (rt >>> 19 | et << 13) ^ (rt << 3 | et >>> 29) ^ rt >>> 6, nt = (et >>> 19 | rt << 13) ^ (et << 3 | rt >>> 29) ^ (et >>> 6 | rt << 26), ot = l[T - 7], st = ot.high, at = ot.low, ct = l[T - 16], ht = ct.high, lt = ct.low, G = Y + at, q = V + st + (G >>> 0 < Y >>> 0 ? 1 : 0), G = G + nt, q = q + it + (G >>> 0 < nt >>> 0 ? 1 : 0), G = G + lt, q = q + ht + (G >>> 0 < lt >>> 0 ? 1 : 0); Z.high = q, Z.low = G } var ft = O & I ^ ~O & X, ut = U & K ^ ~U & L, dt = C & R ^ C & M ^ R & M, vt = D & E ^ D & F ^ E & F, pt = (C >>> 28 | D << 4) ^ (C << 30 | D >>> 2) ^ (C << 25 | D >>> 7), _t = (D >>> 28 | C << 4) ^ (D << 30 | C >>> 2) ^ (D << 25 | C >>> 7), yt = (O >>> 14 | U << 18) ^ (O >>> 18 | U << 14) ^ (O << 23 | U >>> 9), gt = (U >>> 14 | O << 18) ^ (U >>> 18 | O << 14) ^ (U << 23 | O >>> 9), Bt = h[T], wt = Bt.high, kt = Bt.low, St = N + gt, mt = j + yt + (St >>> 0 < N >>> 0 ? 1 : 0), St = St + ut, mt = mt + ft + (St >>> 0 < ut >>> 0 ? 1 : 0), St = St + kt, mt = mt + wt + (St >>> 0 < kt >>> 0 ? 1 : 0), St = St + G, mt = mt + q + (St >>> 0 < G >>> 0 ? 1 : 0), xt = _t + vt, bt = pt + dt + (xt >>> 0 < _t >>> 0 ? 1 : 0); j = X, N = L, X = I, L = K, I = O, K = U, U = W + St | 0, O = P + mt + (U >>> 0 < W >>> 0 ? 1 : 0) | 0, P = M, W = F, M = R, F = E, R = C, E = D, D = St + xt | 0, C = mt + bt + (D >>> 0 < St >>> 0 ? 1 : 0) | 0 } v = i.low = v + D, i.high = d + C + (v >>> 0 < D >>> 0 ? 1 : 0), _ = n.low = _ + E, n.high = p + R + (_ >>> 0 < E >>> 0 ? 1 : 0), g = o.low = g + F, o.high = y + M + (g >>> 0 < F >>> 0 ? 1 : 0), w = s.low = w + W, s.high = B + P + (w >>> 0 < W >>> 0 ? 1 : 0), S = a.low = S + U, a.high = k + O + (S >>> 0 < U >>> 0 ? 1 : 0), x = c.low = x + K, c.high = m + I + (x >>> 0 < K >>> 0 ? 1 : 0), H = f.low = H + L, f.high = b + X + (H >>> 0 < L >>> 0 ? 1 : 0), A = u.low = A + N, u.high = z + j + (A >>> 0 < N >>> 0 ? 1 : 0) }, _doFinalize: function () { var t = this._data, r = t.words, e = 8 * this._nDataBytes, i = 8 * t.sigBytes; r[i >>> 5] |= 128 << 24 - i % 32, r[(i + 128 >>> 10 << 5) + 30] = Math.floor(e / 4294967296), r[(i + 128 >>> 10 << 5) + 31] = e, t.sigBytes = 4 * r.length, this._process(); var n = this._hash.toX32(); return n }, clone: function () { var t = n.clone.call(this); return t._hash = this._hash.clone(), t }, blockSize: 32 }); e.SHA512 = n._createHelper(f), e.HmacSHA512 = n._createHmacHelper(f) }(), function () { var r = t, e = r.x64, i = e.Word, n = e.WordArray, o = r.algo, s = o.SHA512, a = o.SHA384 = s.extend({ _doReset: function () { this._hash = new n.init([new i.init(3418070365, 3238371032), new i.init(1654270250, 914150663), new i.init(2438529370, 812702999), new i.init(355462360, 4144912697), new i.init(1731405415, 4290775857), new i.init(2394180231, 1750603025), new i.init(3675008525, 1694076839), new i.init(1203062813, 3204075428)]) }, _doFinalize: function () { var t = s._doFinalize.call(this); return t.sigBytes -= 16, t } }); r.SHA384 = s._createHelper(a), r.HmacSHA384 = s._createHmacHelper(a) }(), t.lib.Cipher || function (r) { var e = t, i = e.lib, n = i.Base, o = i.WordArray, s = i.BufferedBlockAlgorithm, a = e.enc, c = (a.Utf8, a.Base64), h = e.algo, l = h.EvpKDF, f = i.Cipher = s.extend({ cfg: n.extend(), createEncryptor: function (t, r) { return this.create(this._ENC_XFORM_MODE, t, r) }, createDecryptor: function (t, r) { return this.create(this._DEC_XFORM_MODE, t, r) }, init: function (t, r, e) { this.cfg = this.cfg.extend(e), this._xformMode = t, this._key = r, this.reset() }, reset: function () { s.reset.call(this), this._doReset() }, process: function (t) { return this._append(t), this._process() }, finalize: function (t) { t && this._append(t); var r = this._doFinalize(); return r }, keySize: 4, ivSize: 4, _ENC_XFORM_MODE: 1, _DEC_XFORM_MODE: 2, _createHelper: function () { function t(t) { return "string" == typeof t ? m : w } return function (r) { return { encrypt: function (e, i, n) { return t(i).encrypt(r, e, i, n) }, decrypt: function (e, i, n) { return t(i).decrypt(r, e, i, n) } } } }() }), u = (i.StreamCipher = f.extend({ _doFinalize: function () { var t = this._process(!0); return t }, blockSize: 1 }), e.mode = {}), d = i.BlockCipherMode = n.extend({ createEncryptor: function (t, r) { return this.Encryptor.create(t, r) }, createDecryptor: function (t, r) { return this.Decryptor.create(t, r) }, init: function (t, r) { this._cipher = t, this._iv = r } }), v = u.CBC = function () { function t(t, e, i) { var n = this._iv; if (n) { var o = n; this._iv = r } else var o = this._prevBlock; for (var s = 0; s < i; s++)t[e + s] ^= o[s] } var e = d.extend(); return e.Encryptor = e.extend({ processBlock: function (r, e) { var i = this._cipher, n = i.blockSize; t.call(this, r, e, n), i.encryptBlock(r, e), this._prevBlock = r.slice(e, e + n) } }), e.Decryptor = e.extend({ processBlock: function (r, e) { var i = this._cipher, n = i.blockSize, o = r.slice(e, e + n); i.decryptBlock(r, e), t.call(this, r, e, n), this._prevBlock = o } }), e }(), p = e.pad = {}, _ = p.Pkcs7 = { pad: function (t, r) { for (var e = 4 * r, i = e - t.sigBytes % e, n = i << 24 | i << 16 | i << 8 | i, s = [], a = 0; a < i; a += 4)s.push(n); var c = o.create(s, i); t.concat(c) }, unpad: function (t) { var r = 255 & t.words[t.sigBytes - 1 >>> 2]; t.sigBytes -= r } }, y = (i.BlockCipher = f.extend({ cfg: f.cfg.extend({ mode: v, padding: _ }), reset: function () { f.reset.call(this); var t = this.cfg, r = t.iv, e = t.mode; if (this._xformMode == this._ENC_XFORM_MODE) var i = e.createEncryptor; else { var i = e.createDecryptor; this._minBufferSize = 1 } this._mode && this._mode.__creator == i ? this._mode.init(this, r && r.words) : (this._mode = i.call(e, this, r && r.words), this._mode.__creator = i) }, _doProcessBlock: function (t, r) { this._mode.processBlock(t, r) }, _doFinalize: function () { var t = this.cfg.padding; if (this._xformMode == this._ENC_XFORM_MODE) { t.pad(this._data, this.blockSize); var r = this._process(!0) } else { var r = this._process(!0); t.unpad(r) } return r }, blockSize: 4 }), i.CipherParams = n.extend({ init: function (t) { this.mixIn(t) }, toString: function (t) { return (t || this.formatter).stringify(this) } })), g = e.format = {}, B = g.OpenSSL = { stringify: function (t) { var r = t.ciphertext, e = t.salt; if (e) var i = o.create([1398893684, 1701076831]).concat(e).concat(r); else var i = r; return i.toString(c) }, parse: function (t) { var r = c.parse(t), e = r.words; if (1398893684 == e[0] && 1701076831 == e[1]) { var i = o.create(e.slice(2, 4)); e.splice(0, 4), r.sigBytes -= 16 } return y.create({ ciphertext: r, salt: i }) } }, w = i.SerializableCipher = n.extend({ cfg: n.extend({ format: B }), encrypt: function (t, r, e, i) { i = this.cfg.extend(i); var n = t.createEncryptor(e, i), o = n.finalize(r), s = n.cfg; return y.create({ ciphertext: o, key: e, iv: s.iv, algorithm: t, mode: s.mode, padding: s.padding, blockSize: t.blockSize, formatter: i.format }) }, decrypt: function (t, r, e, i) { i = this.cfg.extend(i), r = this._parse(r, i.format); var n = t.createDecryptor(e, i).finalize(r.ciphertext); return n }, _parse: function (t, r) { return "string" == typeof t ? r.parse(t, this) : t } }), k = e.kdf = {}, S = k.OpenSSL = { execute: function (t, r, e, i) { i || (i = o.random(8)); var n = l.create({ keySize: r + e }).compute(t, i), s = o.create(n.words.slice(r), 4 * e); return n.sigBytes = 4 * r, y.create({ key: n, iv: s, salt: i }) } }, m = i.PasswordBasedCipher = w.extend({ cfg: w.cfg.extend({ kdf: S }), encrypt: function (t, r, e, i) { i = this.cfg.extend(i); var n = i.kdf.execute(e, t.keySize, t.ivSize); i.iv = n.iv; var o = w.encrypt.call(this, t, r, n.key, i); return o.mixIn(n), o }, decrypt: function (t, r, e, i) { i = this.cfg.extend(i), r = this._parse(r, i.format); var n = i.kdf.execute(e, t.keySize, t.ivSize, r.salt); i.iv = n.iv; var o = w.decrypt.call(this, t, r, n.key, i); return o } }) }(), t.mode.CFB = function () { function r(t, r, e, i) { var n = this._iv; if (n) { var o = n.slice(0); this._iv = void 0 } else var o = this._prevBlock; i.encryptBlock(o, 0); for (var s = 0; s < e; s++)t[r + s] ^= o[s] } var e = t.lib.BlockCipherMode.extend(); return e.Encryptor = e.extend({ processBlock: function (t, e) { var i = this._cipher, n = i.blockSize; r.call(this, t, e, n, i), this._prevBlock = t.slice(e, e + n) } }), e.Decryptor = e.extend({ processBlock: function (t, e) { var i = this._cipher, n = i.blockSize, o = t.slice(e, e + n); r.call(this, t, e, n, i), this._prevBlock = o } }), e }(), t.mode.ECB = function () { var r = t.lib.BlockCipherMode.extend(); return r.Encryptor = r.extend({ processBlock: function (t, r) { this._cipher.encryptBlock(t, r) } }), r.Decryptor = r.extend({ processBlock: function (t, r) { this._cipher.decryptBlock(t, r) } }), r }(), t.pad.AnsiX923 = { pad: function (t, r) { var e = t.sigBytes, i = 4 * r, n = i - e % i, o = e + n - 1; t.clamp(), t.words[o >>> 2] |= n << 24 - o % 4 * 8, t.sigBytes += n }, unpad: function (t) { var r = 255 & t.words[t.sigBytes - 1 >>> 2]; t.sigBytes -= r } }, t.pad.Iso10126 = { pad: function (r, e) { var i = 4 * e, n = i - r.sigBytes % i; r.concat(t.lib.WordArray.random(n - 1)).concat(t.lib.WordArray.create([n << 24], 1)) }, unpad: function (t) { var r = 255 & t.words[t.sigBytes - 1 >>> 2]; t.sigBytes -= r } }, t.pad.Iso97971 = { pad: function (r, e) { r.concat(t.lib.WordArray.create([2147483648], 1)), t.pad.ZeroPadding.pad(r, e) }, unpad: function (r) { t.pad.ZeroPadding.unpad(r), r.sigBytes-- } }, t.mode.OFB = function () { var r = t.lib.BlockCipherMode.extend(), e = r.Encryptor = r.extend({ processBlock: function (t, r) { var e = this._cipher, i = e.blockSize, n = this._iv, o = this._keystream; n && (o = this._keystream = n.slice(0), this._iv = void 0), e.encryptBlock(o, 0); for (var s = 0; s < i; s++)t[r + s] ^= o[s] } }); return r.Decryptor = e, r }(), t.pad.NoPadding = { pad: function () { }, unpad: function () { } }, function (r) { var e = t, i = e.lib, n = i.CipherParams, o = e.enc, s = o.Hex, a = e.format; a.Hex = { stringify: function (t) { return t.ciphertext.toString(s) }, parse: function (t) { var r = s.parse(t); return n.create({ ciphertext: r }) } } }(), function () { var r = t, e = r.lib, i = e.BlockCipher, n = r.algo, o = [], s = [], a = [], c = [], h = [], l = [], f = [], u = [], d = [], v = []; !function () { for (var t = [], r = 0; r < 256; r++)r < 128 ? t[r] = r << 1 : t[r] = r << 1 ^ 283; for (var e = 0, i = 0, r = 0; r < 256; r++) { var n = i ^ i << 1 ^ i << 2 ^ i << 3 ^ i << 4; n = n >>> 8 ^ 255 & n ^ 99, o[e] = n, s[n] = e; var p = t[e], _ = t[p], y = t[_], g = 257 * t[n] ^ 16843008 * n; a[e] = g << 24 | g >>> 8, c[e] = g << 16 | g >>> 16, h[e] = g << 8 | g >>> 24, l[e] = g; var g = 16843009 * y ^ 65537 * _ ^ 257 * p ^ 16843008 * e; f[n] = g << 24 | g >>> 8, u[n] = g << 16 | g >>> 16, d[n] = g << 8 | g >>> 24, v[n] = g, e ? (e = p ^ t[t[t[y ^ p]]], i ^= t[t[i]]) : e = i = 1 } }(); var p = [0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54], _ = n.AES = i.extend({ _doReset: function () { if (!this._nRounds || this._keyPriorReset !== this._key) { for (var t = this._keyPriorReset = this._key, r = t.words, e = t.sigBytes / 4, i = this._nRounds = e + 6, n = 4 * (i + 1), s = this._keySchedule = [], a = 0; a < n; a++)if (a < e) s[a] = r[a]; else { var c = s[a - 1]; a % e ? e > 6 && a % e == 4 && (c = o[c >>> 24] << 24 | o[c >>> 16 & 255] << 16 | o[c >>> 8 & 255] << 8 | o[255 & c]) : (c = c << 8 | c >>> 24, c = o[c >>> 24] << 24 | o[c >>> 16 & 255] << 16 | o[c >>> 8 & 255] << 8 | o[255 & c], c ^= p[a / e | 0] << 24), s[a] = s[a - e] ^ c } for (var h = this._invKeySchedule = [], l = 0; l < n; l++) { var a = n - l; if (l % 4) var c = s[a]; else var c = s[a - 4]; l < 4 || a <= 4 ? h[l] = c : h[l] = f[o[c >>> 24]] ^ u[o[c >>> 16 & 255]] ^ d[o[c >>> 8 & 255]] ^ v[o[255 & c]] } } }, encryptBlock: function (t, r) { this._doCryptBlock(t, r, this._keySchedule, a, c, h, l, o) }, decryptBlock: function (t, r) { var e = t[r + 1]; t[r + 1] = t[r + 3], t[r + 3] = e, this._doCryptBlock(t, r, this._invKeySchedule, f, u, d, v, s); var e = t[r + 1]; t[r + 1] = t[r + 3], t[r + 3] = e }, _doCryptBlock: function (t, r, e, i, n, o, s, a) { for (var c = this._nRounds, h = t[r] ^ e[0], l = t[r + 1] ^ e[1], f = t[r + 2] ^ e[2], u = t[r + 3] ^ e[3], d = 4, v = 1; v < c; v++) { var p = i[h >>> 24] ^ n[l >>> 16 & 255] ^ o[f >>> 8 & 255] ^ s[255 & u] ^ e[d++], _ = i[l >>> 24] ^ n[f >>> 16 & 255] ^ o[u >>> 8 & 255] ^ s[255 & h] ^ e[d++], y = i[f >>> 24] ^ n[u >>> 16 & 255] ^ o[h >>> 8 & 255] ^ s[255 & l] ^ e[d++], g = i[u >>> 24] ^ n[h >>> 16 & 255] ^ o[l >>> 8 & 255] ^ s[255 & f] ^ e[d++]; h = p, l = _, f = y, u = g } var p = (a[h >>> 24] << 24 | a[l >>> 16 & 255] << 16 | a[f >>> 8 & 255] << 8 | a[255 & u]) ^ e[d++], _ = (a[l >>> 24] << 24 | a[f >>> 16 & 255] << 16 | a[u >>> 8 & 255] << 8 | a[255 & h]) ^ e[d++], y = (a[f >>> 24] << 24 | a[u >>> 16 & 255] << 16 | a[h >>> 8 & 255] << 8 | a[255 & l]) ^ e[d++], g = (a[u >>> 24] << 24 | a[h >>> 16 & 255] << 16 | a[l >>> 8 & 255] << 8 | a[255 & f]) ^ e[d++]; t[r] = p, t[r + 1] = _, t[r + 2] = y, t[r + 3] = g }, keySize: 8 }); r.AES = i._createHelper(_) }(), function () {
+ function r(t, r) { var e = (this._lBlock >>> t ^ this._rBlock) & r; this._rBlock ^= e, this._lBlock ^= e << t } function e(t, r) {
+ var e = (this._rBlock >>> t ^ this._lBlock) & r; this._lBlock ^= e, this._rBlock ^= e << t;
+ } var i = t, n = i.lib, o = n.WordArray, s = n.BlockCipher, a = i.algo, c = [57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36, 63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4], h = [14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10, 23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2, 41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48, 44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32], l = [1, 2, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 28], f = [{ 0: 8421888, 268435456: 32768, 536870912: 8421378, 805306368: 2, 1073741824: 512, 1342177280: 8421890, 1610612736: 8389122, 1879048192: 8388608, 2147483648: 514, 2415919104: 8389120, 2684354560: 33280, 2952790016: 8421376, 3221225472: 32770, 3489660928: 8388610, 3758096384: 0, 4026531840: 33282, 134217728: 0, 402653184: 8421890, 671088640: 33282, 939524096: 32768, 1207959552: 8421888, 1476395008: 512, 1744830464: 8421378, 2013265920: 2, 2281701376: 8389120, 2550136832: 33280, 2818572288: 8421376, 3087007744: 8389122, 3355443200: 8388610, 3623878656: 32770, 3892314112: 514, 4160749568: 8388608, 1: 32768, 268435457: 2, 536870913: 8421888, 805306369: 8388608, 1073741825: 8421378, 1342177281: 33280, 1610612737: 512, 1879048193: 8389122, 2147483649: 8421890, 2415919105: 8421376, 2684354561: 8388610, 2952790017: 33282, 3221225473: 514, 3489660929: 8389120, 3758096385: 32770, 4026531841: 0, 134217729: 8421890, 402653185: 8421376, 671088641: 8388608, 939524097: 512, 1207959553: 32768, 1476395009: 8388610, 1744830465: 2, 2013265921: 33282, 2281701377: 32770, 2550136833: 8389122, 2818572289: 514, 3087007745: 8421888, 3355443201: 8389120, 3623878657: 0, 3892314113: 33280, 4160749569: 8421378 }, { 0: 1074282512, 16777216: 16384, 33554432: 524288, 50331648: 1074266128, 67108864: 1073741840, 83886080: 1074282496, 100663296: 1073758208, 117440512: 16, 134217728: 540672, 150994944: 1073758224, 167772160: 1073741824, 184549376: 540688, 201326592: 524304, 218103808: 0, 234881024: 16400, 251658240: 1074266112, 8388608: 1073758208, 25165824: 540688, 41943040: 16, 58720256: 1073758224, 75497472: 1074282512, 92274688: 1073741824, 109051904: 524288, 125829120: 1074266128, 142606336: 524304, 159383552: 0, 176160768: 16384, 192937984: 1074266112, 209715200: 1073741840, 226492416: 540672, 243269632: 1074282496, 260046848: 16400, 268435456: 0, 285212672: 1074266128, 301989888: 1073758224, 318767104: 1074282496, 335544320: 1074266112, 352321536: 16, 369098752: 540688, 385875968: 16384, 402653184: 16400, 419430400: 524288, 436207616: 524304, 452984832: 1073741840, 469762048: 540672, 486539264: 1073758208, 503316480: 1073741824, 520093696: 1074282512, 276824064: 540688, 293601280: 524288, 310378496: 1074266112, 327155712: 16384, 343932928: 1073758208, 360710144: 1074282512, 377487360: 16, 394264576: 1073741824, 411041792: 1074282496, 427819008: 1073741840, 444596224: 1073758224, 461373440: 524304, 478150656: 0, 494927872: 16400, 511705088: 1074266128, 528482304: 540672 }, { 0: 260, 1048576: 0, 2097152: 67109120, 3145728: 65796, 4194304: 65540, 5242880: 67108868, 6291456: 67174660, 7340032: 67174400, 8388608: 67108864, 9437184: 67174656, 10485760: 65792, 11534336: 67174404, 12582912: 67109124, 13631488: 65536, 14680064: 4, 15728640: 256, 524288: 67174656, 1572864: 67174404, 2621440: 0, 3670016: 67109120, 4718592: 67108868, 5767168: 65536, 6815744: 65540, 7864320: 260, 8912896: 4, 9961472: 256, 11010048: 67174400, 12058624: 65796, 13107200: 65792, 14155776: 67109124, 15204352: 67174660, 16252928: 67108864, 16777216: 67174656, 17825792: 65540, 18874368: 65536, 19922944: 67109120, 20971520: 256, 22020096: 67174660, 23068672: 67108868, 24117248: 0, 25165824: 67109124, 26214400: 67108864, 27262976: 4, 28311552: 65792, 29360128: 67174400, 30408704: 260, 31457280: 65796, 32505856: 67174404, 17301504: 67108864, 18350080: 260, 19398656: 67174656, 20447232: 0, 21495808: 65540, 22544384: 67109120, 23592960: 256, 24641536: 67174404, 25690112: 65536, 26738688: 67174660, 27787264: 65796, 28835840: 67108868, 29884416: 67109124, 30932992: 67174400, 31981568: 4, 33030144: 65792 }, { 0: 2151682048, 65536: 2147487808, 131072: 4198464, 196608: 2151677952, 262144: 0, 327680: 4198400, 393216: 2147483712, 458752: 4194368, 524288: 2147483648, 589824: 4194304, 655360: 64, 720896: 2147487744, 786432: 2151678016, 851968: 4160, 917504: 4096, 983040: 2151682112, 32768: 2147487808, 98304: 64, 163840: 2151678016, 229376: 2147487744, 294912: 4198400, 360448: 2151682112, 425984: 0, 491520: 2151677952, 557056: 4096, 622592: 2151682048, 688128: 4194304, 753664: 4160, 819200: 2147483648, 884736: 4194368, 950272: 4198464, 1015808: 2147483712, 1048576: 4194368, 1114112: 4198400, 1179648: 2147483712, 1245184: 0, 1310720: 4160, 1376256: 2151678016, 1441792: 2151682048, 1507328: 2147487808, 1572864: 2151682112, 1638400: 2147483648, 1703936: 2151677952, 1769472: 4198464, 1835008: 2147487744, 1900544: 4194304, 1966080: 64, 2031616: 4096, 1081344: 2151677952, 1146880: 2151682112, 1212416: 0, 1277952: 4198400, 1343488: 4194368, 1409024: 2147483648, 1474560: 2147487808, 1540096: 64, 1605632: 2147483712, 1671168: 4096, 1736704: 2147487744, 1802240: 2151678016, 1867776: 4160, 1933312: 2151682048, 1998848: 4194304, 2064384: 4198464 }, { 0: 128, 4096: 17039360, 8192: 262144, 12288: 536870912, 16384: 537133184, 20480: 16777344, 24576: 553648256, 28672: 262272, 32768: 16777216, 36864: 537133056, 40960: 536871040, 45056: 553910400, 49152: 553910272, 53248: 0, 57344: 17039488, 61440: 553648128, 2048: 17039488, 6144: 553648256, 10240: 128, 14336: 17039360, 18432: 262144, 22528: 537133184, 26624: 553910272, 30720: 536870912, 34816: 537133056, 38912: 0, 43008: 553910400, 47104: 16777344, 51200: 536871040, 55296: 553648128, 59392: 16777216, 63488: 262272, 65536: 262144, 69632: 128, 73728: 536870912, 77824: 553648256, 81920: 16777344, 86016: 553910272, 90112: 537133184, 94208: 16777216, 98304: 553910400, 102400: 553648128, 106496: 17039360, 110592: 537133056, 114688: 262272, 118784: 536871040, 122880: 0, 126976: 17039488, 67584: 553648256, 71680: 16777216, 75776: 17039360, 79872: 537133184, 83968: 536870912, 88064: 17039488, 92160: 128, 96256: 553910272, 100352: 262272, 104448: 553910400, 108544: 0, 112640: 553648128, 116736: 16777344, 120832: 262144, 124928: 537133056, 129024: 536871040 }, { 0: 268435464, 256: 8192, 512: 270532608, 768: 270540808, 1024: 268443648, 1280: 2097152, 1536: 2097160, 1792: 268435456, 2048: 0, 2304: 268443656, 2560: 2105344, 2816: 8, 3072: 270532616, 3328: 2105352, 3584: 8200, 3840: 270540800, 128: 270532608, 384: 270540808, 640: 8, 896: 2097152, 1152: 2105352, 1408: 268435464, 1664: 268443648, 1920: 8200, 2176: 2097160, 2432: 8192, 2688: 268443656, 2944: 270532616, 3200: 0, 3456: 270540800, 3712: 2105344, 3968: 268435456, 4096: 268443648, 4352: 270532616, 4608: 270540808, 4864: 8200, 5120: 2097152, 5376: 268435456, 5632: 268435464, 5888: 2105344, 6144: 2105352, 6400: 0, 6656: 8, 6912: 270532608, 7168: 8192, 7424: 268443656, 7680: 270540800, 7936: 2097160, 4224: 8, 4480: 2105344, 4736: 2097152, 4992: 268435464, 5248: 268443648, 5504: 8200, 5760: 270540808, 6016: 270532608, 6272: 270540800, 6528: 270532616, 6784: 8192, 7040: 2105352, 7296: 2097160, 7552: 0, 7808: 268435456, 8064: 268443656 }, { 0: 1048576, 16: 33555457, 32: 1024, 48: 1049601, 64: 34604033, 80: 0, 96: 1, 112: 34603009, 128: 33555456, 144: 1048577, 160: 33554433, 176: 34604032, 192: 34603008, 208: 1025, 224: 1049600, 240: 33554432, 8: 34603009, 24: 0, 40: 33555457, 56: 34604032, 72: 1048576, 88: 33554433, 104: 33554432, 120: 1025, 136: 1049601, 152: 33555456, 168: 34603008, 184: 1048577, 200: 1024, 216: 34604033, 232: 1, 248: 1049600, 256: 33554432, 272: 1048576, 288: 33555457, 304: 34603009, 320: 1048577, 336: 33555456, 352: 34604032, 368: 1049601, 384: 1025, 400: 34604033, 416: 1049600, 432: 1, 448: 0, 464: 34603008, 480: 33554433, 496: 1024, 264: 1049600, 280: 33555457, 296: 34603009, 312: 1, 328: 33554432, 344: 1048576, 360: 1025, 376: 34604032, 392: 33554433, 408: 34603008, 424: 0, 440: 34604033, 456: 1049601, 472: 1024, 488: 33555456, 504: 1048577 }, { 0: 134219808, 1: 131072, 2: 134217728, 3: 32, 4: 131104, 5: 134350880, 6: 134350848, 7: 2048, 8: 134348800, 9: 134219776, 10: 133120, 11: 134348832, 12: 2080, 13: 0, 14: 134217760, 15: 133152, 2147483648: 2048, 2147483649: 134350880, 2147483650: 134219808, 2147483651: 134217728, 2147483652: 134348800, 2147483653: 133120, 2147483654: 133152, 2147483655: 32, 2147483656: 134217760, 2147483657: 2080, 2147483658: 131104, 2147483659: 134350848, 2147483660: 0, 2147483661: 134348832, 2147483662: 134219776, 2147483663: 131072, 16: 133152, 17: 134350848, 18: 32, 19: 2048, 20: 134219776, 21: 134217760, 22: 134348832, 23: 131072, 24: 0, 25: 131104, 26: 134348800, 27: 134219808, 28: 134350880, 29: 133120, 30: 2080, 31: 134217728, 2147483664: 131072, 2147483665: 2048, 2147483666: 134348832, 2147483667: 133152, 2147483668: 32, 2147483669: 134348800, 2147483670: 134217728, 2147483671: 134219808, 2147483672: 134350880, 2147483673: 134217760, 2147483674: 134219776, 2147483675: 0, 2147483676: 133120, 2147483677: 2080, 2147483678: 131104, 2147483679: 134350848 }], u = [4160749569, 528482304, 33030144, 2064384, 129024, 8064, 504, 2147483679], d = a.DES = s.extend({ _doReset: function () { for (var t = this._key, r = t.words, e = [], i = 0; i < 56; i++) { var n = c[i] - 1; e[i] = r[n >>> 5] >>> 31 - n % 32 & 1 } for (var o = this._subKeys = [], s = 0; s < 16; s++) { for (var a = o[s] = [], f = l[s], i = 0; i < 24; i++)a[i / 6 | 0] |= e[(h[i] - 1 + f) % 28] << 31 - i % 6, a[4 + (i / 6 | 0)] |= e[28 + (h[i + 24] - 1 + f) % 28] << 31 - i % 6; a[0] = a[0] << 1 | a[0] >>> 31; for (var i = 1; i < 7; i++)a[i] = a[i] >>> 4 * (i - 1) + 3; a[7] = a[7] << 5 | a[7] >>> 27 } for (var u = this._invSubKeys = [], i = 0; i < 16; i++)u[i] = o[15 - i] }, encryptBlock: function (t, r) { this._doCryptBlock(t, r, this._subKeys) }, decryptBlock: function (t, r) { this._doCryptBlock(t, r, this._invSubKeys) }, _doCryptBlock: function (t, i, n) { this._lBlock = t[i], this._rBlock = t[i + 1], r.call(this, 4, 252645135), r.call(this, 16, 65535), e.call(this, 2, 858993459), e.call(this, 8, 16711935), r.call(this, 1, 1431655765); for (var o = 0; o < 16; o++) { for (var s = n[o], a = this._lBlock, c = this._rBlock, h = 0, l = 0; l < 8; l++)h |= f[l][((c ^ s[l]) & u[l]) >>> 0]; this._lBlock = c, this._rBlock = a ^ h } var d = this._lBlock; this._lBlock = this._rBlock, this._rBlock = d, r.call(this, 1, 1431655765), e.call(this, 8, 16711935), e.call(this, 2, 858993459), r.call(this, 16, 65535), r.call(this, 4, 252645135), t[i] = this._lBlock, t[i + 1] = this._rBlock }, keySize: 2, ivSize: 2, blockSize: 2 }); i.DES = s._createHelper(d); var v = a.TripleDES = s.extend({ _doReset: function () { var t = this._key, r = t.words; this._des1 = d.createEncryptor(o.create(r.slice(0, 2))), this._des2 = d.createEncryptor(o.create(r.slice(2, 4))), this._des3 = d.createEncryptor(o.create(r.slice(4, 6))) }, encryptBlock: function (t, r) { this._des1.encryptBlock(t, r), this._des2.decryptBlock(t, r), this._des3.encryptBlock(t, r) }, decryptBlock: function (t, r) { this._des3.decryptBlock(t, r), this._des2.encryptBlock(t, r), this._des1.decryptBlock(t, r) }, keySize: 6, ivSize: 2, blockSize: 2 }); i.TripleDES = s._createHelper(v)
+ }(), function () { function r() { for (var t = this._S, r = this._i, e = this._j, i = 0, n = 0; n < 4; n++) { r = (r + 1) % 256, e = (e + t[r]) % 256; var o = t[r]; t[r] = t[e], t[e] = o, i |= t[(t[r] + t[e]) % 256] << 24 - 8 * n } return this._i = r, this._j = e, i } var e = t, i = e.lib, n = i.StreamCipher, o = e.algo, s = o.RC4 = n.extend({ _doReset: function () { for (var t = this._key, r = t.words, e = t.sigBytes, i = this._S = [], n = 0; n < 256; n++)i[n] = n; for (var n = 0, o = 0; n < 256; n++) { var s = n % e, a = r[s >>> 2] >>> 24 - s % 4 * 8 & 255; o = (o + i[n] + a) % 256; var c = i[n]; i[n] = i[o], i[o] = c } this._i = this._j = 0 }, _doProcessBlock: function (t, e) { t[e] ^= r.call(this) }, keySize: 8, ivSize: 0 }); e.RC4 = n._createHelper(s); var a = o.RC4Drop = s.extend({ cfg: s.cfg.extend({ drop: 192 }), _doReset: function () { s._doReset.call(this); for (var t = this.cfg.drop; t > 0; t--)r.call(this) } }); e.RC4Drop = n._createHelper(a) }(), t.mode.CTRGladman = function () { function r(t) { if (255 === (t >> 24 & 255)) { var r = t >> 16 & 255, e = t >> 8 & 255, i = 255 & t; 255 === r ? (r = 0, 255 === e ? (e = 0, 255 === i ? i = 0 : ++i) : ++e) : ++r, t = 0, t += r << 16, t += e << 8, t += i } else t += 1 << 24; return t } function e(t) { return 0 === (t[0] = r(t[0])) && (t[1] = r(t[1])), t } var i = t.lib.BlockCipherMode.extend(), n = i.Encryptor = i.extend({ processBlock: function (t, r) { var i = this._cipher, n = i.blockSize, o = this._iv, s = this._counter; o && (s = this._counter = o.slice(0), this._iv = void 0), e(s); var a = s.slice(0); i.encryptBlock(a, 0); for (var c = 0; c < n; c++)t[r + c] ^= a[c] } }); return i.Decryptor = n, i }(), function () { function r() { for (var t = this._X, r = this._C, e = 0; e < 8; e++)a[e] = r[e]; r[0] = r[0] + 1295307597 + this._b | 0, r[1] = r[1] + 3545052371 + (r[0] >>> 0 < a[0] >>> 0 ? 1 : 0) | 0, r[2] = r[2] + 886263092 + (r[1] >>> 0 < a[1] >>> 0 ? 1 : 0) | 0, r[3] = r[3] + 1295307597 + (r[2] >>> 0 < a[2] >>> 0 ? 1 : 0) | 0, r[4] = r[4] + 3545052371 + (r[3] >>> 0 < a[3] >>> 0 ? 1 : 0) | 0, r[5] = r[5] + 886263092 + (r[4] >>> 0 < a[4] >>> 0 ? 1 : 0) | 0, r[6] = r[6] + 1295307597 + (r[5] >>> 0 < a[5] >>> 0 ? 1 : 0) | 0, r[7] = r[7] + 3545052371 + (r[6] >>> 0 < a[6] >>> 0 ? 1 : 0) | 0, this._b = r[7] >>> 0 < a[7] >>> 0 ? 1 : 0; for (var e = 0; e < 8; e++) { var i = t[e] + r[e], n = 65535 & i, o = i >>> 16, s = ((n * n >>> 17) + n * o >>> 15) + o * o, h = ((4294901760 & i) * i | 0) + ((65535 & i) * i | 0); c[e] = s ^ h } t[0] = c[0] + (c[7] << 16 | c[7] >>> 16) + (c[6] << 16 | c[6] >>> 16) | 0, t[1] = c[1] + (c[0] << 8 | c[0] >>> 24) + c[7] | 0, t[2] = c[2] + (c[1] << 16 | c[1] >>> 16) + (c[0] << 16 | c[0] >>> 16) | 0, t[3] = c[3] + (c[2] << 8 | c[2] >>> 24) + c[1] | 0, t[4] = c[4] + (c[3] << 16 | c[3] >>> 16) + (c[2] << 16 | c[2] >>> 16) | 0, t[5] = c[5] + (c[4] << 8 | c[4] >>> 24) + c[3] | 0, t[6] = c[6] + (c[5] << 16 | c[5] >>> 16) + (c[4] << 16 | c[4] >>> 16) | 0, t[7] = c[7] + (c[6] << 8 | c[6] >>> 24) + c[5] | 0 } var e = t, i = e.lib, n = i.StreamCipher, o = e.algo, s = [], a = [], c = [], h = o.Rabbit = n.extend({ _doReset: function () { for (var t = this._key.words, e = this.cfg.iv, i = 0; i < 4; i++)t[i] = 16711935 & (t[i] << 8 | t[i] >>> 24) | 4278255360 & (t[i] << 24 | t[i] >>> 8); var n = this._X = [t[0], t[3] << 16 | t[2] >>> 16, t[1], t[0] << 16 | t[3] >>> 16, t[2], t[1] << 16 | t[0] >>> 16, t[3], t[2] << 16 | t[1] >>> 16], o = this._C = [t[2] << 16 | t[2] >>> 16, 4294901760 & t[0] | 65535 & t[1], t[3] << 16 | t[3] >>> 16, 4294901760 & t[1] | 65535 & t[2], t[0] << 16 | t[0] >>> 16, 4294901760 & t[2] | 65535 & t[3], t[1] << 16 | t[1] >>> 16, 4294901760 & t[3] | 65535 & t[0]]; this._b = 0; for (var i = 0; i < 4; i++)r.call(this); for (var i = 0; i < 8; i++)o[i] ^= n[i + 4 & 7]; if (e) { var s = e.words, a = s[0], c = s[1], h = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8), l = 16711935 & (c << 8 | c >>> 24) | 4278255360 & (c << 24 | c >>> 8), f = h >>> 16 | 4294901760 & l, u = l << 16 | 65535 & h; o[0] ^= h, o[1] ^= f, o[2] ^= l, o[3] ^= u, o[4] ^= h, o[5] ^= f, o[6] ^= l, o[7] ^= u; for (var i = 0; i < 4; i++)r.call(this) } }, _doProcessBlock: function (t, e) { var i = this._X; r.call(this), s[0] = i[0] ^ i[5] >>> 16 ^ i[3] << 16, s[1] = i[2] ^ i[7] >>> 16 ^ i[5] << 16, s[2] = i[4] ^ i[1] >>> 16 ^ i[7] << 16, s[3] = i[6] ^ i[3] >>> 16 ^ i[1] << 16; for (var n = 0; n < 4; n++)s[n] = 16711935 & (s[n] << 8 | s[n] >>> 24) | 4278255360 & (s[n] << 24 | s[n] >>> 8), t[e + n] ^= s[n] }, blockSize: 4, ivSize: 2 }); e.Rabbit = n._createHelper(h) }(), t.mode.CTR = function () { var r = t.lib.BlockCipherMode.extend(), e = r.Encryptor = r.extend({ processBlock: function (t, r) { var e = this._cipher, i = e.blockSize, n = this._iv, o = this._counter; n && (o = this._counter = n.slice(0), this._iv = void 0); var s = o.slice(0); e.encryptBlock(s, 0), o[i - 1] = o[i - 1] + 1 | 0; for (var a = 0; a < i; a++)t[r + a] ^= s[a] } }); return r.Decryptor = e, r }(), function () { function r() { for (var t = this._X, r = this._C, e = 0; e < 8; e++)a[e] = r[e]; r[0] = r[0] + 1295307597 + this._b | 0, r[1] = r[1] + 3545052371 + (r[0] >>> 0 < a[0] >>> 0 ? 1 : 0) | 0, r[2] = r[2] + 886263092 + (r[1] >>> 0 < a[1] >>> 0 ? 1 : 0) | 0, r[3] = r[3] + 1295307597 + (r[2] >>> 0 < a[2] >>> 0 ? 1 : 0) | 0, r[4] = r[4] + 3545052371 + (r[3] >>> 0 < a[3] >>> 0 ? 1 : 0) | 0, r[5] = r[5] + 886263092 + (r[4] >>> 0 < a[4] >>> 0 ? 1 : 0) | 0, r[6] = r[6] + 1295307597 + (r[5] >>> 0 < a[5] >>> 0 ? 1 : 0) | 0, r[7] = r[7] + 3545052371 + (r[6] >>> 0 < a[6] >>> 0 ? 1 : 0) | 0, this._b = r[7] >>> 0 < a[7] >>> 0 ? 1 : 0; for (var e = 0; e < 8; e++) { var i = t[e] + r[e], n = 65535 & i, o = i >>> 16, s = ((n * n >>> 17) + n * o >>> 15) + o * o, h = ((4294901760 & i) * i | 0) + ((65535 & i) * i | 0); c[e] = s ^ h } t[0] = c[0] + (c[7] << 16 | c[7] >>> 16) + (c[6] << 16 | c[6] >>> 16) | 0, t[1] = c[1] + (c[0] << 8 | c[0] >>> 24) + c[7] | 0, t[2] = c[2] + (c[1] << 16 | c[1] >>> 16) + (c[0] << 16 | c[0] >>> 16) | 0, t[3] = c[3] + (c[2] << 8 | c[2] >>> 24) + c[1] | 0, t[4] = c[4] + (c[3] << 16 | c[3] >>> 16) + (c[2] << 16 | c[2] >>> 16) | 0, t[5] = c[5] + (c[4] << 8 | c[4] >>> 24) + c[3] | 0, t[6] = c[6] + (c[5] << 16 | c[5] >>> 16) + (c[4] << 16 | c[4] >>> 16) | 0, t[7] = c[7] + (c[6] << 8 | c[6] >>> 24) + c[5] | 0 } var e = t, i = e.lib, n = i.StreamCipher, o = e.algo, s = [], a = [], c = [], h = o.RabbitLegacy = n.extend({ _doReset: function () { var t = this._key.words, e = this.cfg.iv, i = this._X = [t[0], t[3] << 16 | t[2] >>> 16, t[1], t[0] << 16 | t[3] >>> 16, t[2], t[1] << 16 | t[0] >>> 16, t[3], t[2] << 16 | t[1] >>> 16], n = this._C = [t[2] << 16 | t[2] >>> 16, 4294901760 & t[0] | 65535 & t[1], t[3] << 16 | t[3] >>> 16, 4294901760 & t[1] | 65535 & t[2], t[0] << 16 | t[0] >>> 16, 4294901760 & t[2] | 65535 & t[3], t[1] << 16 | t[1] >>> 16, 4294901760 & t[3] | 65535 & t[0]]; this._b = 0; for (var o = 0; o < 4; o++)r.call(this); for (var o = 0; o < 8; o++)n[o] ^= i[o + 4 & 7]; if (e) { var s = e.words, a = s[0], c = s[1], h = 16711935 & (a << 8 | a >>> 24) | 4278255360 & (a << 24 | a >>> 8), l = 16711935 & (c << 8 | c >>> 24) | 4278255360 & (c << 24 | c >>> 8), f = h >>> 16 | 4294901760 & l, u = l << 16 | 65535 & h; n[0] ^= h, n[1] ^= f, n[2] ^= l, n[3] ^= u, n[4] ^= h, n[5] ^= f, n[6] ^= l, n[7] ^= u; for (var o = 0; o < 4; o++)r.call(this) } }, _doProcessBlock: function (t, e) { var i = this._X; r.call(this), s[0] = i[0] ^ i[5] >>> 16 ^ i[3] << 16, s[1] = i[2] ^ i[7] >>> 16 ^ i[5] << 16, s[2] = i[4] ^ i[1] >>> 16 ^ i[7] << 16, s[3] = i[6] ^ i[3] >>> 16 ^ i[1] << 16; for (var n = 0; n < 4; n++)s[n] = 16711935 & (s[n] << 8 | s[n] >>> 24) | 4278255360 & (s[n] << 24 | s[n] >>> 8), t[e + n] ^= s[n] }, blockSize: 4, ivSize: 2 }); e.RabbitLegacy = n._createHelper(h) }(), t.pad.ZeroPadding = { pad: function (t, r) { var e = 4 * r; t.clamp(), t.sigBytes += e - (t.sigBytes % e || e) }, unpad: function (t) { for (var r = t.words, e = t.sigBytes - 1; !(r[e >>> 2] >>> 24 - e % 4 * 8 & 255);)e--; t.sigBytes = e + 1 } }, t
+});
-//我加的函数
-function postToDingTalk(messgae) {
- const dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=18444b555747aad3381bc1d1e3dea72b03158e152a846f818d82a1ca946bd430"
-
- const message1 = "" + messgae
- that.log(messgae)
-
- const body = {
- "msgtype": "markdown",
- "markdown": {
- "title":"动动极速签到",
- "text": message1
- },
- "at": {
- "atMobiles": [],
- "isAtAll": false
- }
- }
-
-
- $.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
- try {
- that.log(resp)
- that.log(data)
- if (err) {
- that.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- $.duckRes = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- },"json")
-}
-
-
-function toDingtalk(urlmain, bodyMain) {
- return {
- url: urlmain,
- body:bodyMain,
- headers: { 'Content-Type': 'application/json;charset=utf-8' },
- timeout: 10000,
- }
-}
-
-function getPic(){
- let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
- let address = "\n\n )
- address = address + code[pos] + ")"
- return address
-}
\ No newline at end of file
+// prettier-ignore
+function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(n,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)}
\ No newline at end of file
diff --git a/src/main/resources/test_spped_red1.js b/src/main/resources/test_spped_red1.js
new file mode 100644
index 0000000..27bde5e
--- /dev/null
+++ b/src/main/resources/test_spped_red1.js
@@ -0,0 +1,526 @@
+/*
+京东极速版红包
+自动提现微信现金
+更新时间:2021-8-2
+活动时间:2021-4-6至2021-5-30
+活动地址:https://prodev.m.jd.com/jdlite/active/31U4T6S4PbcK83HyLPioeCWrD63j/index.html
+活动入口:京东极速版-领红包
+已支持IOS双京东账号,Node.js支持N个京东账号
+脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
+============Quantumultx===============
+[task_local]
+#京东极速版红包
+20 0,22 * * * jd_speed_redpocke.js, tag=京东极速版红包, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
+
+================Loon==============
+[Script]
+cron "20 0,22 * * *" script-path=jd_speed_redpocke.js,tag=京东极速版红包
+
+===============Surge=================
+京东极速版红包 = type=cron,cronexp="20 0,22 * * *",wake-system=1,timeout=3600,script-path=jd_speed_redpocke.js
+
+============小火箭=========
+京东极速版红包 = type=cron,script-path=jd_speed_redpocke.js, cronexpr="20 0,22 * * *", timeout=3600, enable=true
+*/
+const $ = new Env('京东极速版红包');
+const notify = $.isNode() ? require('./sendNotify') : '';
+//Node.js用户请在jdCookie.js处填写京东ck;
+const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
+let cookiesArr = [], cookie = '', message;
+const linkIdArr = ["9wdf1YTT2L59Vr-meKskLA", "7ya6o83WSbNhrbYJqsMfFA"];
+const signLinkId = '9WA12jYGulArzWS7vcrwhw';
+let linkId;
+if ($.isNode()) {
+ Object.keys(jdCookieNode).forEach((item) => {
+ cookiesArr.push(jdCookieNode[item])
+ })
+ if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
+ if (JSON.stringify(process.env).indexOf('GITHUB') > -1) process.exit(0);
+} else {
+ cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
+}
+!(async () => {
+ if (!cookiesArr[0]) {
+ $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
+ return;
+ }
+ for (let i = 0; i < cookiesArr.length; i++) {
+ if (cookiesArr[i]) {
+ console.log(`\n如提示活动火爆,可再执行一次尝试\n`);
+ cookie = cookiesArr[i];
+ $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
+ $.index = i + 1;
+ $.isLogin = true;
+ $.nickName = '';
+ message = '';
+ await TotalBean();
+ console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`);
+ if (!$.isLogin) {
+ $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
+
+ if ($.isNode()) {
+ await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
+ }
+ continue
+ }
+ for (let j = 0; j < linkIdArr.length; j++) {
+ linkId = linkIdArr[j]
+ await jsRedPacket()
+ }
+ }
+ }
+})()
+ .catch((e) => {
+ $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
+ })
+ .finally(() => {
+ $.done();
+ })
+
+async function jsRedPacket() {
+ try {
+ await invite();
+ await sign();//极速版签到提现
+ await reward_query();
+ for (let i = 0; i < 3; ++i) {
+ await redPacket();//开红包
+ await $.wait(2000)
+ }
+ await getPacketList();//领红包提现
+ await signPrizeDetailList();
+ await showMsg()
+ } catch (e) {
+ $.logErr(e)
+ }
+}
+
+function showMsg() {
+ return new Promise(resolve => {
+ if (message) $.msg($.name, '', `京东账号${$.index}${$.nickName}\n${message}`);
+ resolve()
+ })
+}
+async function sign() {
+ return new Promise(resolve => {
+ const body = {"linkId":signLinkId,"serviceName":"dayDaySignGetRedEnvelopeSignService","business":1};
+ const options = {
+ url: `https://api.m.jd.com`,
+ body: `functionId=apSignIn_day&body=${escape(JSON.stringify(body))}&_t=${+new Date()}&appid=activities_platform`,
+ headers: {
+ 'Cookie': cookie,
+ "Host": "api.m.jd.com",
+ 'Origin': 'https://daily-redpacket.jd.com',
+ "Content-Type": "application/x-www-form-urlencoded",
+ "Accept": "*/*",
+ "Connection": "keep-alive",
+ "User-Agent": "jdltapp;iPhone;3.3.2;14.5.1network/wifi;hasUPPay/0;pushNoticeIsOpen/1;lang/zh_CN;model/iPhone13,2;addressid/137923973;hasOCPay/0;appBuild/1047;supportBestPay/0;pv/467.11;apprpd/MyJD_Main;",
+ "Accept-Language": "zh-Hans-CN;q=1, en-CN;q=0.9, zh-Hant-CN;q=0.8",
+ 'Referer': `https://daily-redpacket.jd.com/?activityId=${signLinkId}`,
+ "Accept-Encoding": "gzip, deflate, br"
+ }
+ }
+ $.post(options, async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = $.toObj(data);
+ if (data.code === 0) {
+ if (data.data.retCode === 0) {
+ message += `极速版签到提现:签到成功\n`;
+ console.log(`极速版签到提现:签到成功\n`);
+ } else {
+ console.log(`极速版签到提现:签到失败:${data.data.retMessage}\n`);
+ }
+ } else {
+ console.log(`极速版签到提现:签到异常:${JSON.stringify(data)}\n`);
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function reward_query() {
+ return new Promise(resolve => {
+ $.get(taskGetUrl("spring_reward_query", {
+ "inviter": ["HXZ60he5XxG8XNUF2LSrZg"][Math.floor((Math.random() * 1))],
+ linkId
+ }), async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.code === 0) {
+
+ } else {
+ console.log(data.errMsg)
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+async function redPacket() {
+ return new Promise(resolve => {
+ $.get(taskGetUrl("spring_reward_receive",{"inviter":["HXZ60he5XxG8XNUF2LSrZg"][Math.floor((Math.random() * 1))], linkId}),
+ async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.code === 0) {
+ if (data.data.received.prizeType !== 1) {
+ message += `获得${data.data.received.prizeDesc}\n`
+ console.log(`获得${data.data.received.prizeDesc}`)
+ } else {
+ console.log("获得优惠券")
+ }
+ } else {
+ console.log(data.errMsg)
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+
+function getPacketList() {
+ return new Promise(resolve => {
+ $.get(taskGetUrl("spring_reward_list",{"pageNum":1,"pageSize":100,linkId,"inviter":""}), async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data.code === 0) {
+ for(let item of data.data.items.filter(vo => vo.prizeType===4)){
+ if(item.state===0){
+ console.log(`去提现${item.amount}微信现金`)
+ message += `提现${item.amount}微信现金,`
+ await cashOut(item.id,item.poolBaseId,item.prizeGroupId,item.prizeBaseId)
+ }
+ }
+ } else {
+ console.log(data.errMsg)
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function signPrizeDetailList() {
+ return new Promise(resolve => {
+ const body = {"linkId":signLinkId,"serviceName":"dayDaySignGetRedEnvelopeSignService","business":1,"pageSize":20,"page":1};
+ const options = {
+ url: `https://api.m.jd.com`,
+ body: `functionId=signPrizeDetailList&body=${escape(JSON.stringify(body))}&_t=${+new Date()}&appid=activities_platform`,
+ headers: {
+ 'Cookie': cookie,
+ "Host": "api.m.jd.com",
+ 'Origin': 'https://daily-redpacket.jd.com',
+ "Content-Type": "application/x-www-form-urlencoded",
+ "Accept": "*/*",
+ "Connection": "keep-alive",
+ "User-Agent": "jdltapp;iPhone;3.3.2;14.5.1network/wifi;hasUPPay/0;pushNoticeIsOpen/1;lang/zh_CN;model/iPhone13,2;addressid/137923973;hasOCPay/0;appBuild/1047;supportBestPay/0;pv/467.11;apprpd/MyJD_Main;",
+ "Accept-Language": "zh-Hans-CN;q=1, en-CN;q=0.9, zh-Hant-CN;q=0.8",
+ 'Referer': `https://daily-redpacket.jd.com/?activityId=${signLinkId}`,
+ "Accept-Encoding": "gzip, deflate, br"
+ }
+ }
+ $.post(options, async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = $.toObj(data);
+ if (data.code === 0) {
+ if (data.data.code === 0) {
+ const list = (data.data.prizeDrawBaseVoPageBean.items || []).filter(vo => vo['prizeType'] === 4 && vo['prizeStatus'] === 0);
+ for (let code of list) {
+ console.log(`极速版签到提现,去提现${code['prizeValue']}现金\n`);
+ message += `极速版签到提现,去提现${code['prizeValue']}微信现金,`
+ await apCashWithDraw(code['id'], code['poolBaseId'], code['prizeGroupId'], code['prizeBaseId']);
+ }
+ } else {
+ console.log(`极速版签到查询奖品:失败:${JSON.stringify(data)}\n`);
+ }
+ } else {
+ console.log(`极速版签到查询奖品:异常:${JSON.stringify(data)}\n`);
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function apCashWithDraw(id, poolBaseId, prizeGroupId, prizeBaseId) {
+ return new Promise(resolve => {
+ const body = {
+ "linkId": signLinkId,
+ "businessSource": "DAY_DAY_RED_PACKET_SIGN",
+ "base": {
+ "prizeType": 4,
+ "business": "dayDayRedPacket",
+ "id": id,
+ "poolBaseId": poolBaseId,
+ "prizeGroupId": prizeGroupId,
+ "prizeBaseId": prizeBaseId
+ }
+ }
+ const options = {
+ url: `https://api.m.jd.com`,
+ body: `functionId=apCashWithDraw&body=${escape(JSON.stringify(body))}&_t=${+new Date()}&appid=activities_platform`,
+ headers: {
+ 'Cookie': cookie,
+ "Host": "api.m.jd.com",
+ 'Origin': 'https://daily-redpacket.jd.com',
+ "Content-Type": "application/x-www-form-urlencoded",
+ "Accept": "*/*",
+ "Connection": "keep-alive",
+ "User-Agent": "jdltapp;iPhone;3.3.2;14.5.1network/wifi;hasUPPay/0;pushNoticeIsOpen/1;lang/zh_CN;model/iPhone13,2;addressid/137923973;hasOCPay/0;appBuild/1047;supportBestPay/0;pv/467.11;apprpd/MyJD_Main;",
+ "Accept-Language": "zh-Hans-CN;q=1, en-CN;q=0.9, zh-Hant-CN;q=0.8",
+ 'Referer': `https://daily-redpacket.jd.com/?activityId=${signLinkId}`,
+ "Accept-Encoding": "gzip, deflate, br"
+ }
+ }
+ $.post(options, async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = $.toObj(data);
+ if (data.code === 0) {
+ if (data.data.status === "310") {
+ console.log(`极速版签到提现现金成功!`)
+ message += `极速版签到提现现金成功!`;
+ } else {
+ console.log(`极速版签到提现现金:失败:${JSON.stringify(data)}\n`);
+ }
+ } else {
+ console.log(`极速版签到提现现金:异常:${JSON.stringify(data)}\n`);
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function cashOut(id,poolBaseId,prizeGroupId,prizeBaseId,) {
+ let body = {
+ "businessSource": "SPRING_FESTIVAL_RED_ENVELOPE",
+ "base": {
+ "id": id,
+ "business": null,
+ "poolBaseId": poolBaseId,
+ "prizeGroupId": prizeGroupId,
+ "prizeBaseId": prizeBaseId,
+ "prizeType": 4
+ },
+ linkId,
+ "inviter": ""
+ }
+ return new Promise(resolve => {
+ $.post(taskPostUrl("apCashWithDraw",body), async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ console.log(`提现零钱结果:${data}`)
+ data = JSON.parse(data);
+ if (data.code === 0) {
+ if (data['data']['status'] === "310") {
+ console.log(`提现成功!`)
+ message += `提现成功!\n`;
+ } else {
+ console.log(`提现失败:${data['data']['message']}`);
+ message += `提现失败:${data['data']['message']}`;
+ }
+ } else {
+ console.log(`提现异常:${data['errMsg']}`);
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+
+function invite() {
+ let t = +new Date()
+ let inviterId = [
+ "5V7vHE23qh2EkdBHXRFDuA=="
+ ][Math.floor((Math.random() * 1))]
+ var headers = {
+ 'Host': 'api.m.jd.com',
+ 'accept': 'application/json, text/plain, */*',
+ 'content-type': 'application/x-www-form-urlencoded',
+ 'origin': 'https://invite-reward.jd.com',
+ 'accept-language': 'zh-cn',
+ 'user-agent': $.isNode() ? (process.env.JS_USER_AGENT ? process.env.JS_USER_AGENT : (require('./JS_USER_AGENTS').USER_AGENT)) : ($.getdata('JSUA') ? $.getdata('JSUA') : "'jdltapp;iPad;3.1.0;14.4;network/wifi;Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
+ 'referer': 'https://invite-reward.jd.com/',
+ 'Cookie': cookie
+ };
+
+ var dataString = `functionId=InviteFriendChangeAssertsService&body={"method":"attendInviteActivity","data":{"inviterPin":"${encodeURIComponent(inviterId)}","channel":1,"token":"","frontendInitStatus":""}}&referer=-1&eid=eidI9b2981202fsec83iRW1nTsOVzCocWda3YHPN471AY78%2FQBhYbXeWtdg%2F3TCtVTMrE1JjM8Sqt8f2TqF1Z5P%2FRPGlzA1dERP0Z5bLWdq5N5B2VbBO&aid=&client=ios&clientVersion=14.4.2&networkType=wifi&fp=-1&uuid=ab048084b47df24880613326feffdf7eee471488&osVersion=14.4.2&d_brand=iPhone&d_model=iPhone10,2&agent=-1&pageClickKey=-1&platform=3&lang=zh_CN&appid=market-task-h5&_t=${t}`;
+ var options = {
+ url: `https://api.m.jd.com/?t=${t}`,
+ headers: headers,
+ body: dataString
+ };
+ $.post(options, (err, resp, data) => {
+ // console.log(data)
+ })
+}
+
+function taskPostUrl(function_id, body) {
+ return {
+ url: `https://api.m.jd.com/`,
+ body: `appid=activities_platform&functionId=${function_id}&body=${escape(JSON.stringify(body))}&t=${+new Date()}`,
+ headers: {
+ 'Cookie': cookie,
+ 'Host': 'api.m.jd.com',
+ 'Accept': '*/*',
+ 'Connection': 'keep-alive',
+ // 'user-agent': $.isNode() ? (process.env.JS_USER_AGENT ? process.env.JS_USER_AGENT : (require('./JS_USER_AGENTS').USER_AGENT)) : ($.getdata('JSUA') ? $.getdata('JSUA') : "'jdltapp;iPad;3.1.0;14.4;network/wifi;Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
+ 'user-agent': "jdltapp;iPhone;3.3.2;14.3;b488010ad24c40885d846e66931abaf532ed26a5;network/4g;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone11,8;addressid/2005183373;hasOCPay/0;appBuild/1049;supportBestPay/0;pv/220.46;apprpd/;ref/JDLTSubMainPageViewController;psq/0;ads/;psn/b488010ad24c40885d846e66931abaf532ed26a5|520;jdv/0|iosapp|t_335139774|liteshare|CopyURL|1618673222002|1618673227;adk/;app_device/IOS;pap/JA2020_3112531|3.3.2|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1 ",
+ 'Accept-Language': 'zh-Hans-CN;q=1,en-CN;q=0.9',
+ 'Accept-Encoding': 'gzip, deflate, br',
+ 'Content-Type': "application/x-www-form-urlencoded",
+ "referer": "https://an.jd.com/babelDiy/Zeus/q1eB6WUB8oC4eH1BsCLWvQakVsX/index.html"
+ }
+ }
+}
+
+
+function taskGetUrl(function_id, body) {
+ return {
+ url: `https://api.m.jd.com/?appid=activities_platform&functionId=${function_id}&body=${escape(JSON.stringify(body))}&t=${+new Date()}`,
+ headers: {
+ 'Cookie': cookie,
+ 'Host': 'api.m.jd.com',
+ 'Accept': '*/*',
+ 'Connection': 'keep-alive',
+ 'user-agent': $.isNode() ? (process.env.JS_USER_AGENT ? process.env.JS_USER_AGENT : (require('./JS_USER_AGENTS').USER_AGENT)) : ($.getdata('JSUA') ? $.getdata('JSUA') : "'jdltapp;iPad;3.1.0;14.4;network/wifi;Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
+ 'Accept-Language': 'zh-Hans-CN;q=1,en-CN;q=0.9',
+ 'Accept-Encoding': 'gzip, deflate, br',
+ 'Content-Type': "application/x-www-form-urlencoded",
+ "referer": "https://an.jd.com/babelDiy/Zeus/q1eB6WUB8oC4eH1BsCLWvQakVsX/index.html"
+ }
+ }
+}
+
+function TotalBean() {
+ return new Promise(async resolve => {
+ const options = {
+ url: "https://me-api.jd.com/user_new/info/GetJDUserInfoUnion",
+ headers: {
+ Host: "me-api.jd.com",
+ Accept: "*/*",
+ Connection: "keep-alive",
+ Cookie: cookie,
+ "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"),
+ "Accept-Language": "zh-cn",
+ "Referer": "https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&",
+ "Accept-Encoding": "gzip, deflate, br"
+ }
+ }
+ $.get(options, (err, resp, data) => {
+ try {
+ if (err) {
+ $.logErr(err)
+ } else {
+ if (data) {
+ data = JSON.parse(data);
+ if (data['retcode'] === "1001") {
+ $.isLogin = false; //cookie过期
+ return;
+ }
+ if (data['retcode'] === "0" && data.data && data.data.hasOwnProperty("userInfo")) {
+ $.nickName = data.data.userInfo.baseInfo.nickname;
+ }
+ } else {
+ console.log('京东服务器返回空数据');
+ }
+ }
+ } catch (e) {
+ $.logErr(e)
+ } finally {
+ resolve();
+ }
+ })
+ })
+}
+
+function safeGet(data) {
+ try {
+ if (typeof JSON.parse(data) == "object") {
+ return true;
+ }
+ } catch (e) {
+ console.log(e);
+ console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
+ return false;
+ }
+}
+
+function jsonParse(str) {
+ if (typeof str == "string") {
+ try {
+ return JSON.parse(str);
+ } catch (e) {
+ console.log(e);
+ $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
+ return [];
+ }
+ }
+}
+// prettier-ignore
+function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(n,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)}
\ No newline at end of file
diff --git a/src/main/resources/test_startMan.js b/src/main/resources/test_startMan.js
new file mode 100644
index 0000000..e5f3d01
--- /dev/null
+++ b/src/main/resources/test_startMan.js
@@ -0,0 +1,292 @@
+/**
+ 星推官
+ cron 22 3,4 * * * https://raw.githubusercontent.com/star261/jd/main/scripts/jd_xtg.js
+ * */
+const $ = new Env('星推官');
+const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
+const notify = $.isNode() ? require('./sendNotify') : '';
+let cookiesArr = [];
+if ($.isNode()) {
+ Object.keys(jdCookieNode).forEach((item) => {
+ cookiesArr.push(jdCookieNode[item])
+ })
+ if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {
+ };
+} else {
+ cookiesArr = [
+ $.getdata("CookieJD"),
+ $.getdata("CookieJD2"),
+ ...$.toObj($.getdata("CookiesJD") || "[]").map((item) => item.cookie)].filter((item) => !!item);
+}
+let shareList = [],message = '';
+!(async () => {
+ if (!cookiesArr[0]) {
+ $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
+ return;
+ }
+ if(Date.now() > 1636646400000){
+ console.log(`活动结束`);
+ return;
+ }
+
+ for (let i = 0; i < cookiesArr.length; i++) {
+ if (cookiesArr[i]) {
+ $.cookie = cookiesArr[i];
+ $.UserName = decodeURIComponent($.cookie.match(/pt_pin=([^; ]+)(?=;?)/) && $.cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
+ $.index = i + 1;
+ $.isLogin = true;
+ $.nickName = '';
+ await TotalBean();
+ console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`);
+ if (!$.isLogin) {
+ $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
+ if ($.isNode()) {
+ await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
+ }
+ continue
+ }
+ try{
+ await main($.cookie,$.index)
+ }catch (e) {
+ console.log(JSON.stringify(e))
+ }
+ }
+ }
+ if(message){
+ await notify.sendNotify(`星推官`, message);
+ }
+ console.log(JSON.stringify(shareList));
+ if(shareList.length === 0){return;}
+ let allShareList = [];
+ for (let i = 0; i < cookiesArr.length; i++) {
+ let cookie = cookiesArr[i];
+ let userName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1]);
+ for (let j = 0; j < shareList.length; j++) {
+ if(shareList[j].user === userName){
+ allShareList.push(shareList[j]);
+ break;
+ }
+ }
+ }
+ console.log(`\n==================开始内部助力===================\n`)
+ for (let i = 0; i < cookiesArr.length; i++) {
+ let cookie = cookiesArr[i];
+ let userName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1]);
+ let canHelp = true;
+ let helpTime = 0;
+ for (let j = 0; j < allShareList.length && canHelp && helpTime < 5; j++) {
+ let oneCodeInfo = allShareList[j];
+ if(oneCodeInfo.user === userName || oneCodeInfo.need === 0){
+ continue;
+ }
+ console.log(`\n${userName}去助力:${oneCodeInfo.user},助力码:${oneCodeInfo.code}`);
+ let doSupport = await takeRequest(cookie,`{"shareId":"${oneCodeInfo.code}","apiMapping":"/api/supportTask/doSupport"}`);
+ if(doSupport.status === 7){
+ console.log(`助力成功`);
+ oneCodeInfo.need--;
+ helpTime++;
+ }else if(doSupport.status === 5){
+ console.log(`助力次数已用完`);
+ canHelp=false;
+ }
+ console.log(`助力结果:${JSON.stringify(doSupport)}`);
+ await $.wait(2000);
+ }
+ }
+})().catch((e) => {
+ $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
+}).finally(() => {
+ $.done();
+});
+
+async function main(cookie,index) {
+ let userName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1]);
+ let homePage = await takeRequest(cookie,`{"apiMapping":"/api/index/indexInfo"}`);
+ await takeRequest(cookie,`{"apiMapping":"/api/front/rule"}`);
+ await takeRequest(cookie,`{"apiMapping":"/api/index/groupIndex"}`);
+ let getTaskList = await takeRequest(cookie,`{"apiMapping":"/api/task/getTaskList"}`);
+ let supportInfo = await takeRequest(cookie,`{"apiMapping":"/api/supportTask/getSupportList"}`);
+ if(JSON.stringify(homePage) === '{}' || JSON.stringify(getTaskList) === '{}'){
+ console.log(`\n${userName},获取活动详情失败`);
+ return ;
+ }
+ console.log(`${userName},获取活动详情成功`);
+ await $.wait(2000);
+ if(homePage.signState !== '1'){
+ console.log(`${userName},去签到`);
+ let sign = await takeRequest(cookie,`{"apiMapping":"/api/task/doSign"}`);
+ console.log(`${userName},执行签到结果:${JSON.stringify(sign)}`);
+ }else{
+ console.log(`${userName},今日已签到`);
+ }
+ let time = 0;
+ let runFlag = false;
+ let freshFlag = false;
+ do {
+ runFlag = false;
+ for (let i = 0; i < getTaskList.length; i++) {
+ let oneTask = getTaskList[i];
+ if(oneTask.totalNum === oneTask.finishNum){
+ console.log(`${userName},任务:${oneTask.taskName},已完成`);
+ continue;
+ }
+ console.log(`${userName},任务:${oneTask.taskName},去执行`);
+ if(oneTask.type === 'JOIN_SHOPPING_CART'){
+ let getReward = await takeRequest(cookie,`{"parentId":"${oneTask.parentId}","taskId":"${oneTask.taskId}","apiMapping":"/api/task/getReward"}`);
+ console.log(`${userName},执行结果:${JSON.stringify(getReward)}`);
+ await $.wait(2000);
+ }
+ if(oneTask.type === 'BROWSE_TASK' || oneTask.type === 'FOLLOW_CHANNEL_TASK'){
+ let doInfo = await takeRequest(cookie,`{"parentId":"${oneTask.parentId}","taskId":"${oneTask.taskId}","apiMapping":"/api/task/doTask"}`);
+ let time = 10;
+ if(oneTask.browseTime > 0){
+ time = oneTask.browseTime;
+ }
+ await $.wait(time*1000);
+ let getReward = await takeRequest(cookie,`{"parentId":"${oneTask.parentId}","taskId":"${oneTask.taskId}","timeStamp":${doInfo.timeStamp},"apiMapping":"/api/task/getReward"}`);
+ console.log(`${userName},执行结果:${JSON.stringify(getReward)}`);
+ await $.wait(1000);
+ }
+
+ if( oneTask.type === 'FOLLOW_SHOP_TASK'){
+ let doInfo = await takeRequest(cookie,`{"parentId":"${oneTask.parentId}","taskId":"${oneTask.taskId}","apiMapping":"/api/task/doTask"}`);
+ if(doInfo.rewardVo === null){
+ await $.wait(6000);
+ let getReward = await takeRequest(cookie,`{"parentId":"${oneTask.parentId}","taskId":"${oneTask.taskId}","timeStamp":${doInfo.timeStamp},"apiMapping":"/api/task/getReward"}`);
+ console.log(`${userName},执行结果:${JSON.stringify(getReward)}`);
+ }else{
+ console.log(`${userName},执行结果:${JSON.stringify(doInfo)}`);
+ }
+ await $.wait(4000);
+ }
+ runFlag = true;
+ freshFlag = true;
+ }
+ time ++;
+ if(runFlag && time < 30){
+ await $.wait(1000);
+ getTaskList = await takeRequest(cookie,`{"apiMapping":"/api/task/getTaskList"}`);
+ }
+ }while (runFlag && time < 30);
+
+
+ if(freshFlag){
+ homePage = await takeRequest(cookie,`{"apiMapping":"/api/index/indexInfo"}`);
+ }
+ let myScore = homePage.myScore;
+ let canDraw = Math.floor(myScore/100);
+ console.log(`\n可以抽奖:${canDraw}次`);
+ for (let i = 0; i < canDraw; i++) {
+ console.log(`\n进行第${i+1}次抽奖`)
+ let lotteryInfo = await takeRequest(cookie,`{"apiMapping":"/api/lottery/lottery"}`);
+ console.log(`抽奖结果:${JSON.stringify(lotteryInfo)}`);
+ await $.wait(2000);
+ }
+ if(supportInfo.supportNeedNum !== supportInfo.supportedNum){
+ let needTime = Number(supportInfo.supportNeedNum) - Number(supportInfo.supportedNum);
+ let shareCode = await takeRequest(cookie,`{"apiMapping":"/api/supportTask/getShareId"}`);
+ shareList.push({'user':userName,'code':shareCode,'need':needTime});
+ console.log(`助力码:${shareCode}`);
+ }else{
+ console.log(`助力已满`);
+ }
+ let pageNum = 1;
+ let lotteryList = []
+ do {
+ lotteryList = await takeRequest(cookie,`{"pageNum":${pageNum},"apiMapping":"/api/record/prizeRecord"}`);
+ lotteryList = lotteryList.list
+ for (let i = 0; i < lotteryList.length; i++) {
+ let oneLottery = lotteryList[i];
+ if(oneLottery.prizeType === 2 || oneLottery.prizeType === 3){
+ continue;
+ }
+ console.log(`${userName},奖励:${JSON.stringify(oneLottery)}`);
+ if(oneLottery.prizeType === 1 || oneLottery.addressStatus === false){
+ message +=`第${index}个账号,${userName},抽到了实物:${oneLottery.prizeName}\n`;
+ }
+ }
+ pageNum++;
+ await $.wait(1000);
+ }while (lotteryList.length === 10);
+}
+async function takeRequest(cookie,body){
+ let url = 'https://api.m.jd.com/api';
+ const headers = {
+ 'Origin' : `https://starintroducer.jd.com`,
+ 'Cookie' : cookie ,
+ 'Connection' : `keep-alive`,
+ 'Accept' : `application/json, text/plain, */*`,
+ 'Referer' : `https://starintroducer.jd.com/`,
+ 'Host' : `api.m.jd.com`,
+ '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"),
+ 'Accept-Language' : `zh-cn`,
+ 'Accept-Encoding' : `gzip, deflate, br`
+ };
+ let myRequest = {url: url, headers: headers,body: `appid=china-joy&functionId=star_push_jd_prod&body=${body}&t=${Date.now()}`};
+ return new Promise(async resolve => {
+ $.post(myRequest, (err, resp, data) => {
+ try {
+ if(err){
+ console.log(err);
+ }else{
+ data = JSON.parse(data);
+ if(data && data.data && JSON.stringify(data.data) === '{}'){
+ console.log(JSON.stringify(data))
+ }
+ }
+ } catch (e) {
+ console.log(data);
+ $.logErr(e, resp)
+ } finally {
+ resolve(data.data || {});
+ }
+ })
+ })
+}
+
+function TotalBean() {
+ return new Promise(async resolve => {
+ const options = {
+ "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
+ "headers": {
+ "Accept": "application/json,text/plain, */*",
+ "Content-Type": "application/x-www-form-urlencoded",
+ "Accept-Encoding": "gzip, deflate, br",
+ "Accept-Language": "zh-cn",
+ "Connection": "keep-alive",
+ "Cookie": $.cookie,
+ "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
+ "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (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")
+ }
+ }
+ $.post(options, (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (data) {
+ data = JSON.parse(data);
+ if (data['retcode'] === 13) {
+ $.isLogin = false; //cookie过期
+ return
+ }
+ if (data['retcode'] === 0) {
+ $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
+ } else {
+ $.nickName = $.UserName
+ }
+ } else {
+ console.log(`京东服务器返回空数据`)
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve();
+ }
+ })
+ })
+}
+
+function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(n,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)}
\ No newline at end of file
diff --git a/src/main/resources/test_try_joy.js b/src/main/resources/test_try_joy.js
deleted file mode 100644
index a86cfd7..0000000
--- a/src/main/resources/test_try_joy.js
+++ /dev/null
@@ -1,1099 +0,0 @@
-/*
- * 由ZCY01二次修改:脚本默认不运行
- * 由 X1a0He 修复:依然保持脚本默认不运行
- * 如需运行请自行添加环境变量:JD_TRY,值填 true 即可运行
- * TG交流群:https://t.me/jd_zero205
- * TG通知频道:https://t.me/jd_zero205_tz
- *
- update 2021/09/05
- 京东试用:脚本更新地址 https://github.com/zero205/JD_tencent_scf/raw/main/jd_try.js
- 脚本兼容: Node.js
- 每天最多关注300个商店,但用户商店关注上限为500个。
- 请配合取关脚本试用,使用 jd_unsubscribe.js 提前取关至少250个商店确保京东试用脚本正常运行。
- *
- * X1a0He留
- * 由于没有兼容Qx,原脚本已失效,建议原脚本的兼容Qx注释删了
- * 脚本是否耗时只看args_xh.maxLength的大小
- * 上一作者说了每天最多300个商店,总上限为500个,jd_unsubscribe.js我已更新为批量取关版
- * 请提前取关至少250个商店确保京东试用脚本正常运行
- * 没有写通知,是否申请成功没有进行通知,但脚本会把状态log出日志
- */
- let maxSize = 20
- const $ = new Env('京东试用')
- const URL = 'https://api.m.jd.com/client.action'
- let trialActivityIdList = []
- let trialActivityTitleList = []
- let notifyMsg = ''
- let message = ""
- let process={
- env:{
- "JD_TRY":"true"
- }
- }
- // default params
- let args_xh = {
- /*
- * 是否进行通知
- * 可设置环境变量:JD_TRY_NOTIFY
- * */
- // isNotify: process.env.JD_TRY_NOTIFY || true,
- // 商品原价,低于这个价格都不会试用
- jdPrice: process.env.JD_TRY_PRICE || 0,
- /*
- * 获取试用商品类型,默认为1
- * 1 - 精选
- * 2 - 闪电试用
- * 3 - 家用电器(可能会有变化)
- * 4 - 手机数码(可能会有变化)
- * 5 - 电脑办公(可能会有变化)
- * 可设置环境变量:JD_TRY_TABID
- * */
- // TODO: tab ids as array(support multi tabIds)
- // tabId: process.env.JD_TRY_TABID && process.env.JD_TRY_TABID.split('@').map(Number) || [1],
- tabId: process.env.JD_TRY_TABID || 1,
- /*
- * 试用商品标题过滤
- * 可设置环境变量:JD_TRY_TITLEFILTERS,关键词与关键词之间用@分隔
- * */
- titleFilters: process.env.JD_TRY_TITLEFILTERS && process.env.JD_TRY_TITLEFILTERS.split('@') || ["避孕","锁精","延时","延迟","润滑","私处","跳蛋","乳贴","情趣","龟头","自慰","啪啪","情趣","避孕套","润滑","延时","飞机杯"],
- // 试用价格(中了要花多少钱),高于这个价格都不会试用,小于等于才会试用
- trialPrice: 100,
- /*
- * 最小提供数量,例如试用商品只提供2份试用资格,当前设置为1,则会进行申请
- * 若只提供5分试用资格,当前设置为10,则不会申请
- * 可设置环境变量:JD_TRY_MINSUPPLYNUM
- * */
- minSupplyNum: process.env.JD_TRY_MINSUPPLYNUM || 1,
- /*
- * 过滤大于设定值的已申请人数,例如下面设置的1000,A商品已经有1001人申请了,则A商品不会进行申请,会被跳过
- * 可设置环境变量:JD_TRY_APPLYNUMFILTER
- * */
- applyNumFilter: process.env.JD_TRY_APPLYNUMFILTER || 99999,
- /*
- * 商品试用之间和获取商品之间的间隔, 单位:毫秒(1秒=1000毫秒)
- * 可设置环境变量:JD_TRY_APPLYINTERVAL
- * */
- applyInterval: process.env.JD_TRY_APPLYINTERVAL || 5000,
- /*
- * 商品数组的最大长度,通俗来说就是即将申请的商品队列长度
- * 例如设置为20,当第一次获取后获得12件,过滤后剩下5件,将会进行第二次获取,过滤后加上第一次剩余件数
- * 例如是18件,将会进行第三次获取,直到过滤完毕后为20件才会停止,不建议设置太大
- * 可设置环境变量:JD_TRY_MAXLENGTH
- * */
- maxLength: 50
- }
-
- !(async() => {
- // console.log(`\n本脚本默认不运行,也不建议运行\n如需运行请自行添加环境变量:JD_TRY,值填:true\n`)
- await $.wait(1000)
- if(process.env.JD_TRY && process.env.JD_TRY === 'true'){
- await requireConfig()
- if(!$.cookiesArr[0]){
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {
- "open-url": "https://bean.m.jd.com/"
- })
- return
- }
- for(let i = 0; i < $.cookiesArr.length; i++){
- message += "[通知] 动动试用(搞笑版) \n\n --- \n\n"
- if($.cookiesArr[i]){
- $.cookie = $.cookiesArr[i];
- $.UserName = decodeURIComponent($.cookie.match(/pt_pin=(.+?);/) && $.cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await totalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if(!$.isLogin){
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {
- "open-url": "https://bean.m.jd.com/bean/signIndex.action"
- });
- await $.notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- continue
- }
-
- username = $.UserName
- if ($.UserName == "jd_66ea783827d30"){
- username = "跑腿小弟"
- }
- if ($.UserName == "jd_4521b375ebb5d"){
- username = "锟锟"
- }
- if ($.UserName == "jd_542c10c0222bc"){
- username = "康康"
- }
- //加上名称
- message = message + "【羊毛姐妹】" + username + " \n\n "
-
- $.totalTry = 0
- $.totalSuccess = 0
- let size = 1;
- while(trialActivityIdList.length < args_xh.maxLength && size < maxSize){
- console.log(`\n正在进行第 ${size} 次获取试用商品\n`)
- await try_feedsList(1, size++)
- await try_feedsList(2, size++)
- await try_feedsList(5, size++)
- await try_feedsList(16, size++)
- if(trialActivityIdList.length < args_xh.maxLength){
- console.log(`间隔延时中,请等待 ${args_xh.applyInterval} ms`)
- await $.wait(args_xh.applyInterval);
- }
- }
- console.log("正在执行试用申请...")
- await $.wait(args_xh.applyInterval);
- for(let i = 0; i < trialActivityIdList.length; i++){
- await try_apply(trialActivityTitleList[i], trialActivityIdList[i])
- console.log(`间隔延时中,请等待 ${args_xh.applyInterval} ms\n`)
- await $.wait(args_xh.applyInterval);
- }
- console.log("试用申请执行完毕...")
-
- // await try_MyTrials(1, 1) //申请中的商品
- await try_MyTrials(1, 2) //申请成功的商品
- // await try_MyTrials(1, 3) //申请失败的商品
- await showMsg()
- }
- postToDingTalk(message)
- message = ""
- }
- await $.notify.sendNotify(`${$.name}`, notifyMsg);
- } else {
- console.log(`\n您未设置运行【京东试用】脚本,结束运行!\n`)
- }
- })().catch((e) => {
- console.log(`❗️ ${$.name} 运行错误!\n${e}`)
- }).finally(() => {
- $.done()
- })
-
- function requireConfig(){
- return new Promise(resolve => {
- console.log('开始获取配置文件\n')
- $.notify = $.isNode() ? require('./sendNotify') : { sendNotify: async() => { } }
- //获取 Cookies
- $.cookiesArr = []
- if($.isNode()){
- //Node.js用户请在jdCookie.js处填写京东ck;
- const jdCookieNode = require('./jdCookie.js');
- Object.keys(jdCookieNode).forEach((item) => {
- if(jdCookieNode[item]){
- $.cookiesArr.push(jdCookieNode[item])
- }
- })
- if(process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => { };
- } else {
- //IOS等用户直接用NobyDa的jd $.cookie
- $.cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
- }
- console.log(`共${$.cookiesArr.length}个京东账号\n`)
- for (const key in args_xh) {
- if(typeof args_xh[key] == 'string') {
- args_xh[key] = Number(args_xh[key])
- }
- }
- // console.debug(args_xh)
- resolve()
- })
- }
-
- //获取商品列表并且过滤 By X1a0He
- function try_feedsList(tabId, page){
- return new Promise((resolve, reject) => {
- const body = JSON.stringify({
- "tabId": `${tabId}`,
- "page": page,
- "previewTime": ""
- });
- let option = taskurl_xh('newtry', 'try_feedsList', body)
- $.get(option, (err, resp, data) => {
- try{
- if(err){
- console.log(`🚫 ${arguments.callee.name.toString()} API请求失败,请检查网路\n${JSON.stringify(err)}`)
- } else {
- // console.debug(data)
- // return
- data = JSON.parse(data)
- if(data.success){
- $.totalPages = data.data.pages
- console.log(`获取到商品 ${data.data.feedList.length} 条\n`)
- for(let i = 0; i < data.data.feedList.length; i++){
- if(trialActivityIdList.length > args_xh.maxLength){
- console.log('商品列表长度已满.结束获取')
- }else
- if(data.data.feedList[i].applyState === 1){
- console.log(`商品已申请试用:${data.data.feedList[i].skuTitle}`)
- continue
- }else
- if(data.data.feedList[i].applyState !== null){
- console.log(`商品状态异常,跳过:${data.data.feedList[i].skuTitle}`)
- continue
- }else
- if(data.data.feedList[i].skuTitle){
- console.log(`检测第 ${page} 页 第 ${i + 1} 个商品\n${data.data.feedList[i].skuTitle}`)
- if(parseFloat(data.data.feedList[i].jdPrice) <= args_xh.jdPrice){
- console.log(`商品被过滤,${data.data.feedList[i].jdPrice} < ${args_xh.jdPrice} \n`)
- }else if(parseFloat(data.data.feedList[i].supplyNum) < args_xh.minSupplyNum && data.data.feedList[i].supplyNum !== null){
- console.log(`商品被过滤,提供申请的份数小于预设申请的份数 \n`)
- }else if(parseFloat(data.data.feedList[i].applyNum) > args_xh.applyNumFilter && data.data.feedList[i].applyNum !== null){
- console.log(`商品被过滤,已申请试用人数大于预设人数 \n`)
- }else if(parseFloat(data.data.feedList[i].trialPrice) > args_xh.trialPrice){
- console.log(`商品被过滤,期待价格高于预设价格 \n`)
- }else if(args_xh.titleFilters.some(fileter_word => data.data.feedList[i].skuTitle.includes(fileter_word))){
- console.log(`商品通过,将加入试用组,trialActivityId为${data.data.feedList[i].trialActivityId}\n`)
- trialActivityIdList.push(data.data.feedList[i].trialActivityId)
- trialActivityTitleList.push(data.data.feedList[i].skuTitle)
- }
- }else{
- console.log('skuTitle解析异常')
- return
- }
- }
- console.log(`当前试用组id如下,长度为:${trialActivityIdList.length}\n${trialActivityIdList}\n`)
- } else {
- console.log(`💩 获得试用列表失败: ${data.message}`)
- }
- }
- } catch(e){
- console.log(e);
- reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`)
- } finally{
- resolve()
- }
- })
- })
- }
-
- function try_apply(title, activityId){
- return new Promise((resolve, reject) => {
- console.log(`申请试用商品中...`)
- console.log(`商品:${title}`)
- console.log(`id为:${activityId}`)
- const body = JSON.stringify({
- "activityId": activityId,
- "previewTime": ""
- });
- let option = taskurl_xh('newtry', 'try_apply', body)
- $.get(option, (err, resp, data) => {
- try{
- if(err){
- console.log(`🚫 ${arguments.callee.name.toString()} API请求失败,请检查网路\n${JSON.stringify(err)}`)
- } else {
- $.totalTry++
- data = JSON.parse(data)
- if(data.success && data.code === "1"){ // 申请成功
- message += "" + title + "\n\n"
- console.log(data.message)
- $.totalSuccess++
- } else if(data.code === "-106"){
- console.log(data.message) // 未在申请时间内!
- } else if(data.code === "-110"){
- console.log(data.message) // 您的申请已成功提交,请勿重复申请…
- } else if(data.code === "-120"){
- console.log(data.message) // 您还不是会员,本品只限会员申请试用,请注册会员后申请!
- } else if(data.code === "-167"){
- console.log(data.message) // 抱歉,此试用需为种草官才能申请。查看下方详情了解更多。
- } else {
- console.log("申请失败", JSON.stringify(data))
- }
- }
- } catch(e){
- reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`)
- } finally{
- resolve()
- }
- })
- })
- }
-
- function try_MyTrials(page, selected){
- return new Promise((resolve, reject) => {
- switch(selected){
- case 1:
- console.log('正在获取已申请的商品...')
- break;
- case 2:
- console.log('正在获取申请成功的商品...')
- break;
- case 3:
- console.log('正在获取申请失败的商品...')
- break;
- default:
- console.log('selected错误')
- }
- const body = JSON.stringify({
- "page": page,
- "selected": selected, // 1 - 已申请 2 - 成功列表,3 - 失败列表
- "previewTime": ""
- });
- let option = taskurl_xh('newtry', 'try_MyTrials', body)
- option.headers.Referer = 'https://pro.m.jd.com/'
- $.get(option, (err, resp, data) => {
- try{
- if(err){
- console.log(`🚫 ${arguments.callee.name.toString()} API请求失败,请检查网路\n${JSON.stringify(err)}`)
- } else {
- // console.log(data)
- // return
- data = JSON.parse(data)
- if(data.success){
- //temp adjustment
- if(selected == 2){
- if (data.success && data.data) {
- $.successList = data.data.list.filter(item => {
- if (item.text.text.includes('请尽快领取')){
- message += "" + item.text.text + "\n\n"
- }
- return item.text.text.includes('请尽快领取')
- })
- console.log(`待领取: ${$.successList.length}个`)
- } else {
- console.log(`获得成功列表失败: ${data.message}`)
- }
- }
- // if(data.data.list.length > 0){
- // for(let item of data.data.list){
- // console.log(`申请时间:${new Date(parseInt(item.applyTime)).toLocaleString()}`)
- // console.log(`申请商品:${item.trialName}`)
- // console.log(`当前状态:${item.text.text}`)
- // console.log(`剩余时间:${remaining(item.leftTime)}`)
- // console.log()
- // }
- // } else {
- // switch(selected){
- // case 1:
- // console.log('无已申请的商品\n')
- // break;
- // case 2:
- // console.log('无申请成功的商品\n')
- // break;
- // case 3:
- // console.log('无申请失败的商品\n')
- // break;
- // default:
- // console.log('selected错误')
- // }
- // }
- } else {
- console.log(`ERROR:try_MyTrials`)
- }
- }
- } catch(e){
- reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`)
- } finally{
- resolve()
- }
- })
- })
- }
-
- function remaining(time){
- let days = parseInt(time / (1000 * 60 * 60 * 24));
- let hours = parseInt((time % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
- let minutes = parseInt((time % (1000 * 60 * 60)) / (1000 * 60));
- return `${days} 天 ${hours} 小时 ${minutes} 分`
- }
-
- function taskurl_xh(appid, functionId, body = JSON.stringify({})){
- return {
- "url": `${URL}?appid=${appid}&functionId=${functionId}&clientVersion=10.1.2&client=wh5&body=${encodeURIComponent(body)}`,
- 'headers': {
- 'Host': 'api.m.jd.com',
- 'Accept-Encoding': 'gzip, deflate, br',
- 'Cookie': $.cookie,
- 'Connection': 'keep-alive',
- 'UserAgent': 'jdapp;iPhone;10.1.2;15.0;ff2caa92a8529e4788a34b3d8d4df66d9573f499;network/wifi;model/iPhone13,4;addressid/2074196292;appBuild/167802;jdSupportDarkMode/1;Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
- 'Accept-Language': 'zh-cn',
- 'Referer': 'https://prodev.m.jd.com/'
- },
- }
- }
-
- async function showMsg(){
- let message1 = `京东账号${$.index} ${$.nickName || $.UserName}\n🎉 本次申请:${$.totalSuccess}/${$.totalTry}个商品🛒\n🎉 ${$.successList.length}个商品待领取`
- message += "" + `🎉 本次申请:${$.totalSuccess}/${$.totalTry}个商品🛒\n🎉 ${$.successList.length}个商品待领取` + "\n\n"
- if(!args_xh.jdNotify || args_xh.jdNotify === 'false'){
- $.msg($.name, ``, message1, {
- "open-url": 'https://try.m.jd.com/user'
- })
- if($.isNode())
- notifyMsg += `${message1}\n\n`
- } else {
- console.log(message1)
- }
- }
-
- function totalBean(){
- return new Promise(async resolve => {
- const options = {
- "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
- "headers": {
- "Accept": "application/json,text/plain, */*",
- "Content-Type": "application/x-www-form-urlencoded",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-cn",
- "Connection": "keep-alive",
- "Cookie": $.cookie,
- "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.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")
- },
- "timeout": 10000,
- }
- $.post(options, (err, resp, data) => {
- try{
- if(err){
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if(data){
- data = JSON.parse(data);
- if(data['retcode'] === 13){
- $.isLogin = false; //cookie过期
- return
- }
- if(data['retcode'] === 0){
- $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
- } else {
- $.nickName = $.UserName
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch(e){
- $.logErr(e, resp)
- } finally{
- resolve();
- }
- })
- })
- }
-
- function jsonParse(str){
- if(typeof str == "string"){
- try{
- return JSON.parse(str);
- } catch(e){
- console.log(e);
- $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
- return [];
- }
- }
- }
-
- // 来自 @chavyleung 大佬
- // https://raw.githubusercontent.com/chavyleung/scripts/master/Env.js
- function Env(name, opts){
- class Http{
- constructor(env){
- this.env = env
- }
-
- send(opts, method = 'GET'){
- opts = typeof opts === 'string' ? {
- url: opts
- } : opts
- let sender = this.get
- if(method === 'POST'){
- sender = this.post
- }
- return new Promise((resolve, reject) => {
- sender.call(this, opts, (err, resp, body) => {
- if(err) reject(err)
- else resolve(resp)
- })
- })
- }
-
- get(opts){
- return this.send.call(this.env, opts)
- }
-
- post(opts){
- return this.send.call(this.env, opts, 'POST')
- }
- }
-
- return new (class{
- constructor(name, opts){
- this.name = name
- this.http = new Http(this)
- this.data = null
- this.dataFile = 'box.dat'
- this.logs = []
- this.isMute = false
- this.isNeedRewrite = false
- this.logSeparator = '\n'
- this.startTime = new Date().getTime()
- Object.assign(this, opts)
- 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(str, defaultValue = null){
- try{
- return JSON.parse(str)
- } catch{
- return defaultValue
- }
- }
-
- toStr(obj, defaultValue = null){
- try{
- return JSON.stringify(obj)
- } catch{
- return defaultValue
- }
- }
-
- getjson(key, defaultValue){
- let json = defaultValue
- const val = this.getdata(key)
- if(val){
- try{
- json = JSON.parse(this.getdata(key))
- } catch{ }
- }
- return json
- }
-
- setjson(val, key){
- try{
- return this.setdata(JSON.stringify(val), key)
- } catch{
- return false
- }
- }
-
- getScript(url){
- return new Promise((resolve) => {
- this.get({
- url
- }, (err, resp, body) => resolve(body))
- })
- }
-
- runScript(script, runOpts){
- return new Promise((resolve) => {
- let httpapi = this.getdata('@chavy_boxjs_userCfgs.httpapi')
- httpapi = httpapi ? httpapi.replace(/\n/g, '').trim() : httpapi
- let httpapi_timeout = this.getdata('@chavy_boxjs_userCfgs.httpapi_timeout')
- httpapi_timeout = httpapi_timeout ? httpapi_timeout * 1 : 20
- httpapi_timeout = runOpts && runOpts.timeout ? runOpts.timeout : httpapi_timeout
- const [key, addr] = httpapi.split('@')
- const opts = {
- url: `http://${addr}/v1/scripting/evaluate`,
- body: {
- script_text: script,
- mock_type: 'cron',
- timeout: httpapi_timeout
- },
- headers: {
- 'X-Key': key,
- 'Accept': '*/*'
- }
- }
- this.post(opts, (err, resp, body) => resolve(body))
- }).catch((e) => this.logErr(e))
- }
-
- loaddata(){
- if(this.isNode()){
- this.fs = this.fs ? this.fs : require('fs')
- this.path = this.path ? this.path : require('path')
- const curDirDataFilePath = this.path.resolve(this.dataFile)
- const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile)
- const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath)
- const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath)
- if(isCurDirDataFile || isRootDirDataFile){
- const datPath = isCurDirDataFile ? curDirDataFilePath : rootDirDataFilePath
- try{
- return JSON.parse(this.fs.readFileSync(datPath))
- } catch(e){
- return {}
- }
- } else return {}
- } else return {}
- }
-
- writedata(){
- if(this.isNode()){
- this.fs = this.fs ? this.fs : require('fs')
- this.path = this.path ? this.path : require('path')
- const curDirDataFilePath = this.path.resolve(this.dataFile)
- const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile)
- const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath)
- const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath)
- const jsondata = JSON.stringify(this.data)
- if(isCurDirDataFile){
- this.fs.writeFileSync(curDirDataFilePath, jsondata)
- } else if(isRootDirDataFile){
- this.fs.writeFileSync(rootDirDataFilePath, jsondata)
- } else {
- this.fs.writeFileSync(curDirDataFilePath, jsondata)
- }
- }
- }
-
- lodash_get(source, path, defaultValue = undefined){
- const paths = path.replace(/\[(\d+)\]/g, '.$1').split('.')
- let result = source
- for(const p of paths){
- result = Object(result)[p]
- if(result === undefined){
- return defaultValue
- }
- }
- return result
- }
-
- lodash_set(obj, path, value){
- if(Object(obj) !== obj) return obj
- if(!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || []
- path.slice(0, -1).reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[
- path[path.length - 1]
- ] = value
- return obj
- }
-
- getdata(key){
- let val = this.getval(key)
- // 如果以 @
- if(/^@/.test(key)){
- const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key)
- const objval = objkey ? this.getval(objkey) : ''
- if(objval){
- try{
- const objedval = JSON.parse(objval)
- val = objedval ? this.lodash_get(objedval, paths, '') : val
- } catch(e){
- val = ''
- }
- }
- }
- return val
- }
-
- setdata(val, key){
- let issuc = false
- if(/^@/.test(key)){
- const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key)
- const objdat = this.getval(objkey)
- const objval = objkey ? (objdat === 'null' ? null : objdat || '{}') : '{}'
- try{
- const objedval = JSON.parse(objval)
- this.lodash_set(objedval, paths, val)
- issuc = this.setval(JSON.stringify(objedval), objkey)
- } catch(e){
- const objedval = {}
- this.lodash_set(objedval, paths, val)
- issuc = this.setval(JSON.stringify(objedval), objkey)
- }
- } else {
- issuc = this.setval(val, key)
- }
- return issuc
- }
-
- getval(key){
- if(this.isSurge() || this.isLoon()){
- return $persistentStore.read(key)
- } else if(this.isQuanX()){
- return $prefs.valueForKey(key)
- } else if(this.isNode()){
- this.data = this.loaddata()
- return this.data[key]
- } else {
- return (this.data && this.data[key]) || null
- }
- }
-
- setval(val, key){
- if(this.isSurge() || this.isLoon()){
- return $persistentStore.write(val, key)
- } else if(this.isQuanX()){
- return $prefs.setValueForKey(val, key)
- } else if(this.isNode()){
- this.data = this.loaddata()
- this.data[key] = val
- this.writedata()
- return true
- } else {
- return (this.data && this.data[key]) || null
- }
- }
-
- initGotEnv(opts){
- 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()
- if(opts){
- opts.headers = opts.headers ? opts.headers : {}
- if(undefined === opts.headers.Cookie && undefined === opts.cookieJar){
- opts.cookieJar = this.ckjar
- }
- }
- }
-
- get(opts, callback = () => { }){
- if(opts.headers){
- delete opts.headers['Content-Type']
- delete opts.headers['Content-Length']
- }
- if(this.isSurge() || this.isLoon()){
- if(this.isSurge() && this.isNeedRewrite){
- opts.headers = opts.headers || {}
- Object.assign(opts.headers, {
- 'X-Surge-Skip-Scripting': false
- })
- }
- $httpClient.get(opts, (err, resp, body) => {
- if(!err && resp){
- resp.body = body
- resp.statusCode = resp.status
- }
- callback(err, resp, body)
- })
- } else if(this.isQuanX()){
- if(this.isNeedRewrite){
- opts.opts = opts.opts || {}
- Object.assign(opts.opts, {
- hints: false
- })
- }
- $task.fetch(opts).then(
- (resp) => {
- const {
- statusCode: status,
- statusCode,
- headers,
- body
- } = resp
- callback(null, {
- status,
- statusCode,
- headers,
- body
- }, body)
- },
- (err) => callback(err)
- )
- } else if(this.isNode()){
- this.initGotEnv(opts)
- this.got(opts).on('redirect', (resp, nextOpts) => {
- try{
- if(resp.headers['set-cookie']){
- const ck = resp.headers['set-cookie'].map(this.cktough.Cookie.parse).toString()
- if(ck){
- this.ckjar.setCookieSync(ck, null)
- }
- nextOpts.cookieJar = this.ckjar
- }
- } catch(e){
- this.logErr(e)
- }
- // this.ckjar.setCookieSync(resp.headers['set-cookie'].map(Cookie.parse).toString())
- }).then(
- (resp) => {
- const {
- statusCode: status,
- statusCode,
- headers,
- body
- } = resp
- callback(null, {
- status,
- statusCode,
- headers,
- body
- }, body)
- },
- (err) => {
- const {
- message: error,
- response: resp
- } = err
- callback(error, resp, resp && resp.body)
- }
- )
- }
- }
-
- post(opts, callback = () => { }){
- // 如果指定了请求体, 但没指定`Content-Type`, 则自动生成
- if(opts.body && opts.headers && !opts.headers['Content-Type']){
- opts.headers['Content-Type'] = 'application/x-www-form-urlencoded'
- }
- if(opts.headers) delete opts.headers['Content-Length']
- if(this.isSurge() || this.isLoon()){
- if(this.isSurge() && this.isNeedRewrite){
- opts.headers = opts.headers || {}
- Object.assign(opts.headers, {
- 'X-Surge-Skip-Scripting': false
- })
- }
- $httpClient.post(opts, (err, resp, body) => {
- if(!err && resp){
- resp.body = body
- resp.statusCode = resp.status
- }
- callback(err, resp, body)
- })
- } else if(this.isQuanX()){
- opts.method = 'POST'
- if(this.isNeedRewrite){
- opts.opts = opts.opts || {}
- Object.assign(opts.opts, {
- hints: false
- })
- }
- $task.fetch(opts).then(
- (resp) => {
- const {
- statusCode: status,
- statusCode,
- headers,
- body
- } = resp
- callback(null, {
- status,
- statusCode,
- headers,
- body
- }, body)
- },
- (err) => callback(err)
- )
- } else if(this.isNode()){
- this.initGotEnv(opts)
- const {
- url,
- ..._opts
- } = opts
- this.got.post(url, _opts).then(
- (resp) => {
- const {
- statusCode: status,
- statusCode,
- headers,
- body
- } = resp
- callback(null, {
- status,
- statusCode,
- headers,
- body
- }, body)
- },
- (err) => {
- const {
- message: error,
- response: resp
- } = err
- callback(error, resp, resp && resp.body)
- }
- )
- }
- }
-
- /**
- *
- * 示例:$.time('yyyy-MM-dd qq HH:mm:ss.S')
- * :$.time('yyyyMMddHHmmssS')
- * y:年 M:月 d:日 q:季 H:时 m:分 s:秒 S:毫秒
- * 其中y可选0-4位占位符、S可选0-1位占位符,其余可选0-2位占位符
- * @param {*} fmt 格式化参数
- *
- */
- time(fmt){
- let o = {
- '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()
- }
- if(/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (new Date().getFullYear() + '').substr(4 - RegExp.$1.length))
- for(let k in o)
- if(new RegExp('(' + k + ')').test(fmt))
- fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
- return fmt
- }
-
- /**
- * 系统通知
- *
- * > 通知参数: 同时支持 QuanX 和 Loon 两种格式, EnvJs根据运行环境自动转换, Surge 环境不支持多媒体通知
- *
- * 示例:
- * $.msg(title, subt, desc, 'twitter://')
- * $.msg(title, subt, desc, { 'open-url': 'twitter://', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' })
- * $.msg(title, subt, desc, { 'open-url': 'https://bing.com', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' })
- *
- * @param {*} title 标题
- * @param {*} subt 副标题
- * @param {*} desc 通知详情
- * @param {*} opts 通知参数
- *
- */
- msg(title = name, subt = '', desc = '', opts){
- const toEnvOpts = (rawopts) => {
- if(!rawopts) return rawopts
- if(typeof rawopts === 'string'){
- if(this.isLoon()) return rawopts
- else if(this.isQuanX()) return {
- 'open-url': rawopts
- }
- else if(this.isSurge()) return {
- url: rawopts
- }
- else return undefined
- } else if(typeof rawopts === 'object'){
- if(this.isLoon()){
- let openUrl = rawopts.openUrl || rawopts.url || rawopts['open-url']
- let mediaUrl = rawopts.mediaUrl || rawopts['media-url']
- return {
- openUrl,
- mediaUrl
- }
- } else if(this.isQuanX()){
- let openUrl = rawopts['open-url'] || rawopts.url || rawopts.openUrl
- let mediaUrl = rawopts['media-url'] || rawopts.mediaUrl
- return {
- 'open-url': openUrl,
- 'media-url': mediaUrl
- }
- } else if(this.isSurge()){
- let openUrl = rawopts.url || rawopts.openUrl || rawopts['open-url']
- return {
- url: openUrl
- }
- }
- } else {
- return undefined
- }
- }
- if(!this.isMute){
- if(this.isSurge() || this.isLoon()){
- $notification.post(title, subt, desc, toEnvOpts(opts))
- } else if(this.isQuanX()){
- $notify(title, subt, desc, toEnvOpts(opts))
- }
- }
- if(!this.isMuteLog){
- let logs = ['', '==============📣系统通知📣==============']
- logs.push(title)
- subt ? logs.push(subt) : ''
- desc ? logs.push(desc) : ''
- console.log(logs.join('\n'))
- this.logs = this.logs.concat(logs)
- }
- }
-
- log(...logs){
- if(logs.length > 0){
- this.logs = [...this.logs, ...logs]
- }
- console.log(logs.join(this.logSeparator))
- }
-
- logErr(err, msg){
- const isPrintSack = !this.isSurge() && !this.isQuanX() && !this.isLoon()
- if(!isPrintSack){
- this.log('', `❗️${this.name}, 错误!`, err)
- } else {
- this.log('', `❗️${this.name}, 错误!`, err.stack)
- }
- }
-
- wait(time){
- return new Promise((resolve) => setTimeout(resolve, time))
- }
-
- done(val = {}){
- const endTime = new Date().getTime()
- const costTime = (endTime - this.startTime) / 1000
- this.log('', `🔔${this.name}, 结束! 🕛 ${costTime} 秒`)
- this.log()
- if(this.isSurge() || this.isQuanX() || this.isLoon()){
- $done(val)
- }
- }
- })(name, opts)
- }
-
-
- //我加的函数
- function postToDingTalk(messgae) {
- const dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=18444b555747aad3381bc1d1e3dea72b03158e152a846f818d82a1ca946bd430"
-
- const message1 = "" + messgae
- that.log(messgae)
-
- const body = {
- "msgtype": "markdown",
- "markdown": {
- "title":"动动试用(搞笑版)",
- "text": message1
- },
- "at": {
- "atMobiles": [],
- "isAtAll": false
- }
- }
-
-
- $.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
- try {
- that.log(resp)
- that.log(data)
- if (err) {
- that.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- $.duckRes = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- },"json")
- }
-
-
- function toDingtalk(urlmain, bodyMain) {
- return {
- url: urlmain,
- body:bodyMain,
- headers: { 'Content-Type': 'application/json;charset=utf-8' },
- timeout: 10000,
- }
- }
-
- function getPic(){
- let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
- let address = "\n\n )
- address = address + code[pos] + ")"
- return address
- }
\ No newline at end of file
diff --git a/src/main/resources/test_trytry.js b/src/main/resources/test_trytry.js
deleted file mode 100644
index 2c40dfa..0000000
--- a/src/main/resources/test_trytry.js
+++ /dev/null
@@ -1,1148 +0,0 @@
-/*
- * 由ZCY01二次修改:脚本默认不运行
- * 由 X1a0He 修复:依然保持脚本默认不运行
- * 如需运行请自行添加环境变量:JD_TRY,值填 true 即可运行
- * TG交流群:https://t.me/jd_zero205
- * TG通知频道:https://t.me/jd_zero205_tz
- *
- update 2021/09/05
- 京东试用:脚本更新地址 https://github.com/zero205/JD_tencent_scf/raw/main/jd_try.js
- 脚本兼容: Node.js
- 每天最多关注300个商店,但用户商店关注上限为500个。
- 请配合取关脚本试用,使用 jd_unsubscribe.js 提前取关至少250个商店确保京东试用脚本正常运行。
- *
- * X1a0He留
- * 由于没有兼容Qx,原脚本已失效,建议原脚本的兼容Qx注释删了
- * 脚本是否耗时只看args_xh.maxLength的大小
- * 上一作者说了每天最多300个商店,总上限为500个,jd_unsubscribe.js我已更新为批量取关版
- * 请提前取关至少250个商店确保京东试用脚本正常运行
- * 没有写通知,是否申请成功没有进行通知,但脚本会把状态log出日志
- */
- let dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=d2b6042cb38f0df63e20797c002208d2710104750c18a1dc84d54106a859a3f0"
- let maxSize = 15
- let totalPages = 999999 //总页数
- const $ = new Env('京东试用')
- const URL = 'https://api.m.jd.com/client.action'
- let trialActivityIdList = []
- let trialActivityTitleList = []
- let notifyMsg = ''
- let message = ""
- let maped = {
- 0:[1,5,10],
- 1:[5,1,10],
- 2:[1,10,5],
- 3:[10,5,1],
- 4:[10,5,1],
- 5:[5,10,1]
- }
- let process={
- env:{
- "JD_TRY":"true"
- }
- }
- // default params
- let args_xh = {
- /*
- * 是否进行通知
- * 可设置环境变量:JD_TRY_NOTIFY
- * */
- // isNotify: process.env.JD_TRY_NOTIFY || true,
- // 商品原价,低于这个价格都不会试用
- jdPrice: process.env.JD_TRY_PRICE || 0,
- /*
- * 获取试用商品类型,默认为1
- * 1 - 精选
- * 2 - 闪电试用
- * 3 - 家用电器(可能会有变化)
- * 4 - 手机数码(可能会有变化)
- * 5 - 电脑办公(可能会有变化)
- * 可设置环境变量:JD_TRY_TABID
- * */
- // TODO: tab ids as array(support multi tabIds)
- // tabId: process.env.JD_TRY_TABID && process.env.JD_TRY_TABID.split('@').map(Number) || [1],
- tabId: process.env.JD_TRY_TABID || 1,
- /*
- * 试用商品标题过滤
- * 可设置环境变量:JD_TRY_TITLEFILTERS,关键词与关键词之间用@分隔
- * */
- titleFilters: ["测电笔","测试","请勿下单", "牛舌","儿童玩具枪", "宣纸", "洋娃娃", "口琴","磨砂壳", "亲子互动", "防卫尖刺", "折叠锯子","牙签防水","购物券","材料包","水勺","碎发","整理棒","内裤","莆田官网","蚊香","遥控器","马桶垫","锅铲","电容笔","茶勺","瓜刨","耳钉","茶杯","滤杯","红绳","装修", "钥匙扣","美容院","芦荟","仿真小蛋糕","儿童便捷","遮瑕膏","香水","汽车摆件","水枪","润唇膏","衬衫","中老年","拐杖","牙签盒","电风扇罩","茶杯","袜子","掏耳","爬爬垫","滑板车","格子长袖","牙线","粉扑","粉扑盒子","停车牌","小勺子","爽肤水","防蚊裤","0-12岁","宝宝牙刷","玩具女孩","固定器","润唇膏","商务休闲", "儿童背包","塑料士兵小军人玩具","串珠玩具","儿童串珠玩具", "运势书","背心马甲","示宽灯","收银机","收钱码","空调罩","效果图","米小芽", "抵用券" ,"手工黏土", "儿童拌饭", "伊威", "菲妮小熊", "刀片" ,"割草机", "儿童n95","儿童口罩", "音频线","土工布","抑菌膏","win10","日历","玻璃吊","竖笛","角阀","三角阀","反光镜","倒车","童装","童装男女童","女童裤子","八倍镜","手提秤","电子秤","钓鱼手竿","鱼饵","护栏","栅网","狗链","切割片","汽油锯","滤芯","饲料","九九乘法","铁丝","监狱","隔离网","宝宝玩具车", "成长裤", "女士内裤", "小兔女士", "浮漂", "儿童磨牙饼", "墙纸", "壁纸", "传菜铃" ,"红包封", "光驱","挂绳","增高","宝宝鞋子", "女童裤子", "宝宝牙刷", "童装", "宝宝灯笼裤", "吃饭衣", "围兜", "牙刷收纳盒","安全锤","抛光机","机油","合成机油","铅笔","吸奶器","鱼钩","翻板钩","口罩盒","九九乘除","耐火泥","尼龙网","侧挂式","手术刀","喷雾器","注射器","驱虫","女士内裤,少女内裤","树苗","塑身裤","笼子","捆扎绳","打包绳","捆绑绳","插销","水乳","光和青春","测评","在线直播", "HDMI","LED","SD","SD卡","VGA","hdmi","hpv","led开关电源","windows","一次性","一片装","一盒","万用表","万藓灵","丝袜","中国电信","丰胸","丸","乳液","乳腺","交换","交换机","享底价","亿优信","会员","会员卡","会议杯子","便秘","保健","保护套","保暖女裤","保暖裤","修护","修眉","修眉剪","倒车镜","假睫毛","儿童奶粉","儿童口罩","儿童成长","充电头","充电桩","免钉胶水","养芝堂","内衣","冻干粉","净水剂","减肥","分流","分流器","别针","刮痧","刮痧板","刷牙头","剂","剃须刀配件","削皮刀","前列腺","剥虾","剪","剪钳","办公会议茶杯","办公杯","加温器","包皮","化妆","半身不遂","卡","卡套","卡尺","卡托","卧铺垫","卸妆","卸妆水","压片","参肽片","反光条贴","反光板","反光贴","口红","口腔","口腔抑菌","号码卡","同仁堂","吸顶灯","咬钩","咽炎","哑光","哨","哺乳","哺乳套装","唇釉","啪啪","嚼片","围裙","图钉","地吸","地漏","坐垫","培训","增生贴","墨","墨水","墨盒","墨粉","复合肥","外用","多功能尺子","天线","头","夹","奶瓶","奶粉","妆","妇女","婴","婴儿","孕妇装","学习卡","孩子","安全帽","安全裤","定做","定做榻榻米","定制","宝宝奶粉","宝宝口罩","宝宝成长","实验课","宠物","密封条","小学","尤尖锐湿疣","尺","尼龙管","尿","尿素","尿素霜","屏蔽袋","屏风","工作手册","工作服","巾","带","帽","幕","平衡线","幼儿","幼儿园","幼儿配方","座垫","座套","康复","延时","延迟","延迟喷雾","开果器","彩带","情趣","成人票","手册","手套","手机卡","手机壳","手机维修","打底","打草绳","打钉枪","托","扩音器","把手","护理","护肤","护腿套","护踝","报警器","抽屉轨道","拔毒膏","挂钩","指套","挑逗","挡风","挤奶器","掏耳朵","插座","摄像头镜片","敏感","敏肌","教","教学视频","教材","数据线","文胸","替换头","月子","有机肥","机顶盒","条码","架","染发剂","柔肤水","框","梯","梯子","模具","止痒","毛囊","毛孔","水平仪","水晶头","水龙头","汤勺","汽车脚垫","油漆","泡沫","泡沫胶","泥灸","注射针","泳衣","洁面","洗面","流量卡","浮标","润滑","润颜乳","液","清水剂","清洁","渔具","滤网","漆","漱口水","灯泡","灶台贴纸","烟","烧水棒","热熔胶枪","煤油","燃气报警器","爸爸装","牙刷头","牙刷替换头","牛仔裤","犬粮","狗狗沐浴露","狗粮","猪油","猫咪","猫咪玩具","猫玩具","猫砂","猫粮","玛咖片","玻尿酸","玻璃镜片","玻璃防雾剂","班","理发","用友","甲醛","电池","电缆剪","电话卡","电话牌","男士用品","男童","疣","疮","痉挛","痔疮","瘙痒","皮带","眉笔","眼影","眼镜","眼霜","睡裤","睫毛","矫正","矫正器","矫正带","砂盆","砂纸","硅胶","磨脚","磨脚石","祛斑霜","神露","福来油","空气滤芯","空调滤","窗帘","筒灯","筷子","管","粉刺","粉底","粉饼","精华","精华乳","精油","纱窗","纱网","纳米砖","纸尿裤","纹眉","纹眉色料","线上","线上课程","绑带","维修","维生素","绿幕","绿草皮","美容棒","美工刀","美甲","美缝","美胸","翻身","老人用品","老爷车","老花","考","耳塞","耳罩","职业装","肥佬","肥料","胖子","胶囊","胶带","脚垫","腋毛","腋毛神器","腮红","腰带","膜","自慰","舒缓水","色料","艾条","花萃","葛根","虾青素","蚊帐","蚯蚓粪","蟑螂药","补墙","补水","表带","袋","袖套","裁纸刀","裤头","裸妆","视线盲区贴纸","解码线","训练器","试听课","试用装","课","贴","赠品","足浴粉","车漆","车篓子","车轮","车锁","轨道","转换","转换器","转接","轮胎","轮胎专用胶水","软膏","辅食","运费专拍","连衣裙","适配","适配器","遮挡布","避光垫","避孕套","酒","金属探测","金属探测器","钉子","钙咀嚼片","钢化膜","钢化蛋","钳","铆管","锁精环","镜片","镰刀","长筒袜","门帘","门把手","门槛条","门锁","防撞条","防静电","阴囊","阴部","雨刮","雨披","雨衣","霜","露","青春痘","静电","静脉曲张","非卖品","面膜","鞋垫","鞋带","领结","额头贴","飞机","飞机杯","香薰精油","鱼线","鸭肠","鹿鞭","黄膏贴","鼠标垫","鼻影","鼻毛","鼻毛器","龟头","锯片","单拍不发货","火花塞","红花手套","温度计"],
- // 试用价格(中了要花多少钱),高于这个价格都不会试用,小于等于才会试用
- trialPrice: 0,
- /*
- * 最小提供数量,例如试用商品只提供2份试用资格,当前设置为1,则会进行申请
- * 若只提供5分试用资格,当前设置为10,则不会申请
- * 可设置环境变量:JD_TRY_MINSUPPLYNUM
- * */
- minSupplyNum: 20,
- /*
- * 过滤大于设定值的已申请人数,例如下面设置的1000,A商品已经有1001人申请了,则A商品不会进行申请,会被跳过
- * 可设置环境变量:JD_TRY_APPLYNUMFILTER
- * */
- applyNumFilter: process.env.JD_TRY_APPLYNUMFILTER || 99999,
- /*
- * 商品试用之间和获取商品之间的间隔, 单位:毫秒(1秒=1000毫秒)
- * 可设置环境变量:JD_TRY_APPLYINTERVAL
- * */
- applyInterval: process.env.JD_TRY_APPLYINTERVAL || 5000,
- /*
- * 商品数组的最大长度,通俗来说就是即将申请的商品队列长度
- * 例如设置为20,当第一次获取后获得12件,过滤后剩下5件,将会进行第二次获取,过滤后加上第一次剩余件数
- * 例如是18件,将会进行第三次获取,直到过滤完毕后为20件才会停止,不建议设置太大
- * 可设置环境变量:JD_TRY_MAXLENGTH
- * */
- maxLength: 10
- }
-
- !(async() => {
- // console.log(`\n本脚本默认不运行,也不建议运行\n如需运行请自行添加环境变量:JD_TRY,值填:true\n`)
- await $.wait(1000)
- if(process.env.JD_TRY && process.env.JD_TRY === 'true'){
- await requireConfig()
- if(!$.cookiesArr[0]){
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {
- "open-url": "https://bean.m.jd.com/"
- })
- return
- }
- for(let i = 0; i < $.cookiesArr.length; i++){
- message += "[通知] 试用精选 \n\n --- \n\n"
- if($.cookiesArr[i]){
- $.cookie = $.cookiesArr[i];
- $.UserName = decodeURIComponent($.cookie.match(/pt_pin=(.+?);/) && $.cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await totalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if(!$.isLogin){
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {
- "open-url": "https://bean.m.jd.com/bean/signIndex.action"
- });
- await $.notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- continue
- }
-
- username = $.UserName
- if ($.UserName == "jd_4521b375ebb5d"){
- username = "锟子"
- }
- if ($.UserName == "jd_542c10c0222bc"){
- username = "康子"
- }
- if($.UserName == "jd_66dcb31363ef6"){
- username = "涛子"
- }
- if($.UserName == "18070420956_p"){
- username = "奇怪子"
- }
- if($.UserName == "jd_45d917547c763"){
- username = "跑腿小弟子"
- }
- if ($.UserName == "jd_66ea783827d30"){
- username = "军子"
- }
- if ($.UserName == "jd_4311ac0ff4456"){
- username = "居子"
- }
- maxSize = Math.floor(Math.random() * (10) + 8)
- args_xh.maxLength = Math.floor(Math.random() * (10) + 8)
- let list = maped[Math.floor(Math.random() * (6) + 0)]
- //加上名称
- message = message + "【羊毛姐妹】" + username + " \n\n "
- message = message + "最大页数:" + maxSize + "最大长度:"+ args_xh.maxLength +"申请列表:" + list +" \n\n "
-
- $.totalTry = 0
- $.totalSuccess = 0
- let size = 1;
-
- for (let i =0;i {
- console.log(`❗️ ${$.name} 运行错误!\n${e}`)
- postToDingTalk(e)
- }).finally(() => {
- $.done()
- })
-
-
- function requireConfig(){
- return new Promise(resolve => {
- console.log('开始获取配置文件\n')
- $.notify = $.isNode() ? require('./sendNotify') : { sendNotify: async() => { } }
- //获取 Cookies
- $.cookiesArr = []
- if($.isNode()){
- //Node.js用户请在jdCookie.js处填写京东ck;
- const jdCookieNode = require('./jdCookie.js');
- Object.keys(jdCookieNode).forEach((item) => {
- if(jdCookieNode[item]){
- $.cookiesArr.push(jdCookieNode[item])
- }
- })
- if(process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => { };
- } else {
- //IOS等用户直接用NobyDa的jd $.cookie
- $.cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
- }
- console.log(`共${$.cookiesArr.length}个京东账号\n`)
- for (const key in args_xh) {
- if(typeof args_xh[key] == 'string') {
- args_xh[key] = Number(args_xh[key])
- }
- }
- // console.debug(args_xh)
- resolve()
- })
- }
-
- //获取商品列表并且过滤 By X1a0He
- function try_feedsList(tabId, page){
- return new Promise((resolve, reject) => {
- const body = JSON.stringify({
- "tabId": `${tabId}`,
- "page": page,
- "previewTime": ""
- });
- let option = taskurl_xh('newtry', 'try_feedsList', body)
- $.get(option, (err, resp, data) => {
- try{
- if(err){
- console.log(`🚫 ${arguments.callee.name.toString()} API请求失败,请检查网路\n${JSON.stringify(err)}`)
- } else {
- // console.debug(data)
- // return
- data = JSON.parse(data)
- if(data.success){
- $.totalPages = data.data.pages
- totalPages = $.totalPages
- console.log(`获取到商品 ${data.data.feedList.length} 条\n`)
- for(let i = 0; i < data.data.feedList.length; i++){
- if(trialActivityIdList.length > args_xh.maxLength){
- console.log('商品列表长度已满.结束获取')
- }else
- if(data.data.feedList[i].applyState === 1){
- console.log(`商品已申请试用:${data.data.feedList[i].skuTitle}`)
- continue
- }else
- if(data.data.feedList[i].applyState !== null){
- console.log(`商品状态异常,跳过:${data.data.feedList[i].skuTitle}`)
- continue
- }else
- if(data.data.feedList[i].skuTitle){
- console.log(`检测第 ${page} 页 第 ${i + 1} 个商品\n${data.data.feedList[i].skuTitle}`)
- if(parseFloat(data.data.feedList[i].jdPrice) <= args_xh.jdPrice){
- console.log(`商品被过滤,${data.data.feedList[i].jdPrice} < ${args_xh.jdPrice} \n`)
- }else if(parseFloat(data.data.feedList[i].supplyNum) > args_xh.minSupplyNum && data.data.feedList[i].supplyNum !== null){
- console.log(`商品被过滤,提供申请的份数大于预设申请的份数 \n`)
- }else if(parseFloat(data.data.feedList[i].applyNum) > args_xh.applyNumFilter && data.data.feedList[i].applyNum !== null){
- console.log(`商品被过滤,已申请试用人数大于预设人数 \n`)
- }else if(parseFloat(data.data.feedList[i].trialPrice) > args_xh.trialPrice){
- console.log(`商品被过滤,期待价格高于预设价格 \n`)
- }else if(args_xh.titleFilters.some(fileter_word => data.data.feedList[i].skuTitle.includes(fileter_word))){
- console.log('商品被过滤,含有关键词 \n')
- }else{
- console.log(`商品通过,将加入试用组,trialActivityId为${data.data.feedList[i].trialActivityId}\n`)
- trialActivityIdList.push(data.data.feedList[i].trialActivityId)
- trialActivityTitleList.push(data.data.feedList[i].skuTitle)
- }
- }else{
- console.log('skuTitle解析异常')
- return
- }
- }
- console.log(`当前试用组id如下,长度为:${trialActivityIdList.length}\n${trialActivityIdList}\n`)
- } else {
- console.log(`💩 获得试用列表失败: ${data.message}`)
- }
- }
- } catch(e){
- console.log(e);
- reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`)
- console.log(`${JSON.stringify(data)}`)
- } finally{
- resolve()
- }
- })
- })
- }
-
- function try_apply(title, activityId){
- return new Promise((resolve, reject) => {
- console.log(`申请试用商品中...`)
- console.log(`商品:${title}`)
- console.log(`id为:${activityId}`)
- const body = JSON.stringify({
- "activityId": activityId,
- "previewTime": ""
- });
- let option = taskurl_xh('newtry', 'try_apply', body)
- $.get(option, (err, resp, data) => {
- try{
- if(err){
- console.log(`🚫 ${arguments.callee.name.toString()} API请求失败,请检查网路\n${JSON.stringify(err)}`)
- } else {
- $.totalTry++
- data = JSON.parse(data)
- if(data.success && data.code === "1"){ // 申请成功
- message += "" + title + "\n\n"
- message += "" + `--------` + "\n\n"
- console.log(data.message)
- $.totalSuccess++
- } else if(data.code === "-106"){
- console.log(data.message) // 未在申请时间内!
- } else if(data.code === "-110"){
- console.log(data.message) // 您的申请已成功提交,请勿重复申请…
- } else if(data.code === "-120"){
- console.log(data.message) // 您还不是会员,本品只限会员申请试用,请注册会员后申请!
- } else if(data.code === "-167"){
- console.log(data.message) // 抱歉,此试用需为种草官才能申请。查看下方详情了解更多。
- } else {
- console.log("申请失败", JSON.stringify(data))
- message += "" + JSON.stringify(data) + "\n\n"
- message += "" + `--------` + "\n\n"
- }
- }
- } catch(e){
- console.log(data)
- reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`)
- } finally{
- resolve()
- }
- })
- })
- }
-
- function try_MyTrials(page, selected){
- return new Promise((resolve, reject) => {
- switch(selected){
- case 1:
- console.log('正在获取已申请的商品...')
- break;
- case 2:
- console.log('正在获取申请成功的商品...')
- break;
- case 3:
- console.log('正在获取申请失败的商品...')
- break;
- default:
- console.log('selected错误')
- }
- const body = JSON.stringify({
- "page": page,
- "selected": selected, // 1 - 已申请 2 - 成功列表,3 - 失败列表
- "previewTime": ""
- });
- let option = taskurl_xh('newtry', 'try_MyTrials', body)
- option.headers.Referer = 'https://pro.m.jd.com/'
- $.get(option, (err, resp, data) => {
- try{
- if(err){
- console.log(`🚫 ${arguments.callee.name.toString()} API请求失败,请检查网路\n${JSON.stringify(err)}`)
- } else {
- // console.log(data)
- // return
- data = JSON.parse(data)
- if(data.success){
- //temp adjustment
- if(selected == 2){
- if (data.success && data.data) {
- $.successList = data.data.list.filter(item => {
-
- return item.text.text.includes('试用资格将保留10天')
- })
- console.log(`待领取: ${$.successList.length}个`)
- } else {
- console.log(`获得成功列表失败: ${data.message}`)
- }
- }
-
- if(data.data.list.length > 0){
- let count = 0
- for(let item of data.data.list){
- console.log(`申请时间:${new Date(parseInt(item.applyTime)).toLocaleString()}`)
- console.log(`申请商品:${item.trialName}`)
- console.log(`当前状态:${item.text.text}`)
- console.log(`剩余时间:${remaining(item.leftTime)}`)
- console.log()
-
- if (count < 3){
- message += "" + `申请商品:${item.trialName}` + "\n\n"
- message += "" + `当前状态:${item.text.text}` + "\n\n"
- message += "" + `-----\n\n` + "\n\n"
- count ++
- }
- }
- }
- // else {
- // switch(selected){
- // case 1:
- // console.log('无已申请的商品\n')
- // break;
- // case 2:
- // console.log('无申请成功的商品\n')
- // break;
- // case 3:
- // console.log('无申请失败的商品\n')
- // break;
- // default:
- // console.log('selected错误')
- // }
- // }
- } else {
- console.log(`ERROR:try_MyTrials`)
- }
- }
- } catch(e){
- reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`)
- } finally{
- resolve()
- }
- })
- })
- }
-
- function remaining(time){
- let days = parseInt(time / (1000 * 60 * 60 * 24));
- let hours = parseInt((time % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
- let minutes = parseInt((time % (1000 * 60 * 60)) / (1000 * 60));
- return `${days} 天 ${hours} 小时 ${minutes} 分`
- }
-
- function taskurl_xh(appid, functionId, body = JSON.stringify({})){
- return {
- "url": `${URL}?appid=${appid}&functionId=${functionId}&clientVersion=10.1.2&client=wh5&body=${encodeURIComponent(body)}`,
- 'headers': {
- 'Host': 'api.m.jd.com',
- 'Accept-Encoding': 'gzip, deflate, br',
- 'Cookie': $.cookie,
- 'Connection': 'keep-alive',
- 'UserAgent': 'jdapp;iPhone;10.1.2;15.0;ff2caa92a8529e4788a34b3d8d4df66d9573f499;network/wifi;model/iPhone13,4;addressid/2074196292;appBuild/167802;jdSupportDarkMode/1;Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
- 'Accept-Language': 'zh-cn',
- 'Referer': 'https://prodev.m.jd.com/'
- },
- }
- }
-
- async function showMsg(){
- let message1 = `京东账号${$.index} ${$.nickName || $.UserName}\n🎉 本次申请:${$.totalSuccess}/${$.totalTry}个商品🛒\n🎉 ${$.successList.length}个商品待领取`
- message += "" + `🎉 本次申请:${$.totalSuccess}/${$.totalTry}个商品🛒\n🎉 ${$.successList.length}个商品待领取` + "\n\n"
- if(!args_xh.jdNotify || args_xh.jdNotify === 'false'){
- $.msg($.name, ``, message1, {
- "open-url": 'https://try.m.jd.com/user'
- })
- if($.isNode())
- notifyMsg += `${message1}\n\n`
- } else {
- console.log(message1)
- }
- }
-
- function totalBean(){
- return new Promise(async resolve => {
- const options = {
- "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
- "headers": {
- "Accept": "application/json,text/plain, */*",
- "Content-Type": "application/x-www-form-urlencoded",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-cn",
- "Connection": "keep-alive",
- "Cookie": $.cookie,
- "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.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")
- },
- "timeout": 10000,
- }
- $.post(options, (err, resp, data) => {
- try{
- if(err){
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if(data){
- data = JSON.parse(data);
- if(data['retcode'] === 13){
- $.isLogin = false; //cookie过期
- return
- }
- if(data['retcode'] === 0){
- $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
- } else {
- $.nickName = $.UserName
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch(e){
- $.logErr(e, resp)
- } finally{
- resolve();
- }
- })
- })
- }
-
- function jsonParse(str){
- if(typeof str == "string"){
- try{
- return JSON.parse(str);
- } catch(e){
- console.log(e);
- $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
- return [];
- }
- }
- }
-
- // 来自 @chavyleung 大佬
- // https://raw.githubusercontent.com/chavyleung/scripts/master/Env.js
- function Env(name, opts){
- class Http{
- constructor(env){
- this.env = env
- }
-
- send(opts, method = 'GET'){
- opts = typeof opts === 'string' ? {
- url: opts
- } : opts
- let sender = this.get
- if(method === 'POST'){
- sender = this.post
- }
- return new Promise((resolve, reject) => {
- sender.call(this, opts, (err, resp, body) => {
- if(err) reject(err)
- else resolve(resp)
- })
- })
- }
-
- get(opts){
- return this.send.call(this.env, opts)
- }
-
- post(opts){
- return this.send.call(this.env, opts, 'POST')
- }
- }
-
- return new (class{
- constructor(name, opts){
- this.name = name
- this.http = new Http(this)
- this.data = null
- this.dataFile = 'box.dat'
- this.logs = []
- this.isMute = false
- this.isNeedRewrite = false
- this.logSeparator = '\n'
- this.startTime = new Date().getTime()
- Object.assign(this, opts)
- 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(str, defaultValue = null){
- try{
- return JSON.parse(str)
- } catch{
- return defaultValue
- }
- }
-
- toStr(obj, defaultValue = null){
- try{
- return JSON.stringify(obj)
- } catch{
- return defaultValue
- }
- }
-
- getjson(key, defaultValue){
- let json = defaultValue
- const val = this.getdata(key)
- if(val){
- try{
- json = JSON.parse(this.getdata(key))
- } catch{ }
- }
- return json
- }
-
- setjson(val, key){
- try{
- return this.setdata(JSON.stringify(val), key)
- } catch{
- return false
- }
- }
-
- getScript(url){
- return new Promise((resolve) => {
- this.get({
- url
- }, (err, resp, body) => resolve(body))
- })
- }
-
- runScript(script, runOpts){
- return new Promise((resolve) => {
- let httpapi = this.getdata('@chavy_boxjs_userCfgs.httpapi')
- httpapi = httpapi ? httpapi.replace(/\n/g, '').trim() : httpapi
- let httpapi_timeout = this.getdata('@chavy_boxjs_userCfgs.httpapi_timeout')
- httpapi_timeout = httpapi_timeout ? httpapi_timeout * 1 : 20
- httpapi_timeout = runOpts && runOpts.timeout ? runOpts.timeout : httpapi_timeout
- const [key, addr] = httpapi.split('@')
- const opts = {
- url: `http://${addr}/v1/scripting/evaluate`,
- body: {
- script_text: script,
- mock_type: 'cron',
- timeout: httpapi_timeout
- },
- headers: {
- 'X-Key': key,
- 'Accept': '*/*'
- }
- }
- this.post(opts, (err, resp, body) => resolve(body))
- }).catch((e) => this.logErr(e))
- }
-
- loaddata(){
- if(this.isNode()){
- this.fs = this.fs ? this.fs : require('fs')
- this.path = this.path ? this.path : require('path')
- const curDirDataFilePath = this.path.resolve(this.dataFile)
- const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile)
- const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath)
- const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath)
- if(isCurDirDataFile || isRootDirDataFile){
- const datPath = isCurDirDataFile ? curDirDataFilePath : rootDirDataFilePath
- try{
- return JSON.parse(this.fs.readFileSync(datPath))
- } catch(e){
- return {}
- }
- } else return {}
- } else return {}
- }
-
- writedata(){
- if(this.isNode()){
- this.fs = this.fs ? this.fs : require('fs')
- this.path = this.path ? this.path : require('path')
- const curDirDataFilePath = this.path.resolve(this.dataFile)
- const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile)
- const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath)
- const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath)
- const jsondata = JSON.stringify(this.data)
- if(isCurDirDataFile){
- this.fs.writeFileSync(curDirDataFilePath, jsondata)
- } else if(isRootDirDataFile){
- this.fs.writeFileSync(rootDirDataFilePath, jsondata)
- } else {
- this.fs.writeFileSync(curDirDataFilePath, jsondata)
- }
- }
- }
-
- lodash_get(source, path, defaultValue = undefined){
- const paths = path.replace(/\[(\d+)\]/g, '.$1').split('.')
- let result = source
- for(const p of paths){
- result = Object(result)[p]
- if(result === undefined){
- return defaultValue
- }
- }
- return result
- }
-
- lodash_set(obj, path, value){
- if(Object(obj) !== obj) return obj
- if(!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || []
- path.slice(0, -1).reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[
- path[path.length - 1]
- ] = value
- return obj
- }
-
- getdata(key){
- let val = this.getval(key)
- // 如果以 @
- if(/^@/.test(key)){
- const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key)
- const objval = objkey ? this.getval(objkey) : ''
- if(objval){
- try{
- const objedval = JSON.parse(objval)
- val = objedval ? this.lodash_get(objedval, paths, '') : val
- } catch(e){
- val = ''
- }
- }
- }
- return val
- }
-
- setdata(val, key){
- let issuc = false
- if(/^@/.test(key)){
- const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key)
- const objdat = this.getval(objkey)
- const objval = objkey ? (objdat === 'null' ? null : objdat || '{}') : '{}'
- try{
- const objedval = JSON.parse(objval)
- this.lodash_set(objedval, paths, val)
- issuc = this.setval(JSON.stringify(objedval), objkey)
- } catch(e){
- const objedval = {}
- this.lodash_set(objedval, paths, val)
- issuc = this.setval(JSON.stringify(objedval), objkey)
- }
- } else {
- issuc = this.setval(val, key)
- }
- return issuc
- }
-
- getval(key){
- if(this.isSurge() || this.isLoon()){
- return $persistentStore.read(key)
- } else if(this.isQuanX()){
- return $prefs.valueForKey(key)
- } else if(this.isNode()){
- this.data = this.loaddata()
- return this.data[key]
- } else {
- return (this.data && this.data[key]) || null
- }
- }
-
- setval(val, key){
- if(this.isSurge() || this.isLoon()){
- return $persistentStore.write(val, key)
- } else if(this.isQuanX()){
- return $prefs.setValueForKey(val, key)
- } else if(this.isNode()){
- this.data = this.loaddata()
- this.data[key] = val
- this.writedata()
- return true
- } else {
- return (this.data && this.data[key]) || null
- }
- }
-
- initGotEnv(opts){
- 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()
- if(opts){
- opts.headers = opts.headers ? opts.headers : {}
- if(undefined === opts.headers.Cookie && undefined === opts.cookieJar){
- opts.cookieJar = this.ckjar
- }
- }
- }
-
- get(opts, callback = () => { }){
- if(opts.headers){
- delete opts.headers['Content-Type']
- delete opts.headers['Content-Length']
- }
- if(this.isSurge() || this.isLoon()){
- if(this.isSurge() && this.isNeedRewrite){
- opts.headers = opts.headers || {}
- Object.assign(opts.headers, {
- 'X-Surge-Skip-Scripting': false
- })
- }
- $httpClient.get(opts, (err, resp, body) => {
- if(!err && resp){
- resp.body = body
- resp.statusCode = resp.status
- }
- callback(err, resp, body)
- })
- } else if(this.isQuanX()){
- if(this.isNeedRewrite){
- opts.opts = opts.opts || {}
- Object.assign(opts.opts, {
- hints: false
- })
- }
- $task.fetch(opts).then(
- (resp) => {
- const {
- statusCode: status,
- statusCode,
- headers,
- body
- } = resp
- callback(null, {
- status,
- statusCode,
- headers,
- body
- }, body)
- },
- (err) => callback(err)
- )
- } else if(this.isNode()){
- this.initGotEnv(opts)
- this.got(opts).on('redirect', (resp, nextOpts) => {
- try{
- if(resp.headers['set-cookie']){
- const ck = resp.headers['set-cookie'].map(this.cktough.Cookie.parse).toString()
- if(ck){
- this.ckjar.setCookieSync(ck, null)
- }
- nextOpts.cookieJar = this.ckjar
- }
- } catch(e){
- this.logErr(e)
- }
- // this.ckjar.setCookieSync(resp.headers['set-cookie'].map(Cookie.parse).toString())
- }).then(
- (resp) => {
- const {
- statusCode: status,
- statusCode,
- headers,
- body
- } = resp
- callback(null, {
- status,
- statusCode,
- headers,
- body
- }, body)
- },
- (err) => {
- const {
- message: error,
- response: resp
- } = err
- callback(error, resp, resp && resp.body)
- }
- )
- }
- }
-
- post(opts, callback = () => { }){
- // 如果指定了请求体, 但没指定`Content-Type`, 则自动生成
- if(opts.body && opts.headers && !opts.headers['Content-Type']){
- opts.headers['Content-Type'] = 'application/x-www-form-urlencoded'
- }
- if(opts.headers) delete opts.headers['Content-Length']
- if(this.isSurge() || this.isLoon()){
- if(this.isSurge() && this.isNeedRewrite){
- opts.headers = opts.headers || {}
- Object.assign(opts.headers, {
- 'X-Surge-Skip-Scripting': false
- })
- }
- $httpClient.post(opts, (err, resp, body) => {
- if(!err && resp){
- resp.body = body
- resp.statusCode = resp.status
- }
- callback(err, resp, body)
- })
- } else if(this.isQuanX()){
- opts.method = 'POST'
- if(this.isNeedRewrite){
- opts.opts = opts.opts || {}
- Object.assign(opts.opts, {
- hints: false
- })
- }
- $task.fetch(opts).then(
- (resp) => {
- const {
- statusCode: status,
- statusCode,
- headers,
- body
- } = resp
- callback(null, {
- status,
- statusCode,
- headers,
- body
- }, body)
- },
- (err) => callback(err)
- )
- } else if(this.isNode()){
- this.initGotEnv(opts)
- const {
- url,
- ..._opts
- } = opts
- this.got.post(url, _opts).then(
- (resp) => {
- const {
- statusCode: status,
- statusCode,
- headers,
- body
- } = resp
- callback(null, {
- status,
- statusCode,
- headers,
- body
- }, body)
- },
- (err) => {
- const {
- message: error,
- response: resp
- } = err
- callback(error, resp, resp && resp.body)
- }
- )
- }
- }
-
- /**
- *
- * 示例:$.time('yyyy-MM-dd qq HH:mm:ss.S')
- * :$.time('yyyyMMddHHmmssS')
- * y:年 M:月 d:日 q:季 H:时 m:分 s:秒 S:毫秒
- * 其中y可选0-4位占位符、S可选0-1位占位符,其余可选0-2位占位符
- * @param {*} fmt 格式化参数
- *
- */
- time(fmt){
- let o = {
- '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()
- }
- if(/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (new Date().getFullYear() + '').substr(4 - RegExp.$1.length))
- for(let k in o)
- if(new RegExp('(' + k + ')').test(fmt))
- fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
- return fmt
- }
-
- /**
- * 系统通知
- *
- * > 通知参数: 同时支持 QuanX 和 Loon 两种格式, EnvJs根据运行环境自动转换, Surge 环境不支持多媒体通知
- *
- * 示例:
- * $.msg(title, subt, desc, 'twitter://')
- * $.msg(title, subt, desc, { 'open-url': 'twitter://', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' })
- * $.msg(title, subt, desc, { 'open-url': 'https://bing.com', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' })
- *
- * @param {*} title 标题
- * @param {*} subt 副标题
- * @param {*} desc 通知详情
- * @param {*} opts 通知参数
- *
- */
- msg(title = name, subt = '', desc = '', opts){
- const toEnvOpts = (rawopts) => {
- if(!rawopts) return rawopts
- if(typeof rawopts === 'string'){
- if(this.isLoon()) return rawopts
- else if(this.isQuanX()) return {
- 'open-url': rawopts
- }
- else if(this.isSurge()) return {
- url: rawopts
- }
- else return undefined
- } else if(typeof rawopts === 'object'){
- if(this.isLoon()){
- let openUrl = rawopts.openUrl || rawopts.url || rawopts['open-url']
- let mediaUrl = rawopts.mediaUrl || rawopts['media-url']
- return {
- openUrl,
- mediaUrl
- }
- } else if(this.isQuanX()){
- let openUrl = rawopts['open-url'] || rawopts.url || rawopts.openUrl
- let mediaUrl = rawopts['media-url'] || rawopts.mediaUrl
- return {
- 'open-url': openUrl,
- 'media-url': mediaUrl
- }
- } else if(this.isSurge()){
- let openUrl = rawopts.url || rawopts.openUrl || rawopts['open-url']
- return {
- url: openUrl
- }
- }
- } else {
- return undefined
- }
- }
- if(!this.isMute){
- if(this.isSurge() || this.isLoon()){
- $notification.post(title, subt, desc, toEnvOpts(opts))
- } else if(this.isQuanX()){
- $notify(title, subt, desc, toEnvOpts(opts))
- }
- }
- if(!this.isMuteLog){
- let logs = ['', '==============📣系统通知📣==============']
- logs.push(title)
- subt ? logs.push(subt) : ''
- desc ? logs.push(desc) : ''
- console.log(logs.join('\n'))
- this.logs = this.logs.concat(logs)
- }
- }
-
- log(...logs){
- if(logs.length > 0){
- this.logs = [...this.logs, ...logs]
- }
- console.log(logs.join(this.logSeparator))
- }
-
- logErr(err, msg){
- const isPrintSack = !this.isSurge() && !this.isQuanX() && !this.isLoon()
- if(!isPrintSack){
- this.log('', `❗️${this.name}, 错误!`, err)
- } else {
- this.log('', `❗️${this.name}, 错误!`, err.stack)
- }
- }
-
- wait(time){
- return new Promise((resolve) => setTimeout(resolve, time))
- }
-
- done(val = {}){
- const endTime = new Date().getTime()
- const costTime = (endTime - this.startTime) / 1000
- this.log('', `🔔${this.name}, 结束! 🕛 ${costTime} 秒`)
- this.log()
- if(this.isSurge() || this.isQuanX() || this.isLoon()){
- $done(val)
- }
- }
- })(name, opts)
- }
-
-
- //我加的函数
- function postToDingTalk(messgae) {
- const message1 = "" + messgae
- // that.log(messgae)
-
- const body = {
- "msgtype": "markdown",
- "markdown": {
- "title":"试用精选",
- "text": message1
- },
- "at": {
- "atMobiles": [],
- "isAtAll": true
- }
- }
-
-
- $.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
- try {
- that.log(resp)
- that.log(data)
- if (err) {
- that.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- $.duckRes = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- },"json")
- }
-
-
- function toDingtalk(urlmain, bodyMain) {
- return {
- url: urlmain,
- body:bodyMain,
- headers: { 'Content-Type': 'application/json;charset=utf-8' },
- timeout: 10000,
- }
- }
-
- function getPic(){
- let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
- let address = "\n\n )
- address = address + code[pos] + ")"
- return address
- }
\ No newline at end of file
diff --git a/src/main/resources/test_trytry1.js b/src/main/resources/test_trytry1.js
deleted file mode 100644
index 3021d00..0000000
--- a/src/main/resources/test_trytry1.js
+++ /dev/null
@@ -1,1148 +0,0 @@
-/*
- * 由ZCY01二次修改:脚本默认不运行
- * 由 X1a0He 修复:依然保持脚本默认不运行
- * 如需运行请自行添加环境变量:JD_TRY,值填 true 即可运行
- * TG交流群:https://t.me/jd_zero205
- * TG通知频道:https://t.me/jd_zero205_tz
- *
- update 2021/09/05
- 京东试用:脚本更新地址 https://github.com/zero205/JD_tencent_scf/raw/main/jd_try.js
- 脚本兼容: Node.js
- 每天最多关注300个商店,但用户商店关注上限为500个。
- 请配合取关脚本试用,使用 jd_unsubscribe.js 提前取关至少250个商店确保京东试用脚本正常运行。
- *
- * X1a0He留
- * 由于没有兼容Qx,原脚本已失效,建议原脚本的兼容Qx注释删了
- * 脚本是否耗时只看args_xh.maxLength的大小
- * 上一作者说了每天最多300个商店,总上限为500个,jd_unsubscribe.js我已更新为批量取关版
- * 请提前取关至少250个商店确保京东试用脚本正常运行
- * 没有写通知,是否申请成功没有进行通知,但脚本会把状态log出日志
- */
-
- let dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=d2b6042cb38f0df63e20797c002208d2710104750c18a1dc84d54106a859a3f0"
- let maxSize = 15
- let totalPages = 999999 //总页数
- const $ = new Env('京东试用')
- const URL = 'https://api.m.jd.com/client.action'
- let trialActivityIdList = []
- let trialActivityTitleList = []
- let notifyMsg = ''
- let message = ""
- let maped = {
- 0:[2,8,11],
- 1:[8,2,11],
- 2:[2,11,8],
- 3:[8,11,2],
- 4:[11,8,2],
- 5:[11,2,8]
- }
- let process={
- env:{
- "JD_TRY":"true"
- }
- }
- // default params
- let args_xh = {
- /*
- * 是否进行通知
- * 可设置环境变量:JD_TRY_NOTIFY
- * */
- // isNotify: process.env.JD_TRY_NOTIFY || true,
- // 商品原价,低于这个价格都不会试用
- jdPrice: process.env.JD_TRY_PRICE || 0,
- /*
- * 获取试用商品类型,默认为1
- * 1 - 精选
- * 2 - 闪电试用
- * 3 - 家用电器(可能会有变化)
- * 4 - 手机数码(可能会有变化)
- * 5 - 电脑办公(可能会有变化)
- * 可设置环境变量:JD_TRY_TABID
- * */
- // TODO: tab ids as array(support multi tabIds)
- // tabId: process.env.JD_TRY_TABID && process.env.JD_TRY_TABID.split('@').map(Number) || [1],
- tabId: process.env.JD_TRY_TABID || 1,
- /*
- * 试用商品标题过滤
- * 可设置环境变量:JD_TRY_TITLEFILTERS,关键词与关键词之间用@分隔
- * */
- titleFilters: ["测电笔","测试","请勿下单", "牛舌","儿童玩具枪", "宣纸", "洋娃娃", "口琴","磨砂壳", "亲子互动", "防卫尖刺", "折叠锯子","牙签防水","购物券","材料包","水勺","碎发","整理棒","内裤","莆田官网","蚊香","遥控器","马桶垫","锅铲","电容笔","茶勺","瓜刨","耳钉","茶杯","滤杯","红绳","装修", "钥匙扣", "美容院","芦荟","仿真小蛋糕","儿童便捷","遮瑕膏","香水","汽车摆件","水枪","润唇膏","衬衫","中老年","拐杖","牙签盒","电风扇罩","茶杯","袜子","掏耳","爬爬垫","滑板车","格子长袖","牙线","粉扑","粉扑盒子","停车牌","小勺子","爽肤水","防蚊裤","0-12岁","宝宝牙刷","玩具女孩","固定器","润唇膏","商务休闲", "儿童背包","塑料士兵小军人玩具","串珠玩具","儿童串珠玩具", "运势书","背心马甲","示宽灯","收银机","收钱码","空调罩","效果图","米小芽", "抵用券" ,"手工黏土", "儿童拌饭", "伊威", "菲妮小熊", "刀片" ,"割草机", "儿童n95","儿童口罩", "音频线","土工布","抑菌膏","win10","日历","玻璃吊","竖笛","角阀","三角阀","反光镜","倒车","童装","童装男女童","女童裤子","八倍镜","手提秤","电子秤","钓鱼手竿","鱼饵","护栏","栅网","狗链","切割片","汽油锯","滤芯","饲料","九九乘法","铁丝","监狱","隔离网","宝宝玩具车", "成长裤", "女士内裤", "小兔女士", "浮漂", "儿童磨牙饼", "墙纸", "壁纸", "传菜铃" ,"红包封", "光驱","挂绳","增高","宝宝鞋子", "女童裤子", "宝宝牙刷", "童装", "宝宝灯笼裤", "吃饭衣", "围兜", "牙刷收纳盒","安全锤","抛光机","机油","合成机油","铅笔","吸奶器","鱼钩","翻板钩","口罩盒","九九乘除","耐火泥","尼龙网","侧挂式","手术刀","喷雾器","注射器","驱虫","女士内裤,少女内裤","树苗","塑身裤","笼子","捆扎绳","打包绳","捆绑绳","插销","水乳","光和青春","测评","在线直播", "HDMI","LED","SD","SD卡","VGA","hdmi","hpv","led开关电源","windows","一次性","一片装","一盒","万用表","万藓灵","丝袜","中国电信","丰胸","丸","乳液","乳腺","交换","交换机","享底价","亿优信","会员","会员卡","会议杯子","便秘","保健","保护套","保暖女裤","保暖裤","修护","修眉","修眉剪","倒车镜","假睫毛","儿童奶粉","儿童口罩","儿童成长","充电头","充电桩","免钉胶水","养芝堂","内衣","冻干粉","净水剂","减肥","分流","分流器","别针","刮痧","刮痧板","刷牙头","剂","剃须刀配件","削皮刀","前列腺","剥虾","剪","剪钳","办公会议茶杯","办公杯","加温器","包皮","化妆","半身不遂","卡","卡套","卡尺","卡托","卧铺垫","卸妆","卸妆水","压片","参肽片","反光条贴","反光板","反光贴","口红","口腔","口腔抑菌","号码卡","同仁堂","吸顶灯","咬钩","咽炎","哑光","哨","哺乳","哺乳套装","唇釉","啪啪","嚼片","围裙","图钉","地吸","地漏","坐垫","培训","增生贴","墨","墨水","墨盒","墨粉","复合肥","外用","多功能尺子","天线","头","夹","奶瓶","奶粉","妆","妇女","婴","婴儿","孕妇装","学习卡","孩子","安全帽","安全裤","定做","定做榻榻米","定制","宝宝奶粉","宝宝口罩","宝宝成长","实验课","宠物","密封条","小学","尤尖锐湿疣","尺","尼龙管","尿","尿素","尿素霜","屏蔽袋","屏风","工作手册","工作服","巾","带","帽","幕","平衡线","幼儿","幼儿园","幼儿配方","座垫","座套","康复","延时","延迟","延迟喷雾","开果器","彩带","情趣","成人票","手册","手套","手机卡","手机壳","手机维修","打底","打草绳","打钉枪","托","扩音器","把手","护理","护肤","护腿套","护踝","报警器","抽屉轨道","拔毒膏","挂钩","指套","挑逗","挡风","挤奶器","掏耳朵","插座","摄像头镜片","敏感","敏肌","教","教学视频","教材","数据线","文胸","替换头","月子","有机肥","机顶盒","条码","架","染发剂","柔肤水","框","梯","梯子","模具","止痒","毛囊","毛孔","水平仪","水晶头","水龙头","汤勺","汽车脚垫","油漆","泡沫","泡沫胶","泥灸","注射针","泳衣","洁面","洗面","流量卡","浮标","润滑","润颜乳","液","清水剂","清洁","渔具","滤网","漆","漱口水","灯泡","灶台贴纸","烟","烧水棒","热熔胶枪","煤油","燃气报警器","爸爸装","牙刷头","牙刷替换头","牛仔裤","犬粮","狗狗沐浴露","狗粮","猪油","猫咪","猫咪玩具","猫玩具","猫砂","猫粮","玛咖片","玻尿酸","玻璃镜片","玻璃防雾剂","班","理发","用友","甲醛","电池","电缆剪","电话卡","电话牌","男士用品","男童","疣","疮","痉挛","痔疮","瘙痒","皮带","眉笔","眼影","眼镜","眼霜","睡裤","睫毛","矫正","矫正器","矫正带","砂盆","砂纸","硅胶","磨脚","磨脚石","祛斑霜","神露","福来油","空气滤芯","空调滤","窗帘","筒灯","筷子","管","粉刺","粉底","粉饼","精华","精华乳","精油","纱窗","纱网","纳米砖","纸尿裤","纹眉","纹眉色料","线上","线上课程","绑带","维修","维生素","绿幕","绿草皮","美容棒","美工刀","美甲","美缝","美胸","翻身","老人用品","老爷车","老花","考","耳塞","耳罩","职业装","肥佬","肥料","胖子","胶囊","胶带","脚垫","腋毛","腋毛神器","腮红","腰带","膜","自慰","舒缓水","色料","艾条","花萃","葛根","虾青素","蚊帐","蚯蚓粪","蟑螂药","补墙","补水","表带","袋","袖套","裁纸刀","裤头","裸妆","视线盲区贴纸","解码线","训练器","试听课","试用装","课","贴","赠品","足浴粉","车漆","车篓子","车轮","车锁","轨道","转换","转换器","转接","轮胎","轮胎专用胶水","软膏","辅食","运费专拍","连衣裙","适配","适配器","遮挡布","避光垫","避孕套","酒","金属探测","金属探测器","钉子","钙咀嚼片","钢化膜","钢化蛋","钳","铆管","锁精环","镜片","镰刀","长筒袜","门帘","门把手","门槛条","门锁","防撞条","防静电","阴囊","阴部","雨刮","雨披","雨衣","霜","露","青春痘","静电","静脉曲张","非卖品","面膜","鞋垫","鞋带","领结","额头贴","飞机","飞机杯","香薰精油","鱼线","鸭肠","鹿鞭","黄膏贴","鼠标垫","鼻影","鼻毛","鼻毛器","龟头","锯片","单拍不发货","火花塞","红花手套","温度计"],
- // 试用价格(中了要花多少钱),高于这个价格都不会试用,小于等于才会试用
- trialPrice: 0,
- /*
- * 最小提供数量,例如试用商品只提供2份试用资格,当前设置为1,则会进行申请
- * 若只提供5分试用资格,当前设置为10,则不会申请
- * 可设置环境变量:JD_TRY_MINSUPPLYNUM
- * */
- minSupplyNum:20,
- /*
- * 过滤大于设定值的已申请人数,例如下面设置的1000,A商品已经有1001人申请了,则A商品不会进行申请,会被跳过
- * 可设置环境变量:JD_TRY_APPLYNUMFILTER
- * */
- applyNumFilter: process.env.JD_TRY_APPLYNUMFILTER || 99999,
- /*
- * 商品试用之间和获取商品之间的间隔, 单位:毫秒(1秒=1000毫秒)
- * 可设置环境变量:JD_TRY_APPLYINTERVAL
- * */
- applyInterval: process.env.JD_TRY_APPLYINTERVAL || 5000,
- /*
- * 商品数组的最大长度,通俗来说就是即将申请的商品队列长度
- * 例如设置为20,当第一次获取后获得12件,过滤后剩下5件,将会进行第二次获取,过滤后加上第一次剩余件数
- * 例如是18件,将会进行第三次获取,直到过滤完毕后为20件才会停止,不建议设置太大
- * 可设置环境变量:JD_TRY_MAXLENGTH
- * */
- maxLength: 10
- }
-
- !(async() => {
- // console.log(`\n本脚本默认不运行,也不建议运行\n如需运行请自行添加环境变量:JD_TRY,值填:true\n`)
- await $.wait(1000)
- if(process.env.JD_TRY && process.env.JD_TRY === 'true'){
- await requireConfig()
- if(!$.cookiesArr[0]){
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {
- "open-url": "https://bean.m.jd.com/"
- })
- return
- }
- for(let i = 0; i < $.cookiesArr.length; i++){
- message += "[通知] 试用生鲜美食 \n\n --- \n\n"
- if($.cookiesArr[i]){
- $.cookie = $.cookiesArr[i];
- $.UserName = decodeURIComponent($.cookie.match(/pt_pin=(.+?);/) && $.cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await totalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if(!$.isLogin){
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {
- "open-url": "https://bean.m.jd.com/bean/signIndex.action"
- });
- await $.notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- continue
- }
-
- username = $.UserName
- if ($.UserName == "jd_4521b375ebb5d"){
- username = "锟子"
- }
- if ($.UserName == "jd_542c10c0222bc"){
- username = "康子"
- }
- if($.UserName == "jd_66dcb31363ef6"){
- username = "涛子"
- }
- if($.UserName == "18070420956_p"){
- username = "奇怪子"
- }
- if($.UserName == "jd_45d917547c763"){
- username = "跑腿小弟子"
- }
- if ($.UserName == "jd_66ea783827d30"){
- username = "军子"
- }
- if ($.UserName == "jd_4311ac0ff4456"){
- username = "居子"
- }
- maxSize = Math.floor(Math.random() * (10) + 8)
- args_xh.maxLength = Math.floor(Math.random() * (10) + 8)
- let list = maped[Math.floor(Math.random() * (6) + 0)]
- //加上名称
- message = message + "【羊毛姐妹】" + username + " \n\n "
- message = message + "最大页数:" + maxSize + "最大长度:"+ args_xh.maxLength +"申请列表:" + list +" \n\n "
-
- $.totalTry = 0
- $.totalSuccess = 0
- let size = 1;
-
- for (let i =0;i {
- console.log(`❗️ ${$.name} 运行错误!\n${e}`)
- postToDingTalk(e)
- }).finally(() => {
- $.done()
- })
-
- function requireConfig(){
- return new Promise(resolve => {
- console.log('开始获取配置文件\n')
- $.notify = $.isNode() ? require('./sendNotify') : { sendNotify: async() => { } }
- //获取 Cookies
- $.cookiesArr = []
- if($.isNode()){
- //Node.js用户请在jdCookie.js处填写京东ck;
- const jdCookieNode = require('./jdCookie.js');
- Object.keys(jdCookieNode).forEach((item) => {
- if(jdCookieNode[item]){
- $.cookiesArr.push(jdCookieNode[item])
- }
- })
- if(process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => { };
- } else {
- //IOS等用户直接用NobyDa的jd $.cookie
- $.cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
- }
- console.log(`共${$.cookiesArr.length}个京东账号\n`)
- for (const key in args_xh) {
- if(typeof args_xh[key] == 'string') {
- args_xh[key] = Number(args_xh[key])
- }
- }
- // console.debug(args_xh)
- resolve()
- })
- }
-
- //获取商品列表并且过滤 By X1a0He
- function try_feedsList(tabId, page){
- return new Promise((resolve, reject) => {
- const body = JSON.stringify({
- "tabId": `${tabId}`,
- "page": page,
- "previewTime": ""
- });
- let option = taskurl_xh('newtry', 'try_feedsList', body)
- $.get(option, (err, resp, data) => {
- try{
- if(err){
- console.log(`🚫 ${arguments.callee.name.toString()} API请求失败,请检查网路\n${JSON.stringify(err)}`)
- } else {
- // console.debug(data)
- // return
- data = JSON.parse(data)
- if(data.success){
- $.totalPages = data.data.pages
- totalPages = $.totalPages
- console.log(`获取到商品 ${data.data.feedList.length} 条\n`)
- for(let i = 0; i < data.data.feedList.length; i++){
- if(trialActivityIdList.length > args_xh.maxLength){
- console.log('商品列表长度已满.结束获取')
- }else
- if(data.data.feedList[i].applyState === 1){
- console.log(`商品已申请试用:${data.data.feedList[i].skuTitle}`)
- continue
- }else
- if(data.data.feedList[i].applyState !== null){
- console.log(`商品状态异常,跳过:${data.data.feedList[i].skuTitle}`)
- continue
- }else
- if(data.data.feedList[i].skuTitle){
- console.log(`检测第 ${page} 页 第 ${i + 1} 个商品\n${data.data.feedList[i].skuTitle}`)
- if(parseFloat(data.data.feedList[i].jdPrice) <= args_xh.jdPrice){
- console.log(`商品被过滤,${data.data.feedList[i].jdPrice} < ${args_xh.jdPrice} \n`)
- }else if(parseFloat(data.data.feedList[i].supplyNum) > args_xh.minSupplyNum && data.data.feedList[i].supplyNum !== null){
- console.log(`商品被过滤,提供申请的份数大于预设申请的份数 \n`)
- }else if(parseFloat(data.data.feedList[i].applyNum) > args_xh.applyNumFilter && data.data.feedList[i].applyNum !== null){
- console.log(`商品被过滤,已申请试用人数大于预设人数 \n`)
- }else if(parseFloat(data.data.feedList[i].trialPrice) > args_xh.trialPrice){
- console.log(`商品被过滤,期待价格高于预设价格 \n`)
- }else if(args_xh.titleFilters.some(fileter_word => data.data.feedList[i].skuTitle.includes(fileter_word))){
- console.log('商品被过滤,含有关键词 \n')
- }else{
- console.log(`商品通过,将加入试用组,trialActivityId为${data.data.feedList[i].trialActivityId}\n`)
- trialActivityIdList.push(data.data.feedList[i].trialActivityId)
- trialActivityTitleList.push(data.data.feedList[i].skuTitle)
- }
- }else{
- console.log('skuTitle解析异常')
- return
- }
- }
- console.log(`当前试用组id如下,长度为:${trialActivityIdList.length}\n${trialActivityIdList}\n`)
- } else {
- console.log(`💩 获得试用列表失败: ${data.message}`)
- }
- }
- } catch(e){
- console.log(e);
- reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`)
- console.log(`${JSON.stringify(data)}`)
- } finally{
- resolve()
- }
- })
- })
- }
-
- function try_apply(title, activityId){
- return new Promise((resolve, reject) => {
- console.log(`申请试用商品中...`)
- console.log(`商品:${title}`)
- console.log(`id为:${activityId}`)
- const body = JSON.stringify({
- "activityId": activityId,
- "previewTime": ""
- });
- let option = taskurl_xh('newtry', 'try_apply', body)
- $.get(option, (err, resp, data) => {
- try{
- if(err){
- console.log(`🚫 ${arguments.callee.name.toString()} API请求失败,请检查网路\n${JSON.stringify(err)}`)
- } else {
- $.totalTry++
- data = JSON.parse(data)
- if(data.success && data.code === "1"){ // 申请成功
- message += "" + title + "\n\n"
- message += "" + `--------` + "\n\n"
- console.log(data.message)
- $.totalSuccess++
- } else if(data.code === "-106"){
- console.log(data.message) // 未在申请时间内!
- } else if(data.code === "-110"){
- console.log(data.message) // 您的申请已成功提交,请勿重复申请…
- } else if(data.code === "-120"){
- console.log(data.message) // 您还不是会员,本品只限会员申请试用,请注册会员后申请!
- } else if(data.code === "-167"){
- console.log(data.message) // 抱歉,此试用需为种草官才能申请。查看下方详情了解更多。
- } else {
- console.log("申请失败", JSON.stringify(data))
- message += "" + JSON.stringify(data) + "\n\n"
- message += "" + `--------` + "\n\n"
- }
- }
- } catch(e){
- reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`)
- } finally{
- resolve()
- }
- })
- })
- }
-
- function try_MyTrials(page, selected){
- return new Promise((resolve, reject) => {
- switch(selected){
- case 1:
- console.log('正在获取已申请的商品...')
- break;
- case 2:
- console.log('正在获取申请成功的商品...')
- break;
- case 3:
- console.log('正在获取申请失败的商品...')
- break;
- default:
- console.log('selected错误')
- }
- const body = JSON.stringify({
- "page": page,
- "selected": selected, // 1 - 已申请 2 - 成功列表,3 - 失败列表
- "previewTime": ""
- });
- let option = taskurl_xh('newtry', 'try_MyTrials', body)
- option.headers.Referer = 'https://pro.m.jd.com/'
- $.get(option, (err, resp, data) => {
- try{
- if(err){
- console.log(`🚫 ${arguments.callee.name.toString()} API请求失败,请检查网路\n${JSON.stringify(err)}`)
- } else {
- // console.log(data)
- // return
- data = JSON.parse(data)
- if(data.success){
- //temp adjustment
- if(selected == 2){
- if (data.success && data.data) {
- $.successList = data.data.list.filter(item => {
-
- return item.text.text.includes('试用资格将保留10天')
- })
- console.log(`待领取: ${$.successList.length}个`)
- } else {
- console.log(`获得成功列表失败: ${data.message}`)
- }
- }
- if(data.data.list.length > 0){
- let count = 0
- for(let item of data.data.list){
- console.log(`申请时间:${new Date(parseInt(item.applyTime)).toLocaleString()}`)
- console.log(`申请商品:${item.trialName}`)
- console.log(`当前状态:${item.text.text}`)
- console.log(`剩余时间:${remaining(item.leftTime)}`)
- console.log()
-
-
- if (count < 3){
- message += "" + `申请商品:${item.trialName}` + "\n\n"
- message += "" + `当前状态:${item.text.text}` + "\n\n"
- message += "" + `-----\n\n` + "\n\n"
- count ++
- }
-
- }
- }
- // else {
- // switch(selected){
- // case 1:
- // console.log('无已申请的商品\n')
- // break;
- // case 2:
- // console.log('无申请成功的商品\n')
- // break;
- // case 3:
- // console.log('无申请失败的商品\n')
- // break;
- // default:
- // console.log('selected错误')
- // }
- // }
- } else {
- console.log(`ERROR:try_MyTrials`)
- }
- }
- } catch(e){
- reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`)
- } finally{
- resolve()
- }
- })
- })
- }
-
- function remaining(time){
- let days = parseInt(time / (1000 * 60 * 60 * 24));
- let hours = parseInt((time % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
- let minutes = parseInt((time % (1000 * 60 * 60)) / (1000 * 60));
- return `${days} 天 ${hours} 小时 ${minutes} 分`
- }
-
- function taskurl_xh(appid, functionId, body = JSON.stringify({})){
- return {
- "url": `${URL}?appid=${appid}&functionId=${functionId}&clientVersion=10.1.2&client=wh5&body=${encodeURIComponent(body)}`,
- 'headers': {
- 'Host': 'api.m.jd.com',
- 'Accept-Encoding': 'gzip, deflate, br',
- 'Cookie': $.cookie,
- 'Connection': 'keep-alive',
- 'UserAgent': 'jdapp;iPhone;10.1.2;15.0;ff2caa92a8529e4788a34b3d8d4df66d9573f499;network/wifi;model/iPhone13,4;addressid/2074196292;appBuild/167802;jdSupportDarkMode/1;Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
- 'Accept-Language': 'zh-cn',
- 'Referer': 'https://prodev.m.jd.com/'
- },
- }
- }
-
- async function showMsg(){
- let message1 = `京东账号${$.index} ${$.nickName || $.UserName}\n🎉 本次申请:${$.totalSuccess}/${$.totalTry}个商品🛒\n🎉 ${$.successList.length}个商品待领取`
- message += "" + `🎉 本次申请:${$.totalSuccess}/${$.totalTry}个商品🛒\n🎉 ${$.successList.length}个商品待领取` + "\n\n"
- if(!args_xh.jdNotify || args_xh.jdNotify === 'false'){
- $.msg($.name, ``, message1, {
- "open-url": 'https://try.m.jd.com/user'
- })
- if($.isNode())
- notifyMsg += `${message1}\n\n`
- } else {
- console.log(message1)
- }
- }
-
- function totalBean(){
- return new Promise(async resolve => {
- const options = {
- "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
- "headers": {
- "Accept": "application/json,text/plain, */*",
- "Content-Type": "application/x-www-form-urlencoded",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-cn",
- "Connection": "keep-alive",
- "Cookie": $.cookie,
- "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.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")
- },
- "timeout": 10000,
- }
- $.post(options, (err, resp, data) => {
- try{
- if(err){
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if(data){
- data = JSON.parse(data);
- if(data['retcode'] === 13){
- $.isLogin = false; //cookie过期
- return
- }
- if(data['retcode'] === 0){
- $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
- } else {
- $.nickName = $.UserName
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch(e){
- $.logErr(e, resp)
- } finally{
- resolve();
- }
- })
- })
- }
-
- function jsonParse(str){
- if(typeof str == "string"){
- try{
- return JSON.parse(str);
- } catch(e){
- console.log(e);
- $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
- return [];
- }
- }
- }
-
- // 来自 @chavyleung 大佬
- // https://raw.githubusercontent.com/chavyleung/scripts/master/Env.js
- function Env(name, opts){
- class Http{
- constructor(env){
- this.env = env
- }
-
- send(opts, method = 'GET'){
- opts = typeof opts === 'string' ? {
- url: opts
- } : opts
- let sender = this.get
- if(method === 'POST'){
- sender = this.post
- }
- return new Promise((resolve, reject) => {
- sender.call(this, opts, (err, resp, body) => {
- if(err) reject(err)
- else resolve(resp)
- })
- })
- }
-
- get(opts){
- return this.send.call(this.env, opts)
- }
-
- post(opts){
- return this.send.call(this.env, opts, 'POST')
- }
- }
-
- return new (class{
- constructor(name, opts){
- this.name = name
- this.http = new Http(this)
- this.data = null
- this.dataFile = 'box.dat'
- this.logs = []
- this.isMute = false
- this.isNeedRewrite = false
- this.logSeparator = '\n'
- this.startTime = new Date().getTime()
- Object.assign(this, opts)
- 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(str, defaultValue = null){
- try{
- return JSON.parse(str)
- } catch{
- return defaultValue
- }
- }
-
- toStr(obj, defaultValue = null){
- try{
- return JSON.stringify(obj)
- } catch{
- return defaultValue
- }
- }
-
- getjson(key, defaultValue){
- let json = defaultValue
- const val = this.getdata(key)
- if(val){
- try{
- json = JSON.parse(this.getdata(key))
- } catch{ }
- }
- return json
- }
-
- setjson(val, key){
- try{
- return this.setdata(JSON.stringify(val), key)
- } catch{
- return false
- }
- }
-
- getScript(url){
- return new Promise((resolve) => {
- this.get({
- url
- }, (err, resp, body) => resolve(body))
- })
- }
-
- runScript(script, runOpts){
- return new Promise((resolve) => {
- let httpapi = this.getdata('@chavy_boxjs_userCfgs.httpapi')
- httpapi = httpapi ? httpapi.replace(/\n/g, '').trim() : httpapi
- let httpapi_timeout = this.getdata('@chavy_boxjs_userCfgs.httpapi_timeout')
- httpapi_timeout = httpapi_timeout ? httpapi_timeout * 1 : 20
- httpapi_timeout = runOpts && runOpts.timeout ? runOpts.timeout : httpapi_timeout
- const [key, addr] = httpapi.split('@')
- const opts = {
- url: `http://${addr}/v1/scripting/evaluate`,
- body: {
- script_text: script,
- mock_type: 'cron',
- timeout: httpapi_timeout
- },
- headers: {
- 'X-Key': key,
- 'Accept': '*/*'
- }
- }
- this.post(opts, (err, resp, body) => resolve(body))
- }).catch((e) => this.logErr(e))
- }
-
- loaddata(){
- if(this.isNode()){
- this.fs = this.fs ? this.fs : require('fs')
- this.path = this.path ? this.path : require('path')
- const curDirDataFilePath = this.path.resolve(this.dataFile)
- const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile)
- const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath)
- const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath)
- if(isCurDirDataFile || isRootDirDataFile){
- const datPath = isCurDirDataFile ? curDirDataFilePath : rootDirDataFilePath
- try{
- return JSON.parse(this.fs.readFileSync(datPath))
- } catch(e){
- return {}
- }
- } else return {}
- } else return {}
- }
-
- writedata(){
- if(this.isNode()){
- this.fs = this.fs ? this.fs : require('fs')
- this.path = this.path ? this.path : require('path')
- const curDirDataFilePath = this.path.resolve(this.dataFile)
- const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile)
- const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath)
- const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath)
- const jsondata = JSON.stringify(this.data)
- if(isCurDirDataFile){
- this.fs.writeFileSync(curDirDataFilePath, jsondata)
- } else if(isRootDirDataFile){
- this.fs.writeFileSync(rootDirDataFilePath, jsondata)
- } else {
- this.fs.writeFileSync(curDirDataFilePath, jsondata)
- }
- }
- }
-
- lodash_get(source, path, defaultValue = undefined){
- const paths = path.replace(/\[(\d+)\]/g, '.$1').split('.')
- let result = source
- for(const p of paths){
- result = Object(result)[p]
- if(result === undefined){
- return defaultValue
- }
- }
- return result
- }
-
- lodash_set(obj, path, value){
- if(Object(obj) !== obj) return obj
- if(!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || []
- path.slice(0, -1).reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[
- path[path.length - 1]
- ] = value
- return obj
- }
-
- getdata(key){
- let val = this.getval(key)
- // 如果以 @
- if(/^@/.test(key)){
- const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key)
- const objval = objkey ? this.getval(objkey) : ''
- if(objval){
- try{
- const objedval = JSON.parse(objval)
- val = objedval ? this.lodash_get(objedval, paths, '') : val
- } catch(e){
- val = ''
- }
- }
- }
- return val
- }
-
- setdata(val, key){
- let issuc = false
- if(/^@/.test(key)){
- const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key)
- const objdat = this.getval(objkey)
- const objval = objkey ? (objdat === 'null' ? null : objdat || '{}') : '{}'
- try{
- const objedval = JSON.parse(objval)
- this.lodash_set(objedval, paths, val)
- issuc = this.setval(JSON.stringify(objedval), objkey)
- } catch(e){
- const objedval = {}
- this.lodash_set(objedval, paths, val)
- issuc = this.setval(JSON.stringify(objedval), objkey)
- }
- } else {
- issuc = this.setval(val, key)
- }
- return issuc
- }
-
- getval(key){
- if(this.isSurge() || this.isLoon()){
- return $persistentStore.read(key)
- } else if(this.isQuanX()){
- return $prefs.valueForKey(key)
- } else if(this.isNode()){
- this.data = this.loaddata()
- return this.data[key]
- } else {
- return (this.data && this.data[key]) || null
- }
- }
-
- setval(val, key){
- if(this.isSurge() || this.isLoon()){
- return $persistentStore.write(val, key)
- } else if(this.isQuanX()){
- return $prefs.setValueForKey(val, key)
- } else if(this.isNode()){
- this.data = this.loaddata()
- this.data[key] = val
- this.writedata()
- return true
- } else {
- return (this.data && this.data[key]) || null
- }
- }
-
- initGotEnv(opts){
- 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()
- if(opts){
- opts.headers = opts.headers ? opts.headers : {}
- if(undefined === opts.headers.Cookie && undefined === opts.cookieJar){
- opts.cookieJar = this.ckjar
- }
- }
- }
-
- get(opts, callback = () => { }){
- if(opts.headers){
- delete opts.headers['Content-Type']
- delete opts.headers['Content-Length']
- }
- if(this.isSurge() || this.isLoon()){
- if(this.isSurge() && this.isNeedRewrite){
- opts.headers = opts.headers || {}
- Object.assign(opts.headers, {
- 'X-Surge-Skip-Scripting': false
- })
- }
- $httpClient.get(opts, (err, resp, body) => {
- if(!err && resp){
- resp.body = body
- resp.statusCode = resp.status
- }
- callback(err, resp, body)
- })
- } else if(this.isQuanX()){
- if(this.isNeedRewrite){
- opts.opts = opts.opts || {}
- Object.assign(opts.opts, {
- hints: false
- })
- }
- $task.fetch(opts).then(
- (resp) => {
- const {
- statusCode: status,
- statusCode,
- headers,
- body
- } = resp
- callback(null, {
- status,
- statusCode,
- headers,
- body
- }, body)
- },
- (err) => callback(err)
- )
- } else if(this.isNode()){
- this.initGotEnv(opts)
- this.got(opts).on('redirect', (resp, nextOpts) => {
- try{
- if(resp.headers['set-cookie']){
- const ck = resp.headers['set-cookie'].map(this.cktough.Cookie.parse).toString()
- if(ck){
- this.ckjar.setCookieSync(ck, null)
- }
- nextOpts.cookieJar = this.ckjar
- }
- } catch(e){
- this.logErr(e)
- }
- // this.ckjar.setCookieSync(resp.headers['set-cookie'].map(Cookie.parse).toString())
- }).then(
- (resp) => {
- const {
- statusCode: status,
- statusCode,
- headers,
- body
- } = resp
- callback(null, {
- status,
- statusCode,
- headers,
- body
- }, body)
- },
- (err) => {
- const {
- message: error,
- response: resp
- } = err
- callback(error, resp, resp && resp.body)
- }
- )
- }
- }
-
- post(opts, callback = () => { }){
- // 如果指定了请求体, 但没指定`Content-Type`, 则自动生成
- if(opts.body && opts.headers && !opts.headers['Content-Type']){
- opts.headers['Content-Type'] = 'application/x-www-form-urlencoded'
- }
- if(opts.headers) delete opts.headers['Content-Length']
- if(this.isSurge() || this.isLoon()){
- if(this.isSurge() && this.isNeedRewrite){
- opts.headers = opts.headers || {}
- Object.assign(opts.headers, {
- 'X-Surge-Skip-Scripting': false
- })
- }
- $httpClient.post(opts, (err, resp, body) => {
- if(!err && resp){
- resp.body = body
- resp.statusCode = resp.status
- }
- callback(err, resp, body)
- })
- } else if(this.isQuanX()){
- opts.method = 'POST'
- if(this.isNeedRewrite){
- opts.opts = opts.opts || {}
- Object.assign(opts.opts, {
- hints: false
- })
- }
- $task.fetch(opts).then(
- (resp) => {
- const {
- statusCode: status,
- statusCode,
- headers,
- body
- } = resp
- callback(null, {
- status,
- statusCode,
- headers,
- body
- }, body)
- },
- (err) => callback(err)
- )
- } else if(this.isNode()){
- this.initGotEnv(opts)
- const {
- url,
- ..._opts
- } = opts
- this.got.post(url, _opts).then(
- (resp) => {
- const {
- statusCode: status,
- statusCode,
- headers,
- body
- } = resp
- callback(null, {
- status,
- statusCode,
- headers,
- body
- }, body)
- },
- (err) => {
- const {
- message: error,
- response: resp
- } = err
- callback(error, resp, resp && resp.body)
- }
- )
- }
- }
-
- /**
- *
- * 示例:$.time('yyyy-MM-dd qq HH:mm:ss.S')
- * :$.time('yyyyMMddHHmmssS')
- * y:年 M:月 d:日 q:季 H:时 m:分 s:秒 S:毫秒
- * 其中y可选0-4位占位符、S可选0-1位占位符,其余可选0-2位占位符
- * @param {*} fmt 格式化参数
- *
- */
- time(fmt){
- let o = {
- '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()
- }
- if(/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (new Date().getFullYear() + '').substr(4 - RegExp.$1.length))
- for(let k in o)
- if(new RegExp('(' + k + ')').test(fmt))
- fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
- return fmt
- }
-
- /**
- * 系统通知
- *
- * > 通知参数: 同时支持 QuanX 和 Loon 两种格式, EnvJs根据运行环境自动转换, Surge 环境不支持多媒体通知
- *
- * 示例:
- * $.msg(title, subt, desc, 'twitter://')
- * $.msg(title, subt, desc, { 'open-url': 'twitter://', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' })
- * $.msg(title, subt, desc, { 'open-url': 'https://bing.com', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' })
- *
- * @param {*} title 标题
- * @param {*} subt 副标题
- * @param {*} desc 通知详情
- * @param {*} opts 通知参数
- *
- */
- msg(title = name, subt = '', desc = '', opts){
- const toEnvOpts = (rawopts) => {
- if(!rawopts) return rawopts
- if(typeof rawopts === 'string'){
- if(this.isLoon()) return rawopts
- else if(this.isQuanX()) return {
- 'open-url': rawopts
- }
- else if(this.isSurge()) return {
- url: rawopts
- }
- else return undefined
- } else if(typeof rawopts === 'object'){
- if(this.isLoon()){
- let openUrl = rawopts.openUrl || rawopts.url || rawopts['open-url']
- let mediaUrl = rawopts.mediaUrl || rawopts['media-url']
- return {
- openUrl,
- mediaUrl
- }
- } else if(this.isQuanX()){
- let openUrl = rawopts['open-url'] || rawopts.url || rawopts.openUrl
- let mediaUrl = rawopts['media-url'] || rawopts.mediaUrl
- return {
- 'open-url': openUrl,
- 'media-url': mediaUrl
- }
- } else if(this.isSurge()){
- let openUrl = rawopts.url || rawopts.openUrl || rawopts['open-url']
- return {
- url: openUrl
- }
- }
- } else {
- return undefined
- }
- }
- if(!this.isMute){
- if(this.isSurge() || this.isLoon()){
- $notification.post(title, subt, desc, toEnvOpts(opts))
- } else if(this.isQuanX()){
- $notify(title, subt, desc, toEnvOpts(opts))
- }
- }
- if(!this.isMuteLog){
- let logs = ['', '==============📣系统通知📣==============']
- logs.push(title)
- subt ? logs.push(subt) : ''
- desc ? logs.push(desc) : ''
- console.log(logs.join('\n'))
- this.logs = this.logs.concat(logs)
- }
- }
-
- log(...logs){
- if(logs.length > 0){
- this.logs = [...this.logs, ...logs]
- }
- console.log(logs.join(this.logSeparator))
- }
-
- logErr(err, msg){
- const isPrintSack = !this.isSurge() && !this.isQuanX() && !this.isLoon()
- if(!isPrintSack){
- this.log('', `❗️${this.name}, 错误!`, err)
- } else {
- this.log('', `❗️${this.name}, 错误!`, err.stack)
- }
- }
-
- wait(time){
- return new Promise((resolve) => setTimeout(resolve, time))
- }
-
- done(val = {}){
- const endTime = new Date().getTime()
- const costTime = (endTime - this.startTime) / 1000
- this.log('', `🔔${this.name}, 结束! 🕛 ${costTime} 秒`)
- this.log()
- if(this.isSurge() || this.isQuanX() || this.isLoon()){
- $done(val)
- }
- }
- })(name, opts)
- }
-
-
- //我加的函数
- function postToDingTalk(messgae) {
- const message1 = "" + messgae
- // that.log(messgae)
-
- const body = {
- "msgtype": "markdown",
- "markdown": {
- "title":"试用生鲜美食",
- "text": message1
- },
- "at": {
- "atMobiles": [],
- "isAtAll": false
- }
- }
-
-
- $.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
- try {
- that.log(resp)
- that.log(data)
- if (err) {
- that.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- $.duckRes = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- },"json")
- }
-
-
- function toDingtalk(urlmain, bodyMain) {
- return {
- url: urlmain,
- body:bodyMain,
- headers: { 'Content-Type': 'application/json;charset=utf-8' },
- timeout: 10000,
- }
- }
-
- function getPic(){
- let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
- let address = "\n\n )
- address = address + code[pos] + ")"
- return address
- }
\ No newline at end of file
diff --git a/src/main/resources/test_trytry2.js b/src/main/resources/test_trytry2.js
deleted file mode 100644
index 5d1d6f5..0000000
--- a/src/main/resources/test_trytry2.js
+++ /dev/null
@@ -1,1146 +0,0 @@
-/*
- * 由ZCY01二次修改:脚本默认不运行
- * 由 X1a0He 修复:依然保持脚本默认不运行
- * 如需运行请自行添加环境变量:JD_TRY,值填 true 即可运行
- * TG交流群:https://t.me/jd_zero205
- * TG通知频道:https://t.me/jd_zero205_tz
- *
- update 2021/09/05
- 京东试用:脚本更新地址 https://github.com/zero205/JD_tencent_scf/raw/main/jd_try.js
- 脚本兼容: Node.js
- 每天最多关注300个商店,但用户商店关注上限为500个。
- 请配合取关脚本试用,使用 jd_unsubscribe.js 提前取关至少250个商店确保京东试用脚本正常运行。
- *
- * X1a0He留
- * 由于没有兼容Qx,原脚本已失效,建议原脚本的兼容Qx注释删了
- * 脚本是否耗时只看args_xh.maxLength的大小
- * 上一作者说了每天最多300个商店,总上限为500个,jd_unsubscribe.js我已更新为批量取关版
- * 请提前取关至少250个商店确保京东试用脚本正常运行
- * 没有写通知,是否申请成功没有进行通知,但脚本会把状态log出日志
- */
-
- let dingtalk = "https://oapi.dingtalk.com/robot/send?access_token=d2b6042cb38f0df63e20797c002208d2710104750c18a1dc84d54106a859a3f0"
- let maxSize = 15
- let totalPages = 999999 //总页数
- const $ = new Env('京东试用')
- const URL = 'https://api.m.jd.com/client.action'
- let trialActivityIdList = []
- let trialActivityTitleList = []
- let notifyMsg = ''
- let message = ""
- let maped = {
- 0:[3,9,15],
- 1:[9,15,3],
- 2:[3,15,9],
- 3:[15,3,9],
- 4:[9,3,15],
- 5:[15,9,3]
- }
- let process={
- env:{
- "JD_TRY":"true"
- }
- }
- // default params
- let args_xh = {
- /*
- * 是否进行通知
- * 可设置环境变量:JD_TRY_NOTIFY
- * */
- // isNotify: process.env.JD_TRY_NOTIFY || true,
- // 商品原价,低于这个价格都不会试用
- jdPrice: process.env.JD_TRY_PRICE || 0,
- /*
- * 获取试用商品类型,默认为1
- * 1 - 精选
- * 2 - 闪电试用
- * 3 - 家用电器(可能会有变化)
- * 4 - 手机数码(可能会有变化)
- * 5 - 电脑办公(可能会有变化)
- * 可设置环境变量:JD_TRY_TABID
- * */
- // TODO: tab ids as array(support multi tabIds)
- // tabId: process.env.JD_TRY_TABID && process.env.JD_TRY_TABID.split('@').map(Number) || [1],
- tabId: process.env.JD_TRY_TABID || 1,
- /*
- * 试用商品标题过滤
- * 可设置环境变量:JD_TRY_TITLEFILTERS,关键词与关键词之间用@分隔
- * */
- titleFilters: ["测电笔","测试","请勿下单", "牛舌","儿童玩具枪", "宣纸", "洋娃娃", "口琴","磨砂壳", "亲子互动", "防卫尖刺","折叠锯子","牙签防水","购物券","材料包","水勺","碎发","整理棒","内裤","莆田官网","蚊香","遥控器","马桶垫","锅铲","电容笔","茶勺","瓜刨","耳钉","茶杯","滤杯","红绳","装修", "钥匙扣","美容院","芦荟","仿真小蛋糕","儿童便捷","遮瑕膏","香水","汽车摆件","水枪","润唇膏","衬衫","中老年","拐杖","牙签盒","电风扇罩","茶杯","袜子","掏耳","爬爬垫","滑板车","格子长袖","牙线","粉扑","粉扑盒子","停车牌","小勺子","爽肤水","防蚊裤","0-12岁","宝宝牙刷","玩具女孩","固定器","润唇膏","商务休闲", "儿童背包","塑料士兵小军人玩具","串珠玩具","儿童串珠玩具", "运势书","背心马甲","示宽灯","收银机","收钱码","空调罩","效果图","米小芽", "抵用券" ,"手工黏土", "儿童拌饭", "伊威", "菲妮小熊", "刀片" ,"割草机", "儿童n95","儿童口罩", "音频线","土工布","抑菌膏","win10","日历","玻璃吊","竖笛","角阀","三角阀","反光镜","倒车","童装","童装男女童","女童裤子","八倍镜","手提秤","电子秤","钓鱼手竿","鱼饵","护栏","栅网","狗链","切割片","汽油锯","滤芯","饲料","九九乘法","铁丝","监狱","隔离网","宝宝玩具车", "成长裤", "女士内裤", "小兔女士", "浮漂", "儿童磨牙饼", "墙纸", "壁纸", "传菜铃" ,"红包封", "光驱","挂绳","增高","宝宝鞋子", "女童裤子", "宝宝牙刷", "童装", "宝宝灯笼裤", "吃饭衣", "围兜", "牙刷收纳盒","安全锤","抛光机","机油","合成机油","铅笔","吸奶器","鱼钩","翻板钩","口罩盒","九九乘除","耐火泥","尼龙网","侧挂式","手术刀","喷雾器","注射器","驱虫","女士内裤,少女内裤","树苗","塑身裤","笼子","捆扎绳","打包绳","捆绑绳","插销","水乳","光和青春","测评","在线直播", "HDMI","LED","SD","SD卡","VGA","hdmi","hpv","led开关电源","windows","一次性","一片装","一盒","万用表","万藓灵","丝袜","中国电信","丰胸","丸","乳液","乳腺","交换","交换机","享底价","亿优信","会员","会员卡","会议杯子","便秘","保健","保护套","保暖女裤","保暖裤","修护","修眉","修眉剪","倒车镜","假睫毛","儿童奶粉","儿童口罩","儿童成长","充电头","充电桩","免钉胶水","养芝堂","内衣","冻干粉","净水剂","减肥","分流","分流器","别针","刮痧","刮痧板","刷牙头","剂","剃须刀配件","削皮刀","前列腺","剥虾","剪","剪钳","办公会议茶杯","办公杯","加温器","包皮","化妆","半身不遂","卡","卡套","卡尺","卡托","卧铺垫","卸妆","卸妆水","压片","参肽片","反光条贴","反光板","反光贴","口红","口腔","口腔抑菌","号码卡","同仁堂","吸顶灯","咬钩","咽炎","哑光","哨","哺乳","哺乳套装","唇釉","啪啪","嚼片","围裙","图钉","地吸","地漏","坐垫","培训","增生贴","墨","墨水","墨盒","墨粉","复合肥","外用","多功能尺子","天线","头","夹","奶瓶","奶粉","妆","妇女","婴","婴儿","孕妇装","学习卡","孩子","安全帽","安全裤","定做","定做榻榻米","定制","宝宝奶粉","宝宝口罩","宝宝成长","实验课","宠物","密封条","小学","尤尖锐湿疣","尺","尼龙管","尿","尿素","尿素霜","屏蔽袋","屏风","工作手册","工作服","巾","带","帽","幕","平衡线","幼儿","幼儿园","幼儿配方","座垫","座套","康复","延时","延迟","延迟喷雾","开果器","彩带","情趣","成人票","手册","手套","手机卡","手机壳","手机维修","打底","打草绳","打钉枪","托","扩音器","把手","护理","护肤","护腿套","护踝","报警器","抽屉轨道","拔毒膏","挂钩","指套","挑逗","挡风","挤奶器","掏耳朵","插座","摄像头镜片","敏感","敏肌","教","教学视频","教材","数据线","文胸","替换头","月子","有机肥","机顶盒","条码","架","染发剂","柔肤水","框","梯","梯子","模具","止痒","毛囊","毛孔","水平仪","水晶头","水龙头","汤勺","汽车脚垫","油漆","泡沫","泡沫胶","泥灸","注射针","泳衣","洁面","洗面","流量卡","浮标","润滑","润颜乳","液","清水剂","清洁","渔具","滤网","漆","漱口水","灯泡","灶台贴纸","烟","烧水棒","热熔胶枪","煤油","燃气报警器","爸爸装","牙刷头","牙刷替换头","牛仔裤","犬粮","狗狗沐浴露","狗粮","猪油","猫咪","猫咪玩具","猫玩具","猫砂","猫粮","玛咖片","玻尿酸","玻璃镜片","玻璃防雾剂","班","理发","用友","甲醛","电池","电缆剪","电话卡","电话牌","男士用品","男童","疣","疮","痉挛","痔疮","瘙痒","皮带","眉笔","眼影","眼镜","眼霜","睡裤","睫毛","矫正","矫正器","矫正带","砂盆","砂纸","硅胶","磨脚","磨脚石","祛斑霜","神露","福来油","空气滤芯","空调滤","窗帘","筒灯","筷子","管","粉刺","粉底","粉饼","精华","精华乳","精油","纱窗","纱网","纳米砖","纸尿裤","纹眉","纹眉色料","线上","线上课程","绑带","维修","维生素","绿幕","绿草皮","美容棒","美工刀","美甲","美缝","美胸","翻身","老人用品","老爷车","老花","考","耳塞","耳罩","职业装","肥佬","肥料","胖子","胶囊","胶带","脚垫","腋毛","腋毛神器","腮红","腰带","膜","自慰","舒缓水","色料","艾条","花萃","葛根","虾青素","蚊帐","蚯蚓粪","蟑螂药","补墙","补水","表带","袋","袖套","裁纸刀","裤头","裸妆","视线盲区贴纸","解码线","训练器","试听课","试用装","课","贴","赠品","足浴粉","车漆","车篓子","车轮","车锁","轨道","转换","转换器","转接","轮胎","轮胎专用胶水","软膏","辅食","运费专拍","连衣裙","适配","适配器","遮挡布","避光垫","避孕套","酒","金属探测","金属探测器","钉子","钙咀嚼片","钢化膜","钢化蛋","钳","铆管","锁精环","镜片","镰刀","长筒袜","门帘","门把手","门槛条","门锁","防撞条","防静电","阴囊","阴部","雨刮","雨披","雨衣","霜","露","青春痘","静电","静脉曲张","非卖品","面膜","鞋垫","鞋带","领结","额头贴","飞机","飞机杯","香薰精油","鱼线","鸭肠","鹿鞭","黄膏贴","鼠标垫","鼻影","鼻毛","鼻毛器","龟头","锯片","单拍不发货","火花塞","红花手套","温度计"],
- // 试用价格(中了要花多少钱),高于这个价格都不会试用,小于等于才会试用
- trialPrice: 0,
- /*
- * 最小提供数量,例如试用商品只提供2份试用资格,当前设置为1,则会进行申请
- * 若只提供5分试用资格,当前设置为10,则不会申请
- * 可设置环境变量:JD_TRY_MINSUPPLYNUM
- * */
- minSupplyNum:20,
- /*
- * 过滤大于设定值的已申请人数,例如下面设置的1000,A商品已经有1001人申请了,则A商品不会进行申请,会被跳过
- * 可设置环境变量:JD_TRY_APPLYNUMFILTER
- * */
- applyNumFilter: process.env.JD_TRY_APPLYNUMFILTER || 99999,
- /*
- * 商品试用之间和获取商品之间的间隔, 单位:毫秒(1秒=1000毫秒)
- * 可设置环境变量:JD_TRY_APPLYINTERVAL
- * */
- applyInterval: process.env.JD_TRY_APPLYINTERVAL || 5000,
- /*
- * 商品数组的最大长度,通俗来说就是即将申请的商品队列长度
- * 例如设置为20,当第一次获取后获得12件,过滤后剩下5件,将会进行第二次获取,过滤后加上第一次剩余件数
- * 例如是18件,将会进行第三次获取,直到过滤完毕后为20件才会停止,不建议设置太大
- * 可设置环境变量:JD_TRY_MAXLENGTH
- * */
- maxLength: 10
- }
-
- !(async() => {
- // console.log(`\n本脚本默认不运行,也不建议运行\n如需运行请自行添加环境变量:JD_TRY,值填:true\n`)
- await $.wait(1000)
- if(process.env.JD_TRY && process.env.JD_TRY === 'true'){
- await requireConfig()
- if(!$.cookiesArr[0]){
- $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {
- "open-url": "https://bean.m.jd.com/"
- })
- return
- }
- for(let i = 0; i < $.cookiesArr.length; i++){
- message += "[通知] 闪电试用 \n\n --- \n\n"
- if($.cookiesArr[i]){
- $.cookie = $.cookiesArr[i];
- $.UserName = decodeURIComponent($.cookie.match(/pt_pin=(.+?);/) && $.cookie.match(/pt_pin=(.+?);/)[1])
- $.index = i + 1;
- $.isLogin = true;
- $.nickName = '';
- await totalBean();
- console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
- if(!$.isLogin){
- $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {
- "open-url": "https://bean.m.jd.com/bean/signIndex.action"
- });
- await $.notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
- continue
- }
-
- username = $.UserName
- if ($.UserName == "jd_4521b375ebb5d"){
- username = "锟子"
- }
- if ($.UserName == "jd_542c10c0222bc"){
- username = "康子"
- }
- if($.UserName == "jd_66dcb31363ef6"){
- username = "涛子"
- }
- if($.UserName == "18070420956_p"){
- username = "奇怪子"
- }
- if($.UserName == "jd_45d917547c763"){
- username = "跑腿小弟子"
- }
- if ($.UserName == "jd_66ea783827d30"){
- username = "军子"
- }
- if ($.UserName == "jd_4311ac0ff4456"){
- username = "居子"
- }
- maxSize = Math.floor(Math.random() * (10) + 8)
- args_xh.maxLength = Math.floor(Math.random() * (10) + 8)
- let list = maped[Math.floor(Math.random() * (6) + 0)]
- //加上名称
- message = message + "【羊毛姐妹】" + username + " \n\n "
- message = message + "最大页数:" + maxSize + "最大长度:"+ args_xh.maxLength +"申请列表:" + list +" \n\n "
-
- $.totalTry = 0
- $.totalSuccess = 0
- let size = 1;
-
- for (let i =0;i {
- postToDingTalk(e)
- console.log(`❗️ ${$.name} 运行错误!\n${e}`)
- }).finally(() => {
- $.done()
- })
-
- function requireConfig(){
- return new Promise(resolve => {
- console.log('开始获取配置文件\n')
- $.notify = $.isNode() ? require('./sendNotify') : { sendNotify: async() => { } }
- //获取 Cookies
- $.cookiesArr = []
- if($.isNode()){
- //Node.js用户请在jdCookie.js处填写京东ck;
- const jdCookieNode = require('./jdCookie.js');
- Object.keys(jdCookieNode).forEach((item) => {
- if(jdCookieNode[item]){
- $.cookiesArr.push(jdCookieNode[item])
- }
- })
- if(process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => { };
- } else {
- //IOS等用户直接用NobyDa的jd $.cookie
- $.cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
- }
- console.log(`共${$.cookiesArr.length}个京东账号\n`)
- for (const key in args_xh) {
- if(typeof args_xh[key] == 'string') {
- args_xh[key] = Number(args_xh[key])
- }
- }
- // console.debug(args_xh)
- resolve()
- })
- }
-
- //获取商品列表并且过滤 By X1a0He
- function try_feedsList(tabId, page){
- return new Promise((resolve, reject) => {
- const body = JSON.stringify({
- "tabId": `${tabId}`,
- "page": page,
- "previewTime": ""
- });
- let option = taskurl_xh('newtry', 'try_feedsList', body)
- $.get(option, (err, resp, data) => {
- try{
- if(err){
- console.log(`🚫 ${arguments.callee.name.toString()} API请求失败,请检查网路\n${JSON.stringify(err)}`)
- } else {
- // console.debug(data)
- // return
- data = JSON.parse(data)
- if(data.success){
- $.totalPages = data.data.pages
- totalPages = data.data.pages
- console.log(`获取到商品 ${data.data.feedList.length} 条\n`)
- for(let i = 0; i < data.data.feedList.length; i++){
- if(trialActivityIdList.length > args_xh.maxLength){
- console.log('商品列表长度已满.结束获取')
- }else
- if(data.data.feedList[i].applyState === 1){
- console.log(`商品已申请试用:${data.data.feedList[i].skuTitle}`)
- continue
- }else
- if(data.data.feedList[i].applyState !== null){
- console.log(`商品状态异常,跳过:${data.data.feedList[i].skuTitle}`)
- continue
- }else
- if(data.data.feedList[i].skuTitle){
- console.log(`检测第 ${page} 页 第 ${i + 1} 个商品\n${data.data.feedList[i].skuTitle}`)
- if(parseFloat(data.data.feedList[i].jdPrice) <= args_xh.jdPrice){
- console.log(`商品被过滤,${data.data.feedList[i].jdPrice} < ${args_xh.jdPrice} \n`)
- }else if(parseFloat(data.data.feedList[i].supplyNum) > args_xh.minSupplyNum && data.data.feedList[i].supplyNum !== null){
- console.log(`商品被过滤,提供申请的份数大于预设申请的份数 \n`)
- }else if(parseFloat(data.data.feedList[i].applyNum) > args_xh.applyNumFilter && data.data.feedList[i].applyNum !== null){
- console.log(`商品被过滤,已申请试用人数大于预设人数 \n`)
- }else if(parseFloat(data.data.feedList[i].trialPrice) > args_xh.trialPrice){
- console.log(`商品被过滤,期待价格高于预设价格 \n`)
- }else if(args_xh.titleFilters.some(fileter_word => data.data.feedList[i].skuTitle.includes(fileter_word))){
- console.log('商品被过滤,含有关键词 \n')
- }else{
- console.log(`商品通过,将加入试用组,trialActivityId为${data.data.feedList[i].trialActivityId}\n`)
- trialActivityIdList.push(data.data.feedList[i].trialActivityId)
- trialActivityTitleList.push(data.data.feedList[i].skuTitle)
- }
- }else{
- console.log('skuTitle解析异常')
- return
- }
- }
- console.log(`当前试用组id如下,长度为:${trialActivityIdList.length}\n${trialActivityIdList}\n`)
- } else {
- console.log(`💩 获得试用列表失败: ${data.message}`)
- }
- }
- } catch(e){
- console.log(e);
- reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`)
- console.log(`${JSON.stringify(data)}`)
- } finally{
- resolve()
- }
- })
- })
- }
-
- function try_apply(title, activityId){
- return new Promise((resolve, reject) => {
- console.log(`申请试用商品中...`)
- console.log(`商品:${title}`)
- console.log(`id为:${activityId}`)
- const body = JSON.stringify({
- "activityId": activityId,
- "previewTime": ""
- });
- let option = taskurl_xh('newtry', 'try_apply', body)
- $.get(option, (err, resp, data) => {
- try{
- if(err){
- console.log(`🚫 ${arguments.callee.name.toString()} API请求失败,请检查网路\n${JSON.stringify(err)}`)
- } else {
- $.totalTry++
- data = JSON.parse(data)
- if(data.success && data.code === "1"){ // 申请成功
- message += "" + title + "\n\n"
- message += "" + `-------\n\n` + "\n\n"
- console.log(data.message)
- $.totalSuccess++
- } else if(data.code === "-106"){
- console.log(data.message) // 未在申请时间内!
- } else if(data.code === "-110"){
- console.log(data.message) // 您的申请已成功提交,请勿重复申请…
- } else if(data.code === "-120"){
- console.log(data.message) // 您还不是会员,本品只限会员申请试用,请注册会员后申请!
- } else if(data.code === "-167"){
- console.log(data.message) // 抱歉,此试用需为种草官才能申请。查看下方详情了解更多。
- } else {
- console.log("申请失败", JSON.stringify(data))
- message += "" + JSON.stringify(data) + "\n\n"
- message += "" + `-------\n\n` + "\n\n"
- }
- }
- } catch(e){
- reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`)
- } finally{
- resolve()
- }
- })
- })
- }
-
- function try_MyTrials(page, selected){
- return new Promise((resolve, reject) => {
- switch(selected){
- case 1:
- console.log('正在获取已申请的商品...')
- break;
- case 2:
- console.log('正在获取申请成功的商品...')
- break;
- case 3:
- console.log('正在获取申请失败的商品...')
- break;
- default:
- console.log('selected错误')
- }
- const body = JSON.stringify({
- "page": page,
- "selected": selected, // 1 - 已申请 2 - 成功列表,3 - 失败列表
- "previewTime": ""
- });
- let option = taskurl_xh('newtry', 'try_MyTrials', body)
- option.headers.Referer = 'https://pro.m.jd.com/'
- $.get(option, (err, resp, data) => {
- try{
- if(err){
- console.log(`🚫 ${arguments.callee.name.toString()} API请求失败,请检查网路\n${JSON.stringify(err)}`)
- } else {
- // console.log(data)
- // return
- data = JSON.parse(data)
- if(data.success){
- //temp adjustment
- if(selected == 2){
- if (data.success && data.data) {
- $.successList = data.data.list.filter(item => {
- return item.text.text.includes('试用资格将保留10天')
- })
- console.log(`待领取: ${$.successList.length}个`)
- } else {
- console.log(`获得成功列表失败: ${data.message}`)
- }
- }
- if(data.data.list.length > 0){
- let count = 0
- for(let item of data.data.list){
- console.log(`申请时间:${new Date(parseInt(item.applyTime)).toLocaleString()}`)
- console.log(`申请商品:${item.trialName}`)
- console.log(`当前状态:${item.text.text}`)
- console.log(`剩余时间:${remaining(item.leftTime)}`)
-
- if (count < 3){
- message += "" + `申请商品:${item.trialName}` + "\n\n"
- message += "" + `当前状态:${item.text.text}` + "\n\n"
- message += "" + `-----\n\n` + "\n\n"
- count ++
- }
-
- console.log()
- }
- }
- // else {
- // switch(selected){
- // case 1:
- // console.log('无已申请的商品\n')
- // break;
- // case 2:
- // console.log('无申请成功的商品\n')
- // break;
- // case 3:
- // console.log('无申请失败的商品\n')
- // break;
- // default:
- // console.log('selected错误')
- // }
- // }
- } else {
- console.log(`ERROR:try_MyTrials`)
- }
- }
- } catch(e){
- reject(`⚠️ ${arguments.callee.name.toString()} API返回结果解析出错\n${e}\n${JSON.stringify(data)}`)
- } finally{
- resolve()
- }
- })
- })
- }
-
- function remaining(time){
- let days = parseInt(time / (1000 * 60 * 60 * 24));
- let hours = parseInt((time % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
- let minutes = parseInt((time % (1000 * 60 * 60)) / (1000 * 60));
- return `${days} 天 ${hours} 小时 ${minutes} 分`
- }
-
- function taskurl_xh(appid, functionId, body = JSON.stringify({})){
- return {
- "url": `${URL}?appid=${appid}&functionId=${functionId}&clientVersion=10.1.2&client=wh5&body=${encodeURIComponent(body)}`,
- 'headers': {
- 'Host': 'api.m.jd.com',
- 'Accept-Encoding': 'gzip, deflate, br',
- 'Cookie': $.cookie,
- 'Connection': 'keep-alive',
- 'UserAgent': 'jdapp;iPhone;10.1.2;15.0;ff2caa92a8529e4788a34b3d8d4df66d9573f499;network/wifi;model/iPhone13,4;addressid/2074196292;appBuild/167802;jdSupportDarkMode/1;Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
- 'Accept-Language': 'zh-cn',
- 'Referer': 'https://prodev.m.jd.com/'
- },
- }
- }
-
- async function showMsg(){
- let message1 = `京东账号${$.index} ${$.nickName || $.UserName}\n🎉 本次申请:${$.totalSuccess}/${$.totalTry}个商品🛒\n🎉 ${$.successList.length}个商品待领取`
- message += "" + `🎉 本次申请:${$.totalSuccess}/${$.totalTry}个商品🛒\n🎉 ${$.successList.length}个商品待领取` + "\n\n"
- if(!args_xh.jdNotify || args_xh.jdNotify === 'false'){
- $.msg($.name, ``, message1, {
- "open-url": 'https://try.m.jd.com/user'
- })
- if($.isNode())
- notifyMsg += `${message1}\n\n`
- } else {
- console.log(message1)
- }
- }
-
- function totalBean(){
- return new Promise(async resolve => {
- const options = {
- "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
- "headers": {
- "Accept": "application/json,text/plain, */*",
- "Content-Type": "application/x-www-form-urlencoded",
- "Accept-Encoding": "gzip, deflate, br",
- "Accept-Language": "zh-cn",
- "Connection": "keep-alive",
- "Cookie": $.cookie,
- "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
- "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.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")
- },
- "timeout": 10000,
- }
- $.post(options, (err, resp, data) => {
- try{
- if(err){
- console.log(`${JSON.stringify(err)}`)
- console.log(`${$.name} API请求失败,请检查网路重试`)
- } else {
- if(data){
- data = JSON.parse(data);
- if(data['retcode'] === 13){
- $.isLogin = false; //cookie过期
- return
- }
- if(data['retcode'] === 0){
- $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
- } else {
- $.nickName = $.UserName
- }
- } else {
- console.log(`京东服务器返回空数据`)
- }
- }
- } catch(e){
- $.logErr(e, resp)
- } finally{
- resolve();
- }
- })
- })
- }
-
- function jsonParse(str){
- if(typeof str == "string"){
- try{
- return JSON.parse(str);
- } catch(e){
- console.log(e);
- $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
- return [];
- }
- }
- }
-
- // 来自 @chavyleung 大佬
- // https://raw.githubusercontent.com/chavyleung/scripts/master/Env.js
- function Env(name, opts){
- class Http{
- constructor(env){
- this.env = env
- }
-
- send(opts, method = 'GET'){
- opts = typeof opts === 'string' ? {
- url: opts
- } : opts
- let sender = this.get
- if(method === 'POST'){
- sender = this.post
- }
- return new Promise((resolve, reject) => {
- sender.call(this, opts, (err, resp, body) => {
- if(err) reject(err)
- else resolve(resp)
- })
- })
- }
-
- get(opts){
- return this.send.call(this.env, opts)
- }
-
- post(opts){
- return this.send.call(this.env, opts, 'POST')
- }
- }
-
- return new (class{
- constructor(name, opts){
- this.name = name
- this.http = new Http(this)
- this.data = null
- this.dataFile = 'box.dat'
- this.logs = []
- this.isMute = false
- this.isNeedRewrite = false
- this.logSeparator = '\n'
- this.startTime = new Date().getTime()
- Object.assign(this, opts)
- 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(str, defaultValue = null){
- try{
- return JSON.parse(str)
- } catch{
- return defaultValue
- }
- }
-
- toStr(obj, defaultValue = null){
- try{
- return JSON.stringify(obj)
- } catch{
- return defaultValue
- }
- }
-
- getjson(key, defaultValue){
- let json = defaultValue
- const val = this.getdata(key)
- if(val){
- try{
- json = JSON.parse(this.getdata(key))
- } catch{ }
- }
- return json
- }
-
- setjson(val, key){
- try{
- return this.setdata(JSON.stringify(val), key)
- } catch{
- return false
- }
- }
-
- getScript(url){
- return new Promise((resolve) => {
- this.get({
- url
- }, (err, resp, body) => resolve(body))
- })
- }
-
- runScript(script, runOpts){
- return new Promise((resolve) => {
- let httpapi = this.getdata('@chavy_boxjs_userCfgs.httpapi')
- httpapi = httpapi ? httpapi.replace(/\n/g, '').trim() : httpapi
- let httpapi_timeout = this.getdata('@chavy_boxjs_userCfgs.httpapi_timeout')
- httpapi_timeout = httpapi_timeout ? httpapi_timeout * 1 : 20
- httpapi_timeout = runOpts && runOpts.timeout ? runOpts.timeout : httpapi_timeout
- const [key, addr] = httpapi.split('@')
- const opts = {
- url: `http://${addr}/v1/scripting/evaluate`,
- body: {
- script_text: script,
- mock_type: 'cron',
- timeout: httpapi_timeout
- },
- headers: {
- 'X-Key': key,
- 'Accept': '*/*'
- }
- }
- this.post(opts, (err, resp, body) => resolve(body))
- }).catch((e) => this.logErr(e))
- }
-
- loaddata(){
- if(this.isNode()){
- this.fs = this.fs ? this.fs : require('fs')
- this.path = this.path ? this.path : require('path')
- const curDirDataFilePath = this.path.resolve(this.dataFile)
- const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile)
- const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath)
- const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath)
- if(isCurDirDataFile || isRootDirDataFile){
- const datPath = isCurDirDataFile ? curDirDataFilePath : rootDirDataFilePath
- try{
- return JSON.parse(this.fs.readFileSync(datPath))
- } catch(e){
- return {}
- }
- } else return {}
- } else return {}
- }
-
- writedata(){
- if(this.isNode()){
- this.fs = this.fs ? this.fs : require('fs')
- this.path = this.path ? this.path : require('path')
- const curDirDataFilePath = this.path.resolve(this.dataFile)
- const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile)
- const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath)
- const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath)
- const jsondata = JSON.stringify(this.data)
- if(isCurDirDataFile){
- this.fs.writeFileSync(curDirDataFilePath, jsondata)
- } else if(isRootDirDataFile){
- this.fs.writeFileSync(rootDirDataFilePath, jsondata)
- } else {
- this.fs.writeFileSync(curDirDataFilePath, jsondata)
- }
- }
- }
-
- lodash_get(source, path, defaultValue = undefined){
- const paths = path.replace(/\[(\d+)\]/g, '.$1').split('.')
- let result = source
- for(const p of paths){
- result = Object(result)[p]
- if(result === undefined){
- return defaultValue
- }
- }
- return result
- }
-
- lodash_set(obj, path, value){
- if(Object(obj) !== obj) return obj
- if(!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || []
- path.slice(0, -1).reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[
- path[path.length - 1]
- ] = value
- return obj
- }
-
- getdata(key){
- let val = this.getval(key)
- // 如果以 @
- if(/^@/.test(key)){
- const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key)
- const objval = objkey ? this.getval(objkey) : ''
- if(objval){
- try{
- const objedval = JSON.parse(objval)
- val = objedval ? this.lodash_get(objedval, paths, '') : val
- } catch(e){
- val = ''
- }
- }
- }
- return val
- }
-
- setdata(val, key){
- let issuc = false
- if(/^@/.test(key)){
- const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key)
- const objdat = this.getval(objkey)
- const objval = objkey ? (objdat === 'null' ? null : objdat || '{}') : '{}'
- try{
- const objedval = JSON.parse(objval)
- this.lodash_set(objedval, paths, val)
- issuc = this.setval(JSON.stringify(objedval), objkey)
- } catch(e){
- const objedval = {}
- this.lodash_set(objedval, paths, val)
- issuc = this.setval(JSON.stringify(objedval), objkey)
- }
- } else {
- issuc = this.setval(val, key)
- }
- return issuc
- }
-
- getval(key){
- if(this.isSurge() || this.isLoon()){
- return $persistentStore.read(key)
- } else if(this.isQuanX()){
- return $prefs.valueForKey(key)
- } else if(this.isNode()){
- this.data = this.loaddata()
- return this.data[key]
- } else {
- return (this.data && this.data[key]) || null
- }
- }
-
- setval(val, key){
- if(this.isSurge() || this.isLoon()){
- return $persistentStore.write(val, key)
- } else if(this.isQuanX()){
- return $prefs.setValueForKey(val, key)
- } else if(this.isNode()){
- this.data = this.loaddata()
- this.data[key] = val
- this.writedata()
- return true
- } else {
- return (this.data && this.data[key]) || null
- }
- }
-
- initGotEnv(opts){
- 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()
- if(opts){
- opts.headers = opts.headers ? opts.headers : {}
- if(undefined === opts.headers.Cookie && undefined === opts.cookieJar){
- opts.cookieJar = this.ckjar
- }
- }
- }
-
- get(opts, callback = () => { }){
- if(opts.headers){
- delete opts.headers['Content-Type']
- delete opts.headers['Content-Length']
- }
- if(this.isSurge() || this.isLoon()){
- if(this.isSurge() && this.isNeedRewrite){
- opts.headers = opts.headers || {}
- Object.assign(opts.headers, {
- 'X-Surge-Skip-Scripting': false
- })
- }
- $httpClient.get(opts, (err, resp, body) => {
- if(!err && resp){
- resp.body = body
- resp.statusCode = resp.status
- }
- callback(err, resp, body)
- })
- } else if(this.isQuanX()){
- if(this.isNeedRewrite){
- opts.opts = opts.opts || {}
- Object.assign(opts.opts, {
- hints: false
- })
- }
- $task.fetch(opts).then(
- (resp) => {
- const {
- statusCode: status,
- statusCode,
- headers,
- body
- } = resp
- callback(null, {
- status,
- statusCode,
- headers,
- body
- }, body)
- },
- (err) => callback(err)
- )
- } else if(this.isNode()){
- this.initGotEnv(opts)
- this.got(opts).on('redirect', (resp, nextOpts) => {
- try{
- if(resp.headers['set-cookie']){
- const ck = resp.headers['set-cookie'].map(this.cktough.Cookie.parse).toString()
- if(ck){
- this.ckjar.setCookieSync(ck, null)
- }
- nextOpts.cookieJar = this.ckjar
- }
- } catch(e){
- this.logErr(e)
- }
- // this.ckjar.setCookieSync(resp.headers['set-cookie'].map(Cookie.parse).toString())
- }).then(
- (resp) => {
- const {
- statusCode: status,
- statusCode,
- headers,
- body
- } = resp
- callback(null, {
- status,
- statusCode,
- headers,
- body
- }, body)
- },
- (err) => {
- const {
- message: error,
- response: resp
- } = err
- callback(error, resp, resp && resp.body)
- }
- )
- }
- }
-
- post(opts, callback = () => { }){
- // 如果指定了请求体, 但没指定`Content-Type`, 则自动生成
- if(opts.body && opts.headers && !opts.headers['Content-Type']){
- opts.headers['Content-Type'] = 'application/x-www-form-urlencoded'
- }
- if(opts.headers) delete opts.headers['Content-Length']
- if(this.isSurge() || this.isLoon()){
- if(this.isSurge() && this.isNeedRewrite){
- opts.headers = opts.headers || {}
- Object.assign(opts.headers, {
- 'X-Surge-Skip-Scripting': false
- })
- }
- $httpClient.post(opts, (err, resp, body) => {
- if(!err && resp){
- resp.body = body
- resp.statusCode = resp.status
- }
- callback(err, resp, body)
- })
- } else if(this.isQuanX()){
- opts.method = 'POST'
- if(this.isNeedRewrite){
- opts.opts = opts.opts || {}
- Object.assign(opts.opts, {
- hints: false
- })
- }
- $task.fetch(opts).then(
- (resp) => {
- const {
- statusCode: status,
- statusCode,
- headers,
- body
- } = resp
- callback(null, {
- status,
- statusCode,
- headers,
- body
- }, body)
- },
- (err) => callback(err)
- )
- } else if(this.isNode()){
- this.initGotEnv(opts)
- const {
- url,
- ..._opts
- } = opts
- this.got.post(url, _opts).then(
- (resp) => {
- const {
- statusCode: status,
- statusCode,
- headers,
- body
- } = resp
- callback(null, {
- status,
- statusCode,
- headers,
- body
- }, body)
- },
- (err) => {
- const {
- message: error,
- response: resp
- } = err
- callback(error, resp, resp && resp.body)
- }
- )
- }
- }
-
- /**
- *
- * 示例:$.time('yyyy-MM-dd qq HH:mm:ss.S')
- * :$.time('yyyyMMddHHmmssS')
- * y:年 M:月 d:日 q:季 H:时 m:分 s:秒 S:毫秒
- * 其中y可选0-4位占位符、S可选0-1位占位符,其余可选0-2位占位符
- * @param {*} fmt 格式化参数
- *
- */
- time(fmt){
- let o = {
- '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()
- }
- if(/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (new Date().getFullYear() + '').substr(4 - RegExp.$1.length))
- for(let k in o)
- if(new RegExp('(' + k + ')').test(fmt))
- fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length))
- return fmt
- }
-
- /**
- * 系统通知
- *
- * > 通知参数: 同时支持 QuanX 和 Loon 两种格式, EnvJs根据运行环境自动转换, Surge 环境不支持多媒体通知
- *
- * 示例:
- * $.msg(title, subt, desc, 'twitter://')
- * $.msg(title, subt, desc, { 'open-url': 'twitter://', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' })
- * $.msg(title, subt, desc, { 'open-url': 'https://bing.com', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' })
- *
- * @param {*} title 标题
- * @param {*} subt 副标题
- * @param {*} desc 通知详情
- * @param {*} opts 通知参数
- *
- */
- msg(title = name, subt = '', desc = '', opts){
- const toEnvOpts = (rawopts) => {
- if(!rawopts) return rawopts
- if(typeof rawopts === 'string'){
- if(this.isLoon()) return rawopts
- else if(this.isQuanX()) return {
- 'open-url': rawopts
- }
- else if(this.isSurge()) return {
- url: rawopts
- }
- else return undefined
- } else if(typeof rawopts === 'object'){
- if(this.isLoon()){
- let openUrl = rawopts.openUrl || rawopts.url || rawopts['open-url']
- let mediaUrl = rawopts.mediaUrl || rawopts['media-url']
- return {
- openUrl,
- mediaUrl
- }
- } else if(this.isQuanX()){
- let openUrl = rawopts['open-url'] || rawopts.url || rawopts.openUrl
- let mediaUrl = rawopts['media-url'] || rawopts.mediaUrl
- return {
- 'open-url': openUrl,
- 'media-url': mediaUrl
- }
- } else if(this.isSurge()){
- let openUrl = rawopts.url || rawopts.openUrl || rawopts['open-url']
- return {
- url: openUrl
- }
- }
- } else {
- return undefined
- }
- }
- if(!this.isMute){
- if(this.isSurge() || this.isLoon()){
- $notification.post(title, subt, desc, toEnvOpts(opts))
- } else if(this.isQuanX()){
- $notify(title, subt, desc, toEnvOpts(opts))
- }
- }
- if(!this.isMuteLog){
- let logs = ['', '==============📣系统通知📣==============']
- logs.push(title)
- subt ? logs.push(subt) : ''
- desc ? logs.push(desc) : ''
- console.log(logs.join('\n'))
- this.logs = this.logs.concat(logs)
- }
- }
-
- log(...logs){
- if(logs.length > 0){
- this.logs = [...this.logs, ...logs]
- }
- console.log(logs.join(this.logSeparator))
- }
-
- logErr(err, msg){
- const isPrintSack = !this.isSurge() && !this.isQuanX() && !this.isLoon()
- if(!isPrintSack){
- this.log('', `❗️${this.name}, 错误!`, err)
- } else {
- this.log('', `❗️${this.name}, 错误!`, err.stack)
- }
- }
-
- wait(time){
- return new Promise((resolve) => setTimeout(resolve, time))
- }
-
- done(val = {}){
- const endTime = new Date().getTime()
- const costTime = (endTime - this.startTime) / 1000
- this.log('', `🔔${this.name}, 结束! 🕛 ${costTime} 秒`)
- this.log()
- if(this.isSurge() || this.isQuanX() || this.isLoon()){
- $done(val)
- }
- }
- })(name, opts)
- }
-
-
- //我加的函数
- function postToDingTalk(messgae) {
- const message1 = "" + messgae
- // that.log(messgae)
-
- const body = {
- "msgtype": "markdown",
- "markdown": {
- "title":"闪电试用",
- "text": message1
- },
- "at": {
- "atMobiles": [],
- "isAtAll": true
- }
- }
-
-
- $.post(toDingtalk(dingtalk,JSON.stringify(body)), (data,status,xhr)=>{
- try {
- that.log(resp)
- that.log(data)
- if (err) {
- that.log(JSON.stringify(err));
- $.logErr(err);
- } else {
- if (safeGet(data)) {
- $.duckRes = JSON.parse(data);
- }
- }
- } catch (e) {
- $.logErr(e, resp)
- } finally {
- resolve();
- }
- },"json")
- }
-
-
- function toDingtalk(urlmain, bodyMain) {
- return {
- url: urlmain,
- body:bodyMain,
- headers: { 'Content-Type': 'application/json;charset=utf-8' },
- timeout: 10000,
- }
- }
-
- function getPic(){
- let code = ["1.gif","2.png","3.png","4.png","5.gif","6.gif","7.gif","8.gif","9.gif","10.png","11.png"]
- let address = "\n\n )
- address = address + code[pos] + ")"
- return address
- }
\ No newline at end of file
diff --git a/src/main/resources/test_trytryOne.js b/src/main/resources/test_trytryOne.js
index e78124d..d08d131 100644
--- a/src/main/resources/test_trytryOne.js
+++ b/src/main/resources/test_trytryOne.js
@@ -81,7 +81,7 @@ let args_xh = {
* 试用商品标题过滤
* 可设置环境变量:JD_TRY_TITLEFILTERS,关键词与关键词之间用@分隔
* */
- titleFilters: ["鞋","钳","酒","课","裤","考","疮","疣","漆","梯","框","架","巾","尿","尺","妆","夹","哨","剪","剂","丸","龟头","sd","鼻膏","鼻炎","鼻毛","U盘","鼻影","鼻头","鼻塞","黑沙","黑头","黄冈","鹿鞭","鸭肠","鸡胗","鱼饵","鱼钩","鱼缸","鱼线","鱼竿","驱虫","香薰","饲料","饭盒","食盐","领结","领带","鞋带","鞋垫","面霜","面酱","面膜","面罩","面碗","静电","青汁","露指","雨衣","雨披","雨刮","陀螺","阴部","阴囊","防疫","闹钟","门锁","门档","门帘","门吸","长筒","镰刀","镜片","锯片","锯条","锅铲","锁头","铆管","铅笔","铁丝","钢笔","钢丝","钙片","钓箱","钉子","针头","酵素","遮瑕","适配","辅食","软膏","软糖","轮胎","转接","转换","轨道","车锁","车轮","车漆","跳绳","赠品","贺卡","贴膜","贴纸","贴布","角阀","裸妆","裤头","装修","袜子","袖套","衬衫","表带","补水","补墙","补发","蚊香","蚊帐","葛根","菜罩","菊粉","莘月","茶杯","茶宠","茶壶","茶勺","茶具","茗杯","花萃","花瓶","花洒","芦荟","艾草","艾条","艾叶","色料","自慰","腰带","腮红","腋毛","脱毛","脱发","脚垫","脖套","胸针","胸包","胶枪","胶带","SD","胶囊","胖子","背膜","肥料","肥佬","耳钉","耳罩","老花","翻身","美胸","美缝","美甲","网线","网卡","网兜","绿幕","绷带","维修","绑带","练字","线上","纹眉","纱网","纱窗","红绳","精油","精华","粉饼","粉扑","粉底","粉刺","筷子","筒灯","笼子","笔槽","童装","竖笛","窗帘","私处","神露","祛疤","磨脚","碳粉","碟子","碎发","硬笔","硅胶","砂锅","砂纸","砂盆","短裙","矫正","睫毛","睡裤","眼霜","眼镜","眼贴","眼袋","眼罩","眼影","眉笔","相纸","盘香","盖世","监狱","皮带","皮套","百褶","白酒","瘙痒","痛风","痔疮","痉挛","男童","电钻","电瓶","电池","甲醛","用友","瓜刨","琴弦","球拍","球帽","玻璃","玻珠","玛咖","猫粮","猫砂","猫用","猫咪","猪油","狗链","狗粮","犬粮","牛舌","牙膏","牙线","牙签","牙套","牙刷","燮乐","煤油","炖盅","灯膜","灯泡","灭鼠","灭蝇","滤镜","滤芯","滤网","滤杯","湿粮","渔具","润滑","消毒","浮漂","浮标","测试","测评","洗面","洁面","泳衣","泥灸","泡沫","油罐","油漆","油壶","沉香","汤盅","汤勺","水泥","水枪","水带","水勺","水乳","毛孔","毛囊","母乳","死皮","止痒","模具","棒球","棉袜","梳子","梯子","桌垫","树苗","栅网","柜吸","染发","条码","机油","月子","早教","日历","断奶","斗笔","文胸","教育","教材","教学","教具","敏肌","敏感","擦窗","插销","插座","掸子","掏耳","挑逗","指套","挂钩","挂钟","挂绳","挂篓","拐杖","护踝","护膝","护腕","护肤","护理","护栏","护具","抓周","把手","托盘","打底","手电","手套","手册","戒烟","情趣","徽墨","彩铅","彩带","弹簧","延迟","延时","康复","座套","座垫","底座","幼儿","干裂","幕布","帽子","帆睿","布袋","屏风","尿素","小学","射灯","导购","宿便","宣纸","宠物","宝佩","定制","定做","学历","婴儿","妇女","奶粉","奶瓶","头绳","头皮","天线","外用","壁纸","墨镜","墨粉","墨盒","墨水","墨条","墨块","增高","墙纸","培训","垫片","坐垫","地漏","地桩","地吸","圣杯","图钉","围裙","围兜","嚼片","喷壶","啪啪","唇釉","哺乳","哑光","咽炎","咳嗽","咬钩","呼噜","周岁","后膜","台灯","口腔","口罩","口红","口琴","发绳","压片","卸妆","卡针","卡牌","卡托","卡尺","卡套","卡册","医生","匙扣","化妆","包皮","勿拍","勺子","剪钳","剥虾","刷子","刷头","刮痧","别针","刨木","分流","刀片","刀头","减肥","冰袋","农亨","内裤","内衣","光驱","假发","倒车","修眉","修护","信纸","信封","保健","便秘","侧包","作业","会员","优盘","伊威","交换","乳腺","乳液","书法","书包","丰胸","丝袜","一盒","鼻气膏","鼻毛器","HPV","SD卡","FMJ","uv镜","鼻康爽","鼠标手","鼠标垫","黄金卡","黄膏贴","麦克风","鸳鸯锅","鸥曼GTL","鱼塘膜","魔法棒","高升专","马桶垫","马桶刷","马丁靴","LED","香囊袋","飞机杯","风湿贴","风水鱼","额头贴","hpv","音频线","韩味多","非卖品","青春痘","雅翔仕","隔离霜","隔离网","隔热棉","隔热板","陶瓷瓶","陈皮鸡","防静电","防裂膏","防蚊裤","防疫包","防滑垫","防渗膜","防晒霜","防晒乳","防撞条","门槛条","门把手","长筒袜","镜头贴","镜头膜","键盘垫","锁精环","钥匙扣","钥匙套","钢化蛋","钢化膜","钢丝球","金刚胶","配件盒","避孕套","避光垫","遮瑕膏","遮挡布","遥控器","通体砖","VGA","透气贴","逍遥马","适配器","追踪器","连衣裙","运势书","过滤棉","过敏性","过家家","输精管","软电线","转换器","车篓子","身体乳","趴趴枕","足浴粉","超比乐","起雾棒","购物袋","购物券","调音器","试用装","试听课","训练器","订账本","订书机","警示牌","触控笔","解码线","角磨机","覆盖膜","西汀片","褪黑素","裁纸刀","补光灯","蟑螂药","蛋白肽","蚯蚓粪","虾青素","萨瑞斯","菊花茶","荧光笔","苦荞茶","苏兰卡","苍蝇药","苍蝇拍","艾脐贴","艾胜者","艾绒贴","艾灸贴","舒缓水","自拍杆","自弹器","臂力器","膝盖贴","胜平堂","胖大海","育苗盘","肩周炎","职业装","耐火泥","老爷车","翻页笔","翻板钩","翻分器","羽毛球","美肌霜","美工笔","美工刀","美容院","美容油","美容棒","绿草皮","维生素","绘图板","细纹霜","纸尿裤","纳米砖","纤维素","红包袋","红包封","素颜霜","糖糖粉","精华露","精华乳","类纸膜","米小芽","签字笔","筹划税","筋骨贴","空调罩","空调滤","秋梨膏","福来油","祛斑霜","示宽灯","磨脚石","磨砂壳","砍菜刀","砍柴刀","矫正带","矫正器","睡眠片","眼药水","眼线笔","真空袋","益生菌","皮筋枪","百日宴","白板笔","番茄丁","电话牌","电话卡","电脑包","电缆剪","电源线","电容笔","电子秤","甜品勺","瑶浴粉","琮德轩","理疗贴","理发推","理发器","玻璃胶","玻璃吊","玻珠幕","玻尿酸","玛咖茶","玛咖片","玉米须","玉米粉","猫罐头","猫玩具","狗零食","狗皮膏","牵引器","牛仔裤","牙签盒","牙刷头","爽肤水","爸爸鞋","爸爸装","爬爬垫","热敷包","烧水棒","炎膏贴","火花塞","激光剑","潜水服","漱口水","滑漂座","滑板车","滑块袋","滋养霜","湿手器","温度计","清洁球","清洁液","清洁刷","清水剂","润颜乳","润滑液","润唇膏","消毒液","测电笔","流量卡","洗鼻器","洗地液","洋娃娃","注射针","注射器","泡澡球","泡泡纸","泡沫胶","沐浴包","汽油锯","水龙头","水管道","水果泥","水晶泥","水晶头","水平仪","水凝膜","气雾棒","气垫霜","气压杆","椅子套","棒棒糖","样板盒","标识牌","标签纸","标志牌","栀子茶","柔肤水","染发剂","枕头套","枇杷膏","材料包","机顶盒","木糖醇","有机肥","替换头","晨铭轩","晚安茶","方向盘","整理棒","数据线","救生衣","效果图","改光膜","收银机","收钱码","收藏册","收敛水","擦银布","擦玻璃","撑衣杆","摇步器","摄影灯","摄像头","搅拌勺","握力器","提词器","提示牌","排气扇","掏耳朵","捆绑绳","捆扎绳","挤奶器","挡风板","按摩球","拾音器","拨浪鼓","拔毒膏","拉柳枪","拉力绳","拉力器","抽水器","抵用券","抬头纹","报警器","护腿套","护眼贴","护手霜","抛光机","抚奶嘴","投屏器","抓痒器","抑菌膏","扭扭车","扩音器","打飞机","打钉枪","打虫糖","打草绳","打包绳","手电筒","手机袋","手机线","手机壳","手机卡","手术刀","手提秤","手推车","手工DIY","手动幕","戒奶嘴","成长裤","成人票","悠悠球","总复习","思维棋","弹力绳","开果器","开关盒","延长器","床垫套","幼儿园","平衡线","平光镜","干眼症","干洗剂","工作服","川品社","屏蔽袋","屏幕膜","尿素霜","尾灯膜","尼龙网","尼龙管","小状元","小汤匙","小斗篷","小塔糖","小勺子","封口机","对接头","富贵包","密码锁","密封袋","密封条","宫颈炎","实验课","宝珠笔","宝宝霜","宝塔糖","定位器","安全锤","安全裤","安全帽","孩儿乐","学习卡","存储卡","孕妇装","孔明锁","婴幼儿","如意碗","大头围","多色笔","外包税","复合肽","复合肥","增生贴","塔菲克","塑身裤","塑料杯","垃圾袋","坐骨膏","坐便椅","坐便器","土工膜","土工布","圆珠笔","固定器","喷雾器","唑溶液","咖啡豆","咖啡勺","告知牌","吸顶灯","吸油纸","吸奶器","同仁堂","吃饭衣","号码卡","台账本","口香糖","口罩盒","变身器","反弹器","反光镜","反光贴","反光板","双黄连","双面板","双层片","双导向","参肽片","去角质","去毛器","去枣核","去斑霜","压差表","卸妆水","卧铺垫","协尔聪","半身裙","包装膜","加温器","加密狗","办公杯","办公宝","割草机","前列腺","削皮刀","刺激贴","刺梨糕","刹车油","刷牙头","刮痧板","创可贴","切菜板","切割片","分线盒","分流器","凳子套","减关镜","净水剂","冻干粉","冷敷贴","冷凝胶","冷兵器","决明子","冰箱贴","内胆包","养芝堂","养生茶","养殖膜","公文包","八倍镜","充电桩","充电头","儿童n95","储奶袋","停车牌","假睫毛","倒车镜","修眉剪","修正带","修复乳","保鲜膜","保温棉","保暖裤","保护镜","保护膜","保护套","保护壳","侧挂式","体验装","体温计","传菜铃","会员卡","亿优信","享底价","交换机","五宝茶","五参茶","乒乓球","中老年","中性笔","中国结","专用贴","专升本","三轮车","三角阀","三清茶","万藓灵","万用表","丁香茶","一片装","一次性","hdmi","HDMI","黑色水笔","钓箱配件","鼻腔喷雾","钓箱边网","钙咀嚼片","降葵花盘","钓箱侧袋","香薰精油","防水涂料","金属探测","钓鱼手竿","运费专拍","防臭盖子","PVC板","高清配件","车载u盘","钓鱼插件","静脉曲张","雷气日式","雕刻工具","食用色素","T口弯头","防卫尖刺","4/3膜","防水敷贴","鸡毛掸子","防疫香包","视频mv","黑芝麻丸","静音阻尼","金属合金","隔音耳塞","软件系统","车内清洁","赛柏瑞斯","货车用品","调羹冰勺","请勿下单","评估检测","视频教程","蒲公英茶","落花啼春","菲妮小熊","莆田官网","芊乔珠宝","腰肌劳损","腰椎突出","腋毛神器","背心马甲","老式鸣笛","老人用品","线上课程","纹眉色料","红花手套","粉扑盒子","空气滤芯","称斤积木","神经痛贴","礼品链接","男士用品","电风扇罩","电脑电源","电磨组套","电焊护脚","玻璃镜片","玫瑰花茶","玩具女孩","猫咪玩具","牙签防水","热熔胶枪","烘焙纸杯","灶台贴纸","满分冲刺","滚梳直柄","清洁配件","清洁软胶","清洁套装","消防水带","消化不良","涂鸦贴纸","海狸先生","洗地专用","泸州老窖","汽车车灯","汽车脚垫","汽车椅背","汽车摆件","水管配件","欧布圣剑","格子长袖","查询软件","方向盘套","教学视频","摘果神器","摆件车模","摄像头膜","损伤膏贴","挡风玻璃","拌饭海苔","抽屉轨道","折叠锯子","投影仪包","打包袋子","手机维修","手工黏土","快递纸箱","德尔地板","延迟喷雾","床头台灯","幼儿配方","工作手册","尤克里里","少儿读物","小兔女士","寒假作业","宝宝鞋子","宝宝牙刷","宝宝成长","宝宝奶粉","宝宝口罩","学生文具","女童靴子","女童裤子","女士内裤","声卡套装","增生膏贴","在线直播","园艺工具","商务休闲","哺乳套装","启动电源","合成机油","口腔抑菌","反光条贴","卧铺毛毯","南疆巴朗","半身不遂","凝胶糖果","决明子茶","公主项链","免钉胶水","光和青春","先徽葱油","儿童雨伞","儿童随身","儿童背包","儿童牙膏","儿童椅子","儿童拌饭","儿童成长","儿童奶粉","儿童吸管","儿童口罩","儿童医生","儿童便捷","儿童乐园","健康检测","保暖背心","保暖女裤","保护贴膜","会议记录","会议杯子","代餐奶昔","仓鼠零食","亲子互动","产品体验","事后入怀","九九乘除","九九乘法","串珠玩具","中性水笔","中国电信","下关沱茶","万向滑轮","H10E","G100","轻酸瓶3%","打印机碳带","牙刷替换头","除菌洗地液","靠背收纳袋","水管保温套","枇杷雪梨膏","空调遥控器","慢性鼻1炎","燃气报警器","行车记录仪","枇杷秋梨膏","SUP掌机","金属探测器","摄像头镜片","牙刷收纳盒","接线式直管","钓箱置物袋","消防应急灯","童装男女童","电视遥控器","鱼池防水膜","棉线结矶杆","消化道出血","狗狗沐浴露","win10","手机充电线","玻璃防雾剂","DHA藻油","椅背置物袋","鱼塘专用膜","惯性小汽车","尤尖锐湿疣","小孩子演奏","宝宝玩具车","宝宝灯笼裤","定做榻榻米","多功能尺子","垃圾处理器","地面清洁液","品雅有机茶","单拍不发货","半圆滑漂挡","剃须刀配件","儿童磨牙饼","儿童益生菌","儿童玩具枪","儿童沐浴露","儿童暖暖套","仿真小蛋糕","人参五宝茶","中央扶手箱","windows","Ockered","0-12岁","KVM切换器","SMOVES","HEISHA","黑色塑料薄膜","移动wifi","远投路滑配件","轮胎专用胶水","视线盲区贴纸","矶钓钓鱼配件","烘焙彩针糖果","汽车尾部挂件","樱の色鱼子酱","擦车清洁工具","小苍兰沐浴露","宝宝儿童零食","奥咖云南特产","办公会议茶杯","儿童电话手表","儿童电动牙刷","儿童保温水杯","儿童串珠玩具","不干胶标签带","led开关电源","汽车头枕腰靠套装","金龙鱼 面条挂面","KB216有线键盘","德生源氨基酸洗发水","女士内裤,少女内裤","塑料士兵小军人玩具","N1162有线鼠标","奇异果嫩肤磨砂沐浴乳","MS116 有线鼠标","生鲜火锅 250g墨鱼饼","生鲜 方便菜 500g排骨*2","破壳茶叶铁观音正味浓香型一级罐装100g","正宗农家鸡蛋散养农村柴鸡蛋营养美味健康轻食","夕恒手机散热器吃鸡神器半导体冰冻冷风散热器","野铺子雪媚娘蛋黄酥6枚装 野铺子蛋黄酥【6枚装】","安宝笛蓓缦水养柔肤茉莉海盐磨砂沐浴露40ml*3","奥咖云南特产贡菊茶40g/罐无硫天然生态贡菊茶罐装","破壳茶叶poke福建安溪铁观音浓香型圆罐装散茶100g","羊蝎子批发现杀羊脊骨内蒙古新鲜火锅食材 羊蝎子1000g","落花啼春 吊坠女佛公弥勒笑佛玉坠玉石阿富汗项链挂坠玉佩玉器","奥咖姜枣黑糖茶300克/盒云南特产女生大姨妈月经期温暖小肚肚","正宗内蒙古羊肉卷 羔羊卷 涮火锅食材火锅料 1000g羊肉卷","新鲜雪花肥牛卷牛肉片牛肉卷涮火锅套餐配菜火锅食材 2斤肥牛卷","a1雪绒蛋糕550g早餐食品小面包蒸蛋糕 a1雪绒蛋糕550g","瑞发德 藤椒琵琶腿 400g 烤鸡腿 鸡肉 冷冻油炸半成品小吃","羊杂清真 原味羊杂 熟食速食火锅食材新鲜免切批发 纯羊杂4斤装","THISE利斯欧洲原装进口全脂纯牛奶500ml高钙有机健康高端奶","乐凡希 三明治火腿片 三连包 150克(50克 X 3) 冷藏熟食","牛杂牛肚牛百叶白千层毛肚丝黑毛肚配菜批发新鲜火锅食材 1000g白千层","【5盒装】丹麦风味曲奇饼干休闲零食小吃 【5盒装】丹麦风味曲奇饼干","3份起正宗武汉热干面过早速食拌面碱水面带调料酱包方便面条湖北 6包","奇异果嫩肤磨砂沐浴乳 香氛清洁香水沐浴露留香沐浴液 红樱桃300ml","老北京炸酱面杂酱面休闲食品韩国拌面方便面速食特产网红面条102g/包","盖世 美人唇杏鲍菇木耳海茸/裙带菜150g*4袋 解冻即食 海鲜水产","牛黄喉烧烤新鲜配菜牛杂牛喉管涮锅麻辣烫凉拌火锅食材 250g*2牛黄喉","新鲜 猪胸骨 猪脆骨 散养土猪肉 软骨 猪排骨 批发 猪胸骨1000g","牛杂牛肚牛百叶白千层毛肚丝黑毛肚配菜批发新鲜火锅食材 1000g黑毛肚丝","丹麦风味曲奇饼干大分量盒装休闲零食饼干礼包 丹麦风味曲奇饼干360g/盒","正宗农家鸡蛋 散养农村柴鸡蛋 营养美味早餐 现捡 玉米黄虫草蛋 鸡蛋20枚","宝佩 印尼五瓣小金刚菩提子双龙肉纹国潮复古单圈手链文玩佛珠手串男女 松石款","老北京炸酱面杂酱面休闲食品韩国拌面方便面速食特产网红面条102g/包 10包","金汤佛跳墙正宗即食袋装海参鲍鱼捞饭盆菜海鲜大礼包熟食海鲜 2袋佛跳墙250g","猫村长泰式榴莲糖238g桶装特浓泰式风味榴莲奶糖 泰式风味榴莲糖238g/桶","3份起正宗武汉热干面过早速食拌面碱水面带调料酱包方便面条湖北 12包","厚切猪五花肉片韩国烤肉食材新鲜烧烤食材韩式烤肉片生猪肉 五花肉片250g*2盒","惠发 速冻炸鸡食品 裹粉鸡胸肉 鸡米花 鸡排 半成品 烧烤食材 400g鸡米花","老北京炸酱面杂酱面休闲食品韩国拌面方便面速食特产网红面条102g/包 3包尝鲜装","宝藏驼 猴头菇驼奶饼干代餐膳食纤维休闲零食小吃独立包装开袋即食饼干400g*1盒","舟山 黄花鱼新鲜冷冻 小黄鱼海鲜水产 清蒸红烧烧烤油炸皆可 整箱六斤装中号黄花鱼","中国龙瓷 生日礼物送女生男友情人节十二生肖摆件创意礼品工艺品德化白瓷器摆件伴手礼物","啡趣精品挂耳咖啡现磨美式黑咖啡无糖滤挂式手冲咖啡粉新鲜烘焙风味原产地新朋友入会礼盒装","野生金鲳鱼大号新鲜冷冻鲜活白鲳鱼海昌鱼平鱼海鲜水产 大号金鲳鱼*1条(约8两-1斤)","MASIL 玛丝兰韩国三次方氨基酸洗发水便携旅行装8ml去屑控油(8ml*20条/盒)","SeeHe喜氢485ml瓶装 含氢饮用水 富氢水 水素水 弱碱性 办公室用水 12瓶装","中秋节送礼 广式月饼 手工酥皮 莲蓉乌月饼 休闲零食 散装蛋黄莲蓉乌米月饼*6个 50g","黄海大鲅鱼新鲜鲅鱼鲅鱼整条鲅鱼马鲛鱼批发野生海捕鲅鱼 小号鲅鱼2500g(6两-8两/条)","TIMESWIND天然新疆玉多彩葫芦莲花手串戈壁玉黄玉古风个性女款玉石手链 玉莲花珠葫芦手链","S925银几何显脸瘦的耳环女潮时尚长款气质蝴蝶结流苏耳坠个性超仙百搭网红同款耳饰品 金色一对价","中国龙瓷 生日礼物送女生男友情人节十二生肖摆件创意礼品工艺品德化白瓷器摆件伴手礼物 十二生肖-牛","朗言 机器人项链男小丑嘻哈蹦迪毛衣卫衣潮网红ins吊坠欧美时尚百搭锁骨链男女情侣 机器人小丑项链","国拓 地道纯猪肉脆皮烤肠300g 早餐热狗肠 纯肉肠 香肠 烧烤囤货食材 脆皮火山石烤肠 台湾烤肠","【JD空运】云南高原种植丹东99草莓新鲜奶油草莓 平安夜送礼盒孕妇水果 坏果包赔 2盒中果 礼盒装","排骨正宗香酥炸排骨速冻菜肴 快手菜 速食方便菜 蒜香腌制半成品 黑椒 半成品菜 排骨2包*500g","荷美尔(Hormel)精选低温午餐肉300g/包 囤货必备全程冷链植物配料慢煮工艺口感绵密 火锅食材泡面搭档","斐济原装进口 Fitsui斐粹 理疗级饮用天然矿泉水 高偏硅酸型高端饮用水 整箱1.5L*12瓶 1.5L整箱","女士香水三件套装淡香清新自由之水反转巴黎香水礼盒套装情人节生日礼物节日送礼 【黑鸦片香水三件套/每瓶30ml】","乐凡希 三明治火腿片 三连包 150克(50克 X 3) 冷藏熟食 早餐 西餐烘焙 烧烤食材 火锅食材 西餐食材","康佳(KONKA)燃气灶单眼灶具 5.0KW猛火台式单灶液化气灶 家用不锈钢大火力灶台 JZY-D502Y(液化气)","长杆粘毛器两用伸缩杆大号地板粘毛滚筒长柄粘毛神器可撕式替换芯拖地滚毛器沾尘纸清理沙发 长杆两用+(19CM共6卷粘纸)","AULTRON牙结石去除器超声波洁牙器家用洁牙器洁牙仪可视洗牙器神器去黑黄牙结石牙垢茶渍烟渍清除器 金属蓝色【太空铝合金质感】","柯梦迪( Chredina)国潮无线充电器华为苹果通用桌面卡通图案迷你便携式 玲珑CR-W09 Type-C输入(安卓10W/苹果7.5W)","全麦面包代餐吐司切片0脂肪0蔗糖健身粗粮面包片轻食早餐零食整箱装 真全麦0脂肪0蔗糖代餐面包 整箱1 真全麦0脂0蔗糖代餐面包 整箱1斤装(约24片)"],
+ titleFilters: ["鞋", "钳", "酒", "课", "裤", "考", "疮", "疣", "漆", "梯", "框", "架", "巾", "尿", "尺", "妆", "夹", "哨", "剪", "剂", "丸", "sd", "SD", "鼻炎", "鼻影", "龟头", "鼻膏", "鼻毛", "鼻头", "鼻塞", "黑沙", "黑头", "黄冈", "鹿鞭", "鸭肠", "鸡胗", "鱼饵", "鱼钩", "鱼缸", "鱼线", "鱼竿", "驱虫", "香薰", "饲料", "饭盒", "食盐", "领结", "领带", "鞋带", "鞋垫", "面霜", "面酱", "面膜", "面罩", "面碗", "静电", "青汁", "露指", "雨衣", "雨披", "雨刮", "陀螺", "阴部", "阴囊", "防疫", "闹钟", "门锁", "门档", "门帘", "门吸", "长筒", "镰刀", "镜片", "锯片", "锯条", "锅铲", "锁头", "U盘", "铆管", "铅笔", "铁丝", "钢笔", "钢丝", "钙片", "钓箱", "钉子", "针头", "酵素", "遮瑕", "适配", "辅食", "软膏", "软糖", "轮胎", "转接", "转换", "轨道", "车锁", "车轮", "车漆", "跳绳", "赠品", "贺卡", "贴膜", "贴纸", "贴布", "角阀", "裸妆", "裤头", "装修", "袜子", "袖套", "衬衫", "表带", "补水", "补墙", "补发", "蚊香", "蚊帐", "葛根", "菜罩", "菊粉", "莘月", "茶杯", "茶宠", "茶壶", "茶勺", "茶具", "茗杯", "花萃", "花瓶", "花洒", "芦荟", "艾草", "艾条", "艾叶", "色料", "自慰", "腰带", "腮红", "腋毛", "脱毛", "脱发", "脚垫", "脖套", "胸针", "胸包", "胶枪", "胶带", "胶囊", "胖子", "背膜", "肥料", "肥佬", "耳钉", "耳罩", "老花", "翻身", "美胸", "美缝", "美甲", "网线", "网卡", "网兜", "绿幕", "绷带", "维修", "绑带", "练字", "线上", "纹眉", "纱网", "纱窗", "红绳", "精油", "精华", "粉饼", "粉扑", "粉底", "粉刺", "筷子", "筒灯", "笼子", "笔槽", "童装", "竖笛", "窗帘", "私处", "神露", "祛疤", "磨脚", "碳粉", "碟子", "碎发", "硬笔", "硅胶", "砂锅", "砂纸", "砂盆", "短裙", "矫正", "睫毛", "睡裤", "眼霜", "眼镜", "眼贴", "眼袋", "眼罩", "眼影", "眉笔", "相纸", "盘香", "盖世", "监狱", "皮带", "皮套", "百褶", "白酒", "瘙痒", "痛风", "痔疮", "痉挛", "男童", "电钻", "电瓶", "电池", "甲醛", "用友", "瓜刨", "琴弦", "球拍", "球帽", "玻璃", "玻珠", "玛咖", "猫粮", "猫砂", "猫用", "猫咪", "猪油", "狗链", "狗粮", "犬粮", "牛舌", "牙膏", "牙线", "牙签", "牙套", "牙刷", "燮乐", "煤油", "炖盅", "灯膜", "灯泡", "灭鼠", "灭蝇", "滤镜", "滤芯", "滤网", "滤杯", "湿粮", "渔具", "润滑", "消毒", "浮漂", "浮标", "测试", "测评", "洗面", "洁面", "泳衣", "泥灸", "泡沫", "油罐", "油漆", "油壶", "沉香", "汤盅", "汤勺", "水泥", "水枪", "水带", "水勺", "水乳", "毛孔", "毛囊", "母乳", "死皮", "止痒", "模具", "棒球", "棉袜", "梳子", "梯子", "桌垫", "树苗", "栅网", "柜吸", "染发", "条码", "机油", "月子", "早教", "日历", "断奶", "斗笔", "文胸", "教育", "教材", "教学", "教具", "敏肌", "敏感", "擦窗", "插销", "插座", "掸子", "掏耳", "挑逗", "指套", "挂钩", "挂钟", "挂绳", "挂篓", "拐杖", "护踝", "护膝", "护腕", "护肤", "护理", "护栏", "护具", "抓周", "把手", "托盘", "打底", "手电", "手套", "手册", "戒烟", "情趣", "徽墨", "彩铅", "彩带", "弹簧", "延迟", "延时", "康复", "座套", "座垫", "底座", "幼儿", "干裂", "幕布", "帽子", "帆睿", "布袋", "屏风", "尿素", "小学", "射灯", "导购", "宿便", "宣纸", "宠物", "宝佩", "定制", "定做", "学历", "婴儿", "妇女", "奶粉", "奶瓶", "头绳", "头皮", "天线", "外用", "壁纸", "墨镜", "墨粉", "墨盒", "墨水", "墨条", "墨块", "增高", "墙纸", "培训", "垫片", "坐垫", "地漏", "地桩", "地吸", "圣杯", "图钉", "围裙", "围兜", "嚼片", "喷壶", "啪啪", "唇釉", "哺乳", "哑光", "咽炎", "咳嗽", "咬钩", "呼噜", "周岁", "后膜", "台灯", "口腔", "口罩", "口红", "口琴", "发绳", "压片", "卸妆", "卡针", "卡牌", "卡托", "卡尺", "卡套", "卡册", "医生", "匙扣", "化妆", "包皮", "勿拍", "勺子", "剪钳", "剥虾", "刷子", "刷头", "刮痧", "别针", "刨木", "分流", "刀片", "刀头", "减肥", "冰袋", "农亨", "内裤", "内衣", "光驱", "假发", "倒车", "修眉", "修护", "信纸", "信封", "保健", "便秘", "侧包", "作业", "会员", "优盘", "伊威", "交换", "乳腺", "乳液", "书法", "书包", "丰胸", "丝袜", "一盒", "uv镜", "SD卡", "鼻气膏", "FMJ", "LED", "VGA", "hpv", "HPV", "鼻毛器", "鼻康爽", "鼠标手", "鼠标垫", "黄金卡", "黄膏贴", "麦克风", "鸳鸯锅", "鱼塘膜", "魔法棒", "高升专", "马桶垫", "马桶刷", "马克笔", "马丁靴", "香囊袋", "飞机杯", "风湿贴", "风水鱼", "额头贴", "音频线", "韩味多", "非卖品", "青春痘", "雅翔仕", "隔离霜", "隔离网", "隔热棉", "隔热板", "陶瓷瓶", "陈皮鸡", "防静电", "防裂膏", "防蚊裤", "防疫包", "防滑垫", "防渗膜", "防晒霜", "防晒乳", "防撞条", "门槛条", "门把手", "长筒袜", "镜头贴", "镜头膜", "键盘垫", "锁精环", "钥匙扣", "钥匙套", "钢化蛋", "钢化膜", "钢丝球", "金刚胶", "配件盒", "避孕套", "避光垫", "遮瑕膏", "遮挡布", "遥控器", "通体砖", "透气贴", "逍遥马", "适配器", "追踪器", "连衣裙", "运势书", "过滤棉", "过敏性", "过家家", "输精管", "软电线", "转换器", "车篓子", "身体乳", "趴趴枕", "足浴粉", "超比乐", "起雾棒", "购物袋", "购物券", "调音器", "试用装", "试听课", "训练器", "订账本", "订书机", "警示牌", "触控笔", "解码线", "角磨机", "覆盖膜", "西汀片", "褪黑素", "裁纸刀", "补光灯", "蟑螂药", "蛋白肽", "蚯蚓粪", "虾青素", "萨瑞斯", "菊花茶", "荧光笔", "苦荞茶", "苏兰卡", "苍蝇药", "苍蝇拍", "艾脐贴", "艾胜者", "艾绒贴", "艾灸贴", "舒缓水", "自拍杆", "自弹器", "臂力器", "膝盖贴", "胜平堂", "胖大海", "育苗盘", "肩周炎", "职业装", "耐火泥", "老爷车", "翻页笔", "翻板钩", "翻分器", "羽毛球", "美肌霜", "美工笔", "美工刀", "美容院", "美容油", "美容棒", "绿草皮", "维生素", "绘图板", "细纹霜", "纸尿裤", "纳米砖", "纤维素", "红包袋", "红包封", "素颜霜", "糖糖粉", "精华露", "精华乳", "类纸膜", "米小芽", "签字笔", "筹划税", "筋骨贴", "空调罩", "空调滤", "秋梨膏", "福来油", "祛斑霜", "示宽灯", "磨脚石", "磨砂壳", "砍菜刀", "砍柴刀", "矫正带", "矫正器", "睡眠片", "眼药水", "眼线笔", "真空袋", "益生菌", "皮筋枪", "百日宴", "白板笔", "番茄丁", "男人茶", "电话牌", "电话卡", "电脑包", "电缆剪", "电源线", "电容笔", "电子秤", "甜品勺", "瑶浴粉", "琮德轩", "理疗贴", "理发推", "理发器", "玻璃胶", "玻璃吊", "玻珠幕", "玻尿酸", "玛咖茶", "玛咖片", "玉米须", "玉米粉", "猫罐头", "猫玩具", "狗零食", "狗皮膏", "牵引器", "牛仔裤", "牙签盒", "牙刷头", "爽肤水", "爸爸鞋", "爸爸装", "爬爬垫", "热敷包", "烧水棒", "炎膏贴", "火花塞", "激光剑", "潜水服", "漱口水", "滑漂座", "滑板车", "滑块袋", "滋养霜", "湿手器", "温度计", "清洁球", "清洁液", "清洁刷", "清水剂", "润颜乳", "润滑液", "润唇膏", "消毒液", "测电笔", "流量卡", "洗鼻器", "洗地液", "洋娃娃", "注射针", "注射器", "泡澡球", "泡泡纸", "泡沫胶", "沐浴包", "汽油锯", "水龙头", "水管道", "水果泥", "水晶泥", "水晶头", "水平仪", "水凝膜", "气雾棒", "气垫霜", "气压杆", "椅子套", "棒棒糖", "样板盒", "标识牌", "标签纸", "标志牌", "栀子茶", "柔肤水", "染发剂", "枕头套", "枇杷膏", "材料包", "机顶盒", "木糖醇", "有机肥", "替换头", "晨铭轩", "晚安茶", "方向盘", "整理棒", "数据线", "救生衣", "效果图", "改光膜", "收银机", "收钱码", "收藏册", "收敛水", "擦银布", "擦玻璃", "撑衣杆", "摇步器", "摄影灯", "摄像头", "搅拌勺", "握力器", "提词器", "提示牌", "排气扇", "掏耳朵", "捆绑绳", "捆扎绳", "挤奶器", "挡风板", "按摩球", "拾音器", "拨浪鼓", "拔毒膏", "拉柳枪", "拉力绳", "拉力器", "抽水器", "抵用券", "抬头纹", "报警器", "护腿套", "护眼贴", "护手霜", "抛光机", "抚奶嘴", "投屏器", "抓痒器", "抑菌膏", "扭扭车", "扩音器", "打飞机", "打钉枪", "打虫糖", "打草绳", "打包绳", "手电筒", "手机袋", "手机线", "手机壳", "手机卡", "手术刀", "手提秤", "手推车", "手动幕", "戒奶嘴", "成长裤", "成人票", "悠悠球", "总复习", "思维棋", "弹力绳", "开果器", "开关盒", "延长器", "床垫套", "幼儿园", "平衡线", "平光镜", "干眼症", "干洗剂", "工作服", "川品社", "屏蔽袋", "屏幕膜", "尿素霜", "尾灯膜", "尼龙网", "尼龙管", "小状元", "小汤匙", "小斗篷", "小塔糖", "小勺子", "封口机", "对接头", "富贵包", "密码锁", "密封袋", "密封条", "宫颈炎", "实验课", "宝珠笔", "宝宝霜", "宝塔糖", "定位器", "安全锤", "安全裤", "安全帽", "孩儿乐", "学习卡", "存储卡", "孕妇装", "孔明锁", "婴幼儿", "如意碗", "大头围", "多色笔", "外包税", "复合肽", "复合肥", "增生贴", "塔菲克", "塑身裤", "塑料杯", "垃圾袋", "坐骨膏", "坐便椅", "坐便器", "土工膜", "土工布", "圆珠笔", "固定器", "喷雾器", "唑溶液", "咖啡豆", "咖啡勺", "告知牌", "吸顶灯", "吸油纸", "吸奶器", "同仁堂", "吃饭衣", "号码卡", "台账本", "口香糖", "口罩盒", "变身器", "反弹器", "反光镜", "反光贴", "反光板", "双黄连", "双面板", "双层片", "双导向", "参肽片", "去角质", "去毛器", "去枣核", "去斑霜", "压差表", "卸妆水", "卧铺垫", "协尔聪", "半身裙", "包装膜", "加温器", "加密狗", "办公杯", "办公宝", "割草机", "前列腺", "削皮刀", "刺激贴", "刺梨糕", "刹车油", "刷牙头", "刮痧板", "创可贴", "切菜板", "切割片", "分线盒", "分流器", "凳子套", "减关镜", "净水剂", "冻干粉", "冷敷贴", "冷凝胶", "冷兵器", "决明子", "冰箱贴", "内胆包", "养芝堂", "养生茶", "养殖膜", "公文包", "八宝茶", "八倍镜", "充电桩", "充电头", "储奶袋", "停车牌", "假睫毛", "倒车镜", "修眉剪", "修正带", "修复乳", "保鲜膜", "保温棉", "保暖裤", "保护镜", "保护膜", "保护套", "保护壳", "侧挂式", "体验装", "体温计", "传菜铃", "会员卡", "亿优信", "享底价", "交换机", "五宝茶", "五参茶", "乒乓球", "中老年", "中性笔", "中国结", "专用贴", "专升本", "三轮车", "三角阀", "三清茶", "万藓灵", "万用表", "丁香茶", "一片装", "一次性", "hdmi", "静音阻尼", "防水敷贴", "防疫香包", "钓鱼手竿", "视频mv", "防水涂料", "运费专拍", "钓箱边网", "黑芝麻丸", "软件系统", "货车用品", "隔音耳塞", "请勿下单", "防卫尖刺", "雷气日式", "PVC板", "钓鱼插件", "车内清洁", "金属探测", "车载u盘", "钓箱侧袋", "赛柏瑞斯", "鼻腔喷雾", "食用色素", "香薰精油", "黑色水笔", "防臭盖子", "4/3膜", "调羹冰勺", "金属合金", "雕刻工具", "钙咀嚼片", "T口弯头", "静脉曲张", "降葵花盘", "钓箱配件", "评估检测", "鸡毛掸子", "HDMI", "H10E", "G100", "高清配件", "视频教程", "蒲公英茶", "落花啼春", "菲妮小熊", "莆田官网", "芊乔珠宝", "腰肌劳损", "腰椎突出", "腋毛神器", "背心马甲", "老式鸣笛", "老人用品", "线上课程", "纹眉色料", "红花手套", "粉扑盒子", "空气滤芯", "称斤积木", "神经痛贴", "礼品链接", "男士用品", "电风扇罩", "电脑电源", "电磨组套", "电焊护脚", "玻璃镜片", "玫瑰花茶", "玩具女孩", "猫咪玩具", "牙签防水", "热熔胶枪", "烘焙纸杯", "灶台贴纸", "满分冲刺", "滚梳直柄", "清洁配件", "清洁软胶", "清洁套装", "消防水带", "消化不良", "涂鸦贴纸", "海狸先生", "洗地专用", "泸州老窖", "汽车车灯", "汽车脚垫", "汽车椅背", "汽车摆件", "水管配件", "欧布圣剑", "格子长袖", "查询软件", "方向盘套", "教学视频", "摘果神器", "摆件车模", "摄像头膜", "损伤膏贴", "挡风玻璃", "拌饭海苔", "抽屉轨道", "折叠锯子", "投影仪包", "打包袋子", "手机维修", "手工黏土", "快递纸箱", "德尔地板", "延迟喷雾", "床头台灯", "幼儿配方", "工作手册", "尤克里里", "少儿读物", "小兔女士", "寒假作业", "宝宝鞋子", "宝宝牙刷", "宝宝成长", "宝宝奶粉", "宝宝口罩", "学生文具", "女童靴子", "女童裤子", "女士内裤", "声卡套装", "增生膏贴", "在线直播", "园艺工具", "商务休闲", "哺乳套装", "启动电源", "合成机油", "口腔抑菌", "反光条贴", "卧铺毛毯", "南疆巴朗", "半身不遂", "凝胶糖果", "决明子茶", "公主项链", "免钉胶水", "光和青春", "先徽葱油", "儿童雨伞", "儿童随身", "儿童背包", "儿童牙膏", "儿童椅子", "儿童拌饭", "儿童成长", "儿童奶粉", "儿童吸管", "儿童口罩", "儿童医生", "儿童便捷", "儿童乐园", "健康检测", "保暖背心", "保暖女裤", "保护贴膜", "会议记录", "会议杯子", "代餐奶昔", "仓鼠零食", "亲子互动", "产品体验", "事后入怀", "九九乘除", "九九乘法", "串珠玩具", "中性水笔", "中国电信", "下关沱茶", "万向滑轮", "鸥曼GTL", "手工DIY", "儿童n95", "SUP掌机", "行车记录仪", "消化道出血", "0-12岁", "电视遥控器", "棉线结矶杆", "金属探测器", "椅背置物袋", "鱼塘专用膜", "牙刷收纳盒", "燃气报警器", "慢性鼻1炎", "玻璃防雾剂", "摄像头镜片", "接线式直管", "枇杷秋梨膏", "童装男女童", "轻酸瓶3%", "水管保温套", "惯性小汽车", "鱼池防水膜", "狗狗沐浴露", "消防应急灯", "手机充电线", "钓箱置物袋", "打印机碳带", "靠背收纳袋", "牙刷替换头", "枇杷雪梨膏", "win10", "除菌洗地液", "DHA藻油", "空调遥控器", "尤尖锐湿疣", "小孩子演奏", "宝宝玩具车", "宝宝灯笼裤", "定做榻榻米", "多功能尺子", "垃圾处理器", "地面清洁液", "品雅有机茶", "单拍不发货", "半圆滑漂挡", "剃须刀配件", "儿童磨牙饼", "儿童益生菌", "儿童玩具枪", "儿童沐浴露", "儿童暖暖套", "仿真小蛋糕", "人参五宝茶", "中央扶手箱", "KVM切换器", "移动wifi", "SMOVES", "HEISHA", "黑色塑料薄膜", "远投路滑配件", "轮胎专用胶水", "视线盲区贴纸", "矶钓钓鱼配件", "烘焙彩针糖果", "汽车尾部挂件", "樱の色鱼子酱", "擦车清洁工具", "小苍兰沐浴露", "宝宝儿童零食", "奥咖云南特产", "办公会议茶杯", "儿童电话手表", "儿童电动牙刷", "儿童保温水杯", "儿童串珠玩具", "不干胶标签带", "人参黄精枸杞茶", "led开关电源", "QHE+ 其嘉", "windows", "Ockered", "汽车头枕腰靠套装", "金龙鱼 面条挂面", "德生源氨基酸洗发水", "女士内裤,少女内裤", "塑料士兵小军人玩具", "N1162有线鼠标", "KB216有线键盘", "奇异果嫩肤磨砂沐浴乳", "MS116 有线鼠标", "乐凡希 三明治火腿片", "生鲜火锅 250g墨鱼饼", "生鲜 方便菜 500g排骨*2", "破壳茶叶正味碳焙铁观音一级罐装100g", "破壳茶叶铁观音正味浓香型一级罐装100g", "正宗农家鸡蛋散养农村柴鸡蛋营养美味健康轻食", "新鲜羊肉卷肥牛卷涮火锅套餐烧烤配菜火锅食材", "夕恒手机散热器吃鸡神器半导体冰冻冷风散热器", "新鲜鱼类海鲜水产 健康轻食 生鲜 2斤装鳕鱼", "野铺子雪媚娘蛋黄酥6枚装 野铺子蛋黄酥【6枚装】", "安宝笛蓓缦水养柔肤茉莉海盐磨砂沐浴露40ml*3", "奥咖云南特产贡菊茶40g/罐无硫天然生态贡菊茶罐装", "破壳茶叶poke福建安溪铁观音浓香型圆罐装散茶100g", "羊蝎子批发现杀羊脊骨内蒙古新鲜火锅食材 羊蝎子1000g", "方便食品 烧烤火锅食材海鲜水产 原味烤肠200g/包*1", "落花啼春 吊坠女佛公弥勒笑佛玉坠玉石阿富汗项链挂坠玉佩玉器", "正宗内蒙古羊肉卷 羔羊卷 涮火锅食材火锅料 1000g羊肉卷", "奥咖姜枣黑糖茶300克/盒云南特产女生大姨妈月经期温暖小肚肚", "新鲜雪花肥牛卷牛肉片牛肉卷涮火锅套餐配菜火锅食材 2斤肥牛卷", "瑞发德 藤椒琵琶腿 400g 烤鸡腿 鸡肉 冷冻油炸半成品小吃", "a1雪绒蛋糕550g早餐食品小面包蒸蛋糕 a1雪绒蛋糕550g", "羊杂清真 原味羊杂 熟食速食火锅食材新鲜免切批发 纯羊杂4斤装", "礼物金大福珠宝小雏菊银手链女款925银气质韩版简约手链 小雏菊", "THISE利斯欧洲原装进口全脂纯牛奶500ml高钙有机健康高端奶", "【5盒装】丹麦风味曲奇饼干休闲零食小吃 【5盒装】丹麦风味曲奇饼干", "乐凡希 三明治火腿片 三连包 150克(50克 X 3) 冷藏熟食", "3份起正宗武汉热干面过早速食拌面碱水面带调料酱包方便面条湖北 6包", "3份起正宗武汉热干面过早速食拌面碱水面带调料酱包方便面条湖北 12包", "老北京炸酱面杂酱面休闲食品韩国拌面方便面速食特产网红面条102g/包", "奇异果嫩肤磨砂沐浴乳 香氛清洁香水沐浴露留香沐浴液 红樱桃300ml", "盖世 美人唇杏鲍菇木耳海茸/裙带菜150g*4袋 解冻即食 海鲜水产", "新鲜 猪胸骨 猪脆骨 散养土猪肉 软骨 猪排骨 批发 猪胸骨1000g", "满沃 黑枸杞(大果>7MM)100克 青海柴达木大果黑枸杞 天然花青素", "牛黄喉烧烤新鲜配菜牛杂牛喉管涮锅麻辣烫凉拌火锅食材 250g*2牛黄喉", "牛杂牛肚牛百叶白千层毛肚丝黑毛肚配菜批发新鲜火锅食材 1000g白千层", "牛杂牛肚牛百叶白千层毛肚丝黑毛肚配菜批发新鲜火锅食材 1000g黑毛肚丝", "丹麦风味曲奇饼干大分量盒装休闲零食饼干礼包 丹麦风味曲奇饼干360g/盒", "宝佩 印尼五瓣小金刚菩提子双龙肉纹国潮复古单圈手链文玩佛珠手串男女 松石款", "正宗农家鸡蛋 散养农村柴鸡蛋 营养美味早餐 现捡 玉米黄虫草蛋 鸡蛋20枚", "猫村长泰式榴莲糖238g桶装特浓泰式风味榴莲奶糖 泰式风味榴莲糖238g/桶", "老北京炸酱面杂酱面休闲食品韩国拌面方便面速食特产网红面条102g/包 10包", "金汤佛跳墙正宗即食袋装海参鲍鱼捞饭盆菜海鲜大礼包熟食海鲜 2袋佛跳墙250g", "惠发 速冻炸鸡食品 裹粉鸡胸肉 鸡米花 鸡排 半成品 烧烤食材 400g鸡米花", "厚切猪五花肉片韩国烤肉食材新鲜烧烤食材韩式烤肉片生猪肉 五花肉片250g*2盒", "老北京炸酱面杂酱面休闲食品韩国拌面方便面速食特产网红面条102g/包 3包尝鲜装", "宝藏驼 猴头菇驼奶饼干代餐膳食纤维休闲零食小吃独立包装开袋即食饼干400g*1盒", "舟山 黄花鱼新鲜冷冻 小黄鱼海鲜水产 清蒸红烧烧烤油炸皆可 整箱六斤装中号黄花鱼", "中国龙瓷 生日礼物送女生男友情人节十二生肖摆件创意礼品工艺品德化白瓷器摆件伴手礼物", "啡趣精品挂耳咖啡现磨美式黑咖啡无糖滤挂式手冲咖啡粉新鲜烘焙风味原产地新朋友入会礼盒装", "野生金鲳鱼大号新鲜冷冻鲜活白鲳鱼海昌鱼平鱼海鲜水产 大号金鲳鱼*1条(约8两-1斤)", "SeeHe喜氢485ml瓶装 含氢饮用水 富氢水 水素水 弱碱性 办公室用水 12瓶装", "MASIL 玛丝兰韩国三次方氨基酸洗发水便携旅行装8ml去屑控油(8ml*20条/盒)", "中秋节送礼 广式月饼 手工酥皮 莲蓉乌月饼 休闲零食 散装蛋黄莲蓉乌米月饼*6个 50g", "黄海大鲅鱼新鲜鲅鱼鲅鱼整条鲅鱼马鲛鱼批发野生海捕鲅鱼 小号鲅鱼2500g(6两-8两/条)", "TIMESWIND天然新疆玉多彩葫芦莲花手串戈壁玉黄玉古风个性女款玉石手链 玉莲花珠葫芦手链", "S925银几何显脸瘦的耳环女潮时尚长款气质蝴蝶结流苏耳坠个性超仙百搭网红同款耳饰品 金色一对价", "中国龙瓷 生日礼物送女生男友情人节十二生肖摆件创意礼品工艺品德化白瓷器摆件伴手礼物 十二生肖-牛", "朗言 机器人项链男小丑嘻哈蹦迪毛衣卫衣潮网红ins吊坠欧美时尚百搭锁骨链男女情侣 机器人小丑项链", "【JD空运】云南高原种植丹东99草莓新鲜奶油草莓 平安夜送礼盒孕妇水果 坏果包赔 2盒中果 礼盒装", "国拓 地道纯猪肉脆皮烤肠300g 早餐热狗肠 纯肉肠 香肠 烧烤囤货食材 脆皮火山石烤肠 台湾烤肠", "排骨正宗香酥炸排骨速冻菜肴 快手菜 速食方便菜 蒜香腌制半成品 黑椒 半成品菜 排骨2包*500g", "荷美尔(Hormel)精选低温午餐肉300g/包 囤货必备全程冷链植物配料慢煮工艺口感绵密 火锅食材泡面搭档", "利客(RIKAY) 无线蓝牙耳机双唛长续航AI降噪挂耳式商务运动跑步开车代驾外卖适用苹果华为小米OPPO手机", "斐济原装进口 Fitsui斐粹 理疗级饮用天然矿泉水 高偏硅酸型高端饮用水 整箱1.5L*12瓶 1.5L整箱", "女士香水三件套装淡香清新自由之水反转巴黎香水礼盒套装情人节生日礼物节日送礼 【黑鸦片香水三件套/每瓶30ml】", "乐凡希 三明治火腿片 三连包 150克(50克 X 3) 冷藏熟食 早餐 西餐烘焙 烧烤食材 火锅食材 西餐食材", "康佳(KONKA)燃气灶单眼灶具 5.0KW猛火台式单灶液化气灶 家用不锈钢大火力灶台 JZY-D502Y(液化气)", "长杆粘毛器两用伸缩杆大号地板粘毛滚筒长柄粘毛神器可撕式替换芯拖地滚毛器沾尘纸清理沙发 长杆两用+(19CM共6卷粘纸)", "AULTRON牙结石去除器超声波洁牙器家用洁牙器洁牙仪可视洗牙器神器去黑黄牙结石牙垢茶渍烟渍清除器 金属蓝色【太空铝合金质感】", "柯梦迪( Chredina)国潮无线充电器华为苹果通用桌面卡通图案迷你便携式 玲珑CR-W09 Type-C输入(安卓10W/苹果7.5W)", "全麦面包代餐吐司切片0脂肪0蔗糖健身粗粮面包片轻食早餐零食整箱装 真全麦0脂肪0蔗糖代餐面包 整箱1 真全麦0脂0蔗糖代餐面包 整箱1斤装(约24片)"],
// 试用价格(中了要花多少钱),高于这个价格都不会试用,小于等于才会试用
trialPrice: 0,
/*
diff --git a/src/main/resources/test_wish.js b/src/main/resources/test_wish.js
new file mode 100644
index 0000000..2d4409c
--- /dev/null
+++ b/src/main/resources/test_wish.js
@@ -0,0 +1,419 @@
+/*
+众筹许愿池
+活动入口:京东-京东众筹-众筹许愿池
+脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
+===============Quantumultx===============
+[task_local]
+#众筹许愿池
+40 0,2 * * * https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_wish.js, tag=众筹许愿池, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
+
+================Loon==============
+[Script]
+cron "40 0,2 * * *" script-path=https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_wish.js,tag=众筹许愿池
+
+===============Surge=================
+众筹许愿池 = type=cron,cronexp="40 0,2 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_wish.js
+
+============小火箭=========
+众筹许愿池 = type=cron,script-path=https://raw.githubusercontent.com/Aaron-lv/sync/jd_scripts/jd_wish.js, cronexpr="40 0,2 * * *", timeout=3600, enable=true
+ */
+const $ = new Env('众筹许愿池');
+const notify = $.isNode() ? require('./sendNotify') : '';
+//Node.js用户请在jdCookie.js处填写京东ck;
+const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
+let message = '', allMessage = '';
+//IOS等用户直接用NobyDa的jd cookie
+let cookiesArr = [], cookie = '';
+const JD_API_HOST = 'https://api.m.jd.com/client.action';
+let appIdArr = ['1E1NXxq0', '1FV1VwKc', '1FFRWxaY', '1FFVQyqw', '1FV1ZwKY', '1FFdSxqw'];
+let appNameArr = ['众筹许愿池', '惊喜大作战', '荣耀钞能力', '1111点心动', '好物好生活', '焕新带电生活'];
+let appId, appName;
+$.shareCode = [];
+if ($.isNode()) {
+ Object.keys(jdCookieNode).forEach((item) => {
+ cookiesArr.push(jdCookieNode[item])
+ })
+ if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
+} else {
+ cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
+}
+!(async () => {
+ if (!cookiesArr[0]) {
+ $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
+ return;
+ }
+ for (let i = 0; i < cookiesArr.length; i++) {
+ if (cookiesArr[i]) {
+ cookie = cookiesArr[i];
+ $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
+ $.index = i + 1;
+ $.isLogin = true;
+ $.nickName = '';
+ message = '';
+ await TotalBean();
+ console.log(`\n*******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`);
+ if (!$.isLogin) {
+ $.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
+
+ if ($.isNode()) {
+ await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
+ }
+ continue
+ }
+ for (let j = 0; j < appIdArr.length; j++) {
+ appId = appIdArr[j]
+ appName = appNameArr[j]
+ console.log(`\n开始第${j + 1}个活动:${appName}\n`)
+ await jd_wish();
+ }
+ }
+ }
+ if (allMessage) {
+ if ($.isNode()) await notify.sendNotify($.name, allMessage);
+ $.msg($.name, '', allMessage)
+ }
+ let res = await getAuthorShareCode('')
+ if (!res) {
+ $.http.get({url: ''}).then((resp) => {}).catch((e) => console.log('刷新CDN异常', e));
+ await $.wait(1000)
+ res = await getAuthorShareCode('')
+ }
+ $.shareCode = [...$.shareCode, ...(res || [])]
+ for (let i = 0; i < cookiesArr.length; i++) {
+ if (cookiesArr[i]) {
+ cookie = cookiesArr[i];
+ $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
+ console.log(`开始内部助力\n`)
+ for (let v = 0; v < appIdArr.length; v++) {
+ $.canHelp = true
+ appId = appIdArr[v]
+ appName = appNameArr[v]
+ console.log(`开始助力第${v + 1}个活动:${appName}\n`)
+ for (let j = 0; j < $.shareCode.length && $.canHelp; j++) {
+ if ($.shareCode[j].appId === appId) {
+ console.log(`${$.UserName} 去助力 ${$.shareCode[j].use} 的助力码 ${$.shareCode[j].code}`)
+ if ($.UserName == $.shareCode[j].use) {
+ console.log(`不能助力自己\n`)
+ continue
+ }
+ $.delcode = false
+ await harmony_collectScore({"appId":appId,"taskToken":$.shareCode[j].code,"actionType":"0","taskId":"6"})
+ await $.wait(2000)
+ if ($.delcode) {
+ $.shareCode.splice(j, 1)
+ j--
+ continue
+ }
+ }
+ }
+ }
+ }
+ }
+})()
+ .catch((e) => {
+ $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
+ })
+ .finally(() => {
+ $.done();
+ })
+async function jd_wish() {
+ try {
+ await healthyDay_getHomeData();
+ await $.wait(2000)
+
+ let getHomeDataRes = (await healthyDay_getHomeData(false)).data.result.userInfo
+ let forNum = Math.floor(getHomeDataRes.userScore / getHomeDataRes.scorePerLottery)
+ await $.wait(2000)
+
+ if (forNum === 0) {
+ console.log(`没有抽奖机会\n`)
+ } else {
+ console.log(`可以抽奖${forNum}次,去抽奖\n`)
+ }
+
+ $.canLottery = true
+ for (let j = 0; j < forNum && $.canLottery; j++) {
+ await interact_template_getLotteryResult()
+ await $.wait(2000)
+ }
+ if (message) allMessage += `京东账号${$.index} ${$.nickName || $.UserName}\n${appName}\n${message}${$.index !== cookiesArr.length ? '\n\n' : ''}`
+
+ } catch (e) {
+ $.logErr(e)
+ }
+}
+
+async function healthyDay_getHomeData(type = true) {
+ return new Promise(async resolve => {
+ $.post(taskUrl('healthyDay_getHomeData', {"appId":appId,"taskToken":"","channelId":1}), async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} getHomeData API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (type) {
+ for (let key of Object.keys(data.data.result.taskVos).reverse()) {
+ let vo = data.data.result.taskVos[key]
+ if (vo.status !== 2 && vo.status !== 0) {
+ if (vo.taskType === 13 || vo.taskType === 12) {
+ console.log(`签到`)
+ await harmony_collectScore({"appId":appId,"taskToken":vo.simpleRecordInfoVo.taskToken,"taskId":vo.taskId,"actionType":"0"}, vo.taskType)
+ } else if (vo.taskType === 1) {
+ $.complete = false;
+ for (let key of Object.keys(vo.followShopVo)) {
+ let followShopVo = vo.followShopVo[key]
+ if (followShopVo.status !== 2) {
+ console.log(`【${followShopVo.shopName}】${vo.subTitleName}`)
+ await harmony_collectScore({"appId":appId,"taskToken":followShopVo.taskToken,"taskId":vo.taskId,"actionType":"0"})
+ if ($.complete) break;
+ }
+ }
+ } else if (vo.taskType === 8) {
+ $.complete = false;
+ for (let key of Object.keys(vo.productInfoVos)) {
+ let productInfoVos = vo.productInfoVos[key]
+ if (productInfoVos.status !== 2) {
+ console.log(`【${productInfoVos.skuName}】${vo.subTitleName}`)
+ await harmony_collectScore({"appId":appId,"taskToken":productInfoVos.taskToken,"taskId":vo.taskId,"actionType":"1"})
+ await $.wait(vo.waitDuration * 1000)
+ await harmony_collectScore({"appId":appId,"taskToken":productInfoVos.taskToken,"taskId":vo.taskId,"actionType":"0"})
+ if ($.complete) break;
+ }
+ }
+ } else if (vo.taskType === 9 || vo.taskType === 26) {
+ $.complete = false;
+ for (let key of Object.keys(vo.shoppingActivityVos)) {
+ let shoppingActivityVos = vo.shoppingActivityVos[key]
+ if (shoppingActivityVos.status !== 2) {
+ console.log(`【${shoppingActivityVos.title}】${vo.subTitleName}`)
+ if (vo.taskType === 9) {
+ await harmony_collectScore({"appId":appId,"taskToken":shoppingActivityVos.taskToken,"taskId":vo.taskId,"actionType":"1"})
+ await $.wait(vo.waitDuration * 1000)
+ }
+ await harmony_collectScore({"appId":appId,"taskToken":shoppingActivityVos.taskToken,"taskId":vo.taskId,"actionType":"0"})
+ if ($.complete) break;
+ }
+ }
+ } else if (vo.taskType === 14) {
+ console.log(`【京东账号${$.index}(${$.UserName})的${appName}好友互助码】${vo.assistTaskDetailVo.taskToken}\n`)
+ if (vo.times !== vo.maxTimes) {
+ $.shareCode.push({
+ "code": vo.assistTaskDetailVo.taskToken,
+ "appId": appId,
+ "use": $.UserName
+ })
+ }
+ }
+ } else {
+ console.log(`【${vo.taskName}】已完成\n`)
+ }
+ }
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function harmony_collectScore(body = {}, taskType = '') {
+ return new Promise(resolve => {
+ $.post(taskUrl('harmony_collectScore', body), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} collectScore API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ if (data && data.data && data.data.bizCode === 0) {
+ if (taskType === 13) {
+ console.log(`签到成功:获得${data.data.result.score}金币\n`)
+ } else if (body.taskId == 6) {
+ console.log(`助力成功:您的好友获得${data.data.result.score}金币\n`)
+ } else {
+ console.log(`完成任务:获得${data.data.result.score}金币\n`)
+ }
+ } else {
+ if (taskType === 13) {
+ console.log(`签到失败:${data.data.bizMsg}\n`)
+ } else if (body.taskId == 6) {
+ console.log(`助力失败:${data.data.bizMsg || data.msg}\n`)
+ if (data.code === -30001 || (data.data && data.data.bizCode === 108)) $.canHelp = false
+ if (data.data.bizCode === 103) $.delcode = true
+ } else {
+ console.log(body.actionType === "0" ? `完成任务失败:${data.data.bizMsg}\n` : data.data.bizMsg)
+ if (data.data.bizMsg === "任务已完成") $.complete = true;
+ }
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve();
+ }
+ })
+ })
+}
+function interact_template_getLotteryResult() {
+ return new Promise(resolve => {
+ $.post(taskUrl('interact_template_getLotteryResult', {"appId":appId}), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} getLotteryResul API请求失败,请检查网路重试`)
+ } else {
+ if (safeGet(data)) {
+ data = JSON.parse(data);
+ let userAwardsCacheDto = data && data.data && data.data.result && data.data.result.userAwardsCacheDto;
+ if (userAwardsCacheDto) {
+ if (userAwardsCacheDto.type === 2) {
+ console.log(`抽中:${userAwardsCacheDto.jBeanAwardVo.quantity}${userAwardsCacheDto.jBeanAwardVo.ext || `京豆`}`);
+ } else if (userAwardsCacheDto.type === 0) {
+ console.log(`很遗憾未中奖~`)
+ } else if (userAwardsCacheDto.type === 1) {
+ console.log(`抽中:${userAwardsCacheDto.couponVo.prizeName},金额${userAwardsCacheDto.couponVo.usageThreshold}-${userAwardsCacheDto.couponVo.quota},使用时间${userAwardsCacheDto.couponVo.useTimeRange}`);
+ } else {
+ console.log(`抽中:${JSON.stringify(data)}`);
+ message += `抽中:${JSON.stringify(data)}\n`;
+ }
+ } else {
+ $.canLottery = false
+ console.log(`此活动已黑,无法抽奖\n`)
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve();
+ }
+ })
+ })
+}
+
+function taskUrl(function_id, body = {}) {
+ return {
+ url: `${JD_API_HOST}`,
+ body: `functionId=${function_id}&body=${JSON.stringify(body)}&client=wh5&clientVersion=1.0.0`,
+ headers: {
+ "Host": "api.m.jd.com",
+ "Accept": "application/json, text/plain, */*",
+ "Content-Type": "application/x-www-form-urlencoded",
+ "Origin": "https://h5.m.jd.com",
+ "Cookie": cookie,
+ "Accept-Language": "zh-cn",
+ "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"),
+ "Referer": "https://h5.m.jd.com/babelDiy/Zeus/4FdmTJQNah9oDJyQN8NggvRi1nEY/index.html",
+ "Accept-Encoding": "gzip, deflate, br"
+ }
+ }
+}
+
+function getAuthorShareCode(url) {
+ return new Promise(async resolve => {
+ const options = {
+ url: `${url}?${new Date()}`, "timeout": 10000, headers: {
+ "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"
+ }
+ };
+ if ($.isNode() && process.env.TG_PROXY_HOST && process.env.TG_PROXY_PORT) {
+ const tunnel = require("tunnel");
+ const agent = {
+ https: tunnel.httpsOverHttp({
+ proxy: {
+ host: process.env.TG_PROXY_HOST,
+ port: process.env.TG_PROXY_PORT * 1
+ }
+ })
+ }
+ Object.assign(options, { agent })
+ }
+ $.get(options, async (err, resp, data) => {
+ try {
+ resolve(JSON.parse(data))
+ } catch (e) {
+ // $.logErr(e, resp)
+ } finally {
+ resolve();
+ }
+ })
+ await $.wait(10000)
+ resolve();
+ })
+}
+
+function TotalBean() {
+ return new Promise(async resolve => {
+ const options = {
+ "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
+ "headers": {
+ "Accept": "application/json,text/plain, */*",
+ "Content-Type": "application/x-www-form-urlencoded",
+ "Accept-Encoding": "gzip, deflate, br",
+ "Accept-Language": "zh-cn",
+ "Connection": "keep-alive",
+ "Cookie": cookie,
+ "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
+ "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (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")
+ }
+ }
+ $.post(options, (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if (data) {
+ data = JSON.parse(data);
+ if (data['retcode'] === 13) {
+ $.isLogin = false; //cookie过期
+ return
+ }
+ if (data['retcode'] === 0) {
+ $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
+ } else {
+ $.nickName = $.UserName
+ }
+ } else {
+ console.log(`京东服务器返回空数据`)
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve();
+ }
+ })
+ })
+}
+function safeGet(data) {
+ try {
+ if (typeof JSON.parse(data) == "object") {
+ return true;
+ }
+ } catch (e) {
+ console.log(e);
+ console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
+ return false;
+ }
+}
+function jsonParse(str) {
+ if (typeof str == "string") {
+ try {
+ return JSON.parse(str);
+ } catch (e) {
+ console.log(e);
+ $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
+ return [];
+ }
+ }
+}
+// prettier-ignore
+function Env(t,e){"undefined"!=typeof process&&JSON.stringify(process.env).indexOf("GITHUB")>-1&&process.exit(0);class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`🔔${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(n,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============📣系统通知📣=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`❗️${this.name}, 错误!`,t.stack):this.log("",`❗️${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`🔔${this.name}, 结束! 🕛 ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)}
\ No newline at end of file
diff --git a/src/main/resources/test_yiliCow.js b/src/main/resources/test_yiliCow.js
new file mode 100644
index 0000000..b7a61e2
--- /dev/null
+++ b/src/main/resources/test_yiliCow.js
@@ -0,0 +1,563 @@
+/*
+伊利养牛记
+
+如果提示没有养牛 自己手动进去养一只
+活动入口:伊利京东自营旗舰店->伊利牛奶
+21.0复制整段话 Http:/JnE0bflXQPzN4R 伊利云养一头牛,赢1分钱得牛奶一提!坚持打卡~每日多个好礼相送哟!快来云养的牛宝宝吧!#f1EQN5nQJa%去【椋〣崬】
+
+[task_local]
+#伊利养牛记
+cron 38 5,18 * * * jd_ylyn.js, tag=伊利养牛记, img-url=https://raw.githubusercontent.com/Orz-3/mini/master/Color/jd.png, enabled=true
+*/
+const $ = new Env('伊利养牛记');
+//Node.js用户请在jdCookie.js处填写京东ck;
+const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
+const randomCount = $.isNode() ? 20 : 5;
+const notify = $.isNode() ? require('./sendNotify') : '';
+let merge = {}
+let codeList = []
+Exchange = $.isNode() ? (process.env.Cowexchange ? process.env.Cowexchange : false) : ($.getdata("Cowexchange") ? $.getdata("Cowexchange") : false);
+//IOS等用户直接用NobyDa的jd cookie
+let cookiesArr = [],
+ cookie = '';
+if ($.isNode()) {
+ Object.keys(jdCookieNode).forEach((item) => {
+ cookiesArr.push(jdCookieNode[item])
+ })
+ if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
+} else {
+ cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
+}
+
+const JD_API_HOST = `https://api.m.jd.com/client.action`;
+message = ""
+$.shareuuid = "7eaf779f13f64e2cbb2b1a55fd1de09f" //
+ !(async () => {
+ console.log(`入口:21.0复制整段话 Http:/JnE0bflXQPzN4R 伊利云养一头牛,赢1分钱得牛奶一提!坚持打卡~每日多个好礼相送哟!快来云养的牛宝宝吧!#f1EQN5nQJa%去【椋〣崬】\n`)
+ if (!cookiesArr[0]) {
+ $.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {
+ "open-url": "https://bean.m.jd.com/"
+ });
+ return;
+ }
+ for (let i = 0; i $.logErr(e))
+ .finally(() => $.done())
+//获取活动信息
+
+
+
+//genToken
+function genToken() {
+ let config = {
+ url: 'https://api.m.jd.com/client.action?functionId=genToken&clientVersion=10.0.4&build=88641&client=android&d_brand=OPPO&d_model=PCAM00&osVersion=10&screen=2208*1080&partner=oppo&oaid=&openudid=7049442d7e415232&eid=eidAfb0d81231cs3I4yd3GgLRjqcx9qFEcJEmyOMn1BwD8wvLt/pM7ENipVIQXuRiDyQ0FYw2aud9+AhtGqo1Zhp0TsLEgoKZvAWkaXhApgim9hlEyRB&sdkVersion=29&lang=zh_CN&uuid=7049442d7e415232&aid=7049442d7e415232&area=4_48201_54794_0&networkType=wifi&wifiBssid=774de7601b5cddf9aad1ae30f3a3dfc0&uts=0f31TVRjBSsqndu4%2FjgUPz6uymy50MQJ3DxdOrbYUybTe3dL1fv5SZqA7LxGNRtzSOx8fh0f3M1MbIvt421AKNKOpCPfGQrrVUodx%2Fkyzv10ruE8Nej2sOUKwb8tCv2kUQ1xlvckMf%2F%2BQlbGZpk3SF6y3AMv848PpSuaIzc4Wef2Q%2FEVdfQwC5mHEU9bM129HM13EJuyirzz6m2X3KkBMA%3D%3D&uemps=0-0&st=1626585864591&sign=b8c73932c27934ace61d09b492e47cd1&sv=101',
+ body: 'body=%7B%22action%22%3A%22to%22%2C%22to%22%3A%22https%253A%252F%252Flzdz-isv.isvjcloud.com%252Fdingzhi%252Fyili%252Fyangniu%252Factivity%252F5070687%253FactivityId%253Ddz2103100001340201%2526shareUuid%253Dbd93957c016242f6a51194d35449432c%2526adsource%253Dziying%2526shareuserid4minipg%253Du%252FcWHIy7%252Fx3Ij%252BHjfbnnePkaL5GGqMTUc8u%252Fotw2E%252Ba7Ak3lgFoFQlZmf45w8Jzw%2526shopid%253D1000013402%22%7D&',
+ headers: {
+ 'Host': 'api.m.jd.com',
+ 'accept': '*/*',
+ 'user-agent': 'JD4iPhone/167490 (iPhone; iOS 14.2; Scale/3.00)',
+ 'accept-language': 'zh-Hans-JP;q=1, en-JP;q=0.9, zh-Hant-TW;q=0.8, ja-JP;q=0.7, en-US;q=0.6',
+ 'content-type': 'application/x-www-form-urlencoded',
+ 'Cookie': cookie
+ }
+ }
+ return new Promise(resolve => {
+ $.post(config, async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${$.name} API请求失败,请检查网路重试`);
+ console.log(`${JSON.stringify(err)}`)
+ } else {
+ data = JSON.parse(data);
+ $.isvToken = data['tokenKey']
+ //console.log($.isvToken)
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+
+//获取pin需要用到
+function getToken2() {
+ let config = {
+ url: 'https://api.m.jd.com/client.action?functionId=isvObfuscator&clientVersion=10.0.4&build=88641&client=android&d_brand=OPPO&d_model=PCAM00&osVersion=10&screen=2208*1080&partner=oppo&oaid=&openudid=7049442d7e415232&eid=eidAfb0d81231cs3I4yd3GgLRjqcx9qFEcJEmyOMn1BwD8wvLt/pM7ENipVIQXuRiDyQ0FYw2aud9+AhtGqo1Zhp0TsLEgoKZvAWkaXhApgim9hlEyRB&sdkVersion=29&lang=zh_CN&uuid=7049442d7e415232&aid=7049442d7e415232&area=4_48201_54794_0&networkType=wifi&wifiBssid=774de7601b5cddf9aad1ae30f3a3dfc0&uts=0f31TVRjBSsqndu4%2FjgUPz6uymy50MQJ3DxdOrbYUybTe3dL1fv5SZqA7LxGNRtzSOx8fh0f3M1MbIvt421AKNKOpCPfGQrrVUodx%2Fkyzv10ruE8Nej2sOUKwb8tCv2kUQ1xlvckMf%2F%2BQlbGZpk3SF6y3AMv848PpSuaIzc4Wef2Q%2FEVdfQwC5mHEU9bM129HM13EJuyirzz6m2X3KkBMA%3D%3D&uemps=0-0&st=1626585867093&sign=35d78547e97fda4666f0819866a13b19&sv=121',
+ body: 'body=%7B%22id%22%3A%22%22%2C%22url%22%3A%22https%3A%2F%2Flzdz-isv.isvjcloud.com%22%7D&',
+ headers: {
+ 'Host': 'api.m.jd.com',
+ 'accept': '*/*',
+ 'user-agent': 'JD4iPhone/167490 (iPhone; iOS 14.2; Scale/3.00)',
+ 'accept-language': 'zh-Hans-JP;q=1, en-JP;q=0.9, zh-Hant-TW;q=0.8, ja-JP;q=0.7, en-US;q=0.6',
+ 'content-type': 'application/x-www-form-urlencoded',
+ 'Cookie': cookie
+ }
+ }
+ return new Promise(resolve => {
+ $.post(config, async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ data = JSON.parse(data);
+ $.token2 = data['token']
+ //console.log($.token2)
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+
+
+
+
+//抄的书店的 不过不加好像也能进去
+function getActCk() {
+ return new Promise(resolve => {
+ $.get(taskUrl("/dingzhi/yili/yangniu/activity", `activityId=dz2103100001340201&shareUuid=bd93957c016242f6a51194d35449432c&adsource=ziying&shareuserid4minipg=u/cWHIy7/x3Ij+HjfbnnePkaL5GGqMTUc8u/otw2E+a7Ak3lgFoFQlZmf45w8Jzw&shopid=1000013402&lng=114.062541&lat=29.541254&sid=eec1865d9c44c1070f3b5e6718c9ee1w&un_area=4_48201_54794_0`), (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ if ($.isNode())
+ for (let ck of resp['headers']['set-cookie']) {
+ cookie = `${cookie}; ${ck.split(";")[0]};`
+ }
+ else {
+ for (let ck of resp['headers']['Set-Cookie'].split(',')) {
+ cookie = `${cookie}; ${ck.split(";")[0]};`
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+
+//获取我的pin
+function getshopid() {
+ let config = taskPostUrl("/dz/common/getSimpleActInfoVo", "activityId=dz2103100001340201")
+
+ return new Promise(resolve => {
+ $.post(config, async (err, resp, data) => {
+
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ data = JSON.parse(data);
+ if (data.result) {
+ $.shopid = data.data.venderId
+ //console.log($.shopid)
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+
+//获取我的pin
+function getMyPin() {
+ let config = taskPostUrl("/customer/getMyPing", `userId=${$.shopid}&token=${encodeURIComponent($.token2)}&fromType=APP`)
+ // console.log(config)
+ return new Promise(resolve => {
+ $.post(config, async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ data = JSON.parse(data);
+ if (data.data && data.data.secretPin) {
+ $.pin = data.data.secretPin
+ // console.log($.pin)
+ $.nickname = data.data.nickname
+ $.lz_jdpin_token = resp['headers']['set-cookie'].filter(row => row.indexOf("lz_jdpin_token") !== -1)[0]
+ // console.log(data)
+ console.log(`${$.nickname}`);
+
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+
+function adlog() {
+ let config = taskPostUrl("/common/accessLogWithAD", `venderId=1000013402&code=99&pin=${encodeURIComponent($.pin)}&activityId=dz2103100001340201&pageUrl=https%3A%2F%2Flzdz-isv.isvjcloud.com%2Fdingzhi%2Fyili%2Fyangniu%2Factivity%2F4827909%3FactivityId%3Ddz2103100001340201%26shareUuid%3Db44243656a694b6f94bb30a4a5f2a45d%26adsource%3Dziying%26shareuserid4minipg%3D5Iufa9rY657S3OP3PLSpK07oeVP9kq2pYSH90mYt4m3fwcJlClpxrfmVYaGKuquQkdK3rLBQpEQH9V4tdrrh0w%3D%3D%26shopid%3D1000013402%26lng%3D114.062604%26lat%3D29.541501%26sid%3D6e9bfee3838075a72533536815d8f3ew%26un_area%3D4_48201_54794_0&subType=app&adSource=ziying`)
+ // console.log(config)
+ return new Promise(resolve => {
+ $.post(config, async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ // data = JSON.parse(data);
+ if ($.isNode())
+ for (let ck of resp['headers']['set-cookie']) {
+ cookie = `${cookie}; ${ck.split(";")[0]};`
+ }
+ else {
+ for (let ck of resp['headers']['Set-Cookie'].split(',')) {
+ cookie = `${cookie}; ${ck.split(";")[0]};`
+ }
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+
+function saveCow() {
+ return new Promise(resolve => {
+
+ let body = `activityId=dz2103100001340201&actorUuid=${$.shareuuid}&shareUuid=${$.shareuuid}&cowNick=%E6%9F%A0%E6%AA%AC`
+ let config = taskPostUrl('/dingzhi/yili/yangniu/saveCow', body)
+ // console.log(config)
+ $.post(config, async (err, resp, data) => {
+ //$.log(data)
+ try {
+ if (err) {
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ data = JSON.parse(data);
+ if (data.result == true) {
+ $.cowNick = data.data.cowNick
+ $.log("取名:"+$.cowNick)
+ } else if(data.result == false){
+
+ $.log(data.errorMessage)
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+
+// 获得用户信息
+function getUserInfo() {
+ return new Promise(resolve => {
+ let body = `pin=${encodeURIComponent($.pin)}`
+ let config = taskPostUrl('/wxActionCommon/getUserInfo', body)
+ // console.log(config)
+ $.post(config, async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ data = JSON.parse(data);
+ if (data.data) {
+ $.userId = data.data.id
+ $.pinImg = data.data.yunMidImageUrl
+ $.nick = data.data.nickname
+ } else {
+ $.cando = false
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+
+function getUid() {
+ return new Promise(resolve => {
+ let body = `activityId=dz2103100001340201&pin=${encodeURIComponent($.pin)}&pinImg=${$.pinImg }&nick=${encodeURIComponent($.nick)}&cjyxPin=&cjhyPin=&shareUuid=${$.shareuuid}`
+ $.post(taskPostUrl('/dingzhi/yili/yangniu/activityContent', body), async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ data = JSON.parse(data);
+ if (data.result) {
+ if(data.data.openCard == false){
+ console.log("当前未开卡,无法助力和兑换奖励哦")
+ await join(100000000000168,1000013402)
+
+ }
+ $.shareuuid = data.data.actorUuid
+ console.log(`\n【京东账号${$.index}(${$.UserName})的${$.name}\n好友互助码】${$.shareuuid}\n`);
+
+
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function join(venderId,shopId) {
+ return new Promise(resolve => {
+let joinurl ={
+ url: `https://api.m.jd.com/client.action?appid=jd_shop_member&functionId=bindWithVender&body={"venderId":"${venderId}","shopId":"${shopId}","bindByVerifyCodeFlag":1,"registerExtend":{},"writeChildFlag":0}&client=H5&clientVersion=8.5.6&uuid=88888&jsonp=jsonp_1599410555929_50468`,
+ headers: {
+ 'Origin': 'https://api.m.jd.com',
+ 'Host': 'api.m.jd.com',
+ 'accept': '*/*',
+ 'user-agent': 'Mozilla/4.0 (compatible; MSIE 9.0; Windows NT 6.1)',
+ 'accept-language': 'zh-Hans-JP;q=1, en-JP;q=0.9, zh-Hant-TW;q=0.8, ja-JP;q=0.7, en-US;q=0.6',
+ 'Referer': `https://api.m.jd.com/client.action?appid=jd_shop_member&functionId=bindWithVender&body={"venderId":"${venderId}","shopId":"${shopId}","bindByVerifyCodeFlag":1,"registerExtend":{},"writeChildFlag":0}&client=H5&clientVersion=8.5.6&uuid=88888&jsonp=jsonp_1599410555929_50468`,
+ 'Cookie': cookie1,
+ }
+ }
+
+ $.get(joinurl, async (err, resp, data) => {
+ try {
+
+ data = data.match(/(\{().+\})/)[1]
+ data = JSON.parse(data);
+ if(data.success == true){
+ $.log(data.message)
+ }else if(data.success == false){
+ $.log(data.message)
+ }
+
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+
+function feedCow() {
+
+ let config = taskPostUrl("/dingzhi/yili/yangniu/feedCow", `activityId=dz2103100001340201&actorUuid=${$.shareuuid}&pin=${encodeURIComponent($.pin)}`)
+ // console.log(config)
+ return new Promise(resolve => {
+ $.post(config, async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ data = JSON.parse(data);
+ if (data.result) {
+ if (data.data) {
+ $.cs = data.data.score2*0.1
+ $.cj = data.data.assistCount
+ $.log($.cj)
+ console.log(`老牛等级:${data.data.level}\n下一等级还需吃奶:${data.data.score*0.1}\n剩余奶滴:${data.data.score2*0.1}`)
+ }
+ } else {
+ console.log(data.errorMessage)
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+
+}
+
+
+function dotask(taskType, taskValue) {
+
+ let config = taskPostUrl("/dingzhi/yili/yangniu/saveTask", `activityId=dz2103100001340201&actorUuid=${$.shareuuid}&pin=${encodeURIComponent($.pin)}&taskType=${taskType}&taskValue=${taskValue}`)
+ // console.log(config)
+ return new Promise(resolve => {
+ $.post(config, async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ data = JSON.parse(data);
+ if (data.result) {
+ if (data.data) {
+ console.log("恭喜你,获得奶滴: " + data.data.milkCount )
+ }
+ } else {
+ console.log(data.errorMessage)
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+
+}
+
+function draw() {
+
+ let config = taskPostUrl("/dingzhi/yili/yangniu/start", `activityId=dz2103100001340201&pin=${encodeURIComponent($.pin)}&actorUuid=${$.shareuuid}`)
+ // console.log(config)
+ return new Promise(resolve => {
+ $.post(config, async (err, resp, data) => {
+ try {
+ if (err) {
+ console.log(`${JSON.stringify(err)}`)
+ console.log(`${$.name} API请求失败,请检查网路重试`)
+ } else {
+ data = JSON.parse(data);
+ if (data.result) {
+ if (Object.keys(data.data).length == 0) {
+ console.log("抽奖成功,恭喜你抽了个寂寞: ")
+ } else {
+ console.log(`恭喜你抽中 ${data.data.name}`)
+ $.drawresult += `恭喜你抽中 ${data.data.name} `
+ }
+ } else {
+ console.log(data.errorMessage)
+ }
+ }
+ } catch (e) {
+ $.logErr(e, resp)
+ } finally {
+ resolve(data);
+ }
+ })
+ })
+}
+function taskUrl(url, body) {
+ const time = Date.now();
+ // console.log(cookie)
+ return {
+ url: `https://lzdz-isv.isvjcloud.com${url}?${body}`,
+ headers: {
+ 'Host': 'lzdz-isv.isvjcloud.com',
+ 'Accept': 'application/json',
+ // 'X-Requested-With': 'XMLHttpRequest',
+ 'Referer': 'https://lzdz-isv.isvjcloud.com/dingzhi/yili/yangniu/activity/4827909?activityId=dz2103100001340201&shareUuid=b44243656a694b6f94bb30a4a5f2a45d&adsource=ziying&shareuserid4minipg=5Iufa9rY657S3OP3PLSpK07oeVP9kq2pYSH90mYt4m3fwcJlClpxrfmVYaGKuquQkdK3rLBQpEQH9V4tdrrh0w==&shopid=1000013402&lng=114.062604&lat=29.541501&sid=6e9bfee3838075a72533536815d8f3ew&un_area=4_48201_54794_0',
+ 'user-agent': 'jdapp;android;10.0.4;11;2393039353533623-7383235613364343;network/wifi;model/Redmi K30;addressid/138549750;aid/290955c2782e1c44;oaid/b30cf82cacfa8972;osVer/30;appBuild/88641;partner/xiaomi001;eufv/1;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 11; Redmi K30 Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045537 Mobile Safari/537.36',
+ 'content-type': 'application/x-www-form-urlencoded',
+ 'Cookie': `${cookie} IsvToken=${$.IsvToken};AUTH_C_USER=${$.pin}`,
+ }
+ }
+}
+
+
+
+function taskPostUrl(url, body) {
+ return {
+ url: `https://lzdz-isv.isvjcloud.com${url}`,
+ body: body,
+ headers: {
+ 'Host': 'lzdz-isv.isvjcloud.com',
+ 'Accept': 'application/json',
+ 'X-Requested-With': 'XMLHttpRequest',
+
+
+ 'Referer': 'https://lzdz-isv.isvjcloud.com/dingzhi/yili/yangniu/activity/4827909?activityId=dz2103100001340201&shareUuid=b44243656a694b6f94bb30a4a5f2a45d&adsource=ziying&shareuserid4minipg=5Iufa9rY657S3OP3PLSpK07oeVP9kq2pYSH90mYt4m3fwcJlClpxrfmVYaGKuquQkdK3rLBQpEQH9V4tdrrh0w==&shopid=1000013402&lng=114.062604&lat=29.541501&sid=6e9bfee3838075a72533536815d8f3ew&un_area=4_48201_54794_0',
+ 'user-agent': 'jdapp;android;10.0.4;11;2393039353533623-7383235613364343;network/wifi;model/Redmi K30;addressid/138549750;aid/290955c2782e1c44;oaid/b30cf82cacfa8972;osVer/30;appBuild/88641;partner/xiaomi001;eufv/1;jdSupportDarkMode/0;Mozilla/5.0 (Linux; Android 11; Redmi K30 Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045537 Mobile Safari/537.36',
+ 'content-type': 'application/x-www-form-urlencoded',
+ 'Cookie': `${cookie} IsvToken=${$.IsvToken};AUTH_C_USER=${$.pin};${$.lz_jdpin_token}`,
+ }
+ }
+}
+
+
+
+
+function jsonParse(str) {
+ if (typeof str == "string") {
+ try {
+ return JSON.parse(str);
+ } catch (e) {
+ console.log(e);
+ $.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
+ return [];
+ }
+ }
+}
+// prettier-ignore
+function Env(t,e){class s{constructor(t){this.env=t}send(t,e="GET"){t="string"==typeof t?{url:t}:t;let s=this.get;return"POST"===e&&(s=this.post),new Promise((e,i)=>{s.call(this,t,(t,s,r)=>{t?i(t):e(s)})})}get(t){return this.send.call(this.env,t)}post(t){return this.send.call(this.env,t,"POST")}}return new class{constructor(t,e){this.name=t,this.http=new s(this),this.data=null,this.dataFile="box.dat",this.logs=[],this.isMute=!1,this.isNeedRewrite=!1,this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,e),this.log("",`??${this.name}, 开始!`)}isNode(){return"undefined"!=typeof module&&!!module.exports}isQuanX(){return"undefined"!=typeof $task}isSurge(){return"undefined"!=typeof $httpClient&&"undefined"==typeof $loon}isLoon(){return"undefined"!=typeof $loon}toObj(t,e=null){try{return JSON.parse(t)}catch{return e}}toStr(t,e=null){try{return JSON.stringify(t)}catch{return e}}getjson(t,e){let s=e;const i=this.getdata(t);if(i)try{s=JSON.parse(this.getdata(t))}catch{}return s}setjson(t,e){try{return this.setdata(JSON.stringify(t),e)}catch{return!1}}getScript(t){return new Promise(e=>{this.get({url:t},(t,s,i)=>e(i))})}runScript(t,e){return new Promise(s=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let r=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");r=r?1*r:20,r=e&&e.timeout?e.timeout:r;const[o,h]=i.split("@"),n={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(n,(t,e,i)=>s(i))}).catch(t=>this.logErr(t))}loaddata(){if(!this.isNode())return{};{this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e);if(!s&&!i)return{};{const i=s?t:e;try{return JSON.parse(this.fs.readFileSync(i))}catch(t){return{}}}}}writedata(){if(this.isNode()){this.fs=this.fs?this.fs:require("fs"),this.path=this.path?this.path:require("path");const t=this.path.resolve(this.dataFile),e=this.path.resolve(process.cwd(),this.dataFile),s=this.fs.existsSync(t),i=!s&&this.fs.existsSync(e),r=JSON.stringify(this.data);s?this.fs.writeFileSync(t,r):i?this.fs.writeFileSync(e,r):this.fs.writeFileSync(t,r)}}lodash_get(t,e,s){const i=e.replace(/\[(\d+)\]/g,".$1").split(".");let r=t;for(const t of i)if(r=Object(r)[t],void 0===r)return s;return r}lodash_set(t,e,s){return Object(t)!==t?t:(Array.isArray(e)||(e=e.toString().match(/[^.[\]]+/g)||[]),e.slice(0,-1).reduce((t,s,i)=>Object(t[s])===t[s]?t[s]:t[s]=Math.abs(e[i+1])>>0==+e[i+1]?[]:{},t)[e[e.length-1]]=s,t)}getdata(t){let e=this.getval(t);if(/^@/.test(t)){const[,s,i]=/^@(.*?)\.(.*?)$/.exec(t),r=s?this.getval(s):"";if(r)try{const t=JSON.parse(r);e=t?this.lodash_get(t,i,""):e}catch(t){e=""}}return e}setdata(t,e){let s=!1;if(/^@/.test(e)){const[,i,r]=/^@(.*?)\.(.*?)$/.exec(e),o=this.getval(i),h=i?"null"===o?null:o||"{}":"{}";try{const e=JSON.parse(h);this.lodash_set(e,r,t),s=this.setval(JSON.stringify(e),i)}catch(e){const o={};this.lodash_set(o,r,t),s=this.setval(JSON.stringify(o),i)}}else s=this.setval(t,e);return s}getval(t){return this.isSurge()||this.isLoon()?$persistentStore.read(t):this.isQuanX()?$prefs.valueForKey(t):this.isNode()?(this.data=this.loaddata(),this.data[t]):this.data&&this.data[t]||null}setval(t,e){return this.isSurge()||this.isLoon()?$persistentStore.write(t,e):this.isQuanX()?$prefs.setValueForKey(t,e):this.isNode()?(this.data=this.loaddata(),this.data[e]=t,this.writedata(),!0):this.data&&this.data[e]||null}initGotEnv(t){this.got=this.got?this.got:require("got"),this.cktough=this.cktough?this.cktough:require("tough-cookie"),this.ckjar=this.ckjar?this.ckjar:new this.cktough.CookieJar,t&&(t.headers=t.headers?t.headers:{},void 0===t.headers.Cookie&&void 0===t.cookieJar&&(t.cookieJar=this.ckjar))}get(t,e=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t,e=null){const s=e?new Date(e):new Date;let i={"M+":s.getMonth()+1,"d+":s.getDate(),"H+":s.getHours(),"m+":s.getMinutes(),"s+":s.getSeconds(),"q+":Math.floor((s.getMonth()+3)/3),S:s.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(s.getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in i)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[e]:("00"+i[e]).substr((""+i[e]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============??系统通知??=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`??${this.name}, 错误!`,t.stack):this.log("",`??${this.name}, 错误!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`??${this.name}, 结束! ?? ${s} 秒`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)}
\ No newline at end of file