-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjd-util.js
5212 lines (5180 loc) · 270 KB
/
jd-util.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
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("../utils/utils");
const config_1 = require("../config/config");
class MonsterNian {
constructor(params, containerDiv, outputTextarea) {
this.detailurl = "https://api.m.jd.com/client.action?functionId=nian_getTaskDetail";
this.data = [];
this.timer = 1000;
this.taskToken = "";
this.params = params;
this.container = containerDiv;
this.outputTextarea = outputTextarea;
this.outputTextarea.value = `当你看到这行文字时,说明你还没有配置好浏览器UA或者还没有登录京东帐号!`;
}
get() {
var postData = "functionId=nian_getTaskDetail&body={}&client=wh5&clientVersion=1.0.0";
fetch(this.detailurl, {
method: "POST",
mode: "cors",
credentials: "include",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: postData
}).then(function (response) {
return response.json();
}).then((res) => {
this.data = res.data.result;
if (this.data) {
// this.taskToken = this.data.taskVos[1]["shoppingActivityVos"][0]["taskToken"];
this.outputTextarea.value = `获取数据成功\n
好物加购:${this.data.taskVos[5]["times"]}/${this.data.taskVos[5]["maxTimes"]}\n
逛逛好店:${this.data.taskVos[4]["times"]}/${this.data.taskVos[4]["maxTimes"]}\n
已逛会场:${this.data.taskVos[3]["times"]}/${this.data.taskVos[3]["maxTimes"]}\n
好玩互动:${this.data.taskVos[6]["times"]}/${this.data.taskVos[6]["maxTimes"]}\n
浏览活动:${this.data.taskVos[2]["times"]}/${this.data.taskVos[2]["maxTimes"]}`;
this.list();
}
else {
this.outputTextarea.value = "请先进入活动页开启红包后再开启最后任务吧~";
}
});
}
list() {
const content = document.createElement("div");
let msg = `
<div style="margin:10px;">
<button class="auto" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">一键完成任务</button>
<button class="help" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">帮助作者队伍助力</button>
<button class="invite" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">获取我的助力链接</button>
<input class="inviteLink" type="text" style="width:80vw;height: 25px;font-size:14px;border: solid 1px #000;border-radius: 5px;margin: 10px auto;display: block;" placeholder="请输入需要助力的分享链接">
<button class="assist" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">为TA助力</button>
<button class="group" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">获取我的队伍分享链接</button>
<input class="groupLink" type="text" style="width:80vw;height: 25px;font-size:14px;border: solid 1px #000;border-radius: 5px;margin: 10px auto;display: block;" placeholder="请输入需要助力的队伍的分享链接">
<button class="assistGroup" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">为这个队伍助力</button>
<button class="raise" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">炸年兽</button>
<button class="shop" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">逛逛好店</button>
<button class="browser" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">逛逛主会场</button>
<button class="product" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">好物加购</button>
<button class="shopping" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">逛逛会场</button>
<button class="activity" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">好玩互动</button>
<button class="viewActive" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">浏览活动</button>
<button class="record" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">LBS定位</button>
</div>`;
// <button class="help" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">帮作者助力</button>
// <button class="join" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">加入作者战队</button>
content.innerHTML = msg;
this.container.appendChild(content);
const o = utils_1._$('.shop'), h = utils_1._$('.help'), a = utils_1._$('.activity'), v = utils_1._$('.viewActive'), r = utils_1._$('.record'), s = utils_1._$('.shopping'), i = utils_1._$('.invite'), g = utils_1._$('.group'), b = utils_1._$('.raise'), u = utils_1._$('.auto'), browser = utils_1._$('.browser'), assistGroup = utils_1._$('.assistGroup'), invite = utils_1._$('.inviteLink'), assist = utils_1._$('.assist'), l = utils_1._$('.product');
o.addEventListener('click', () => {
utils_1.default.outPutLog(this.outputTextarea, `开始自动逛逛好店任务`);
this.send(this.data.taskVos[3]["browseShopVo"], this.data.taskVos[3]["taskId"]);
});
l.addEventListener('click', () => {
utils_1.default.outPutLog(this.outputTextarea, `开始自动好物加购任务`);
this.send(this.data.taskVos[2]["productInfoVos"], this.data.taskVos[2]["taskId"]);
});
s.addEventListener('click', () => {
utils_1.default.outPutLog(this.outputTextarea, `开始自动逛逛会场任务`);
this.send(this.data.taskVos[4]["shoppingActivityVos"], this.data.taskVos[4]["taskId"]);
});
a.addEventListener('click', () => {
utils_1.default.outPutLog(this.outputTextarea, `开始自动好玩互动任务`);
this.send(this.data.taskVos[5]["shoppingActivityVos"], this.data.taskVos[5]["taskId"]);
});
v.addEventListener('click', () => {
utils_1.default.outPutLog(this.outputTextarea, `开始自动浏览活动任务`);
this.send(this.data.taskVos[2]["shoppingActivityVos"], this.data.taskVos[2]["taskId"]);
});
r.addEventListener('click', () => {
utils_1.default.outPutLog(this.outputTextarea, `开始自动LBS定位任务`);
this.send([this.data.taskVos[7]["simpleRecordInfoVo"]], this.data.taskVos[7]["taskId"]);
});
browser.addEventListener('click', () => {
utils_1.default.outPutLog(this.outputTextarea, `开始自动逛主会场任务`);
this.doTask();
});
h.addEventListener('click', () => {
this.help();
});
i.addEventListener('click', () => {
utils_1.default.copyText(`https://bunearth.m.jd.com/babelDiy/SGFJVMOZADGTQCZWGEYU/4PWgqmrFHunn8C38mJA712fufguU/index.html?shareType=taskHelp&inviteId=${this.data["inviteId"]}&taskId=1&itemId=${this.data["taskVos"][0]["assistTaskDetailVo"]["itemId"]}&shareFrom=key`);
});
g.addEventListener('click', () => {
this.group();
});
assistGroup.addEventListener('click', () => {
const link = utils_1._$('.groupLink');
this.assistGroup(link.value);
});
assist.addEventListener('click', () => {
const link = utils_1._$('.inviteLink');
this.assist(link.value);
});
b.addEventListener('click', () => {
this.raise();
});
var e = document.createEvent("MouseEvents");
e.initEvent("click", true, true);
u.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
utils_1.default.outPutLog(this.outputTextarea, `一键自动开始任务!`);
this.help();
utils_1.default.outPutLog(this.outputTextarea, `开始自动逛逛好店任务`);
yield this.send(this.data.taskVos[3]["browseShopVo"], this.data.taskVos[3]["taskId"]);
utils_1.default.outPutLog(this.outputTextarea, `开始自动好物加购任务`);
yield this.send(this.data.taskVos[2]["productInfoVos"], this.data.taskVos[2]["taskId"]);
utils_1.default.outPutLog(this.outputTextarea, `开始自动逛逛会场任务`);
yield this.send(this.data.taskVos[4]["shoppingActivityVos"], this.data.taskVos[4]["taskId"]);
utils_1.default.outPutLog(this.outputTextarea, `开始自动好玩互动任务`);
yield this.send(this.data.taskVos[5]["shoppingActivityVos"], this.data.taskVos[5]["taskId"]);
utils_1.default.outPutLog(this.outputTextarea, `开始自动视频直播任务`);
yield this.send(this.data.taskVos[6]["shoppingActivityVos"], this.data.taskVos[6]["taskId"]);
utils_1.default.outPutLog(this.outputTextarea, `全部任务完成`);
// o!.dispatchEvent(e);
// a!.dispatchEvent(e);
// v!.dispatchEvent(e);
// s!.dispatchEvent(e);
// l!.dispatchEvent(e);
}));
}
send(data, taskId) {
return __awaiter(this, void 0, void 0, function* () {
let self = this, length = data.length;
for (let i = 0; i < length; i++) {
var postData = `functionId=nian_collectScore&body={"taskId":${taskId},"itemId":"${data[i]["itemId"]}"}&client=wh5&clientVersion=1.0.0`;
// (function (index, data, len) {
yield new Promise(resolve => {
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
yield fetch("https://api.m.jd.com/client.action?functionId=nian_collectScore", {
method: "POST",
mode: "cors",
credentials: "include",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: postData
}).then(function (response) {
return response.json();
}).then((res) => {
utils_1.default.outPutLog(self.outputTextarea, `操作成功!任务序号:${i + 1}/${length}`);
if (i + 1 >= length) {
utils_1.default.outPutLog(self.outputTextarea, `当前任务已完成!`);
}
resolve();
});
}), (config_1.default.timeoutSpan + utils_1.default.random(300, 500)));
});
// })(i, postData, length)
}
});
}
invite() {
// var postData =`functionId=nian_collectScore&body={"inviteId":"T0kkDJUmGX0Sdet46x7KGSqKNI-klg18GVA8f5s","taskId":1,"itemId":"ASHYV3O7TlGlOXSI"}&client=wh5&clientVersion=1.0.0`;
var postData = `functionId=nian_collectScore&body={"inviteId":"DgxlSNRnRyNRPa01oWqgYGmh6fowp7KSdvYh_P9xeptD0UnvN0zMq6o","taskId":1,"itemId":"ACTNUmK-SyjcNFWT523lDlA"}&client=wh5&clientVersion=1.0.0`;
fetch("https://api.m.jd.com/client.action?functionId=nian_collectScore", {
method: "POST",
mode: "cors",
credentials: "include",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: postData
}).then(function (response) {
return response.json();
}).then((res) => {
utils_1.default.outPutLog(this.outputTextarea, `操作成功!谢谢你的助力!`);
});
}
join() {
fetch("https://api.m.jd.com/client.action?functionId=nian_pk_joinGroup", {
method: "POST",
mode: "cors",
credentials: "include",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: `functionId=nian_pk_joinGroup&body={"inviteId":"VlU-EZopQidWJ6s2oG2sfIHInYsPApTbtntxKA1MAWPJSGYsX6Se6Dv3","confirmFlag":1}&client=wh5&clientVersion=1.0.0`
}).then(function (response) {
return response.json();
}).then((res) => {
if (res.data.bizCode == 0) {
utils_1.default.outPutLog(this.outputTextarea, `操作成功!加入成功!`);
}
else {
utils_1.default.outPutLog(this.outputTextarea, `操作失败,好像满人了哦`);
}
});
}
doTask() {
fetch(" https://api.m.jd.com/client.action?functionId=tc_doTask_mongo", {
method: "POST",
mode: "cors",
credentials: "include",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: `functionId=tc_doTask_mongo&body={"taskToken":${this.taskToken},"actionType":1}&client=wh5&clientVersion=1.0.0`
}).then(function (response) {
return response.json();
}).then((res) => {
utils_1.default.outPutLog(this.outputTextarea, `任务领取成功!`);
this.broswer();
});
}
broswer() {
fetch(`https://api.m.jd.com/client.action?functionId=tc_doTask_mongo&body=%7B%22taskToken%22%3A%22${this.taskToken}%22%2C%22actionType%22%3A0%7D&area=&networkType=&t=1578487649503&appid=publicUseApi&client=wh5&clientVersion=1.0.0`, {
credentials: "include",
}).then(function (response) {
return response.json();
}).then((res) => {
if (res.data.bizCode == 0) {
utils_1.default.outPutLog(this.outputTextarea, `操作成功!`);
}
});
}
raise() {
fetch("https://api.m.jd.com/client.action?functionId=nian_raise", {
method: "POST",
mode: "cors",
credentials: "include",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: `functionId=nian_raise&body={}&client=wh5&clientVersion=1.0.0`
}).then(function (response) {
return response.json();
}).then((res) => {
if (res.data.bizCode == 0) {
utils_1.default.outPutLog(this.outputTextarea, `操作成功!获取奖励如下:${JSON.stringify(res.data.result.levelUpAward)}`);
}
else {
utils_1.default.outPutLog(this.outputTextarea, `操作失败!${res.data.bizMsg}`);
}
});
}
help() {
utils_1.default.outPutLog(this.outputTextarea, `操作成功!谢谢你为我的队伍助力!`);
fetch('https://api.m.jd.com/client.action?functionId=nian_pk_assistGroup', {
method: "POST",
mode: "cors",
credentials: "include",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: `functionId=nian_pk_assistGroup&body={"confirmFlag":1,"inviteId":"XUkkFpUhDG1WJqszpW2uY-4mR3ZvVGMfViX3iMWdE4FeIvO3rYjOC-K6cox9EhXE"}&client=wh5&clientVersion=1.0.0`
}).then((res) => res.json())
.then((json) => {
fetch('https://api.m.jd.com/client.action?functionId=nian_pk_assistGroup', {
method: "POST",
mode: "cors",
credentials: "include",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: `functionId=nian_pk_assistGroup&body={"confirmFlag":1,"inviteId":"XUkkFpUhDG0XY-p35CzwPZgzlWgNooCLIHRgCJ6uCcsnnwdlDlo"}&client=wh5&clientVersion=1.0.0`
}).then((res) => res.json())
.then((json) => {
});
});
}
group() {
fetch('https://api.m.jd.com/client.action?functionId=nian_pk_getHomeData', {
method: "POST",
mode: "cors",
credentials: "include",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: `functionId=nian_pk_getHomeData&body={}&client=wh5&clientVersion=1.0.0`
}).then((res) => res.json())
.then((json) => {
const groupAssistInviteId = json.data.result.groupPkInfo.groupAssistInviteId;
utils_1.default.outPutLog(this.outputTextarea, `获取到邀请id:${groupAssistInviteId}`);
utils_1.default.copyText(`https://bunearth.m.jd.com/babelDiy/ZTSKYQHOPNHCVTWNJSQF/4PWgqmrFHunn8C38mJA712fufguU/index.html?shareType=pk&inviteId=${groupAssistInviteId}`);
});
}
assistGroup(url) {
if (!url || !url.includes('inviteId')) {
alert("请输入要助力的队伍分享链接或输入正确的队伍分享地址!");
return;
}
const inviteId = utils_1.default.getSearchString(url, "inviteId") || url;
fetch('https://api.m.jd.com/client.action?functionId=nian_pk_assistGroup', {
method: "POST",
mode: "cors",
credentials: "include",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: `functionId=nian_pk_assistGroup&body={"confirmFlag":1,"inviteId":"${inviteId}"}&client=wh5&clientVersion=1.0.0`
}).then((res) => res.json())
.then((json) => {
utils_1.default.outPutLog(this.outputTextarea, `助力结果:${json.data.bizMsg}`);
});
}
assist(url) {
if (!url && url.includes('itemId') && url.includes('inviteId')) {
alert("请输入要助力的分享链接或输入正确的分享地址!");
return;
}
const inviteId = utils_1.default.getSearchString(url, "inviteId"), itemId = utils_1.default.getSearchString(url, "itemId");
fetch('https://api.m.jd.com/client.action?functionId=nian_collectScore', {
method: "POST",
mode: "cors",
credentials: "include",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: `functionId=nian_collectScore&body={"taskId":1,"inviteId":"${inviteId}","itemId":"${itemId}"}&client=wh5&clientVersion=1.0.0`
}).then((res) => res.json())
.then((json) => {
utils_1.default.outPutLog(this.outputTextarea, `助力结果:${json.data.bizMsg}`);
});
}
// let extraData = {
// id: "jmdd-react-smash_0",
// data: {
// random:this.getRnd(),
// }
// };
getExtraData(args) {
return JSON.stringify(Object.assign(smashUtils.get_info(args)['data'], { "buttonid": args['id'], "sceneid": "homePageh5", "appid": "50073" }));
}
getRnd() {
return Math.floor(1e6 * Math.random()).toString();
}
}
exports.default = MonsterNian;
},{"../config/config":6,"../utils/utils":31}],2:[function(require,module,exports){
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("../utils/utils");
class Guardianstar {
constructor(containerDiv, outputTextarea) {
this.data = [];
this.token = "jd6df03bd53f0f292f";
this.starIdArr = ['meiditongliya', 'bolangwutiaoren', 'quechaozhuyilong', 'haierchenxiao', 'oulebyangzi', 'haiermaoxiaotong', 'changhongsongyi', 'skgwangyibo'];
this.container = containerDiv;
this.outputTextarea = outputTextarea;
}
get() {
return __awaiter(this, void 0, void 0, function* () {
this.doTask();
});
}
doTask() {
return __awaiter(this, void 0, void 0, function* () {
for (let i = 0; i < this.starIdArr.length; i++) {
yield new Promise(resolve => {
let starId = this.starIdArr[i];
utils_1.default.outPutLog(this.outputTextarea, `当前明星:${starId}`);
fetch(`https://urvsaggpt.m.jd.com/guardianstar/getHomePage?t=${new Date().getTime()}&starId=${starId}`).then(res => res.json()).then((json) => __awaiter(this, void 0, void 0, function* () {
let data = json.data;
let { shopList, venueList, productList } = data[0];
yield utils_1.default.sleep(1000);
utils_1.default.outPutLog(this.outputTextarea, '开始商店任务');
for (let i = 0; i < shopList.length; i++) {
// await Utils.sleep(1000);
let shop = shopList[i];
yield new Promise((resolveFn) => __awaiter(this, void 0, void 0, function* () {
utils_1.default.outPutLog(this.outputTextarea, `商店任务${i + 1}/${shopList.length}`);
if (shop.shopStatus != 3 && shop.shopStatus != 4) {
let body = { starId: starId, id: shop.shopId, type: "shop", status: shop.shopStatus };
if (shop.shopStatus == 1) {
this.doTaskPost(body).then((res) => {
utils_1.default.outPutLog(this.outputTextarea, res.msg);
});
utils_1.default.outPutLog(this.outputTextarea, '模拟浏览任务等待10s');
yield utils_1.default.sleep(11000);
}
body.status = 2;
this.doTaskPost(body).then((res) => {
utils_1.default.outPutLog(this.outputTextarea, res.msg);
});
}
else {
utils_1.default.outPutLog(this.outputTextarea, `任务已完成`);
}
yield utils_1.default.sleep(1000);
resolveFn();
}));
}
utils_1.default.outPutLog(this.outputTextarea, '商店任务已完成~');
yield utils_1.default.sleep(1000);
utils_1.default.outPutLog(this.outputTextarea, '开始会场任务');
for (let i = 0; i < venueList.length; i++) {
let venue = venueList[i];
yield new Promise((resolveFn) => __awaiter(this, void 0, void 0, function* () {
utils_1.default.outPutLog(this.outputTextarea, `会场任务:${i + 1}/${venueList.length}`);
let body = { starId: starId, id: venue.venueId, type: "venue", status: venue.venueStatus };
if (venue.venueStatus != 3 && venue.venueStatus != 4) {
if (venue.venueStatus == 1) {
this.doTaskPost(body).then((res) => {
utils_1.default.outPutLog(this.outputTextarea, res.msg);
});
utils_1.default.outPutLog(this.outputTextarea, '模拟浏览任务等待10s');
yield utils_1.default.sleep(11000);
}
body.status = 2;
this.doTaskPost(body).then((res) => {
utils_1.default.outPutLog(this.outputTextarea, res.msg);
});
}
else {
utils_1.default.outPutLog(this.outputTextarea, `任务已完成`);
}
yield utils_1.default.sleep(1000);
resolveFn();
}));
}
utils_1.default.outPutLog(this.outputTextarea, '商品任务已完成~');
yield utils_1.default.sleep(1000);
utils_1.default.outPutLog(this.outputTextarea, '开始商品任务');
for (let i = 0; i < productList.length; i++) {
let product = productList[i];
yield new Promise((resolveFn) => __awaiter(this, void 0, void 0, function* () {
utils_1.default.outPutLog(this.outputTextarea, `商品任务:${i + 1}/${productList.length}`);
let body = { starId: starId, id: product.productId, type: "product", status: product.productStatus };
if (product.productStatus != 3 && product.productStatus != 4) {
if (product.productStatus == 1) {
this.doTaskPost(body).then((res) => {
utils_1.default.outPutLog(this.outputTextarea, res.msg);
});
utils_1.default.outPutLog(this.outputTextarea, '模拟浏览任务等待10s');
yield utils_1.default.sleep(11000);
}
body.status = 2;
this.doTaskPost(body).then((res) => {
utils_1.default.outPutLog(this.outputTextarea, res.msg);
});
}
else {
utils_1.default.outPutLog(this.outputTextarea, `任务已完成`);
}
yield utils_1.default.sleep(1000);
resolveFn();
}));
}
utils_1.default.outPutLog(this.outputTextarea, '商品任务已完成~');
resolve();
}));
});
}
});
}
list() {
const content = document.createElement("div");
content.innerHTML = `<h1 style="color:red;font-weight: 700;font-size: 18px;">本活动页脚本自动执行,请留意控制台输出</h1>`;
this.container.appendChild(content);
}
doTaskPost(data) {
let { starId, id, type, status } = data;
return fetch('https://urvsaggpt.m.jd.com/guardianstar/doTask', {
body: `starId=${starId}&type=${type}&id=${id}&status=${status}`,
headers: {
"content-type": "application/x-www-form-urlencoded",
},
method: "POST",
credentials: "include"
}).then(res => res.json());
}
}
exports.default = Guardianstar;
},{"../utils/utils":31}],3:[function(require,module,exports){
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("../utils/utils");
const config_1 = require("../config/config");
class Stall {
constructor(containerDiv, outputTextarea) {
this.data = [];
this.taskVos = [];
this.timer = 1000;
this.secretp = "";
this.inviteUrl = 'https://bunearth.m.jd.com/babelDiy/Zeus/4SJUHwGdUQYgg94PFzjZZbGZRjDd/index.html?shareType=homeTask&inviteId=';
this.groupInvitedUrl = 'https://bunearth.m.jd.com/babelDiy/Zeus/4SJUHwGdUQYgg94PFzjZZbGZRjDd/index.html?shareType=cbdDay&inviteId=';
this.switchFlag = true;
this.switchtimer = 0;
this.container = containerDiv;
this.outputTextarea = outputTextarea;
}
get() {
utils_1.default.outPutLog(this.outputTextarea, `当你看到这行文字时,说明你还没有配置好浏览器UA或者还没有登录京东帐号!`);
Promise.all([
utils_1.default.request("stall_getHomeData"),
new Promise((resolve) => {
setTimeout(() => {
utils_1.default.request("stall_getTaskDetail").then(resolve);
}, 1000);
}),
]).then(([homeData, taskData]) => Promise.all([homeData, taskData]))
.then(([homeData, taskData]) => {
this.secretp = homeData.data.result.homeMainInfo.secretp;
this.data = taskData.data.result;
if (this.data) {
this.taskVos = this.data.taskVos;
let value = "";
for (let j = 0; j < this.data.taskVos.length; j++) {
value += `\n${this.taskVos[j]["taskName"]}:${this.data.taskVos[1]["status"] == 2 ? "已完成" : "未完成"}(${this.taskVos[j]["times"]}/${this.taskVos[j]["maxTimes"]})`;
}
utils_1.default.outPutLog(this.outputTextarea, value, true, true);
this.list();
}
});
}
updateTask() {
return new Promise(reslove => {
utils_1.default.request("stall_getTaskDetail").then((res) => {
this.data = res.data.result;
if (this.data) {
this.taskVos = this.data.taskVos;
let value = '任务数据更新成功';
for (let j = 0; j < this.data.taskVos.length; j++) {
value += `\n${this.taskVos[j]["taskName"]}:${this.data.taskVos[1]["status"] == 2 ? "已完成" : "未完成"}(${this.taskVos[j]["times"]}/${this.taskVos[j]["maxTimes"]})`;
}
utils_1.default.outPutLog(this.outputTextarea, value);
}
reslove();
}).catch(() => {
utils_1.default.outPutLog(this.outputTextarea, "数据获取失败,请稍后再试");
});
});
}
list() {
let hours = new Date().getHours();
if (hours >= 20 && hours < 22) {
this.helpGroup(false);
}
// let UATipsDiv = _$('#UATipsDiv');
// if (this.container && UATipsDiv) {
// this.container.removeChild(UATipsDiv);
// }
const content = document.createElement("div");
let msg = `
<div style="margin:10px;">
<button class="help" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">帮作者助力</button>
<button class="helpGroup" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">帮助作者商圈助力</button>
<button class="invite" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">获取助力链接</button>
<input class="inviteLink" type="text" style="width:80vw;height: 25px;font-size:14px;border: solid 1px #000;border-radius: 5px;margin: 10px auto;display: block;" placeholder="请输入需要助力的分享链接">
<button class="assist" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">为TA助力</button>
<button class="group" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">获取商圈分享链接</button>
<input class="groupLink" type="text" style="width:80vw;height: 25px;font-size:14px;border: solid 1px #000;border-radius: 5px;margin: 10px auto;display: block;" placeholder="请输入需要助力的商圈的分享链接">
<button class="assistGroup" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">为这个商圈助力</button>
<button class="steal" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">抢夺商圈红包</button>
<button class="raise" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">解锁升级</button>
<button class="collect" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">收取金币</button>
<input class="timerSpan" type="text" style="width:80vw;height: 25px;font-size:14px;border: solid 1px #000;border-radius: 5px;margin: 10px auto;display: block;" placeholder="请输入定时时间间隔(毫秒)">
<button class="timer" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">定时收取金币</button>
<button class="auto" style="width: 120px;height:30px;background-color: red;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">一键完成任务</button>
<hr>
<p style="text-align:center;font-weight:700;color:red;">一键完成任务将会默认为作者助力<br>操作的时候不要执行其他任务</p>
<hr>
<button class="deliver" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">快递小哥送货</button>
<button class="signIn" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">每天签到</button>
<button class="master" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">逛逛主会场</button>
<button class="browser" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">逛逛商铺</button>
<button class="shopping" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">逛逛会场</button>
<button class="funny" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">好玩互动</button>
<button class="viewProduct" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">浏览好物</button>
<button class="addproduct" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">好物加购</button>
<button class="goodShopping" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">逛逛好物会场</button>
<button class="others" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">浏览其他活动</button>
<button class="treasure" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">寻宝箱领金币</button>
<button class="city" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">城市版图任务</button>
</div>`;
// <button class="" disabled style="width: 120px;height:30px;background-color: gray;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">开通联合会员任务</button>
// <button class="join" style="width: 120px;height:30px;background-color: #2196F3;border-radius: 5px;border: 0;color:#fff;margin:5px auto;display:block">加入作者战队</button>
content.innerHTML = msg;
this.container.appendChild(content);
const signIn = utils_1._$('.signIn'), others = utils_1._$('.others'), group = utils_1._$('.group'), master = utils_1._$('.master'), steal = utils_1._$('.steal'), help = utils_1._$('.help'), funny = utils_1._$('.funny'), viewProduct = utils_1._$('.viewProduct'), city = utils_1._$('.city'), shopping = utils_1._$('.shopping'), invite = utils_1._$('.invite'), goodShopping = utils_1._$('.goodShopping'), timer = utils_1._$('.timer'), deliver = utils_1._$('.deliver'), raise = utils_1._$('.raise'), collect = utils_1._$(".collect"), browser = utils_1._$('.browser'), assistGroup = utils_1._$('.assistGroup'), helpGroup = utils_1._$('.helpGroup'), assist = utils_1._$('.assist'), auto = utils_1._$('.auto'), treasure = utils_1._$('.treasure'), addproduct = utils_1._$('.addproduct');
auto.addEventListener('click', () => {
this.autoDoTask();
});
signIn.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
this.signInEvent();
}));
deliver.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
this.deliverEvent();
}));
treasure.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
this.openTreasure();
}));
master.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
this.doTask(3, `开始每天主会场任务`, "shoppingActivityVos");
}));
addproduct.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
this.addproductEvent();
}));
shopping.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
this.doTask(9, `开始自动逛逛会场任务`, "shoppingActivityVos");
}));
goodShopping.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
this.doTask(16, `开始自动逛逛好物会场任务`, "shoppingActivityVos");
}));
funny.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
this.doTask(14, `开始自动好玩互动任务`, "shoppingActivityVos");
}));
others.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
this.doTask(15, `开始自动好玩互动任务`, "shoppingActivityVos");
}));
viewProduct.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
this.viewProductEvent();
}));
browser.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
this.browserEvent();
}));
steal.addEventListener('click', () => {
utils_1.default.outPutLog(this.outputTextarea, `开始抢夺红包`);
if (new Date().getHours() < 20) {
alert('不在使用时间范围内!');
}
else {
this.steal();
}
});
collect.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
utils_1.default.outPutLog(this.outputTextarea, `开始收取金币`);
yield this.collect();
}));
group.addEventListener('click', () => {
this.group();
});
timer.addEventListener('click', () => {
this.switchTimer();
});
helpGroup.addEventListener('click', () => {
this.helpGroup();
});
help.addEventListener('click', () => {
this.help();
});
invite.addEventListener('click', () => {
this.getInvite();
});
assistGroup.addEventListener('click', () => {
const link = utils_1._$('.groupLink');
this.assistGroup(link.value);
});
assist.addEventListener('click', () => {
const link = utils_1._$('.inviteLink');
this.assist(link.value);
});
raise.addEventListener('click', () => {
this.raise();
});
city.addEventListener('click', () => {
utils_1.default.outPutLog(this.outputTextarea, `开始城市版图任务`);
this.visit();
});
let e = document.createEvent("MouseEvents");
e.initEvent("click", true, true);
}
signInEvent() {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((reslove) => __awaiter(this, void 0, void 0, function* () {
let taskVo = this.getTaskById(1);
utils_1.default.outPutLog(this.outputTextarea, `开始每天签到任务`);
if (!taskVo || taskVo["status"] == 2) {
utils_1.default.outPutLog(this.outputTextarea, `系统尚未分配到该任务或者任务已完成,先去完成其他任务吧~`);
}
else {
yield this.single(1, "1");
}
reslove();
}));
});
}
deliverEvent() {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((reslove) => __awaiter(this, void 0, void 0, function* () {
let taskVo = this.getTaskById(24);
utils_1.default.outPutLog(this.outputTextarea, `开始快递小哥送快递任务`);
if (!taskVo || taskVo["status"] == 2) {
utils_1.default.outPutLog(this.outputTextarea, `系统尚未分配到该任务或者任务已完成,先去完成其他任务吧~`);
}
else {
yield this.multi(24, "1", 5);
yield this.updateTask();
}
reslove();
}));
});
}
addproductEvent() {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((reslove) => __awaiter(this, void 0, void 0, function* () {
let taskVo = this.getTaskById(101);
if (!taskVo || taskVo["status"] == 2) {
utils_1.default.outPutLog(this.outputTextarea, `系统尚未分配到该任务或者任务已完成,先去完成其他任务吧~`);
}
else {
utils_1.default.outPutLog(this.outputTextarea, `开始自动加购好物任务`);
yield this.add(taskVo["productInfoVos"], taskVo["taskId"]);
yield this.updateTask();
}
reslove();
}));
});
}
viewProductEvent() {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((reslove) => __awaiter(this, void 0, void 0, function* () {
let taskVo = this.getTaskById(100);
if (!taskVo || taskVo["status"] == 2) {
utils_1.default.outPutLog(this.outputTextarea, `系统尚未分配到该任务或者任务已完成,先去完成其他任务吧~`);
}
else {
utils_1.default.outPutLog(this.outputTextarea, `开始自动浏览好物任务`);
yield this.view(taskVo["productInfoVos"], taskVo["taskId"]);
yield this.updateTask();
}
reslove();
}));
});
}
browserEvent() {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((reslove) => __awaiter(this, void 0, void 0, function* () {
utils_1.default.outPutLog(this.outputTextarea, `开始自逛逛商店任务`);
let taskVo = this.getTaskById(10);
if (!taskVo || taskVo["status"] == 2) {
utils_1.default.outPutLog(this.outputTextarea, `系统尚未分配到该任务或者任务已完成,先去完成其他任务吧~`);
}
else {
yield this.browser(taskVo["browseShopVo"], taskVo["taskId"]);
yield this.updateTask();
}
reslove();
}));
});
}
doTask(taskId, title, key, once = false) {
return __awaiter(this, void 0, void 0, function* () {
let taskVo = this.getTaskById(taskId);
utils_1.default.outPutLog(this.outputTextarea, title);
if (!taskVo || taskVo["status"] == 2) {
utils_1.default.outPutLog(this.outputTextarea, `系统尚未分配到该任务或者任务已完成,先去完成其他任务吧~`);
}
else {
yield this.send(taskVo[key], taskVo["taskId"]);
yield this.updateTask();
}
});
}
autoDoTask() {
return __awaiter(this, void 0, void 0, function* () {
utils_1.default.outPutLog(this.outputTextarea, '开始自动一键执行任务');
yield this.updateTask();
this.helpGroup();
this.help();
yield this.signInEvent();
yield this.deliverEvent();
yield this.browserEvent();
yield this.viewProductEvent();
yield this.doTask(3, `开始每天主会场任务`, "shoppingActivityVos");
yield this.doTask(9, `开始自动逛逛会场任务`, "shoppingActivityVos");
yield this.doTask(14, `开始自动好玩互动任务`, "shoppingActivityVos");
yield this.doTask(16, `开始自动逛逛好物会场任务`, "shoppingActivityVos");
yield this.doTask(15, `开始自动好玩互动任务`, "shoppingActivityVos");
yield this.addproductEvent();
yield this.visit();
yield this.openTreasure();
utils_1.default.outPutLog(this.outputTextarea, '所有任务已完成');
});
}
getTaskById(id) {
return this.taskVos.filter((value) => {
return value['taskId'] == id;
})[0];
}
single(taskId, itemId) {
return new Promise(reslove => {
let extraData = {
id: "homeWorldCityCourierSmashId0",
data: {
inviteId: "-1",
stealId: "-1",
rnd: this.getRnd(),
taskId: taskId
}
};
let postData = { "taskId": taskId, "itemId": itemId, "ss": `{\"extraData\":${this.getExtraData(extraData)},\"businessData\":{\"taskId\":${taskId},\"rnd\":\"${extraData['data']['rnd']}\",\"inviteId\":\"-1\",\"stealId\":\"-1\"},\"secretp\":\"${this.secretp}\"}`, "shopSign": "" };
utils_1.default.request("stall_collectScore", postData).then((res) => {
utils_1.default.outPutLog(this.outputTextarea, res.data.bizMsg);
reslove();
}).catch(() => {
reslove();
});
});
}
multi(taskId, itemId, count) {
return __awaiter(this, void 0, void 0, function* () {
for (let i = 0; i < count; i++) {
yield this.single(taskId, itemId);
yield utils_1.default.sleep(8000);
}
});
}
collect() {
return new Promise(reslove => {
let extraData = {
id: "jmdd-react-smash_0",
data: {
inviteId: "-1",
stealId: "-1",
rnd: this.getRnd(),
taskId: "collectProducedCoin"
}
};
let postData = {
"ss": `{\"extraData\":${this.getExtraData(extraData)},\"businessData\":{\"taskId\":\"collectProducedCoin\",\"rnd\":\"${extraData['data']['rnd']}\",\"inviteId\":\"-1\",\"stealId\":\"-1\"},\"secretp\":\"${this.secretp}\"}`
};
utils_1.default.request('stall_collectProduceScore', postData).then(res => {
utils_1.default.outPutLog(this.outputTextarea, "领取金币:" + res.data.result.produceScore);
reslove();
});
});
}
switchTimer() {
if (this.switchFlag) {
let span = +utils_1._$('.timerSpan').value;
if (span <= 60000) {
alert(`当前领取时间间隔太短了!建议调整一下!`);
return;
}
utils_1.default.outPutLog(this.outputTextarea, "开启定时器");
utils_1._$('.timer').innerText = '取消定时收取';
this.switchtimer = window.setInterval(() => {
this.collect();
}, span);
}
else {
utils_1.default.outPutLog(this.outputTextarea, "停止定时器");
utils_1._$('.timer').innerText = '定时收取金币';
window.clearInterval(this.switchtimer);
this.timer = 0;
}
this.switchFlag = !this.switchFlag;
}
visit() {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((next) => __awaiter(this, void 0, void 0, function* () {
utils_1.default.request('stall_myShop', {}).then((res) => __awaiter(this, void 0, void 0, function* () {
let shopList = res.data.result.shopList;
let self = this, length = shopList.length;
for (let i = 0; i < length; i++) {
let city = shopList[i], shopSign = city['shopId'];
utils_1.default.outPutLog(self.outputTextarea, `任务城市进度:${i + 1}/${length}当前任务城市:${city['name']}`);
yield utils_1.default.sleep(3000);
let postData = { "shopSign": shopSign };
yield new Promise(resolve => {
utils_1.default.request('stall_getTaskDetail', postData).then((result) => __awaiter(this, void 0, void 0, function* () {
let taskVos = result.data.result.taskVos;
for (let j = 0; j < taskVos.length; j++) {
let taskVo = taskVos[j];
if (taskVo['status'] == 2) {
utils_1.default.outPutLog(self.outputTextarea, `当前任务已完成!跳过~`);
}
else {
yield new Promise(resolveFn => {
utils_1.default.outPutLog(self.outputTextarea, `定时模拟等待任务结束!`);
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
let extraData = {
id: "domainAutoSignSmashId",
data: {
inviteId: "-1",
stealId: "-1",
rnd: this.getRnd(),
taskId: taskVo['taskId']
}
};
let postData = { "taskId": taskVo['taskId'], "itemId": this.getItemIdByName(taskVo, taskVo['taskName'], taskVo['taskId']), "ss": `{\"extraData\":${this.getExtraData(extraData)},\"businessData\":{\"taskId\":${taskVo['taskId']},\"rnd\":\"${extraData['data']['rnd']}\",\"inviteId\":\"-1\",\"stealId\":\"-1\"},\"secretp\":\"${this.secretp}\"}`, "shopSign": shopSign };
yield utils_1.default.request("stall_collectScore", postData).then(() => {
utils_1.default.outPutLog(self.outputTextarea, `当前任务已完成!`);
resolveFn();
});
}), (config_1.default.timeoutSpan + utils_1.default.random(300, 500)));
});
}
}
utils_1.default.outPutLog(self.outputTextarea, `任务已完成${i + 1}/${length}`);
resolve();
})).catch(() => {
resolve();
});
});
}
next();
})).catch(() => {
next();
});
}));
});
}
getVoNameById(id) {
let voName = '';
switch (id) {
case 1:
voName = 'simpleRecordInfoVo';
break;
case 2:
voName = 'followShopVo';
break;
case 3:
voName = 'shoppingActivityVos';
break;
default:
voName = 'shoppingActivityVos';
break;
}
return voName;
}
getItemIdByName(task, name, taskId) {
let VoName = this.getVoNameById(taskId);
if (taskId == 1) {
return task[VoName]['itemId'];
}
else {
let shop = task[VoName].filter((shopVo) => {
return shopVo['shopName'] == task['taskName'] || shopVo['subtitle'] == task['taskName'];
})[0];
return shop ? shop['itemId'] : task[VoName][0]['itemId'];
}
}
browser(data, taskId) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((next) => __awaiter(this, void 0, void 0, function* () {
let self = this, length = data.length;
for (let i = 0; i < length; i++) {
let extraData = {
id: "jmdd-react-smash_74",
data: {
inviteId: "-1",
stealId: "-1",
rnd: this.getRnd(),
taskId: taskId
}
};
let postData = { "taskId": taskId, "itemId": data[i]['itemId'], "actionType": "1", "ss": `{\"extraData\":${this.getExtraData(extraData)},\"businessData\":{\"taskId\":${taskId},\"rnd\":\"${extraData['data']['rnd']}\",\"inviteId\":\"-1\",\"stealId\":\"-1\"},\"secretp\":\"${this.secretp}\"}`, "shopSign": "" };
yield new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
yield utils_1.default.sleep(config_1.default.timeoutSpan + utils_1.default.random(300, 500));
yield utils_1.default.request("stall_collectScore", postData).then(() => {
utils_1.default.outPutLog(self.outputTextarea, `模拟关注店铺中!`);
utils_1.default.request('followShop', { "shopId": data[i]['shopId'], "follow": true, "type": "0" }).then(() => __awaiter(this, void 0, void 0, function* () {
utils_1.default.outPutLog(self.outputTextarea, `等待8s任务完成后再领取奖励中`);
yield utils_1.default.sleep(8000 + utils_1.default.random(300, 500));
let extraData = {
id: "jmdd-react-smash_74",