-
Notifications
You must be signed in to change notification settings - Fork 126
/
gua_wealth_island.js
1320 lines (1282 loc) · 108 KB
/
gua_wealth_island.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
/*
https://st.jingxi.com/fortune_island/index2.html
18 0-23/2 * * * https://raw.githubusercontent.com/smiek2121/scripts/master/gua_wealth_island.js 财富大陆
*/
const $ = new Env('财富大陆');
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
// const notify = $.isNode() ? require('./sendNotify') : '';
CryptoScripts()
$.CryptoJS = $.isNode() ? require('crypto-js') : CryptoJS;
let UA = `jdpingou;iPhone;5.2.2;14.3;${randomString(40)};network/wifi;model/iPhone12,1;appBuild/100630;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/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`
function randomString(e) {
e = e || 32;
let t = "abcdef0123456789", a = t.length, n = "";
for (i = 0; i < e; i++)
n += t.charAt(Math.floor(Math.random() * a));
return n
}
$.InviteList = []
$.innerInviteList = [];
const HelpAuthorFlag = true;//是否助力作者SH true 助力,false 不助力
// 热气球接客 每次运行接客次数
let serviceNum = 10;// 每次运行接客次数
if ($.isNode() && process.env.gua_wealth_island_serviceNum) {
serviceNum = Number(process.env.gua_wealth_island_serviceNum);
}
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);
}
$.appId = 10032;
!(async () => {
if (!cookiesArr[0]) {
$.msg('【京东账号一】宠汪汪积分兑换奖品失败', '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', { "open-url": "https://bean.m.jd.com/bean/signIndex.action" });
return
}
console.log(`\n
想要我的财富吗
我把它放在一个神奇的岛屿
去找吧
`)
await requestAlgo();
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;
console.log(`\n*****开始【京东账号${$.index}】${$.UserName}****\n`);
UA = `jdpingou;iPhone;5.2.2;14.3;${randomString(40)};network/wifi;model/iPhone12,1;appBuild/100630;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/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`
await run();
}
}
})()
.catch((e) => {
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
}).finally(() => {
$.done();
})
async function run() {
try{
$.HomeInfo = ''
$.LeadInfo = ''
$.buildList = ''
$.Fund = ''
$.task = []
$.Biztask = []
$.Aggrtask = []
$.Employtask = []
await GetHomePageInfo()
if($.HomeInfo){
$.InviteList.push($.HomeInfo.strMyShareId)
console.log(`等级:${$.HomeInfo.dwLandLvl} 当前金币:${$.HomeInfo.ddwCoinBalance} 当前财富:${$.HomeInfo.ddwRichBalance} 助力码:${$.HomeInfo.strMyShareId}`)
}
if($.LeadInfo && $.LeadInfo.dwLeadType == 2){
await $.wait(2000)
console.log(`\n新手引导`)
await noviceTask()
await GetHomePageInfo()
await $.wait(1000)
}
// 寻宝
await XBDetail()
// 加速卡
await GetProp()
// 故事会
await StoryInfo()
// 建筑升级
await buildList()
// 签到 邀请奖励
await sign()
// 签到-小程序
await signs()
// 捡垃圾
await pickshell(1)
// 热气球接客
// await service(serviceNum)
// 倒垃圾
await RubbishOper()
// 导游
await Guide()
// 撸珍珠
await Pearl()
// 牛牛任务
await ActTask()
// 日常任务、成就任务
await UserTask()
}
catch (e) {
console.log(e);
}
}
async function GetHomePageInfo() {
let e = getJxAppToken()
let additional= `&strPgtimestamp=${e.strPgtimestamp}&strPhoneID=${e.strPhoneID}&strPgUUNum=${e.strPgUUNum}&ddwTaskId=&strShareId=&strMarkList=guider_step%2Ccollect_coin_auth%2Cguider_medal%2Cguider_over_flag%2Cbuild_food_full%2Cbuild_sea_full%2Cbuild_shop_full%2Cbuild_fun_full%2Cmedal_guider_show%2Cguide_guider_show%2Cguide_receive_vistor%2Cdaily_task%2Cguider_daily_task%2Ccfd_has_show_selef_point`
let stk= `_cfd_t,bizCode,ddwTaskId,dwEnv,ptag,source,strMarkList,strPgUUNum,strPgtimestamp,strPhoneID,strShareId,strVersion,strZone`
$.HomeInfo = await taskGet(`user/QueryUserInfo`, stk, additional)
if($.HomeInfo){
$.Fund = $.HomeInfo.Fund || ''
$.LeadInfo = $.HomeInfo.LeadInfo || ''
$.buildInfo = $.HomeInfo.buildInfo || ''
$.XbStatus = $.HomeInfo.XbStatus || []
if($.buildInfo.buildList){
$.buildList = $.buildInfo.buildList || ''
}
}
}
// 寻宝
async function XBDetail(){
try{
let XBDetail = $.XbStatus.XBDetail.filter((x) => x.dwRemainCnt !== 0 && x.ddwColdEndTm <= parseInt(Date.now()/1000,10))
if(XBDetail.length > 0){
console.log(`\n开始寻宝`)
for(let k of XBDetail || []){
if(k.ddwColdEndTm <= parseInt(Date.now()/1000,10)){
await $.wait(2000)
let res = await taskGet(`user/TreasureHunt`, '_cfd_t,bizCode,dwEnv,ptag,source,strIndex,strZone', `&strIndex=${k.strIndex}`)
if(res && res.iRet == 0){
if (res.AwardInfo.dwAwardType === 0) {
console.log(`${res.strAwardDesc},获得 ${res.AwardInfo.ddwValue} 金币`)
} else if (res.AwardInfo.dwAwardType === 1) {
console.log(`${res.strAwardDesc},获得 ${res.AwardInfo.ddwValue} 财富`)
} else {
console.log("寻宝失败\n"+$.toObj(res,res))
}
}else if(res && res.sErrMsg){
console.log(`寻宝失败 ${res.sErrMsg}`)
}else{
console.log("寻宝失败\n"+$.toObj(res,res))
}
}
}
}else{
console.log('\n暂无宝物')
}
}catch (e) {
$.logErr(e);
}
}
// 加速卡任务
async function GetProp(){
try{
console.log('\n加速卡任务')
await $.wait(2000)
$.propTask = await taskGet(`story/GetPropTask`, '_cfd_t,bizCode,dwEnv,ptag,source,strZone', '&ptag=')
if($.propTask && $.propTask.Data && $.propTask.Data.TaskList){
for(let t of $.propTask.Data.TaskList || []){
let res = ''
if(t.dwCompleteNum < t.dwTargetNum){
if([9,11].includes(t.dwPointType)) continue
res = await taskGet('DoTask2', '_cfd_t,bizCode,configExtra,dwEnv,ptag,source,strZone,taskId', `&ptag=&taskId=${t.ddwTaskId}&configExtra=`)
if (res.ret === 0) {
console.log(`[${t.strTaskName}]加速卡任务完成`)
} else {
console.log(`[${t.strTaskName}]加速卡任务失败`, $.toStr(res,res))
await $.wait(2000)
continue
}
await $.wait(2000)
}
if(t.dwAwardStatus == 2){
res = await taskGet('Award2', '_cfd_t,bizCode,dwEnv,ptag,source,strZone,taskId', `&ptag=&taskId=${t.ddwTaskId}`)
if (res.ret === 0) {
console.log(`[${t.strTaskName}]加速卡领取成功`)
if(res.data.prizeInfo){
let task = $.toObj(res.data.prizeInfo,res.data.prizeInfo)
let msg = []
for(let card of task.CardInfo.CardList || []){
msg.push(card.strCardName)
}
console.log(`获得[${msg.join(',')}]加速卡`)
}
} else {
console.log(`[${t.strTaskName}]加速卡领取失败`, $.toStr(res,res))
await $.wait(2000)
continue
}
await $.wait(2000)
}
}
}
await $.wait(2000)
$.propInfo = await taskGet(`user/GetPropCardCenterInfo`, '_cfd_t,bizCode,dwEnv,ptag,source,strZone', '&ptag=')
console.log('\n加速卡使用')
if($.propInfo && $.propInfo.cardInfo){
let flag = $.propInfo.cardInfo.dwWorkingType || 0
let res = ''
for (let card of $.propInfo.cardInfo.coincard || []) {
if(card.ddwCardTargetTm > 0 ) console.log(`[金币卡]结束时间:${$.time('yyyy-MM-dd HH:mm:ss',card.ddwCardTargetTm*1000)}`)
// if(flag == 1 || flag == 3) break
if (card.dwCardNums !== 0 && (flag == 0 || flag == 2)) {
res = await taskGet('user/UsePropCard', '_cfd_t,bizCode,dwCardType,dwEnv,ptag,source,strCardTypeIndex,strZone', `&ptag=&dwCardType=1&strCardTypeIndex=${encodeURIComponent(card.strCardTypeIndex)}`)
if (res.iRet === 0) {
console.log(`[${card.strCardName}]金币卡使用成功`)
if(res.ddwCardTargetTm > 0 ) console.log(`[金币卡]结束时间:${$.time('yyyy-MM-dd HH:mm:ss',res.ddwCardTargetTm*1000)}`)
flag += 1
} else {
console.log(`[${card.strCardName}]金币卡使用失败`, $.toStr(res,res))
}
await $.wait(2000)
}
}
for (let card of $.propInfo.cardInfo.richcard || []) {
if(card.ddwCardTargetTm > 0 ) console.log(`[财富卡]结束时间:${$.time('yyyy-MM-dd HH:mm:ss',card.ddwCardTargetTm*1000)}`)
// if(flag == 2 || flag == 3) break
if (card.dwCardNums !== 0 && (flag == 0 || flag == 1)) {
res = await taskGet('user/UsePropCard', '_cfd_t,bizCode,dwCardType,dwEnv,ptag,source,strCardTypeIndex,strZone', `&ptag=&dwCardType=2&strCardTypeIndex=${encodeURIComponent(card.strCardTypeIndex)}`)
if (res.iRet === 0) {
console.log(`[${card.strCardName}]财富卡使用成功`)
if(res.ddwCardTargetTm > 0 ) console.log(`[财富卡]结束时间:${$.time('yyyy-MM-dd HH:mm:ss',res.ddwCardTargetTm*1000)}`)
flag += 2
} else {
console.log(`[${card.strCardName}]财富卡使用失败`, $.toStr(res,res))
}
await $.wait(2000)
}
}
}
}catch (e) {
console.log(e);
}
}
// 故事会
async function StoryInfo(){
try{
if($.HomeInfo.StoryInfo && $.HomeInfo.StoryInfo.StoryList){
let additional = ``
let stk = ``
let type = ``
let res = ``
await $.wait(1000)
// 点击故事
if($.HomeInfo.StoryInfo.StoryList[0].dwStatus == 1){
if($.HomeInfo.StoryInfo.StoryList[0].dwType == 4){
console.log(`\n贩卖`)
additional = `&ptag=&strStoryId=${$.HomeInfo.StoryInfo.StoryList[0].strStoryId}&dwType=2&ddwTriggerDay=${$.HomeInfo.StoryInfo.StoryList[0].ddwTriggerDay}`
stk = `_cfd_t,bizCode,ddwTriggerDay,dwEnv,dwType,ptag,source,strStoryId,strZone`
type = `CollectorOper`
res = await taskGet(`story/${type}`, stk, additional)
// console.log(JSON.stringify(res))
}else if($.HomeInfo.StoryInfo.StoryList[0].dwType == 1){
console.log(`\n故事会[${$.HomeInfo.StoryInfo.StoryList[0].Special.strName}]`)
additional = `&ptag=&strStoryId=${$.HomeInfo.StoryInfo.StoryList[0].strStoryId}&dwType=2&triggerType=${$.HomeInfo.StoryInfo.StoryList[0].Special.dwTriggerType}&ddwTriggerDay=${$.HomeInfo.StoryInfo.StoryList[0].ddwTriggerDay}`
stk = `_cfd_t,bizCode,ddwTriggerDay,dwEnv,dwType,ptag,source,strStoryId,strZone,triggerType`
type = `SpecialUserOper`
res = await taskGet(`story/${type}`, stk, additional)
// console.log(JSON.stringify(res))
}else if($.HomeInfo.StoryInfo.StoryList[0].dwType == 2){
console.log(`\n美人鱼`)
additional = `&ptag=&strStoryId=${$.HomeInfo.StoryInfo.StoryList[0].strStoryId}&dwType=1&ddwTriggerDay=${$.HomeInfo.StoryInfo.StoryList[0].ddwTriggerDay}`
stk = `_cfd_t,bizCode,ddwTriggerDay,dwEnv,dwType,ptag,source,strStoryId,strZone`
type = `MermaidOper`
res = await taskGet(`story/${type}`, stk, additional)
console.log(JSON.stringify(res))
}
}
if($.HomeInfo.StoryInfo.StoryList[0].dwType == 4 && ( (res && res.iRet == 0) || res == '')){
await pickshell(4)
await $.wait(1000)
console.log(`查询背包`)
additional = `&ptag=`
stk = `_cfd_t,bizCode,dwEnv,ptag,source,strZone`
res = await taskGet(`story/querystorageroom`, stk, additional)
let TypeCnt = []
if(res.Data && res.Data.Office){
for(let i of res.Data.Office){
TypeCnt.push(`${i.dwType}:${i.dwCount}`)
}
}
TypeCnt = TypeCnt.join(`|`)
if(TypeCnt){
console.log(`出售`)
await $.wait(1000)
additional = `&ptag=&strTypeCnt=${TypeCnt}&dwSceneId=2`
stk = `_cfd_t,bizCode,dwEnv,dwSceneId,ptag,source,strTypeCnt,strZone`
res = await taskGet(`story/sellgoods`, stk, additional)
await printRes(res, '贩卖')
additional = `&ptag=&strStoryId=${$.HomeInfo.StoryInfo.StoryList[0].strStoryId}&dwType=4&ddwTriggerDay=${$.HomeInfo.StoryInfo.StoryList[0].ddwTriggerDay}`
stk = `_cfd_t,bizCode,ddwTriggerDay,dwEnv,dwType,ptag,source,strStoryId,strZone`
type = `CollectorOper`
res = await taskGet(`story/${type}`, stk, additional)
// console.log(JSON.stringify(res))
}
}else if($.HomeInfo.StoryInfo.StoryList[0].dwType == 1 && ( (res && res.iRet == 0) || res == '')){
if(res && res.iRet == 0 && res.Data && res.Data.Serve && res.Data.Serve.dwWaitTime){
console.log(`等待 ${res.Data.Serve.dwWaitTime}秒`)
await $.wait(res.Data.Serve.dwWaitTime * 1000)
await $.wait(1000)
}
additional = `&ptag=&strStoryId=${$.HomeInfo.StoryInfo.StoryList[0].strStoryId}&dwType=3&triggerType=${$.HomeInfo.StoryInfo.StoryList[0].Special.dwTriggerType}&ddwTriggerDay=${$.HomeInfo.StoryInfo.StoryList[0].ddwTriggerDay}`
stk = `_cfd_t,bizCode,ddwTriggerDay,dwEnv,dwType,ptag,source,strStoryId,strZone,triggerType`
type = `SpecialUserOper`
res = await taskGet(`story/${type}`, stk, additional)
await printRes(res, `故事会[${$.HomeInfo.StoryInfo.StoryList[0].Special.strName}]`)
// console.log(JSON.stringify(res))
}else if($.HomeInfo.StoryInfo.StoryList[0].dwType == 2 && ( (res && res.iRet == 0) || res == '')){
if($.HomeInfo.StoryInfo.StoryList[0].dwStatus == 4){
additional = `&ptag=&strStoryId=${$.HomeInfo.StoryInfo.StoryList[0].strStoryId}&dwType=4&ddwTriggerDay=${$.HomeInfo.StoryInfo.StoryList[0].ddwTriggerDay}`
}else{
additional = `&ptag=&strStoryId=${$.HomeInfo.StoryInfo.StoryList[0].strStoryId}&dwType=2&ddwTriggerDay=${$.HomeInfo.StoryInfo.StoryList[0].ddwTriggerDay}`
}
await $.wait(5000)
stk = `_cfd_t,bizCode,ddwTriggerDay,dwEnv,dwType,ptag,source,strStoryId,strZone`
type = `MermaidOper`
res = await taskGet(`story/${type}`, stk, additional)
await printRes(res,'美人鱼')
// console.log(JSON.stringify(res))
}
}
}catch (e) {
$.logErr(e);
}
}
// 建筑升级
async function buildList(){
try{
await $.wait(2000)
console.log(`\n升级房屋、收集金币`)
if($.buildList){
for(let i in $.buildList){
let item = $.buildList[i]
let title = '未识别'
if(item.strBuildIndex == 'food'){
title = '美食城'
}else if(item.strBuildIndex == 'sea'){
title = '旅馆'
}else if(item.strBuildIndex == 'shop'){
title = '商店'
}else if(item.strBuildIndex == 'fun'){
title = '游乐场'
}
let additional = `&strBuildIndex=${item.strBuildIndex}`
let stk= `_cfd_t,bizCode,dwEnv,ptag,source,strBuildIndex,strZone`
let GetBuildInfo = await taskGet(`user/GetBuildInfo`, stk, additional)
let msg = `\n[${title}] 当前等级:${item.dwLvl} 接待收入:${item.ddwOneceVistorAddCoin}/人 座位人数:${item.dwContain}`
if(GetBuildInfo) msg += `\n升级->需要金币:${GetBuildInfo.ddwNextLvlCostCoin} 获得财富:${GetBuildInfo.ddwLvlRich}`
console.log(msg)
await $.wait(1000)
if(GetBuildInfo.dwCanLvlUp > 0){
console.log(`${item.dwLvl == 0 && '开启' || '升级'}${title}`)
if(item.dwLvl == 0){
await taskGet(`user/createbuilding`, stk, additional)
}else{
if(GetBuildInfo){
additional = `&strBuildIndex=${GetBuildInfo.strBuildIndex}&ddwCostCoin=${GetBuildInfo.ddwNextLvlCostCoin}`
stk = `_cfd_t,bizCode,ddwCostCoin,dwEnv,ptag,source,strBuildIndex,strZone`
let update = await taskGet(`user/BuildLvlUp`, stk, additional)
if(update && update.story && update.story.strToken){
await $.wait(Number(update.story.dwWaitTriTime) * 1000)
await $.wait(1000)
additional= `&strToken=${update.story.strToken}&ddwTriTime=${update.story.ddwTriTime}`
stk = `_cfd_t,bizCode,dwEnv,ptag,source,strBuildIndex,strZone`
// await taskGet(`story/QueryUserStory`, stk, additional)
}
}
}
await $.wait(2000)
}
additional = `&strBuildIndex=${GetBuildInfo.strBuildIndex}&dwType=1`
stk = `_cfd_t,bizCode,dwEnv,dwType,ptag,source,strBuildIndex,strZone`
let CollectCoin = await taskGet(`user/CollectCoin`, stk, additional)
if(CollectCoin && CollectCoin.ddwCoinBalance){
console.log(`收集金币:${CollectCoin.ddwCoin} 当前剩余:${CollectCoin.ddwCoinBalance}`)
await $.wait(Number(CollectCoin.story.dwWaitTriTime) * 1000)
additional= `&strToken=${CollectCoin.story.strToken}&ddwTriTime=${CollectCoin.story.ddwTriTime}`
stk = `_cfd_t,bizCode,dwEnv,ptag,source,strBuildIndex,strZone`
// await taskGet(`story/QueryUserStory`, stk, additional)
}
await $.wait(1000)
}
await GetHomePageInfo()
await $.wait(1000)
}
if($.Fund && $.Fund.dwIsGetGift < $.Fund.dwIsShowFund){
console.log(`\n领取开拓基金${Number($.Fund.strGiftName)}元`)
let additional= ``
let stk= `_cfd_t,bizCode,dwEnv,ptag,source,strZone`
let drawpackprize = await taskGet(`user/drawpackprize`, stk, additional)
}
}catch (e) {
$.logErr(e);
}
}
// 签到 邀请奖励
async function sign(){
try{
// 签到
await $.wait(2000)
$.Aggrtask = await taskGet(`story/GetTakeAggrPage`, '_cfd_t,bizCode,dwEnv,ptag,source,strZone', '&ptag=')
if($.Aggrtask && $.Aggrtask.Data && $.Aggrtask.Data.Sign){
if($.Aggrtask.Data.Sign.dwTodayStatus == 0) {
console.log('\n签到')
let flag = false
let ddwCoin = 0
let ddwMoney = 0
let dwPrizeType = 0
let strPrizePool = 0
let dwPrizeLv = 0
for(i of $.Aggrtask.Data.Sign.SignList){
if(i.dwStatus == 0){
flag = true
ddwCoin = i.ddwCoin || 0
ddwMoney = i.ddwMoney || 0
dwPrizeType = i.dwPrizeType || 0
strPrizePool = i.strPrizePool || 0
dwPrizeLv = i.dwBingoLevel || 0
break;
}
}
if(flag){
let e = getJxAppToken()
let additional = `&ptag=&ddwCoin=${ddwCoin}&ddwMoney=${ddwMoney}&dwPrizeType=${dwPrizeType}&strPrizePool${strPrizePool && '='+strPrizePool ||''}&dwPrizeLv=${dwPrizeLv}&strPgtimestamp=${e.strPgtimestamp}&strPhoneID=${e.strPhoneID}&strPgUUNum=${e.strPgUUNum}`
let stk= `_cfd_t,bizCode,ddwCoin,ddwMoney,dwEnv,dwPrizeLv,dwPrizeType,ptag,source,strPrizePool,strPgUUNum,strPgtimestamp,strPhoneID,strZone`
let res = await taskGet(`story/RewardSign`, stk, additional)
await printRes(res, '签到')
}
}
}
if($.Aggrtask && $.Aggrtask.Data && $.Aggrtask.Data.Employee && $.Aggrtask.Data.Employee.EmployeeList){
if($.Aggrtask.Data && $.Aggrtask.Data.Employee && $.Aggrtask.Data.Employee.EmployeeList){
console.log(`\n领取邀请奖励(${$.Aggrtask.Data.Employee.EmployeeList.length || 0}/${$.Aggrtask.Data.Employee.dwNeedTotalPeople || 0})`)
for(let i of $.Aggrtask.Data.Employee.EmployeeList){
if(i.dwStatus == 0){
let res = await taskGet(`story/helpdraw`, '_cfd_t,bizCode,dwEnv,dwUserId,ptag,source,strZone', `&ptag=&dwUserId=${i.dwId}`)
await printRes(res, '邀请奖励')
}
}
}
}
}catch (e) {
$.logErr(e);
}
}
// 签到-小程序
async function signs(){
try{
// 签到-小程序
await $.wait(2000)
$.Aggrtask = await taskGet(`story/GetTakeAggrPages`, '_cfd_t,bizCode,dwEnv,ptag,source,strZone', '&ptag=')
if($.Aggrtask && $.Aggrtask.Data && $.Aggrtask.Data.Sign){
if($.Aggrtask.Data.Sign.dwTodayStatus == 0) {
console.log('\n签到-小程序')
let flag = false
let ddwCoin = 0
let ddwMoney = 0
let dwPrizeType = 0
let strPrizePool = 0
let dwPrizeLv = 0
for(i of $.Aggrtask.Data.Sign.SignList){
if(i.dwStatus == 0){
flag = true
ddwCoin = i.ddwCoin || 0
ddwMoney = i.ddwMoney || 0
dwPrizeType = i.dwPrizeType || 0
strPrizePool = i.strPrizePool || 0
dwPrizeLv = i.dwBingoLevel || 0
break;
}
}
if(flag){
let e = getJxAppToken()
let additional = `&ptag=&ddwCoin=${ddwCoin}&ddwMoney=${ddwMoney}&dwPrizeType=${dwPrizeType}&strPrizePool${strPrizePool && '='+strPrizePool ||''}&dwPrizeLv=${dwPrizeLv}&strPgtimestamp=${e.strPgtimestamp}&strPhoneID=${e.strPhoneID}&strPgUUNum=${e.strPgUUNum}`
let stk= `_cfd_t,bizCode,ddwCoin,ddwMoney,dwEnv,dwPrizeLv,dwPrizeType,ptag,source,strPrizePool,strPgUUNum,strPgtimestamp,strPhoneID,strZone`
let res = await taskGet(`story/RewardSigns`, stk, additional)
await printRes(res, '签到-小程序')
}
}
}
}catch (e) {
$.logErr(e);
}
}
// 捡垃圾
async function pickshell(num = 1){
return new Promise(async (resolve) => {
try{
console.log(`\n捡垃圾`)
// pickshell dwType 1珍珠 2海螺 3大海螺 4海星 5小贝壳 6扇贝
for(i=1;num--;i++){
await $.wait(2000)
$.queryshell = await taskGet(`story/queryshell`, '_cfd_t,bizCode,dwEnv,ptag,source,strZone', `&ptag=`)
let c = 6
for(i=1;c--;i++){
let o = 1
let name = '珍珠'
if(i == 2) name = '海螺'
if(i == 3) name = '大海螺'
if(i == 4) name = '海星'
if(i == 5) name = '小贝壳'
if(i == 6) name = '扇贝'
do{
console.log(`去捡${name}第${o}次`)
o++;
let res = await taskGet(`story/pickshell`, '_cfd_t,bizCode,dwEnv,dwType,ptag,source,strZone', `&ptag=&dwType=${i}`)
await $.wait(200)
if(!res || res.iRet != 0){
break
}
}while (o < 20)
}
}
}catch (e) {
$.logErr(e);
}
finally {
resolve();
}
})
}
// 热气球接客
async function service(num = 1){
return new Promise(async (resolve) => {
try{
console.log(`\n热气球接客`)
let arr = ['food','sea','shop','fun']
for(i=1;num--;i++){
let strBuildIndex = arr[Math.floor((Math.random()*arr.length))]
console.log(`第${i}/${num+i}次:${strBuildIndex}`)
let res = await taskGet(`user/SpeedUp`, '_cfd_t,bizCode,dwEnv,ptag,source,strBuildIndex,strZone', `&ptag=&strBuildIndex=${strBuildIndex}`)
if(res && res.iRet == 0){
console.log(`当前气球次数:${res.dwTodaySpeedPeople} 金币速度:${res.ddwSpeedCoin}`)
// additional= `&strToken=${res.story.strToken}&ddwTriTime=${res.story.ddwTriTime}`
// stk = `_cfd_t,bizCode,dwEnv,ptag,source,strBuildIndex,strZone`
// await taskGet(`story/QueryUserStory`, stk, additional)
await $.wait(1000)
}
}
}catch (e) {
$.logErr(e);
}
finally {
resolve();
}
})
}
// 倒垃圾
async function RubbishOper(){
try{
// 倒垃圾
await $.wait(2000)
$.QueryRubbishInfo = await taskGet(`story/QueryRubbishInfo`, '_cfd_t,bizCode,dwEnv,ptag,source,strZone', '&ptag=')
if($.QueryRubbishInfo && $.QueryRubbishInfo.Data && $.QueryRubbishInfo.Data.StoryInfo.StoryList){
for(let i of $.QueryRubbishInfo.Data.StoryInfo.StoryList){
let res = ''
if(i.strStoryId == 3){
console.log(`\n倒垃圾`)
$.RubbishOper = await taskGet(`story/RubbishOper`, '_cfd_t,bizCode,dwEnv,dwRewardType,dwType,ptag,source,strZone', '&ptag=&dwType=1&dwRewardType=0')
if($.RubbishOper && $.RubbishOper.Data && $.RubbishOper.Data.ThrowRubbish && $.RubbishOper.Data.ThrowRubbish.Game && $.RubbishOper.Data.ThrowRubbish.Game.RubbishList){
for(let j of $.RubbishOper.Data.ThrowRubbish.Game.RubbishList){
console.log(`放置[${j.strName}]等待任务完成`)
res = await taskGet(`story/RubbishOper`, '_cfd_t,bizCode,dwEnv,dwRewardType,dwRubbishId,dwType,ptag,source,strZone', `&ptag=&dwType=2&dwRewardType=0&dwRubbishId=${j.dwId}`)
await $.wait(2000)
}
if(res && res.Data && res.Data.RubbishGame && res.Data.RubbishGame.AllRubbish && res.Data.RubbishGame.AllRubbish.dwIsGameOver && res.Data.RubbishGame.AllRubbish.dwIsGameOver == 1){
console.log(`任务完成获得:${res.Data.RubbishGame.AllRubbish.ddwCoin && res.Data.RubbishGame.AllRubbish.ddwCoin+'金币' || ''}`)
}else{
console.log(JSON.stringify(res))
}
}
}
}
}
}catch (e) {
$.logErr(e);
}
}
// 雇佣导游
async function Guide(){
try{
await $.wait(2000)
$.Employtask = await taskGet(`user/EmployTourGuideInfo`, '_cfd_t,bizCode,dwEnv,ptag,source,strZone', '&ptag=')
if($.Employtask && $.Employtask.TourGuideList){
console.log(`\n雇佣导游`)
let num = $.Employtask.dwRemainGuideCnt
console.log(`当前可雇佣劳动人数:${num}`)
let arr = [];
for(let i in $.Employtask.TourGuideList){
let item = $.Employtask.TourGuideList[i]
let larr = [],res = true
arr.forEach((x)=>{
if(x.ddwProductCoin < item.ddwProductCoin && res == true){
larr.push(item)
res = false
}
larr.push(x)
})
if(res) larr.push(item)
arr = larr
}
for(let i of arr){
console.log(`${i.strGuideName} 收益:${i.ddwProductCoin} 支付成本:${i.ddwCostCoin} 剩余工作时长:${timeFn(Number(i.ddwRemainTm || 0) * 1000)}`)
let dwIsFree = 0
let ddwConsumeCoin = i.ddwCostCoin
if(i.dwFreeMin != 0) dwIsFree = 1
if(num > 0 && i.ddwRemainTm == 0){
res = await taskGet(`user/EmployTourGuide`, '_cfd_t,bizCode,ddwConsumeCoin,dwEnv,dwIsFree,ptag,source,strBuildIndex,strZone', `&ptag=&strBuildIndex=${i.strBuildIndex}&dwIsFree=${dwIsFree}&ddwConsumeCoin=${ddwConsumeCoin}`)
if(res.iRet == 0){
console.log(`雇佣成功`)
num--;
}else{
console.log(`雇佣失败:`, JSON.stringify(res))
}
await $.wait(3000)
}
}
}
}catch (e) {
$.logErr(e);
}
}
// 撸珍珠
async function Pearl(){
try{
await $.wait(2000)
$.ComposeGameState = await taskGet(`user/ComposePearlState`, '', '&dwGetType=0')
console.log(`\n当前有${$.ComposeGameState.dwCurProgress}个珍珠${$.ComposeGameState.ddwVirHb && ' '+$.ComposeGameState.ddwVirHb/100+"红包" || ''}`)
if($.ComposeGameState.dayDrawInfo.dwIsDraw == 0){
let res = ''
res = await taskGet(`user/GetPearlDailyReward`, '__t,strZone', ``)
if(res && res.iRet == 0 && res.strToken){
res = await taskGet(`user/PearlDailyDraw`, '__t,ddwSeaonStart,strToken,strZone', `&ddwSeaonStart=${$.ComposeGameState.ddwSeasonStartTm}&strToken=${res.strToken}`)
if(res && res.iRet == 0){
if(res.strPrizeName){
console.log(`抽奖获得:${res.strPrizeName || $.toObj(res,res)}`)
}else{
console.log(`抽奖获得:${$.toObj(res,res)}`)
}
}else{
console.log("抽奖失败\n"+$.toObj(res,res))
}
}else{
console.log($.toObj(res,res))
}
}
if (($.ComposeGameState.dwCurProgress < 8 || true) && $.ComposeGameState.strDT) {
let b = 1
console.log(`合珍珠${b}次 `)
// b = 8-$.ComposeGameState.dwCurProgress
for(i=1;b--;i++){
let n = Math.ceil(Math.random()*12+12)
console.log(`上报次数${n}`)
for(m=1;n--;m++){
console.log(`上报第${m}次`)
await $.wait(5000)
await taskGet(`user/RealTmReport`, '', `&dwIdentityType=0&strBussKey=composegame&strMyShareId=${$.ComposeGameState.strMyShareId}&ddwCount=10`)
let s = Math.floor((Math.random()*3))
let n = 0
if(s == 1) n = 1
if(n === 1){
let res = await taskGet(`user/ComposePearlAward`, '__t,size,strBT,strZone,type', `__t=${Date.now()}&type=4&size=1&strBT=${$.ComposeGameState.strDT}`)
if(res && res.iRet == 0){
console.log(`上报得红包:${res.ddwAwardHb && '获得'+res.ddwAwardHb/100+"红包" || ''}${res.ddwVirHb && ' 当前有'+res.ddwVirHb/100+"红包" || ''}`)
}else{
console.log($.toObj(res,res))
}
}
}
console.log("合成珍珠")
let strLT = ($.ComposeGameState.oPT || [])[$.ComposeGameState.ddwCurTime % ($.ComposeGameState.oPT || []).length]
let res = await taskGet(`user/ComposePearlAddProcess`, '__t,strBT,strLT,strZone', `&strBT=${$.ComposeGameState.strDT}&strLT=${strLT}`)
if(res && res.iRet == 0){
console.log(`合成成功:${res.ddwAwardHb && '获得'+res.ddwAwardHb/100+"红包 " || ''}当前有${res.dwCurProgress}个珍珠${res.ddwVirHb && ' '+res.ddwVirHb/100+"红包" || ''}`)
}else{
console.log(JSON.stringify(res))
}
$.ComposeGameState = await taskGet(`user/ComposePearlState`, '', '&dwGetType=0')
}
}
for (let i of $.ComposeGameState.stagelist || []) {
if (i.dwIsAward == 0 && $.ComposeGameState.dwCurProgress >= i.dwCurStageEndCnt) {
await $.wait(2000)
let res = await taskGet(`user/ComposeGameAward`, '__t,dwCurStageEndCnt,strZone', `&dwCurStageEndCnt=${i.dwCurStageEndCnt}`)
await printRes(res,'珍珠领奖')
}
}
}catch (e) {
$.logErr(e);
}
}
// 牛牛任务
async function ActTask(){
try{
let res = ''
await $.wait(2000)
$.Biztask = await taskGet(`story/GetActTask`, '_cfd_t,bizCode,dwEnv,ptag,source,strZone', '&ptag=')
if($.Biztask && $.Biztask.Data && $.Biztask.Data.dwStatus != 4){
console.log(`\n牛牛任务`)
if($.Biztask.Data.dwStatus == 3 && $.Biztask.Data.dwTotalTaskNum && $.Biztask.Data.dwCompleteTaskNum && $.Biztask.Data.dwTotalTaskNum == $.Biztask.Data.dwCompleteTaskNum){
res = await taskGet(`story/ActTaskAward`, '_cfd_t,bizCode,dwEnv,ptag,source,strZone', `&ptag=`)
if(res.iRet == 0){
console.log(`领取全部任务奖励:`, res.Data.ddwBigReward || '')
}else{
console.log(`领取全部任务奖励失败:`, JSON.stringify(res))
}
}
for(let i in $.Biztask.Data.TaskList){
let item = $.Biztask.Data.TaskList[i]
if(item.dwAwardStatus != 2 && item.dwCompleteNum === item.dwTargetNum) continue
console.log(`任务 ${item.strTaskName} ${item.dwCompleteNum}/${item.dwTargetNum}`)
if (item.dwAwardStatus == 2 && item.dwCompleteNum === item.dwTargetNum) {
res = await taskGet(`Award1`, '_cfd_t,bizCode,dwEnv,ptag,source,strZone,taskId', `&ptag=&taskId=${item.ddwTaskId}`)
if(res.ret == 0){
if(res.data.prizeInfo){
res.data.prizeInfo = $.toObj(res.data.prizeInfo)
}
if(res.data.prizeInfo.ddwCoin || res.data.prizeInfo.ddwMoney){
console.log(`${item.strTaskName} 领取奖励:${res.data.prizeInfo.ddwCoin && res.data.prizeInfo.ddwCoin+'金币' || ''} ${res.data.prizeInfo.ddwMoney && res.data.prizeInfo.ddwMoney+'财富' || ''}`)
}else{
console.log(`${item.strTaskName} 领取奖励:`, JSON.stringify(res))
}
}else{
console.log(`${item.strTaskName} 领取奖励失败:`, JSON.stringify(res))
}
await $.wait(1000)
}
if(item.dwAwardStatus == 2 && item.dwCompleteNum < item.dwTargetNum && [1,2].includes(item.dwOrderId)){
await $.wait(1000)
if(item.strTaskName.indexOf('热气球接待') > -1){
let b = (item.dwTargetNum-item.dwCompleteNum)
// 热气球接客
await service(b)
await $.wait((Number(item.dwLookTime) * 1000) || 1000)
}else if(item.dwPointType == 301){
await $.wait((Number(item.dwLookTime) * 1000) || 1000)
res = await taskGet('DoTask1', '_cfd_t,bizCode,configExtra,dwEnv,ptag,source,strZone,taskId', `&ptag=&taskId=${item.ddwTaskId}&configExtra=`)
}
await $.wait(1000)
res = await taskGet(`Award1`, '_cfd_t,bizCode,dwEnv,ptag,source,strZone,taskId', `&ptag=&taskId=${item.ddwTaskId}`)
if(res.ret == 0){
if(res.data.prizeInfo){
res.data.prizeInfo = $.toObj(res.data.prizeInfo)
}
if(res.data.prizeInfo.ddwCoin || res.data.prizeInfo.ddwMoney){
console.log(`${item.strTaskName} 领取奖励:${res.data.prizeInfo.ddwCoin && res.data.prizeInfo.ddwCoin+'金币' || ''} ${res.data.prizeInfo.ddwMoney && res.data.prizeInfo.ddwMoney+'财富' || ''}`)
}else{
console.log(`${item.strTaskName} 领取奖励:`, JSON.stringify(res))
}
}else{
console.log(`${item.strTaskName} 领取奖励失败:`, JSON.stringify(res))
}
await $.wait(1000)
}
}
}
}catch (e) {
$.logErr(e);
}
}
// 日常任务、成就任务
async function UserTask(){
try{
await $.wait(2000)
let res = ''
$.task = await taskGet(`GetUserTaskStatusList`, '_cfd_t,bizCode,dwEnv,ptag,source,strZone,taskId', '&ptag=&taskId=0')
if($.task && $.task.data && $.task.data.userTaskStatusList){
console.log(`\n日常任务、成就任务`)
for(let i in $.task.data.userTaskStatusList){
let item = $.task.data.userTaskStatusList[i]
if(item.awardStatus != 2 && item.completedTimes === item.targetTimes) continue
console.log(`任务 ${item.taskName} (${item.completedTimes}/${item.targetTimes})`)
if (item.awardStatus == 2 && item.completedTimes === item.targetTimes) {
res = await taskGet(`Award`, '_cfd_t,bizCode,dwEnv,ptag,source,strZone,taskId', `&ptag=&taskId=${item.taskId}`)
if(res.ret == 0){
if(res.data.prizeInfo){
res.data.prizeInfo = $.toObj(res.data.prizeInfo)
}
if(res.data.prizeInfo.ddwCoin || res.data.prizeInfo.ddwMoney || res.data.prizeInfo.strPrizeName){
console.log(`${item.taskName} 领取奖励:${res.data.prizeInfo.ddwCoin && ' '+res.data.prizeInfo.ddwCoin+'金币' || ''}${res.data.prizeInfo.ddwMoney && ' '+res.data.prizeInfo.ddwMoney+'财富' || ''}${res.data.prizeInfo.strPrizeName && ' '+res.data.prizeInfo.strPrizeName+'红包' || ''}`)
}else{
console.log(`${item.taskName} 领取奖励:`, JSON.stringify(res))
}
}else{
console.log(`${item.taskName} 领取奖励失败:`, JSON.stringify(res))
}
await $.wait(1000)
}
if(item.dateType == 2){
if(item.completedTimes < item.targetTimes && ![7,8,9,10].includes(item.orderId)){
if(item.taskName.indexOf('捡贝壳') >-1 || item.taskName.indexOf('赚京币任务') >-1 || item.taskName.indexOf('升级') >-1) continue
let b = (item.targetTimes-item.completedTimes)
for(i=1;b--;i++){
console.log(`第${i}次`)
res = await taskGet('DoTask', '_cfd_t,bizCode,configExtra,dwEnv,ptag,source,strZone,taskId', `&ptag=&taskId=${item.taskId}&configExtra=`)
await $.wait(5000)
}
res = await taskGet(`Award`, '_cfd_t,bizCode,dwEnv,ptag,source,strZone,taskId', `&ptag=&taskId=${item.taskId}`)
if(res.ret == 0){
if(res.data.prizeInfo){
res.data.prizeInfo = $.toObj(res.data.prizeInfo)
}
if(res.data.prizeInfo.ddwCoin || res.data.prizeInfo.ddwMoney || res.data.prizeInfo.strPrizeName){
console.log(`${item.taskName} 领取奖励:${res.data.prizeInfo.ddwCoin && ' '+res.data.prizeInfo.ddwCoin+'金币' || ''}${res.data.prizeInfo.ddwMoney && ' '+res.data.prizeInfo.ddwMoney+'财富' || ''}${res.data.prizeInfo.strPrizeName && ' '+res.data.prizeInfo.strPrizeName+'红包' || ''}`)
}else{
console.log(`${item.taskName} 领取奖励:`, JSON.stringify(res))
}
}else{
console.log(`${item.taskName} 领取奖励失败:`, JSON.stringify(res))
}
}else if(item.awardStatus === 2 && [1].includes(item.orderId)){
}
await $.wait(1000)
}else if(item.dateType == 1){
// console.log('enensss')
}
// break
}
}
}catch (e) {
$.logErr(e);
}
}
function printRes(res, msg=''){
if(res.iRet == 0 && (res.Data || res.ddwCoin || res.ddwMoney || res.strPrizeName)){
let result = res
if(res.Data){
result = res.Data
}
if(result.ddwCoin || result.ddwMoney || result.strPrizeName || result.StagePrizeInfo && result.StagePrizeInfo.strPrizeName){
console.log(`${msg}获得:${result.ddwCoin && ' '+result.ddwCoin+'金币' || ''}${result.ddwMoney && ' '+result.ddwMoney+'财富' || ''}${result.strPrizeName && ' '+result.strPrizeName+'红包' || ''}${result.StagePrizeInfo && result.StagePrizeInfo.strPrizeName && ' '+result.StagePrizeInfo.strPrizeName || ''}`)
}else if(result.Prize){
console.log(`${msg}获得: ${result.Prize.strPrizeName && '优惠券 '+result.Prize.strPrizeName || ''}`)
}else if(res && res.sErrMsg){
console.log(res.sErrMsg)
}else{
console.log(`${msg}完成`, JSON.stringify(res))
// console.log(`完成`)
}
}else if(res && res.sErrMsg){
console.log(`${msg}失败:${res.sErrMsg}`)
}else{
console.log(`${msg}失败:${JSON.stringify(res)}`)
}
}
function getJxAppToken(){
function generateStr(e) {
e = e || 32;
let t = "abcdefghijklmnopqrstuvwxyz1234567890", a = t.length, n = "";
for (i = 0; i < e; i++)
n += t.charAt(Math.floor(Math.random() * a));
return n
}
let phoneId = generateStr(40);
let timestamp = Date.now().toString();
let pgUUNum = $.CryptoJS.MD5('' + decodeURIComponent($.UserName || '') + timestamp + phoneId + 'tPOamqCuk9NLgVPAljUyIHcPRmKlVxDy').toString($.CryptoJS.enc.MD5);
return {
'strPgtimestamp': timestamp,
'strPhoneID': phoneId,
'strPgUUNum': pgUUNum
}
}
async function noviceTask(){
let additional= ``
let stk= ``
additional= ``
stk= `_cfd_t,bizCode,dwEnv,ptag,source,strZone`
await taskGet(`user/guideuser`, stk, additional)
additional= `&strMark=guider_step&strValue=welcom&dwType=2`
stk= `_cfd_t,bizCode,dwEnv,dwType,ptag,source,strMark,strValue,strZone`
await taskGet(`user/SetMark`, stk, additional)
additional= `&strMark=guider_over_flag&strValue=999&dwType=2`
stk= `_cfd_t,bizCode,dwEnv,dwType,ptag,source,strMark,strValue,strZone`
await taskGet(`user/SetMark`, stk, additional)
additional= `&strMark=guider_step&strValue=999&dwType=2`
stk= `_cfd_t,bizCode,dwEnv,dwType,ptag,source,strMark,strValue,strZone`
await taskGet(`user/SetMark`, stk, additional)
additional= `&strMark=guider_step&strValue=999&dwType=2`
stk= `_cfd_t,bizCode,dwEnv,dwType,ptag,source,strMark,strValue,strZone`
await taskGet(`user/SetMark`, stk, additional)
additional= `&strMark=guider_over_flag&strValue=999&dwType=2`
stk= `_cfd_t,bizCode,dwEnv,dwType,ptag,source,strMark,strValue,strZone`
await taskGet(`user/SetMark`, stk, additional)
additional= `&strMark=guider_step&strValue=gift_redpack&dwType=2`
stk= `_cfd_t,bizCode,dwEnv,dwType,ptag,source,strMark,strValue,strZone`
await taskGet(`user/SetMark`, stk, additional)
additional= `&strMark=guider_step&strValue=none&dwType=2`
stk= `_cfd_t,bizCode,dwEnv,dwType,ptag,source,strMark,strValue,strZone`
await taskGet(`user/SetMark`, stk, additional)
}
function taskGet(type, stk, additional){
return new Promise(async (resolve) => {
let myRequest = getGetRequest(type, stk, additional)
$.get(myRequest, async (err, resp, _data) => {
let data = ''
try {
let contents = ''
// console.log(_data)
data = $.toObj(_data)
if(data && data.iRet == 0){
// console.log(_data)
}else{
// 1771|1771|5001|0|0,1771|75|1023|0|请刷新页面重试
// console.log(_data)
}
contents = `1771|${opId(type)}|${data && data.iRet || 0}|0|${data && data.sErrMsg || 0}`
await biz(contents)
}
catch (e) {
$.logErr(e, resp);
}
finally {
resolve(data);
}
});
});
}
function getGetRequest(type, stk='', additional='') {
let url = ``;
let dwEnv = 7;
let types = {
'GetUserTaskStatusList':['GetUserTaskStatusList','jxbfd'],
'Award':['Award','jxbfd'],
'Award1':['Award','jxbfddch'],
'Award2':['Award','jxbfdprop'],
'DoTask':['DoTask','jxbfd'],
'DoTask1':['DoTask','jxbfddch'],
'DoTask2':['DoTask','jxbfdprop'],
}
if(type == 'user/ComposeGameState'){
url = `https://m.jingxi.com/jxbfd/${type}?__t=${Date.now()}&strZone=jxbfd${additional}&_=${Date.now()}&sceneval=2`
}else if(type == 'user/RealTmReport'){
url = `https://m.jingxi.com/jxbfd/${type}?__t=${Date.now()}${additional}&_=${Date.now()}&sceneval=2`
}else{
let stks = ''
if(stk) stks = `&_stk=${stk}`
if(type == 'story/GetTakeAggrPages' || type == 'story/RewardSigns') dwEnv = 6
if(type == 'story/GetTakeAggrPages') type = 'story/GetTakeAggrPage'
if(type == 'story/RewardSigns') type = 'story/RewardSign'
if(types[type]){
url = `https://m.jingxi.com/newtasksys/newtasksys_front/${types[type][0]}?strZone=jxbfd&bizCode=${types[type][1]}&source=jxbfd&dwEnv=${dwEnv}&_cfd_t=${Date.now()}${additional}${stks}&_ste=1&_=${Date.now()}&sceneval=2&g_login_type=1`
}else if(type == 'user/ComposeGameAddProcess' || type == 'user/ComposeGameAward'){
url = `https://m.jingxi.com/jxbfd/${type}?strZone=jxbfd&__t=${Date.now()}${additional}${stks}&_=${Date.now()}&sceneval=2`;
}else{
url = `https://m.jingxi.com/jxbfd/${type}?strZone=jxbfd&bizCode=jxbfd&source=jxbfd&dwEnv=${dwEnv}&_cfd_t=${Date.now()}&ptag=${additional}${stks}&_=${Date.now()}&sceneval=2`;
}
url += `&h5st=${decrypt(Date.now(), stk, '', url)}`;
}
return {
url,
headers: {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
"Connection": "keep-alive",
'Cookie': $.cookie,
'Host': 'm.jingxi.com',
"Referer": "https://st.jingxi.com/",
"User-Agent": UA,
}
}
}
function biz(contents){
return new Promise(async (resolve) => {
let myRequest = {
url:`https://m.jingxi.com/webmonitor/collect/biz.json?contents=${contents}&t=${Math.random()}&sceneval=2`,
headers: {