-
Notifications
You must be signed in to change notification settings - Fork 0
/
jd_bean_sign.js
2066 lines (1985 loc) · 90.9 KB
/
jd_bean_sign.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
Node.JS专用
cron 0 0 * * * https://raw.githubusercontent.com/zero205/JD_tencent_scf/main/jd_bean_sign.js
金融签到有一定使用门槛,需要请仔细阅读下方文字:
JRBODY抓取网站:ms.jr.jd.com/gw/generic/hy/h5/m/appSign(进入金融APP签到页面手动签到);抓取请求body,格式:"reqData=xxx"
变量填写示例:JRBODY: reqData=xxx&reqData=xxx&&reqData=xxx(比如第三个号没有,则留空,长度要与CK一致)
强烈建议用文件,环境变量太长了
云函数用户在config分支新建diy/JRBODY.txt即可(也就是diy文件夹下新建JRBODY.txt).每行一个jrbody,结尾行写'Finish'
例子:
reqData=xxx
(这个号没有,这行空着)
reqData=xxx
Finish
其他环境用户除了JRBODY环境变量可以选用JRBODY.txt文件,放在同目录下,格式同上.
注:优先识别环境变量,如使用txt文件请不要设置环境变量.JRBODY换行符(应为unix换行符)可能影响脚本读取!
出现任何问题请先删除CookieSet.json(云函数不用操作)
云函数提示写入失败正常,无任何影响
*/
console.log('京东多合一签到SCF开始')
const sendNotify = require('./sendNotify.js').sendNotify
const fs = require('fs')
const jr_file = 'JRBODY.txt'
const readline = require('readline')
let cookiesArr = []
let notification = ''
const stopVar = process.env.JD_BEAN_STOP ? process.env.JD_BEAN_STOP : '2000-5000';
console.log('Stop:',stopVar)
async function processLineByLine(jrbodys) {
const fileStream = fs.createReadStream(jr_file)
const rl = readline.createInterface({
input: fileStream,
crlfDelay: Infinity
})
for await (let line of rl) {
line = line.trim()
if (line == 'Finish'){
console.log(`识别到读取结束符号,结束.共读取${jrbodys.length}个`)
return
}
jrbodys.push(line)
}
}
(async () => {
const jdCookieNode = require('./jdCookie.js')
Object.keys(jdCookieNode).forEach((item) => {
let ck = jdCookieNode[item].trim()
if(ck.substring(ck.length-1) !== ';'){
ck = ck + ';'
}
cookiesArr.push(ck)
})
let jrbodys = []
if(process.env.JRBODY) {
jrbodys = process.env.JRBODY.split('&')
}else{
console.log(`未检测到JRBODY环境变量,开始检测${jr_file}`)
try {
await fs.accessSync('./'+jr_file, fs.constants.F_OK)
console.log(`${jr_file} '存在,读取配置'`)
await processLineByLine(jrbodys)
} catch (err) {
console.log(`${jr_file} '不存在,跳过'`)
}
}
if (jrbodys.length != cookiesArr.length) {
console.error(`CK和JRBODY长度不匹配,不使用JRBODY,请阅读脚本开头说明.当前ck长度:${cookiesArr.length},JRBODY长度:${jrbodys.length}`)
jrbodys = undefined
}
for (let i = 0; i < cookiesArr.length; i++) {
const data = {
'cookie':cookiesArr[i]
}
if (jrbodys) {
if(jrbodys[i].startsWith('reqData=')){
data['jrBody'] = jrbodys[i]
}else{
console.log(`跳过第${i+1}个JRBODY,为空或格式不正确`)
}
}
cookiesArr[i] = data
}
console.log('main block finished')
})()
.then(() => {
console.log('Nobyda签到部分开始')
/*************************
京东多合一签到脚本
更新时间: 2021.09.09 20:20 v2.1.3
有效接口: 20+
脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js
电报频道: @NobyDa
问题反馈: @NobyDa_bot
如果转载: 请注明出处
*************************
【 QX, Surge, Loon 说明 】 :
*************************
初次使用时, app配置文件添加脚本配置, 并启用Mitm后:
Safari浏览器打开登录 https://home.m.jd.com/myJd/newhome.action 点击"我的"页面
或者使用旧版网址 https://bean.m.jd.com/bean/signIndex.action 点击签到并且出现签到日历
如果通知获取Cookie成功, 则可以使用此签到脚本. 注: 请勿在京东APP内获取!!!
获取京东金融签到Body说明: 正确添加脚本配置后, 进入"京东金融"APP, 在"首页"点击"签到"并签到一次, 待通知提示成功即可.
由于cookie的有效性(经测试网页Cookie有效周期最长31天),如果脚本后续弹出cookie无效的通知,则需要重复上述步骤。
签到脚本将在每天的凌晨0:05执行, 您可以修改执行时间。 因部分接口京豆限量领取, 建议调整为凌晨签到。
BoxJs或QX Gallery订阅地址: https://raw.githubusercontent.com/NobyDa/Script/master/NobyDa_BoxJs.json
*************************
【 配置多京东账号签到说明 】 :
*************************
正确配置QX、Surge、Loon后, 并使用此脚本获取"账号1"Cookie成功后, 请勿点击退出账号(可能会导致Cookie失效), 需清除浏览器资料或更换浏览器登录"账号2"获取即可; 账号3或以上同理.
注: 如需清除所有Cookie, 您可开启脚本内"DeleteCookie"选项 (第114行)
*************************
【 JSbox, Node.js 说明 】 :
*************************
开启抓包app后, Safari浏览器登录 https://home.m.jd.com/myJd/newhome.action 点击个人中心页面后, 返回抓包app搜索关键字 info/GetJDUserInfoUnion 复制请求头Cookie字段填入json串数据内即可
如需获取京东金融签到Body, 可进入"京东金融"APP (iOS), 在"首页"点击"签到"并签到一次, 返回抓包app搜索关键字 h5/m/appSign 复制请求体填入json串数据内即可
*/
var Key = ''; //该参数已废弃; 仅用于下游脚本的兼容, 请使用json串数据 ↓
var DualKey = ''; //该参数已废弃; 仅用于下游脚本的兼容, 请使用json串数据 ↓
var OtherKey = JSON.stringify(cookiesArr); //无限账号Cookie json串数据, 请严格按照json格式填写, 具体格式请看以下样例:
/*以下样例为双账号("cookie"为必须,其他可选), 第一个账号仅包含Cookie, 第二个账号包含Cookie和金融签到Body:
var OtherKey = `[{
"cookie": "pt_key=xxx;pt_pin=yyy;"
}, {
"cookie": "pt_key=yyy;pt_pin=xxx;",
"jrBody": "reqData=xxx"
}]`
注1: 以上选项仅针对于JsBox或Node.js, 如果使用QX,Surge,Loon, 请使用脚本获取Cookie.
注2: 多账号用户抓取"账号1"Cookie后, 请勿点击退出账号(可能会导致Cookie失效), 需清除浏览器资料或更换浏览器登录"账号2"抓取.
注3: 如果使用Node.js, 需自行安装'request'模块. 例: npm install request -g
注4: Node.js或JSbox环境下已配置数据持久化, 填写Cookie运行一次后, 后续更新脚本无需再次填写, 待Cookie失效后重新抓取填写即可.
注5: 脚本将自动处理"持久化数据"和"手动填写cookie"之间的重复关系, 例如填写多个账号Cookie后, 后续其中一个失效, 仅需填写该失效账号的新Cookie即可, 其他账号不会被清除.
*************************
【Surge 4.2+ 脚本配置】:
*************************
[Script]
京东多合一签到 = type=cron,cronexp=5 0 * * *,wake-system=1,timeout=60,script-path=https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js
获取京东Cookie = type=http-request,requires-body=1,pattern=^https:\/\/(api\.m|me-api|ms\.jr)\.jd\.com\/(client\.action\?functionId=signBean|user_new\/info\/GetJDUserInfoUnion\?|gw\/generic\/hy\/h5\/m\/appSign\?),script-path=https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js
[MITM]
hostname = ms.jr.jd.com, me-api.jd.com, api.m.jd.com
*************************
【Loon 2.1+ 脚本配置】:
*************************
[Script]
cron "5 0 * * *" tag=京东多合一签到, script-path=https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js
http-request ^https:\/\/(api\.m|me-api|ms\.jr)\.jd\.com\/(client\.action\?functionId=signBean|user_new\/info\/GetJDUserInfoUnion\?|gw\/generic\/hy\/h5\/m\/appSign\?) tag=获取京东Cookie, requires-body=true, script-path=https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js
[MITM]
hostname = ms.jr.jd.com, me-api.jd.com, api.m.jd.com
*************************
【 QX 1.0.10+ 脚本配置 】 :
*************************
[task_local]
# 京东多合一签到
5 0 * * * https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js, tag=京东多合一签到, img-url=https://raw.githubusercontent.com/NobyDa/mini/master/Color/jd.png,enabled=true
[rewrite_local]
# 获取京东Cookie.
^https:\/\/(api\.m|me-api)\.jd\.com\/(client\.action\?functionId=signBean|user_new\/info\/GetJDUserInfoUnion\?) url script-request-header https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js
# 获取钢镚签到body.
^https:\/\/ms\.jr\.jd\.com\/gw\/generic\/hy\/h5\/m\/appSign\? url script-request-body https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js
[mitm]
hostname = ms.jr.jd.com, me-api.jd.com, api.m.jd.com
*************************/
var LogDetails = false; //是否开启响应日志, true则开启
var stop = stopVar; //自定义延迟签到, 单位毫秒. 默认分批并发无延迟; 该参数接受随机或指定延迟(例: '2000'则表示延迟2秒; '2000-5000'则表示延迟最小2秒,最大5秒内的随机延迟), 如填入延迟则切换顺序签到(耗时较长), Surge用户请注意在SurgeUI界面调整脚本超时; 注: 该参数Node.js或JSbox环境下已配置数据持久化, 留空(var stop = '')即可清除.
var DeleteCookie = false; //是否清除所有Cookie, true则开启.
var boxdis = true; //是否开启自动禁用, false则关闭. 脚本运行崩溃时(如VPN断连), 下次运行时将自动禁用相关崩溃接口(仅部分接口启用), 崩溃时可能会误禁用正常接口. (该选项仅适用于QX,Surge,Loon)
var ReDis = false; //是否移除所有禁用列表, true则开启. 适用于触发自动禁用后, 需要再次启用接口的情况. (该选项仅适用于QX,Surge,Loon)
var out = 0; //接口超时退出, 用于可能发生的网络不稳定, 0则关闭. 如QX日志出现大量"JS Context timeout"后脚本中断时, 建议填写6000
var $nobyda = nobyda();
var merge = {};
var KEY = '';
async function all(cookie, jrBody) {
KEY = cookie;
merge = {};
$nobyda.num++;
switch (stop) {
case 0:
await Promise.all([
JingDongBean(stop), //京东京豆
JingDongStore(stop), //京东超市
JingRongSteel(stop, jrBody), //金融钢镚
JingDongTurn(stop), //京东转盘
JDFlashSale(stop), //京东闪购
JingDongCash(stop), //京东现金红包
JDMagicCube(stop, 2), //京东小魔方
JingDongSubsidy(stop), //京东金贴
JingDongGetCash(stop), //京东领现金
JingDongShake(stop), //京东摇一摇
JDSecKilling(stop), //京东秒杀
// JingRongDoll(stop, 'JRDoll', '京东金融-签壹', '4D25A6F482'),
// JingRongDoll(stop, 'JRThreeDoll', '京东金融-签叁', '69F5EC743C'),
// JingRongDoll(stop, 'JRFourDoll', '京东金融-签肆', '30C4F86264'),
// JingRongDoll(stop, 'JRFiveDoll', '京东金融-签伍', '1D06AA3B0F')
]);
await Promise.all([
JDUserSignPre(stop, 'JDUndies', '京东商城-内衣', '4PgpL1xqPSW1sVXCJ3xopDbB1f69'), //京东内衣馆
JDUserSignPre(stop, 'JDCard', '京东商城-卡包', '7e5fRnma6RBATV9wNrGXJwihzcD'), //京东卡包
// JDUserSignPre(stop, 'JDCustomized', '京东商城-定制', '2BJK5RBdvc3hdddZDS1Svd5Esj3R'), //京东定制
JDUserSignPre(stop, 'JDaccompany', '京东商城-陪伴', 'kPM3Xedz1PBiGQjY4ZYGmeVvrts'), //京东陪伴
JDUserSignPre(stop, 'JDShoes', '京东商城-鞋靴', '4RXyb1W4Y986LJW8ToqMK14BdTD'), //京东鞋靴
JDUserSignPre(stop, 'JDChild', '京东商城-童装', '3Af6mZNcf5m795T8dtDVfDwWVNhJ'), //京东童装馆
JDUserSignPre(stop, 'JDBaby', '京东商城-母婴', '3BbAVGQPDd6vTyHYjmAutXrKAos6'), //京东母婴馆
JDUserSignPre(stop, 'JD3C', '京东商城-数码', '4SWjnZSCTHPYjE5T7j35rxxuMTb6'), //京东数码电器馆
JDUserSignPre(stop, 'JDWomen', '京东商城-女装', 'DpSh7ma8JV7QAxSE2gJNro8Q2h9'), //京东女装馆
JDUserSignPre(stop, 'JDBook', '京东商城-图书', '3SC6rw5iBg66qrXPGmZMqFDwcyXi'), //京东图书
// JDUserSignPre(stop, 'ReceiveJD', '京东商城-领豆', 'Ni5PUSK7fzZc4EKangHhqPuprn2'), //京东-领京豆
JingRongDoll(stop, 'JTDouble', '京东金贴-双签', '1DF13833F7'), //京东金融 金贴双签
// JingRongDoll(stop, 'XJDouble', '金融现金-双签', 'F68B2C3E71', '', '', '', 'xianjin') //京东金融 现金双签
]);
await Promise.all([
JDUserSignPre(stop, 'JDStory', '京东失眠-补贴', 'UcyW9Znv3xeyixW1gofhW2DAoz4'), //失眠补贴
JDUserSignPre(stop, 'JDPhone', '京东手机-小时', '4Vh5ybVr98nfJgros5GwvXbmTUpg'), //手机小时达
JDUserSignPre(stop, 'JDEsports', '京东商城-电竞', 'CHdHQhA5AYDXXQN9FLt3QUAPRsB'), //京东电竞
JDUserSignPre(stop, 'JDClothing', '京东商城-服饰', '4RBT3H9jmgYg1k2kBnHF8NAHm7m8'), //京东服饰
JDUserSignPre(stop, 'JDSuitcase', '京东商城-箱包', 'ZrH7gGAcEkY2gH8wXqyAPoQgk6t'), //京东箱包馆
JDUserSignPre(stop, 'JDSchool', '京东商城-校园', '2QUxWHx5BSCNtnBDjtt5gZTq7zdZ'), //京东校园
JDUserSignPre(stop, 'JDHealth', '京东商城-健康', 'w2oeK5yLdHqHvwef7SMMy4PL8LF'), //京东健康
JDUserSignPre(stop, 'JDShand', '京东拍拍-二手', '3S28janPLYmtFxypu37AYAGgivfp'), //京东拍拍二手
JDUserSignPre(stop, 'JDClean', '京东商城-清洁', '2Tjm6ay1ZbZ3v7UbriTj6kHy9dn6'), //京东清洁馆
JDUserSignPre(stop, 'JDCare', '京东商城-个护', '2tZssTgnQsiUqhmg5ooLSHY9XSeN'), //京东个人护理馆
JDUserSignPre(stop, 'JDJiaDian', '京东商城-家电', '3uvPyw1pwHARGgndatCXddLNUxHw'), // 京东小家电
// JDUserSignPre(stop, 'JDJewels', '京东商城-珠宝', 'zHUHpTHNTaztSRfNBFNVZscyFZU'), //京东珠宝馆
// JDUserSignPre(stop, 'JDMakeup', '京东商城-美妆', '2smCxzLNuam5L14zNJHYu43ovbAP'), //京东美妆馆
JDUserSignPre(stop, 'JDVege', '京东商城-菜场', 'Wcu2LVCFMkBP3HraRvb7pgSpt64'), //京东菜场
// JDUserSignPre(stop, 'JDLive', '京东智能-生活', 'KcfFqWvhb5hHtaQkS4SD1UU6RcQ') //京东智能生活
]);
await JingRongDoll(stop, 'JDDouble', '金融京豆-双签', 'F68B2C3E71', '', '', '', 'jingdou'); //京东金融 京豆双签
break;
default:
await JingDongBean(0); //京东京豆
await JingDongStore(Wait(stop)); //京东超市
await JingRongSteel(Wait(stop), jrBody); //金融钢镚
await JingDongTurn(Wait(stop)); //京东转盘
await JDFlashSale(Wait(stop)); //京东闪购
await JingDongCash(Wait(stop)); //京东现金红包
await JDMagicCube(Wait(stop), 2); //京东小魔方
await JingDongGetCash(Wait(stop)); //京东领现金
await JingDongSubsidy(Wait(stop)); //京东金贴
await JingDongShake(Wait(stop)); //京东摇一摇
await JDSecKilling(Wait(stop)); //京东秒杀
// await JingRongDoll(Wait(stop), 'JRThreeDoll', '京东金融-签叁', '69F5EC743C');
// await JingRongDoll(Wait(stop), 'JRFourDoll', '京东金融-签肆', '30C4F86264');
// await JingRongDoll(Wait(stop), 'JRFiveDoll', '京东金融-签伍', '1D06AA3B0F');
// await JingRongDoll(Wait(stop), 'JRDoll', '京东金融-签壹', '4D25A6F482');
// await JingRongDoll(Wait(stop), 'XJDouble', '金融现金-双签', 'F68B2C3E71', '', '', '', 'xianjin'); //京东金融 现金双签
await JingRongDoll(Wait(stop), 'JTDouble', '京东金贴-双签', '1DF13833F7'); //京东金融 金贴双签
await JDUserSignPre(Wait(stop), 'JDStory', '京东失眠-补贴', 'UcyW9Znv3xeyixW1gofhW2DAoz4'); //失眠补贴
await JDUserSignPre(Wait(stop), 'JDPhone', '京东手机-小时', '4Vh5ybVr98nfJgros5GwvXbmTUpg'); //手机小时达
await JDUserSignPre(Wait(stop), 'JDCard', '京东商城-卡包', '7e5fRnma6RBATV9wNrGXJwihzcD'); //京东卡包
await JDUserSignPre(Wait(stop), 'JDUndies', '京东商城-内衣', '4PgpL1xqPSW1sVXCJ3xopDbB1f69'); //京东内衣馆
await JDUserSignPre(Wait(stop), 'JDEsports', '京东商城-电竞', 'CHdHQhA5AYDXXQN9FLt3QUAPRsB'); //京东电竞
// await JDUserSignPre(Wait(stop), 'JDCustomized', '京东商城-定制', '2BJK5RBdvc3hdddZDS1Svd5Esj3R'); //京东定制
await JDUserSignPre(Wait(stop), 'JDSuitcase', '京东商城-箱包', 'ZrH7gGAcEkY2gH8wXqyAPoQgk6t'); //京东箱包馆
await JDUserSignPre(Wait(stop), 'JDClothing', '京东商城-服饰', '4RBT3H9jmgYg1k2kBnHF8NAHm7m8'); //京东服饰
await JDUserSignPre(Wait(stop), 'JDSchool', '京东商城-校园', '2QUxWHx5BSCNtnBDjtt5gZTq7zdZ'); //京东校园
await JDUserSignPre(Wait(stop), 'JDHealth', '京东商城-健康', 'w2oeK5yLdHqHvwef7SMMy4PL8LF'); //京东健康
await JDUserSignPre(Wait(stop), 'JDShoes', '京东商城-鞋靴', '4RXyb1W4Y986LJW8ToqMK14BdTD'); //京东鞋靴
await JDUserSignPre(Wait(stop), 'JDChild', '京东商城-童装', '3Af6mZNcf5m795T8dtDVfDwWVNhJ'); //京东童装馆
await JDUserSignPre(Wait(stop), 'JDBaby', '京东商城-母婴', '3BbAVGQPDd6vTyHYjmAutXrKAos6'); //京东母婴馆
await JDUserSignPre(Wait(stop), 'JD3C', '京东商城-数码', '4SWjnZSCTHPYjE5T7j35rxxuMTb6'); //京东数码电器馆
await JDUserSignPre(Wait(stop), 'JDWomen', '京东商城-女装', 'DpSh7ma8JV7QAxSE2gJNro8Q2h9'); //京东女装馆
await JDUserSignPre(Wait(stop), 'JDBook', '京东商城-图书', '3SC6rw5iBg66qrXPGmZMqFDwcyXi'); //京东图书
await JDUserSignPre(Wait(stop), 'JDShand', '京东拍拍-二手', '3S28janPLYmtFxypu37AYAGgivfp'); //京东拍拍二手
// await JDUserSignPre(Wait(stop), 'JDMakeup', '京东商城-美妆', '2smCxzLNuam5L14zNJHYu43ovbAP'); //京东美妆馆
await JDUserSignPre(Wait(stop), 'JDVege', '京东商城-菜场', 'Wcu2LVCFMkBP3HraRvb7pgSpt64'); //京东菜场
await JDUserSignPre(Wait(stop), 'JDaccompany', '京东商城-陪伴', 'kPM3Xedz1PBiGQjY4ZYGmeVvrts'); //京东陪伴
// await JDUserSignPre(Wait(stop), 'JDLive', '京东智能-生活', 'KcfFqWvhb5hHtaQkS4SD1UU6RcQ'); //京东智能生活
await JDUserSignPre(Wait(stop), 'JDClean', '京东商城-清洁', '2Tjm6ay1ZbZ3v7UbriTj6kHy9dn6'); //京东清洁馆
await JDUserSignPre(Wait(stop), 'JDCare', '京东商城-个护', '2tZssTgnQsiUqhmg5ooLSHY9XSeN'); //京东个人护理馆
await JDUserSignPre(Wait(stop), 'JDJiaDian', '京东商城-家电', '3uvPyw1pwHARGgndatCXddLNUxHw'); // 京东小家电馆
// await JDUserSignPre(Wait(stop), 'ReceiveJD', '京东商城-领豆', 'Ni5PUSK7fzZc4EKangHhqPuprn2'); //京东-领京豆
// await JDUserSignPre(Wait(stop), 'JDJewels', '京东商城-珠宝', 'zHUHpTHNTaztSRfNBFNVZscyFZU'); //京东珠宝馆
await JingRongDoll(Wait(stop), 'JDDouble', '金融京豆-双签', 'F68B2C3E71', '', '', '', 'jingdou'); //京东金融 京豆双签
break;
}
await Promise.all([
TotalSteel(), //总钢镚查询
TotalCash(), //总红包查询
TotalBean(), //总京豆查询
TotalSubsidy(), //总金贴查询
TotalMoney() //总现金查询
]);
await notify(); //通知模块
}
function notify() {
return new Promise(resolve => {
try {
var bean = 0;
var steel = 0;
var cash = 0;
var money = 0;
var subsidy = 0;
var success = 0;
var fail = 0;
var err = 0;
var notify = '';
for (var i in merge) {
bean += merge[i].bean ? Number(merge[i].bean) : 0
steel += merge[i].steel ? Number(merge[i].steel) : 0
cash += merge[i].Cash ? Number(merge[i].Cash) : 0
money += merge[i].Money ? Number(merge[i].Money) : 0
subsidy += merge[i].subsidy ? Number(merge[i].subsidy) : 0
success += merge[i].success ? Number(merge[i].success) : 0
fail += merge[i].fail ? Number(merge[i].fail) : 0
err += merge[i].error ? Number(merge[i].error) : 0
notify += merge[i].notify ? "\n" + merge[i].notify : ""
}
var Cash = merge.TotalCash && merge.TotalCash.TCash ? `${merge.TotalCash.TCash}红包` : ""
var Steel = merge.TotalSteel && merge.TotalSteel.TSteel ? `${merge.TotalSteel.TSteel}钢镚` : ``
var beans = merge.TotalBean && merge.TotalBean.Qbear ? `${merge.TotalBean.Qbear}京豆${Steel?`, `:``}` : ""
var Money = merge.TotalMoney && merge.TotalMoney.TMoney ? `${merge.TotalMoney.TMoney}现金${Cash?`, `:``}` : ""
var Subsidy = merge.TotalSubsidy && merge.TotalSubsidy.TSubsidy ? `${merge.TotalSubsidy.TSubsidy}金贴${Money||Cash?", ":""}` : ""
var Tbean = bean ? `${bean.toFixed(0)}京豆${steel?", ":""}` : ""
var TSteel = steel ? `${steel.toFixed(2)}钢镚` : ""
var TCash = cash ? `${cash.toFixed(2)}红包${subsidy||money?", ":""}` : ""
var TSubsidy = subsidy ? `${subsidy.toFixed(2)}金贴${money?", ":""}` : ""
var TMoney = money ? `${money.toFixed(2)}现金` : ""
var Ts = success ? `成功${success}个${fail||err?`, `:``}` : ``
var Tf = fail ? `失败${fail}个${err?`, `:``}` : ``
var Te = err ? `错误${err}个` : ``
var one = `【签到概览】: ${Ts+Tf+Te}${Ts||Tf||Te?`\n`:`获取失败\n`}`
var two = Tbean || TSteel ? `【签到奖励】: ${Tbean+TSteel}\n` : ``
var three = TCash || TSubsidy || TMoney ? `【其他奖励】: ${TCash+TSubsidy+TMoney}\n` : ``
var four = `【账号总计】: ${beans+Steel}${beans||Steel?`\n`:`获取失败\n`}`
var five = `【其他总计】: ${Subsidy+Money+Cash}${Subsidy||Money||Cash?`\n`:`获取失败\n`}`
var DName = merge.TotalBean && merge.TotalBean.nickname ? merge.TotalBean.nickname : "获取失败"
var cnNum = ["零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"];
const Name = DualKey || OtherKey.length > 1 ? `【签到号${cnNum[$nobyda.num]||$nobyda.num}】: ${DName}\n` : ``
const disables = $nobyda.read("JD_DailyBonusDisables")
const amount = disables ? disables.split(",").length : 0
const disa = !notify || amount ? `【温馨提示】: 检测到${$nobyda.disable?`上次执行意外崩溃, `:``}已禁用${notify?`${amount}个`:`所有`}接口, 如需开启请前往BoxJs或查看脚本内第118行注释.\n` : ``
$nobyda.notify("", "", Name + one + two + three + four + five + disa, {
'media-url': $nobyda.headUrl || 'https://cdn.jsdelivr.net/gh/NobyDa/mini@master/Color/jd.png'
});
$nobyda.headUrl = null;
if ($nobyda.isJSBox) {
$nobyda.st = (typeof($nobyda.st) == 'undefined' ? '' : $nobyda.st) + Name + one + two + three + four + five + "\n"
}
} catch (eor) {
$nobyda.notify("通知模块 " + eor.name + "‼️", JSON.stringify(eor), eor.message)
} finally {
resolve()
}
});
}
(async function ReadCookie() {
const EnvInfo = $nobyda.isJSBox ? "JD_Cookie" : "CookieJD";
const EnvInfo2 = $nobyda.isJSBox ? "JD_Cookie2" : "CookieJD2";
const EnvInfo3 = $nobyda.isJSBox ? "JD_Cookies" : "CookiesJD";
const move = CookieMove($nobyda.read(EnvInfo) || Key, $nobyda.read(EnvInfo2) || DualKey, EnvInfo, EnvInfo2, EnvInfo3);
const cookieSet = $nobyda.read(EnvInfo3);
if (DeleteCookie) {
const write = $nobyda.write("", EnvInfo3);
throw new Error(`Cookie清除${write?`成功`:`失败`}, 请手动关闭脚本内"DeleteCookie"选项`);
} else if ($nobyda.isRequest) {
GetCookie()
} else if (Key || DualKey || (OtherKey || cookieSet || '[]') != '[]') {
if (($nobyda.isJSBox || $nobyda.isNode) && stop !== '0') $nobyda.write(stop, "JD_DailyBonusDelay");
out = parseInt($nobyda.read("JD_DailyBonusTimeOut")) || out;
stop = Wait($nobyda.read("JD_DailyBonusDelay"), true) || Wait(stop, true);
boxdis = $nobyda.read("JD_Crash_disable") === "false" || $nobyda.isNode || $nobyda.isJSBox ? false : boxdis;
LogDetails = $nobyda.read("JD_DailyBonusLog") === "true" || LogDetails;
ReDis = ReDis ? $nobyda.write("", "JD_DailyBonusDisables") : "";
$nobyda.num = 0;
if (Key) await all(Key);
if (DualKey && DualKey !== Key) await all(DualKey);
if ((OtherKey || cookieSet || '[]') != '[]') {
try {
OtherKey = checkFormat([...JSON.parse(OtherKey || '[]'), ...JSON.parse(cookieSet || '[]')]);
const updateSet = OtherKey.length ? $nobyda.write(JSON.stringify(OtherKey, null, 2), EnvInfo3) : '';
for (let i = 0; i < OtherKey.length; i++) {
const ck = OtherKey[i].cookie;
const jr = OtherKey[i].jrBody;
if (ck != Key && ck != DualKey) {
await all(ck, jr)
}
}
} catch (e) {
throw new Error(`账号Cookie读取失败, 请检查Json格式. \n${e.message}`)
}
}
sendNotify("京东多合一签到SCF:",notification)
$nobyda.time();
} else {
throw new Error('脚本终止, 未获取Cookie ‼️')
}
})().catch(e => {
$nobyda.notify("京东签到", "", e.message || JSON.stringify(e))
}).finally(() => {
if ($nobyda.isJSBox) $intents.finish($nobyda.st);
$nobyda.done();
})
function JingDongBean(s) {
merge.JDBean = {};
return new Promise(resolve => {
if (disable("JDBean")) return resolve()
setTimeout(() => {
const JDBUrl = {
url: 'https://api.m.jd.com/client.action',
headers: {
Cookie: KEY
},
body: 'functionId=signBeanIndex&appid=ld'
};
$nobyda.post(JDBUrl, function(error, response, data) {
try {
if (error) {
throw new Error(error)
} else {
const cc = JSON.parse(data)
const Details = LogDetails ? "response:\n" + data : '';
if (cc.code == 3) {
console.log("\n" + "京东商城-京豆Cookie失效 " + Details)
merge.JDBean.notify = "京东商城-京豆: 失败, 原因: Cookie失效‼️"
merge.JDBean.fail = 1
} else if (data.match(/跳转至拼图/)) {
merge.JDBean.notify = "京东商城-京豆: 失败, 需要拼图验证 ⚠️"
merge.JDBean.fail = 1
} else if (data.match(/\"status\":\"?1\"?/)) {
console.log("\n" + "京东商城-京豆签到成功 " + Details)
if (data.match(/dailyAward/)) {
merge.JDBean.notify = "京东商城-京豆: 成功, 明细: " + cc.data.dailyAward.beanAward.beanCount + "京豆 🐶"
merge.JDBean.bean = cc.data.dailyAward.beanAward.beanCount
} else if (data.match(/continuityAward/)) {
merge.JDBean.notify = "京东商城-京豆: 成功, 明细: " + cc.data.continuityAward.beanAward.beanCount + "京豆 🐶"
merge.JDBean.bean = cc.data.continuityAward.beanAward.beanCount
} else if (data.match(/新人签到/)) {
const quantity = data.match(/beanCount\":\"(\d+)\".+今天/)
merge.JDBean.bean = quantity ? quantity[1] : 0
merge.JDBean.notify = "京东商城-京豆: 成功, 明细: " + (quantity ? quantity[1] : "无") + "京豆 🐶"
} else {
merge.JDBean.notify = "京东商城-京豆: 成功, 明细: 无京豆 🐶"
}
merge.JDBean.success = 1
} else {
merge.JDBean.fail = 1
console.log("\n" + "京东商城-京豆签到失败 " + Details)
if (data.match(/(已签到|新人签到)/)) {
merge.JDBean.notify = "京东商城-京豆: 失败, 原因: 已签过 ⚠️"
} else if (data.match(/人数较多|S101/)) {
merge.JDBean.notify = "京东商城-京豆: 失败, 签到人数较多 ⚠️"
} else {
merge.JDBean.notify = "京东商城-京豆: 失败, 原因: 未知 ⚠️"
}
}
}
} catch (eor) {
$nobyda.AnError("京东商城-京豆", "JDBean", eor, response, data)
} finally {
resolve()
}
})
}, s)
if (out) setTimeout(resolve, out + s)
});
}
// function JingDongTurn(s) {
// merge.JDTurn = {}, merge.JDTurn.notify = "", merge.JDTurn.success = 0, merge.JDTurn.bean = 0;
// return new Promise((resolve, reject) => {
// if (disable("JDTurn")) return reject()
// const JDTUrl = {
// url: 'https://api.m.jd.com/client.action?functionId=wheelSurfIndex&body=%7B%22actId%22%3A%22jgpqtzjhvaoym%22%2C%22appSource%22%3A%22jdhome%22%7D&appid=ld',
// headers: {
// Cookie: KEY,
// }
// };
// $nobyda.get(JDTUrl, async function(error, response, data) {
// try {
// if (error) {
// throw new Error(error)
// } else {
// const cc = JSON.parse(data)
// const Details = LogDetails ? "response:\n" + data : '';
// if (cc.data && cc.data.lotteryCode) {
// console.log("\n" + "京东商城-转盘查询成功 " + Details)
// return resolve(cc.data.lotteryCode)
// } else {
// merge.JDTurn.notify = "京东商城-转盘: 失败, 原因: 查询错误 ⚠️"
// merge.JDTurn.fail = 1
// console.log("\n" + "京东商城-转盘查询失败 " + Details)
// }
// }
// } catch (eor) {
// $nobyda.AnError("京东转盘-查询", "JDTurn", eor, response, data)
// } finally {
// reject()
// }
// })
// if (out) setTimeout(reject, out + s)
// }).then(data => {
// return JingDongTurnSign(s, data);
// }, () => {});
// }
function JingDongTurn(s) {
if (!merge.JDTurn) merge.JDTurn = {}, merge.JDTurn.notify = "", merge.JDTurn.success = 0, merge.JDTurn.bean = 0;
return new Promise(resolve => {
if (disable("JDTurn")) return resolve();
setTimeout(() => {
const JDTUrl = {
url: `https://api.m.jd.com/client.action?functionId=babelGetLottery`,
headers: {
Cookie: KEY
},
body: 'body=%7B%22enAwardK%22%3A%2295d235f2a09578c6613a1a029b26d12d%22%2C%22riskParam%22%3A%7B%7D%7D&client=wh5'
};
$nobyda.post(JDTUrl, async function(error, response, data) {
try {
if (error) {
throw new Error(error)
} else {
const cc = JSON.parse(data)
const Details = LogDetails ? "response:\n" + data : '';
const also = merge.JDTurn.notify ? true : false
if (cc.code == 3) {
console.log("\n" + "京东转盘Cookie失效 " + Details)
merge.JDTurn.notify = "京东商城-转盘: 失败, 原因: Cookie失效‼️"
merge.JDTurn.fail = 1
} else if (data.match(/(\"T216\"|活动结束)/)) {
merge.JDTurn.notify = "京东商城-转盘: 失败, 原因: 活动结束 ⚠️"
merge.JDTurn.fail = 1
} else if (data.match(/\d+京豆/)) {
console.log("\n" + "京东商城-转盘签到成功 " + Details)
merge.JDTurn.bean += (cc.prizeName && cc.prizeName.split(/(\d+)/)[1]) || 0
merge.JDTurn.notify += `${also?`\n`:``}京东商城-转盘: ${also?`多次`:`成功`}, 明细: ${merge.JDTurn.bean||`无`}京豆 🐶`
merge.JDTurn.success += 1
if (cc.chances > 0) {
await JingDongTurnSign(2000)
}
} else if (data.match(/未中奖|擦肩而过/)) {
merge.JDTurn.notify += `${also?`\n`:``}京东商城-转盘: ${also?`多次`:`成功`}, 状态: 未中奖 🐶`
merge.JDTurn.success += 1
if (cc.chances > 0) {
await JingDongTurnSign(2000)
}
} else {
console.log("\n" + "京东商城-转盘签到失败 " + Details)
merge.JDTurn.fail = 1
if (data.match(/(机会已用完|次数为0)/)) {
merge.JDTurn.notify = "京东商城-转盘: 失败, 原因: 已转过 ⚠️"
} else if (data.match(/(T210|密码)/)) {
merge.JDTurn.notify = "京东商城-转盘: 失败, 原因: 无支付密码 ⚠️"
} else {
merge.JDTurn.notify += `${also?`\n`:``}京东商城-转盘: 失败, 原因: 未知 ⚠️${also?` (多次)`:``}`
}
}
}
} catch (eor) {
$nobyda.AnError("京东商城-转盘", "JDTurn", eor, response, data)
} finally {
resolve()
}
})
}, s)
if (out) setTimeout(resolve, out + s)
});
}
function JingRongSteel(s, body) {
merge.JRSteel = {};
return new Promise(resolve => {
if (disable("JRSteel")) return resolve();
if (!body) {
merge.JRSteel.fail = 1;
merge.JRSteel.notify = "京东金融-钢镚: 失败, 未获取签到Body ⚠️";
return resolve();
}
setTimeout(() => {
const JRSUrl = {
url: 'https://ms.jr.jd.com/gw/generic/hy/h5/m/appSign',
headers: {
Cookie: KEY
},
body: body || ''
};
$nobyda.post(JRSUrl, function(error, response, data) {
try {
if (error) throw new Error(error)
const cc = JSON.parse(data)
const Details = LogDetails ? "response:\n" + data : '';
if (cc.resultCode == 0 && cc.resultData && cc.resultData.resBusiCode == 0) {
console.log("\n" + "京东金融-钢镚签到成功 " + Details)
merge.JRSteel.notify = `京东金融-钢镚: 成功, 获得钢镚奖励 💰`
merge.JRSteel.success = 1
} else {
console.log("\n" + "京东金融-钢镚签到失败 " + Details)
merge.JRSteel.fail = 1
if (cc.resultCode == 0 && cc.resultData && cc.resultData.resBusiCode == 15) {
merge.JRSteel.notify = "京东金融-钢镚: 失败, 原因: 已签过 ⚠️"
} else if (data.match(/未实名/)) {
merge.JRSteel.notify = "京东金融-钢镚: 失败, 账号未实名 ⚠️"
} else if (cc.resultCode == 3) {
merge.JRSteel.notify = "京东金融-钢镚: 失败, 原因: Cookie失效‼️"
} else {
const ng = (cc.resultData && cc.resultData.resBusiMsg) || cc.resultMsg
merge.JRSteel.notify = `京东金融-钢镚: 失败, ${`原因: ${ng||`未知`}`} ⚠️`
}
}
} catch (eor) {
$nobyda.AnError("京东金融-钢镚", "JRSteel", eor, response, data)
} finally {
resolve()
}
})
}, s)
if (out) setTimeout(resolve, out + s)
});
}
function JingDongShake(s) {
if (!merge.JDShake) merge.JDShake = {}, merge.JDShake.success = 0, merge.JDShake.bean = 0, merge.JDShake.notify = '';
return new Promise(resolve => {
if (disable("JDShake")) return resolve()
setTimeout(() => {
const JDSh = {
url: 'https://api.m.jd.com/client.action?appid=vip_h5&functionId=vvipclub_shaking',
headers: {
Cookie: KEY,
}
};
$nobyda.get(JDSh, async function(error, response, data) {
try {
if (error) {
throw new Error(error)
} else {
const Details = LogDetails ? "response:\n" + data : '';
const cc = JSON.parse(data)
const also = merge.JDShake.notify ? true : false
if (data.match(/prize/)) {
console.log("\n" + "京东商城-摇一摇签到成功 " + Details)
merge.JDShake.success += 1
if (cc.data.prizeBean) {
merge.JDShake.bean += cc.data.prizeBean.count || 0
merge.JDShake.notify += `${also?`\n`:``}京东商城-摇摇: ${also?`多次`:`成功`}, 明细: ${merge.JDShake.bean || `无`}京豆 🐶`
} else if (cc.data.prizeCoupon) {
merge.JDShake.notify += `${also?`\n`:``}京东商城-摇摇: ${also?`多次, `:``}获得满${cc.data.prizeCoupon.quota}减${cc.data.prizeCoupon.discount}优惠券→ ${cc.data.prizeCoupon.limitStr}`
} else {
merge.JDShake.notify += `${also?`\n`:``}京东商城-摇摇: 成功, 明细: 未知 ⚠️${also?` (多次)`:``}`
}
if (cc.data.luckyBox.freeTimes != 0) {
await JingDongShake(s)
}
} else {
console.log("\n" + "京东商城-摇一摇签到失败 " + Details)
if (data.match(/true/)) {
merge.JDShake.notify += `${also?`\n`:``}京东商城-摇摇: 成功, 明细: 无奖励 🐶${also?` (多次)`:``}`
merge.JDShake.success += 1
if (cc.data.luckyBox.freeTimes != 0) {
await JingDongShake(s)
}
} else {
merge.JDShake.fail = 1
if (data.match(/(无免费|8000005|9000005)/)) {
merge.JDShake.notify = "京东商城-摇摇: 失败, 原因: 已摇过 ⚠️"
} else if (data.match(/(未登录|101)/)) {
merge.JDShake.notify = "京东商城-摇摇: 失败, 原因: Cookie失效‼️"
} else {
merge.JDShake.notify += `${also?`\n`:``}京东商城-摇摇: 失败, 原因: 未知 ⚠️${also?` (多次)`:``}`
}
}
}
}
} catch (eor) {
$nobyda.AnError("京东商城-摇摇", "JDShake", eor, response, data)
} finally {
resolve()
}
})
}, s)
if (out) setTimeout(resolve, out + s)
});
}
function JDUserSignPre(s, key, title, ac) {
merge[key] = {};
if ($nobyda.isJSBox) {
return JDUserSignPre2(s, key, title, ac);
} else {
return JDUserSignPre1(s, key, title, ac);
}
}
function JDUserSignPre1(s, key, title, acData, ask) {
return new Promise((resolve, reject) => {
if (disable(key, title, 1)) return reject()
const JDUrl = {
url: 'https://api.m.jd.com/?client=wh5&functionId=qryH5BabelFloors',
headers: {
Cookie: KEY
},
opts: {
'filter': 'try{var od=JSON.parse(body);var params=(od.floatLayerList||[]).filter(o=>o.params&&o.params.match(/enActK/)).map(o=>o.params).pop()||(od.floorList||[]).filter(o=>o.template=="signIn"&&o.signInfos&&o.signInfos.params&&o.signInfos.params.match(/enActK/)).map(o=>o.signInfos&&o.signInfos.params).pop();var tId=(od.floorList||[]).filter(o=>o.boardParams&&o.boardParams.turnTableId).map(o=>o.boardParams.turnTableId).pop();var page=od.paginationFlrs;return JSON.stringify({qxAct:params||null,qxTid:tId||null,qxPage:page||null})}catch(e){return `=> 过滤器发生错误: ${e.message}`}'
},
body: `body=${encodeURIComponent(`{"activityId":"${acData}"${ask?`,"paginationParam":"2","paginationFlrs":"${ask}"`:``}}`)}`
};
$nobyda.post(JDUrl, async function(error, response, data) {
try {
if (error) {
throw new Error(error)
} else {
const od = JSON.parse(data || '{}');
const turnTableId = od.qxTid || (od.floorList || []).filter(o => o.boardParams && o.boardParams.turnTableId).map(o => o.boardParams.turnTableId).pop();
const page = od.qxPage || od.paginationFlrs;
if (data.match(/enActK/)) { // 含有签到活动数据
let params = od.qxAct || (od.floatLayerList || []).filter(o => o.params && o.params.match(/enActK/)).map(o => o.params).pop()
if (!params) { // 第一处找到签到所需数据
// floatLayerList未找到签到所需数据,从floorList中查找
let signInfo = (od.floorList || []).filter(o => o.template == 'signIn' && o.signInfos && o.signInfos.params && o.signInfos.params.match(/enActK/))
.map(o => o.signInfos).pop();
if (signInfo) {
if (signInfo.signStat == '1') {
console.log(`\n${title}重复签到`)
merge[key].notify = `${title}: 失败, 原因: 已签过 ⚠️`
merge[key].fail = 1
} else {
params = signInfo.params;
}
} else {
merge[key].notify = `${title}: 失败, 活动查找异常 ⚠️`
merge[key].fail = 1
}
}
if (params) {
return resolve({
params: params
}); // 执行签到处理
}
} else if (turnTableId) { // 无签到数据, 但含有关注店铺签到
const boxds = $nobyda.read("JD_Follow_disable") === "false" ? false : true
if (boxds) {
console.log(`\n${title}关注店铺`)
return resolve(parseInt(turnTableId))
} else {
merge[key].notify = `${title}: 失败, 需要关注店铺 ⚠️`
merge[key].fail = 1
}
} else if (page && !ask) { // 无签到数据, 尝试带参查询
const boxds = $nobyda.read("JD_Retry_disable") === "false" ? false : true
if (boxds) {
console.log(`\n${title}二次查询`)
return resolve(page)
} else {
merge[key].notify = `${title}: 失败, 请尝试开启增强 ⚠️`
merge[key].fail = 1
}
} else {
merge[key].notify = `${title}: 失败, ${!data ? `需要手动执行` : `不含活动数据`} ⚠️`
merge[key].fail = 1
}
}
reject()
} catch (eor) {
$nobyda.AnError(title, key, eor, response, data)
reject()
}
})
if (out) setTimeout(reject, out + s)
}).then(data => {
disable(key, title, 2)
if (typeof(data) == "object") return JDUserSign1(s, key, title, encodeURIComponent(JSON.stringify(data)));
if (typeof(data) == "number") return JDUserSign2(s, key, title, data);
if (typeof(data) == "string") return JDUserSignPre1(s, key, title, acData, data);
}, () => disable(key, title, 2))
}
function JDUserSignPre2(s, key, title, acData) {
return new Promise((resolve, reject) => {
if (disable(key, title, 1)) return reject()
const JDUrl = {
url: `https://pro.m.jd.com/mall/active/${acData}/index.html`,
headers: {
Cookie: KEY,
}
};
$nobyda.get(JDUrl, async function(error, response, data) {
try {
if (error) {
throw new Error(error)
} else {
const act = data.match(/\"params\":\"\{\\\"enActK.+?\\\"\}\"/)
const turnTable = data.match(/\"turnTableId\":\"(\d+)\"/)
const page = data.match(/\"paginationFlrs\":\"(\[\[.+?\]\])\"/)
if (act) { // 含有签到活动数据
return resolve(act)
} else if (turnTable) { // 无签到数据, 但含有关注店铺签到
const boxds = $nobyda.read("JD_Follow_disable") === "false" ? false : true
if (boxds) {
console.log(`\n${title}关注店铺`)
return resolve(parseInt(turnTable[1]))
} else {
merge[key].notify = `${title}: 失败, 需要关注店铺 ⚠️`
merge[key].fail = 1
}
} else if (page) { // 无签到数据, 尝试带参查询
const boxds = $nobyda.read("JD_Retry_disable") === "false" ? false : true
if (boxds) {
console.log(`\n${title}二次查询`)
return resolve(page[1])
} else {
merge[key].notify = `${title}: 失败, 请尝试开启增强 ⚠️`
merge[key].fail = 1
}
} else {
merge[key].notify = `${title}: 失败, ${!data ? `需要手动执行` : `不含活动数据`} ⚠️`
merge[key].fail = 1
}
}
reject()
} catch (eor) {
$nobyda.AnError(title, key, eor, response, data)
reject()
}
})
if (out) setTimeout(reject, out + s)
}).then(data => {
disable(key, title, 2)
if (typeof(data) == "object") return JDUserSign1(s, key, title, encodeURIComponent(`{${data}}`));
if (typeof(data) == "number") return JDUserSign2(s, key, title, data)
if (typeof(data) == "string") return JDUserSignPre1(s, key, title, acData, data)
}, () => disable(key, title, 2))
}
function JDUserSign1(s, key, title, body) {
return new Promise(resolve => {
setTimeout(() => {
const JDUrl = {
url: 'https://api.m.jd.com/client.action?functionId=userSign',
headers: {
Cookie: KEY
},
body: `body=${body}&client=wh5`
};
$nobyda.post(JDUrl, function(error, response, data) {
try {
if (error) {
throw new Error(error)
} else {
const Details = LogDetails ? `response:\n${data}` : '';
if (data.match(/签到成功/)) {
console.log(`\n${title}签到成功(1)${Details}`)
if (data.match(/\"text\":\"\d+京豆\"/)) {
merge[key].bean = data.match(/\"text\":\"(\d+)京豆\"/)[1]
}
merge[key].notify = `${title}: 成功, 明细: ${merge[key].bean || '无'}京豆 🐶`
merge[key].success = 1
} else {
console.log(`\n${title}签到失败(1)${Details}`)
if (data.match(/(已签到|已领取)/)) {
merge[key].notify = `${title}: 失败, 原因: 已签过 ⚠️`
} else if (data.match(/(不存在|已结束|未开始)/)) {
merge[key].notify = `${title}: 失败, 原因: 活动已结束 ⚠️`
} else if (data.match(/\"code\":\"?3\"?/)) {
merge[key].notify = `${title}: 失败, 原因: Cookie失效‼️`
} else {
const ng = data.match(/\"(errorMessage|subCodeMsg)\":\"(.+?)\"/)
merge[key].notify = `${title}: 失败, ${ng?ng[2]:`原因: 未知`} ⚠️`
}
merge[key].fail = 1
}
}
} catch (eor) {
$nobyda.AnError(title, key, eor, response, data)
} finally {
resolve()
}
})
}, s)
if (out) setTimeout(resolve, out + s)
});
}
async function JDUserSign2(s, key, title, tid) {
return console.log(`\n${title} >> 可能需要拼图验证, 跳过签到 ⚠️`);
await new Promise(resolve => {
$nobyda.get({
url: `https://jdjoy.jd.com/api/turncard/channel/detail?turnTableId=${tid}&invokeKey=ztmFUCxcPMNyUq0P`,
headers: {
Cookie: KEY
}
}, function(error, response, data) {
resolve()
})
if (out) setTimeout(resolve, out + s)
});
return new Promise(resolve => {
setTimeout(() => {
const JDUrl = {
url: 'https://jdjoy.jd.com/api/turncard/channel/sign?invokeKey=ztmFUCxcPMNyUq0P',
headers: {
lkt: '1629984131120',
lks: 'd7db92cf40ad5a8d54b9da2b561c5f84',
Cookie: KEY
},
body: `turnTableId=${tid}`
};
$nobyda.post(JDUrl, function(error, response, data) {
try {
if (error) {
throw new Error(error)
} else {
const Details = LogDetails ? `response:\n${data}` : '';
if (data.match(/\"success\":true/)) {
console.log(`\n${title}签到成功(2)${Details}`)
if (data.match(/\"jdBeanQuantity\":\d+/)) {
merge[key].bean = data.match(/\"jdBeanQuantity\":(\d+)/)[1]
}
merge[key].notify = `${title}: 成功, 明细: ${merge[key].bean || '无'}京豆 🐶`
merge[key].success = 1
} else {
const captcha = /请进行验证/.test(data);
if (data.match(/(已经签到|已经领取)/)) {
merge[key].notify = `${title}: 失败, 原因: 已签过 ⚠️`
} else if (data.match(/(不存在|已结束|未开始)/)) {
merge[key].notify = `${title}: 失败, 原因: 活动已结束 ⚠️`
} else if (data.match(/(没有登录|B0001)/)) {
merge[key].notify = `${title}: 失败, 原因: Cookie失效‼️`
} else if (!captcha) {
const ng = data.match(/\"(errorMessage|subCodeMsg)\":\"(.+?)\"/)
merge[key].notify = `${title}: 失败, ${ng?ng[2]:`原因: 未知`} ⚠️`
}
if (!captcha) merge[key].fail = 1;
console.log(`\n${title}签到失败(2)${captcha?`\n需要拼图验证, 跳过通知记录 ⚠️`:``}${Details}`)
}
}
} catch (eor) {
$nobyda.AnError(title, key, eor, response, data)
} finally {
resolve()
}
})
}, 200 + s)
if (out) setTimeout(resolve, out + s + 200)
});
}
function JDFlashSale(s) {
merge.JDFSale = {};
return new Promise(resolve => {
if (disable("JDFSale")) return resolve()
setTimeout(() => {
const JDPETUrl = {
url: 'https://api.m.jd.com/client.action?functionId=partitionJdSgin',
headers: {
Cookie: KEY
},
body: "body=%7B%22version%22%3A%22v2%22%7D&client=apple&clientVersion=9.0.8&openudid=1fce88cd05c42fe2b054e846f11bdf33f016d676&sign=6768e2cf625427615dd89649dd367d41&st=1597248593305&sv=121"
};
$nobyda.post(JDPETUrl, async function(error, response, data) {
try {
if (error) {
throw new Error(error)