-
Notifications
You must be signed in to change notification settings - Fork 911
/
jd_bean_change.js
1103 lines (1056 loc) · 57.9 KB
/
jd_bean_change.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
/*
cron "1 9 * * *" jd_bean_change.js, tag:资产变化强化版by-ccwav
*/
//更新by ccwav,20210821
const $ = new Env('京东资产变动通知');
const notify = $.isNode() ? require('./sendNotify') : '';
const JXUserAgent = $.isNode() ? (process.env.JX_USER_AGENT ? process.env.JX_USER_AGENT : ``):``;
//Node.js用户请在jdCookie.js处填写京东ck;
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
let allMessage = '';
let ReturnMessage = '';
//IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [], cookie = '';
const JD_API_HOST = 'https://api.m.jd.com/client.action';
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])
$.CryptoJS = $.isNode() ? require('crypto-js') : CryptoJS;
$.index = i + 1;
$.beanCount = 0;
$.incomeBean = 0;
$.expenseBean = 0;
$.todayIncomeBean = 0;
$.errorMsg = '';
$.isLogin = true;
$.nickName = '';
$.message = '';
$.balance = 0;
$.expiredBalance = 0;
$.JdzzNum=0;
$.JdMsScore = 0;
$.JdFarmProdName = '';
$.JdtreeEnergy=0;
$.JdtreeTotalEnergy=0;
$.JdwaterTotalT = 0;
$.JdwaterD = 0;
$.JDwaterEveryDayT=0;
$.JDtotalcash=0;
$.JDEggcnt=0;
$.Jxmctoken='';
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 getJdZZ();
await getMs();
await jdfruitRequest('taskInitForFarm', {"version":14,"channel":1,"babelChannel":"120"});
await getjdfruit();
await cash();
await requestAlgo();
await JxmcGetRequest();
await bean();
await getJxFactory(); //惊喜工厂
await getDdFactoryInfo(); // 京东工厂
await showMsg();
}
}
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(() => {
$.done();
})
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' : ''}`;
// 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` })
// }
ReturnMessage=`📣=============账号${$.index}=============📣\n`
ReturnMessage+=`账号名称:${$.nickName || $.UserName}\n`;
ReturnMessage+=`今日收入:${$.todayIncomeBean}京豆 🐶\n`;
ReturnMessage+=`昨日收入:${$.incomeBean}京豆 🐶\n`;
ReturnMessage+=`昨日支出:${$.expenseBean}京豆 🐶\n`;
ReturnMessage+=`当前京豆:${$.beanCount}(今日将过期${$.expirejingdou})京豆🐶\n`;
if(typeof $.JDEggcnt !== "undefined"){
ReturnMessage+=`京喜牧场:${$.JDEggcnt}枚鸡蛋\n`;
}
if(typeof $.JDtotalcash !== "undefined"){
ReturnMessage+=`极速金币:${$.JDtotalcash}金币(≈${$.JDtotalcash / 10000}元)\n`;
}
if(typeof $.JdzzNum !== "undefined"){
ReturnMessage+=`京东赚赚:${$.JdzzNum}金币(≈${$.JdzzNum / 10000}元)\n`;
}
if($.JdMsScore!=0){
ReturnMessage+=`京东秒杀:${$.JdMsScore}秒秒币(≈${$.JdMsScore / 1000}元)\n`;
}
if($.JdFarmProdName != ""){
if($.JdtreeEnergy!=0){
ReturnMessage+=`东东农场:${$.JdFarmProdName},进度${(($.JdtreeEnergy / $.JdtreeTotalEnergy) * 100).toFixed(2)}%`;
if($.JdwaterD!='Infinity' && $.JdwaterD!='-Infinity'){
ReturnMessage+=`,${$.JdwaterD === 1 ? '明天' : $.JdwaterD === 2 ? '后天' : $.JdwaterD + '天后'}可兑🍉\n`;
} else {
ReturnMessage+=`\n`;
}
} else {
ReturnMessage+=`东东农场:${$.JdFarmProdName}\n`;
}
}
if ($.jxFactoryInfo) {
ReturnMessage += `京喜工厂:${$.jxFactoryInfo}🏭\n`
}
if ($.ddFactoryInfo) {
ReturnMessage += `东东工厂:${$.ddFactoryInfo}🏭\n`
}
const response = await await PetRequest('energyCollect');
const initPetTownRes = await PetRequest('initPetTown');
if (initPetTownRes.code === '0' && initPetTownRes.resultCode === '0' && initPetTownRes.message === 'success') {
$.petInfo = initPetTownRes.result;
if (response.resultCode === '0') {
ReturnMessage += `东东萌宠:${$.petInfo.goodsInfo.goodsName},`;
ReturnMessage += `勋章${response.result.medalNum}/${response.result.medalNum+response.result.needCollectMedalNum}块(${response.result.medalPercent}%)\n`;
//ReturnMessage += ` 已有${response.result.medalNum}块勋章,还需${response.result.needCollectMedalNum}块\n`;
}
}
ReturnMessage+=`🧧🧧🧧🧧红包明细🧧🧧🧧🧧`;
ReturnMessage+=`${$.message}\n\n`;
allMessage+=ReturnMessage;
$.msg($.name, '', ReturnMessage , {"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 getJdZZ() {
return new Promise(resolve => {
$.get(taskJDZZUrl("interactTaskIndex"), async (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
$.JdzzNum = data.data.totalNum
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function taskJDZZUrl(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.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',
}
}
}
function getMs() {
return new Promise(resolve => {
$.post(taskMsPostUrl('homePageV2', {}, 'appid=SecKill2020'), (err, resp, data) => {
try {
if (err) {
console.log(`${err},${jsonParse(resp.body)['message']}`)
console.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data)
if (data.code === 2041) {
$.JdMsScore = data.result.assignment.assignmentPoints || 0
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function taskMsPostUrl(function_id, body = {}, extra = '', function_id2) {
let url = `${JD_API_HOST}`;
if (function_id2) {
url += `?functionId=${function_id2}`;
}
return {
url,
body: `functionId=${function_id}&body=${escape(JSON.stringify(body))}&client=wh5&clientVersion=1.0.0&${extra}`,
headers: {
"Cookie": cookie,
"origin": "https://h5.m.jd.com",
"referer": "https://h5.m.jd.com/babelDiy/Zeus/2NUvze9e1uWf4amBhe1AV6ynmSuH/index.html",
'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"),
}
}
}
async function getjdfruit() {
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.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"),
"Content-Type": "application/x-www-form-urlencoded"
},
timeout: 10000,
};
$.post(option, (err, resp, data) => {
try {
if (err) {
console.log('\n东东农场: API查询请求失败 ‼️‼️');
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
$.farmInfo = JSON.parse(data)
if ($.farmInfo.farmUserPro) {
$.JdFarmProdName=$.farmInfo.farmUserPro.name;
$.JdtreeEnergy=$.farmInfo.farmUserPro.treeEnergy;
$.JdtreeTotalEnergy=$.farmInfo.farmUserPro.treeTotalEnergy;
let waterEveryDayT = $.JDwaterEveryDayT;
let waterTotalT = ($.farmInfo.farmUserPro.treeTotalEnergy - $.farmInfo.farmUserPro.treeEnergy - $.farmInfo.farmUserPro.totalEnergy) / 10;//一共还需浇多少次水
let waterD = Math.ceil(waterTotalT / waterEveryDayT);
$.JdwaterTotalT = waterTotalT;
$.JdwaterD = waterD;
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve();
}
})
})
}
function jdfruitRequest(function_id, body = {}, timeout = 1000){
return new Promise(resolve => {
setTimeout(() => {
$.get(taskfruitUrl(function_id, body), (err, resp, data) => {
try {
if (err) {
console.log('\n东东农场: API查询请求失败 ‼️‼️')
console.log(JSON.stringify(err));
console.log(`function_id:${function_id}`)
$.logErr(err);
} else {
if (safeGet(data)) {
data = JSON.parse(data);
$.JDwaterEveryDayT = data.totalWaterTaskInit.totalWaterTaskTimes;
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve(data);
}
})
}, timeout)
})
}
async function PetRequest(function_id, body = {}) {
await $.wait(3000);
return new Promise((resolve, reject) => {
$.post(taskPetUrl(function_id, body), (err, resp, data) => {
try {
if (err) {
console.log('\n东东萌宠: API查询请求失败 ‼️‼️');
console.log(JSON.stringify(err));
$.logErr(err);
} else {
data = JSON.parse(data);
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve(data)
}
})
})
}
function taskPetUrl(function_id, body = {}) {
body["version"] = 2;
body["channel"] = 'app';
return {
url: `${JD_API_HOST}?functionId=${function_id}`,
body: `body=${escape(JSON.stringify(body))}&appid=wh5&loginWQBiz=pet-town&clientVersion=9.0.4`,
headers: {
'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"),
'Host': 'api.m.jd.com',
'Content-Type': 'application/x-www-form-urlencoded',
}
};
}
function taskfruitUrl(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.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,
}
}
function safeGet(data) {
try {
if (typeof JSON.parse(data) == "object") {
return true;
}
} catch (e) {
console.log(e);
console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
return false;
}
}
function cash() {
return new Promise(resolve => {
$.get(taskcashUrl('MyAssetsService.execute',
{"method": "userCashRecord", "data": {"channel": 1, "pageNum": 1, "pageSize": 20}}),
async (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
$.JDtotalcash = data.data.goldBalance ;
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
var __Oxb24bc = ["lite-android&", "stringify", "&android&3.1.0&", "&", "&846c4c32dae910ef", "12aea658f76e453faf803d15c40a72e0", "isNode", "crypto-js", "", "api?functionId=", "&body=", "&appid=lite-android&client=android&uuid=846c4c32dae910ef&clientVersion=3.1.0&t=", "&sign=", "api.m.jd.com", "*/*", "RN", "JDMobileLite/3.1.0 (iPad; iOS 14.4; Scale/2.00)", "zh-Hans-CN;q=1, ja-CN;q=0.9", "undefined", "log", "", "", "", "", "jsjia", "mi.com"];
function taskcashUrl(_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: {
'Host': __Oxb24bc[0xd],
'accept': __Oxb24bc[0xe],
'kernelplatform': __Oxb24bc[0xf],
'user-agent': __Oxb24bc[0x10],
'accept-language': __Oxb24bc[0x11],
'Cookie': 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)
}
})({})
async function JxmcGetRequest() {
let url = ``;
let myRequest = ``;
url = `https://m.jingxi.com/jxmc/queryservice/GetHomePageInfo?channel=7&sceneid=1001&activeid=null&activekey=null&isgift=1&isquerypicksite=1&_stk=channel%2Csceneid&_ste=1`;
url += `&h5st=${decrypt(Date.now(), '', '', url)}&_=${Date.now() + 2}&sceneval=2&g_login_type=1&callback=jsonpCBK${String.fromCharCode(Math.floor(Math.random() * 26) + "A".charCodeAt(0))}&g_ty=ls`;
myRequest = getGetRequest(`GetHomePageInfo`, url);
return new Promise(async resolve => {
$.get(myRequest, (err, resp, data) => {
try {
if (err) {
console.log(`${JSON.stringify(err)}`)
console.log(`API请求失败,请检查网路重试`)
$.runFlag = false;
console.log(`请求失败`)
} else {
data = JSON.parse(data.match(new RegExp(/jsonpCBK.?\((.*);*/))[1]);
if (data.ret === 0) {
$.JDEggcnt=data.data.eggcnt;
}
}
} catch (e) {
console.log(data);
$.logErr(e, resp)
} finally {
resolve();
}
})
})
}
// 惊喜工厂信息查询
function getJxFactory() {
return new Promise(async resolve => {
let infoMsg = "";
await $.get(jxTaskurl('userinfo/GetUserInfo', `pin=&sharePin=&shareType=&materialTuanPin=&materialTuanId=&source=`, '_time,materialTuanId,materialTuanPin,pin,sharePin,shareType,source,zone'), async (err, resp, data) => {
try {
if (err) {
$.jxFactoryInfo = "查询失败!";
//console.log("jx工厂查询失败" + err)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data['ret'] === 0) {
data = data['data'];
$.unActive = true;//标记是否开启了京喜活动或者选购了商品进行生产
if (data.factoryList && data.productionList) {
const production = data.productionList[0];
const factory = data.factoryList[0];
//const productionStage = data.productionStage;
$.commodityDimId = production.commodityDimId;
// subTitle = data.user.pin;
await GetCommodityDetails();//获取已选购的商品信息
infoMsg = `${$.jxProductName} ,进度:${((production.investedElectric / production.needElectric) * 100).toFixed(2)}%`;
if (production.investedElectric >= production.needElectric) {
if (production['exchangeStatus'] === 1) {
infoMsg = `${$.jxProductName} ,已经可兑换,请手动兑换`;
}
if (production['exchangeStatus'] === 3) {
if (new Date().getHours() === 9) {
infoMsg = `${$.jxProductName} ,兑换已超时,请选择新商品进行制造`;
}
}
// await exchangeProNotify()
} else {
infoMsg += ` ,预计:${((production.needElectric - production.investedElectric) / (2 * 60 * 60 * 24)).toFixed(2)}天可兑换`
}
if (production.status === 3) {
infoMsg = "${$.jxProductName} ,已经超时失效, 请选择新商品进行制造"
}
} else {
$.unActive = false;//标记是否开启了京喜活动或者选购了商品进行生产
if (!data.factoryList) {
infoMsg = "当前未开始生产商品,请手动去京东APP->游戏与互动->查看更多->京喜工厂 开启活动"
// $.msg($.name, '【提示】', `京东账号${$.index}[${$.nickName}]京喜工厂活动未开始\n请手动去京东APP->游戏与互动->查看更多->京喜工厂 开启活动`);
} else if (data.factoryList && !data.productionList) {
infoMsg = "当前未开始生产商品,请手动去京东APP->游戏与互动->查看更多->京喜工厂 开启活动"
}
}
}
} else {
console.log(`GetUserInfo异常:${JSON.stringify(data)}`)
}
}
$.jxFactoryInfo = infoMsg;
// console.log(infoMsg);
} catch (e) {
$.logErr(e, resp)
} finally {
resolve();
}
})
}
)
}
// 惊喜的Taskurl
function jxTaskurl(functionId, body = '', stk) {
let url = `https://m.jingxi.com/dreamfactory/${functionId}?zone=dream_factory&${body}&sceneval=2&g_login_type=1&_time=${Date.now()}&_=${Date.now() + 2}&_ste=1`
url += `&h5st=${decrypt(Date.now(), stk, '', url)}`
if (stk) {
url += `&_stk=${encodeURIComponent(stk)}`;
}
return {
url,
headers: {
'Cookie': cookie,
'Host': 'm.jingxi.com',
'Accept': '*/*',
'Connection': 'keep-alive',
'User-Agent': functionId === 'AssistFriend' ? "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36" : 'jdpingou',
'Accept-Language': 'zh-cn',
'Referer': 'https://wqsd.jd.com/pingou/dream_factory/index.html',
'Accept-Encoding': 'gzip, deflate, br',
}
}
}
//惊喜查询当前生产的商品名称
function GetCommodityDetails() {
return new Promise(async resolve => {
// const url = `/dreamfactory/diminfo/GetCommodityDetails?zone=dream_factory&sceneval=2&g_login_type=1&commodityId=${$.commodityDimId}`;
$.get(jxTaskurl('diminfo/GetCommodityDetails', `commodityId=${$.commodityDimId}`, `_time,commodityId,zone`), (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['ret'] === 0) {
data = data['data'];
$.jxProductName = data['commodityList'][0].name;
} else {
console.log(`GetCommodityDetails异常:${JSON.stringify(data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve();
}
})
})
}
// 东东工厂信息查询
async function getDdFactoryInfo() {
// 当心仪的商品存在,并且收集起来的电量满足当前商品所需,就投入
let infoMsg = "";
return new Promise(resolve => {
$.post(ddFactoryTaskUrl('jdfactory_getHomeData'), async (err, resp, data) => {
try {
if (err) {
$.ddFactoryInfo = "获取失败!"
/*console.log(`${JSON.stringify(err)}`)
console.log(`${$.name} API请求失败,请检查网路重试`)*/
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data.data.bizCode === 0) {
// $.newUser = data.data.result.newUser;
//let wantProduct = $.isNode() ? (process.env.FACTORAY_WANTPRODUCT_NAME ? process.env.FACTORAY_WANTPRODUCT_NAME : wantProduct) : ($.getdata('FACTORAY_WANTPRODUCT_NAME') ? $.getdata('FACTORAY_WANTPRODUCT_NAME') : wantProduct);
if (data.data.result.factoryInfo) {
let {
totalScore,
useScore,
produceScore,
remainScore,
couponCount,
name
} = data.data.result.factoryInfo;
infoMsg = `${name} 剩余${couponCount};电力投入情况 ${useScore}/${totalScore};当前总电力:${remainScore * 1 + useScore * 1} ;完成度:${((remainScore * 1 + useScore * 1) / (totalScore * 1)).toFixed(2) * 100}%`
if (((remainScore * 1 + useScore * 1) >= totalScore * 1 + 100000) && (couponCount * 1 > 0)) {
// await jdfactory_addEnergy();
infoMsg = `${name} ,目前数量:${couponCount},当前总电量为:${remainScore * 1 + useScore * 1},已经可以兑换此商品所需总电量:${totalScore},请🔥速去活动页面查看`
}
} else {
infoMsg = `当前未选择商品(或未开启活动) , 请到京东APP=>首页=>京东电器=>(底栏)东东工厂 选择商品!`
}
} else {
$.ddFactoryInfo = "获取失败!"
console.log(`异常:${JSON.stringify(data)}`)
}
}
}
$.ddFactoryInfo = infoMsg;
} catch (e) {
$.logErr(e, resp)
} finally {
resolve();
}
})
})
}
function ddFactoryTaskUrl(function_id, body = {}, function_id2) {
let url = `${JD_API_HOST}`;
if (function_id2) {
url += `?functionId=${function_id2}`;
}
return {
url,
body: `functionId=${function_id}&body=${escape(JSON.stringify(body))}&client=wh5&clientVersion=1.1.0`,
headers: {
"Accept": "application/json, text/plain, */*",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-cn",
"Connection": "keep-alive",
"Content-Type": "application/x-www-form-urlencoded",
"Cookie": cookie,
"Host": "api.m.jd.com",
"Origin": "https://h5.m.jd.com",
"Referer": "https://h5.m.jd.com/babelDiy/Zeus/2uSsV2wHEkySvompfjB43nuKkcHp/index.html",
"User-Agent": "jdapp;iPhone;9.3.4;14.3;88732f840b77821b345bf07fd71f609e6ff12f43;network/4g;ADID/1C141FDD-C62F-425B-8033-9AAB7E4AE6A3;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone11,8;addressid/2005183373;supportBestPay/0;appBuild/167502;jdSupportDarkMode/0;pv/414.19;apprpd/Babel_Native;ref/TTTChannelViewContoller;psq/5;ads/;psn/88732f840b77821b345bf07fd71f609e6ff12f43|1701;jdv/0|iosapp|t_335139774|appshare|CopyURL|1610885480412|1610885486;adk/;app_device/IOS;pap/JA2015_311210|9.3.4|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",
},
timeout: 10000,
}
}
function randomString(e) {
e = e || 32;
let t = "0123456789abcdef", a = t.length, n = "";
for (let i = 0; i < e; i++)
n += t.charAt(Math.floor(Math.random() * a));
return n
}
function getGetRequest(type, url) {
UA = `jdpingou;iPhone;4.13.0;14.4.2;${randomString(40)};network/wifi;model/iPhone10,2;appBuild/100609;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/1;hasOCPay/0;supportBestPay/0;session/${Math.random * 98 + 1};pap/JA2019_3111789;brand/apple;supportJDSHWK/1;Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148`
const method = `GET`;
let headers = {
'Origin': `https://st.jingxi.com`,
'Cookie': cookie,
'Connection': `keep-alive`,
'Accept': `application/json`,
'Referer': `https://st.jingxi.com/pingou/jxmc/index.html`,
'Host': `m.jingxi.com`,
'User-Agent': UA,
'Accept-Encoding': `gzip, deflate, br`,
'Accept-Language': `zh-cn`
};
return {url: url, method: method, headers: headers};
}
Date.prototype.Format = function (fmt) {
var e,
n = this, d = fmt, l = {
"M+": n.getMonth() + 1,
"d+": n.getDate(),
"D+": n.getDate(),
"h+": n.getHours(),
"H+": n.getHours(),
"m+": n.getMinutes(),
"s+": n.getSeconds(),
"w+": n.getDay(),
"q+": Math.floor((n.getMonth() + 3) / 3),
"S+": n.getMilliseconds()
};
/(y+)/i.test(d) && (d = d.replace(RegExp.$1, "".concat(n.getFullYear()).substr(4 - RegExp.$1.length)));
for (var k in l) {
if (new RegExp("(".concat(k, ")")).test(d)) {
var t, a = "S+" === k ? "000" : "00";
d = d.replace(RegExp.$1, 1 == RegExp.$1.length ? l[k] : ("".concat(a) + l[k]).substr("".concat(l[k]).length))
}
}
return d;
}
function decrypt(time, stk, type, url) {
stk = stk || (url ? getJxmcUrlData(url, '_stk') : '')
if (stk) {
const timestamp = new Date(time).Format("yyyyMMddhhmmssSSS");
let hash1 = '';
if ($.fingerprint && $.Jxmctoken && $.enCryptMethodJD) {
hash1 = $.enCryptMethodJD($.Jxmctoken, $.fingerprint.toString(), timestamp.toString(), $.appId.toString(), $.CryptoJS).toString($.CryptoJS.enc.Hex);
} else {
const random = '5gkjB6SpmC9s';
$.Jxmctoken = `tk01wcdf61cb3a8nYUtHcmhSUFFCfddDPRvKvYaMjHkxo6Aj7dhzO+GXGFa9nPXfcgT+mULoF1b1YIS1ghvSlbwhE0Xc`;
$.fingerprint = 5287160221454703;
const str = `${$.Jxmctoken}${$.fingerprint}${timestamp}${$.appId}${random}`;
hash1 = $.CryptoJS.SHA512(str, $.Jxmctoken).toString($.CryptoJS.enc.Hex);
}
let st = '';
stk.split(',').map((item, index) => {
st += `${item}:${getJxmcUrlData(url, item)}${index === stk.split(',').length - 1 ? '' : '&'}`;
})
const hash2 = $.CryptoJS.HmacSHA256(st, hash1.toString()).toString($.CryptoJS.enc.Hex);
return encodeURIComponent(["".concat(timestamp.toString()), "".concat($.fingerprint.toString()), "".concat($.appId.toString()), "".concat($.Jxmctoken), "".concat(hash2)].join(";"))
} else {
return '20210318144213808;8277529360925161;10001;tk01w952a1b73a8nU0luMGtBanZTHCgj0KFVwDa4n5pJ95T/5bxO/m54p4MtgVEwKNev1u/BUjrpWAUMZPW0Kz2RWP8v;86054c036fe3bf0991bd9a9da1a8d44dd130c6508602215e50bb1e385326779d'
}
}
async function requestAlgo() {
$.fingerprint = await generateFp();
$.appId = 10028;
const options = {
"url": `https://cactus.jd.com/request_algo?g_ty=ajax`,
"headers": {