-
Notifications
You must be signed in to change notification settings - Fork 228
/
shangtuo.js
1744 lines (1642 loc) · 66 KB
/
shangtuo.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://shatuvip.com/pages/login/register?recom_code=5290130
或微信扫描二维码下载
https://raw.githubusercontent.com/leafxcy/JavaScript/main/shangtuo.jpg
推荐码: 5290130
抢券时段为7:00到23:59,建议在8点后跑脚本,7点有可能会卡
玩法:进APP后,先手动去全球分红->提取分红金,然后在个人中心->分红余额->提现一次0.03元(需要上传支付宝和微信收款码),就可以跑脚本了
脚本会自动看广告得分红金,抢券,提现
主要收入为抢券得到的红包余额,最低提现0.5。分红金每日会产生分红,但是需要满88才能提现。
推广余额需要拉人头,大家可以拿着这个脚本,用自己的推荐码去发展下线
现在会首先尝试提现推广余额,然后尝试提现红包余额
脚本默认红包余额满0.5自动提现,可以自己新建一个环境变量 stCash 设定红包余额提现金额,export stCash=20
!!!但是不建议提现20块以下,因为手续费高,只有0.5手续费低!!!
CK有效期较短,可能几天后需要重新捉
只测试了IOS,测试过V2P,青龙可以跑
青龙:
捉api.shatuvip.com的包,大部分包里都有Authorization和User-Agent,分别保存在shangtuoAuth和shangtuoUA里
多账号用@分开,例子如下:
export shangtuoAuth="asdfjhkjafqweqwe@askjfbhsakjeh"
export shangtuoUA="UA1@UA2"
重写食用:
打开商拓即可,如果没有获取到,刷新一下广告首页
V2P重写: https://api.shatuvip.com/advert/getAdvertPage? https://raw.githubusercontent.com/leafxcy/JavaScript/main/shangtuo.js
圈X:
[task_local]
#商拓
30 9,21 * * * shangtuo.js, tag=商拓, enabled=true
[rewrite_local]
https://api.shatuvip.com/advert/getAdvertPage? url script-request-header https://raw.githubusercontent.com/leafxcy/JavaScript/main/shangtuo.js
[MITM]
hostname = api.shatuvip.com
*/
const $ = new Env('商拓');
let shangtuoAuthArr = []
let shangtuoUAArr = []
let shangtuoAuth = ''
let shangtuoUA = ''
let userNum = 0
let userInfo = ""
var packWithdrawAmount = ($.isNode() ? (process.env.stCash) : ($.getval('stCash'))) || 0.5;
let secretCode
let compTaskFlag
let grabFlag
let grabCount
let getBondListFlag
let quanList
let logDebug = 0
let logCaller = 0
const notify = $.isNode() ? require('./sendNotify') : '';
!(async () => {
if (typeof $request !== "undefined") {
await getRewrite()
} else {
if(await checkEnv()) {
console.log(`推荐大家拿着这个脚本,用自己的邀请码去发展下线\n`)
console.log(`共${shangtuoAuthArr.length}个账号\n`)
for (userNum = 0; userNum < shangtuoAuthArr.length; userNum++) {
if (shangtuoAuthArr[userNum]) {
shangtuoAuth = shangtuoAuthArr[userNum];
shangtuoUA = shangtuoUAArr[userNum]
accountStatus = 1
console.log(`\n=================== 开始账户${userNum + 1} ===================`)
//账户信息查询
await getUserInfoData(1)
await $.wait(1000);
if(accountStatus) {
//看广告得分红金
await getAdvertPage(1);
await $.wait(1000);
//提取分红金
await changeDividendBonusToBalance();
await $.wait(1000);
//出售券
await getTradeToPage(1);
await $.wait(1000);
//查询团队
await getTeamData();
await $.wait(1000);
//收取直推活跃红包
await getALlRecommendAdvertListPage(0,1);
await $.wait(1000);
//收取间推活跃红包
await getALlRecommendAdvertListPage(0,2);
await $.wait(1000);
//转换红包余额
await getPackBalance(0);
await $.wait(1000);
//抢券
await getUserBalance();
await $.wait(1000);
//优先尝试提现分红金余额
await getUserBalanceWith()
await $.wait(1000);
//然后尝试提现推广余额
await getPopularizeBalance()
await $.wait(1000);
//最后尝试提现红包余额
await getPackBalance(1);
await $.wait(1000);
//账户信息查询
await getUserInfoData(0)
await $.wait(1000);
}
}
}
$.msg(userInfo)
if($.isNode()) await notify.sendNotify($.name, userInfo)
}
}
})()
.catch((e) => $.logErr(e))
.finally(() => $.done())
function checkEnv() {
let shangtuoAuths = $.isNode() ? (process.env.shangtuoAuth) : ($.getval('shangtuoAuth'))
let shangtuoUAs = $.isNode() ? (process.env.shangtuoUA) : ($.getval('shangtuoUA'))
if(!shangtuoAuths || !shangtuoUAs) {
str1 = shangtuoAuths ? "" : "shangtuoAuths"
str2 = shangtuoUAs ? "" : "shangtuoUAs"
$.log(`未找到环境变量: ${str1} ${str2},请重新捉包并正确填写\n`)
return false
}
let shangtuoAuthArrs
if (shangtuoAuths.indexOf('#') > -1) {
shangtuoAuthArrs = shangtuoAuths.split('#');
console.log(`您选择的是用"#"隔开shangtuoAuth\n`)
} else if (shangtuoAuths.indexOf('@') > -1) {
shangtuoAuthArrs = shangtuoAuths.split('@');
console.log(`您选择的是用"@"隔开shangtuoAuth\n`)
} else {
shangtuoAuthArrs = [shangtuoAuths]
};
Object.keys(shangtuoAuthArrs).forEach((item) => {
if (shangtuoAuthArrs[item]) {
shangtuoAuthArr.push(shangtuoAuthArrs[item])
}
})
let shangtuoUAArrs
if (shangtuoUAs.indexOf('#') > -1) {
shangtuoUAArrs = shangtuoUAs.split('#');
console.log(`您选择的是用"#"隔开shangtuoUA\n`)
} else if (shangtuoUAs.indexOf('@') > -1) {
shangtuoUAArrs = shangtuoUAs.split('@');
console.log(`您选择的是用"@"隔开shangtuoUA\n`)
} else {
shangtuoUAArrs = [shangtuoUAs]
};
Object.keys(shangtuoUAArrs).forEach((item) => {
if (shangtuoUAArrs[item]) {
shangtuoUAArr.push(shangtuoUAArrs[item])
}
})
return true
}
function getRewrite() {
if ($request.url.indexOf("getAdvertPage?") > -1) {
shangtuoAuth = $request.headers['Authorization']
if (shangtuoAuth) {
$.setdata(shangtuoAuth, `shangtuoAuth`)
$.log(`获取shangtuoAuth成功:${shangtuoAuth}`)
$.msg(`获取shangtuoAuth成功:${shangtuoAuth}`)
}
shangtuoUA = $request.headers['User-Agent']
if (shangtuoUA) {
$.setdata(shangtuoUA, `shangtuoUA`)
$.log(`获取shangtuoUA成功:${shangtuoUA}`)
$.msg(`获取shangtuoUA成功:${shangtuoUA}`)
}
}
}
//用户信息
function getUserInfoData(checkStatus,timeout = 0) {
if(logCaller) console.log("call "+ printCaller())
return new Promise((resolve, reject) => {
let request = {
url: `https://api.shatuvip.com/user/getUserInfoData`,
headers: {
"Host": "api.shatuvip.com",
"Origin": "https://shatuvip.com",
"Connection": "keep-alive",
"Authorization": shangtuoAuth,
"User-Agent": shangtuoUA,
"Content-Type": "application/json",
"Accept": "*/*",
"Referer": "https://shatuvip.com/",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh-Hans;q=0.9"
},
}
$.get(request, async (err, resp, data) => {
try {
if (err) {
console.log("API请求失败");
console.log(err + " at function " + printCaller());
} else {
if (safeGet(data)) {
let result = JSON.parse(data)
if(logDebug) console.log(result)
if (result.code == 0) {
if(checkStatus) {
console.log(`\n账户${userNum+1}名称:${result.result.nickname}`)
userInfo += `\n账户${userNum+1}名称:${result.result.nickname}\n`
} else {
console.log(`\n账户${userNum+1}名称:${result.result.nickname}`)
console.log(` 推荐码: ${result.result.recom_code}`)
userInfo += ` 推荐码: ${result.result.recom_code}\n`
console.log(` 分红金总额:${result.result.dividend}`)
userInfo += ` 分红金总额:${result.result.dividend}\n`
console.log(` 分红余额: ${result.result.balance_with}`)
userInfo += ` 分红余额: ${result.result.balance_with}\n`
console.log(` 红包余额: ${result.result.balance_packet}`)
userInfo += ` 红包余额: ${result.result.balance_packet}\n`
console.log(` 推广余额: ${result.result.balance_extend}`)
userInfo += ` 推广余额: ${result.result.balance_extend}\n`
console.log(` 可售商券: ${result.result.bond_count}`)
userInfo += ` 可售商券: ${result.result.bond_count}\n`
console.log(` 消费余额: ${result.result.balance}`)
userInfo += ` 消费余额: ${result.result.balance}\n`
console.log(` 消费商券: ${result.result.balance_bonds}`)
userInfo += ` 消费商券: ${result.result.balance_bonds}\n`
}
} else {
console.log(`\n获取账户${userNum+1}信息失败: ${result.msg}`)
if(result.msg.indexOf('登录超时') > -1) {
accountStatus = 0
userInfo += `\n获取账户${userNum+1}信息失败: ${result.msg},请尝试重新捉CK\n`
}
}
}
}
} catch (e) {
console.log(e + " at function " + printCaller(), resp);
} finally {
resolve();
}
})
})
}
//广告列表id
function getAdvertPage(pageNo,timeout = 0) {
if(logCaller) console.log("call "+ printCaller())
return new Promise((resolve) => {
let request = {
url: `https://api.shatuvip.com/advert/getAdvertPage?type=1&pageNo=${pageNo}&column_id=1`,
headers: {
"Host": "api.shatuvip.com",
"Origin": "https://shatuvip.com",
"Connection": "keep-alive",
"Authorization": shangtuoAuth,
"User-Agent": shangtuoUA,
"Content-Type": "application/json",
"Accept": "*/*",
"Referer": "https://shatuvip.com/",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh-Hans;q=0.9"
},
}
$.get(request, async (err, resp, data) => {
try {
if (err) {
console.log("API请求失败");
console.log(err + " at function " + printCaller());
} else {
if (safeGet(data)) {
let result = JSON.parse(data)
if(logDebug) console.log(result)
if (result.code == 0) {
console.log(`获取分红金广告任务列表成功`)
adNum = result.result.length
compTaskFlag = 1
for(let i=0; i<adNum && compTaskFlag; i++) {
compTaskFlag = 0
cid = result.result[i].id
await getAdvertInfo(cid)
await completeTask(cid,secretCode)
}
} else {
console.log(`获取分红金广告任务列表失败: ${result.msg}`)
}
}
}
} catch (e) {
console.log(e + " at function " + printCaller(), resp);
} finally {
resolve();
}
})
})
}
//浏览广告
function getAdvertInfo(cid,timeout = 0) {
if(logCaller) console.log("call "+ printCaller())
return new Promise((resolve) => {
let request = {
url: `https://api.shatuvip.com/advert/getAdvertInfo?id=${cid}`,
headers: {
"Host": "api.shatuvip.com",
"Origin": "https://shatuvip.com",
"Connection": "keep-alive",
"Authorization": shangtuoAuth,
"User-Agent": shangtuoUA,
"Content-Type": "application/json",
"Accept": "*/*",
"Referer": "https://shatuvip.com/",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh-Hans;q=0.9"
},
}
$.get(request, async (err, resp, data) => {
try {
if (err) {
console.log("API请求失败");
console.log(err + " at function " + printCaller());
} else {
if (safeGet(data)) {
let result = JSON.parse(data)
if(logDebug) console.log(result)
if (result.code == 0) {
console.log(`开始浏览广告${cid}`)
secretCode = result.result.uniTime2
await $.wait(7000);
} else {
console.log(`浏览广告失败: ${result.msg}`)
}
}
}
} catch (e) {
console.log(e + " at function " + printCaller(), resp);
} finally {
resolve();
}
})
})
}
//获取分红金
function completeTask(cid,secret,timeout = 0) {
if(logCaller) console.log("call "+ printCaller())
return new Promise((resolve, reject) => {
let request = {
url: `https://api.shatuvip.com/advert/completeTask`,
headers: {
"Host": "api.shatuvip.com",
"Origin": "https://shatuvip.com",
"Connection": "keep-alive",
"Authorization": shangtuoAuth,
"User-Agent": shangtuoUA,
"Content-Type": "application/json",
"Accept": "*/*",
"Referer": "https://shatuvip.com/",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh-Hans;q=0.9"
},
body: `{"id": ${cid}, "secret": "${secret}"}`,
}
$.post(request, async (err, resp, data) => {
try {
if (err) {
console.log("API请求失败");
console.log(err + " at function " + printCaller());
} else {
if (safeGet(data)) {
let result = JSON.parse(data)
if(logDebug) console.log(result)
if (result.code == 0) {
if(result.msg) {
console.log(`获得${result.msg}`)
compTaskFlag = 1
} else {
console.log(`没有获得分红金,结束浏览广告`)
}
} else {
console.log(`获取分红金失败:${result.msg}`)
}
}
}
} catch (e) {
console.log(e + " at function " + printCaller(), resp);
} finally {
resolve();
}
})
})
}
//提取分红金
function changeDividendBonusToBalance(timeout = 0) {
if(logCaller) console.log("call "+ printCaller())
return new Promise((resolve, reject) => {
let request = {
url: `https://api.shatuvip.com/user/changeDividendBonusToBalance`,
headers: {
"Host": "api.shatuvip.com",
"Origin": "https://shatuvip.com",
"Connection": "keep-alive",
"Authorization": shangtuoAuth,
"User-Agent": shangtuoUA,
"Content-Type": "application/json",
"Accept": "*/*",
"Referer": "https://shatuvip.com/",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh-Hans;q=0.9"
},
}
$.get(request, async (err, resp, data) => {
try {
if (err) {
console.log("API请求失败");
console.log(err + " at function " + printCaller());
} else {
if (safeGet(data)) {
let result = JSON.parse(data)
if(logDebug) console.log(result)
if(result.code == 0) {
console.log(`提取分红金获得: ${result.result.bonus}`)
userInfo += `提取分红金获得: ${result.result.bonus}\n`
} else {
console.log(`提取分红金失败: ${result.msg}`)
}
}
}
} catch (e) {
console.log(e + " at function " + printCaller(), resp);
} finally {
resolve();
}
})
})
}
//出售券列表
function getTradeToPage(pageNo,timeout = 0) {
if(logCaller) console.log("call "+ printCaller())
return new Promise((resolve) => {
let request = {
url: `https://api.shatuvip.com/user/getTradeToPage?pageNo=${pageNo}`,
headers: {
"Host": "api.shatuvip.com",
"Origin": "https://shatuvip.com",
"Connection": "keep-alive",
"Authorization": shangtuoAuth,
"User-Agent": shangtuoUA,
"Content-Type": "application/json",
"Accept": "*/*",
"Referer": "https://shatuvip.com/",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh-Hans;q=0.9"
},
}
$.get(request, async (err, resp, data) => {
try {
if (err) {
console.log("API请求失败");
console.log(err + " at function " + printCaller());
} else {
if (safeGet(data)) {
let result = JSON.parse(data)
if(logDebug) console.log(result)
if (result.code == 0) {
for (i = 0; i < result.result.length; i++) {
quanItem = result.result[i]
if(quanItem.locking) {
console.log(`${quanItem.price}券${quanItem.id}出售等待时间:${quanItem.locking}`)
} else {
await getPriceSection(quanItem.id,quanItem.price)
}
}
} else {
console.log(`获取出售券列表失败: ${result.msg}`)
}
}
}
} catch (e) {
console.log(e + " at function " + printCaller(), resp);
} finally {
resolve();
}
})
})
}
//设置券出售金额
function getPriceSection(id,price,timeout = 0) {
if(logCaller) console.log("call "+ printCaller())
return new Promise((resolve) => {
let request = {
url: `https://api.shatuvip.com/market/getPriceSection?id=${id}`,
headers: {
"Host": "api.shatuvip.com",
"Origin": "https://shatuvip.com",
"Connection": "keep-alive",
"Authorization": shangtuoAuth,
"User-Agent": shangtuoUA,
"Content-Type": "application/json",
"Accept": "*/*",
"Referer": "https://shatuvip.com/",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh-Hans;q=0.9"
},
}
$.get(request, async (err, resp, data) => {
try {
if (err) {
console.log("API请求失败");
console.log(err + " at function " + printCaller());
} else {
if (safeGet(data)) {
let result = JSON.parse(data)
if(logDebug) console.log(result)
if (result.code == 0) {
sellPrice = result.result.max
console.log(`${price}券可出售金额为${result.result.min}到${result.result.max},设置为${sellPrice}`)
await tradePutShop(id,price,sellPrice)
} else {
console.log(`获取券可出售金额失败: ${result.msg}`)
}
}
}
} catch (e) {
console.log(e + " at function " + printCaller(), resp);
} finally {
resolve();
}
})
})
}
//券出售
function tradePutShop(id,price,sellPrice,timeout = 0) {
if(logCaller) console.log("call "+ printCaller())
return new Promise((resolve, reject) => {
let request = {
url: `https://api.shatuvip.com/user/tradePutShop`,
headers: {
"Host": "api.shatuvip.com",
"Origin": "https://shatuvip.com",
"Connection": "keep-alive",
"Authorization": shangtuoAuth,
"User-Agent": shangtuoUA,
"Content-Type": "application/json",
"Accept": "*/*",
"Referer": "https://shatuvip.com/",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh-Hans;q=0.9"
},
body: `{"id": ${id}, "price": "${sellPrice}"}`,
}
$.post(request, async (err, resp, data) => {
try {
if (err) {
console.log("API请求失败");
console.log(err + " at function " + printCaller());
} else {
if (safeGet(data)) {
let result = JSON.parse(data)
if(logDebug) console.log(result)
console.log(`出售${price}券结果:${result.msg}`)
}
}
} catch (e) {
console.log(e + " at function " + printCaller(), resp);
} finally {
resolve();
}
})
})
}
//抢券操作
async function getAllBondList(balance) {
let i = 1
quanList = []
getBondListFlag = 1
while(getBondListFlag) {
await getBondList(i,balance)
i++
}
let sortList = quanList.sort(function(a,b){return b["face_price"]-a["face_price"]});
let numList = sortList.length
for(let i=0; i<numList; i++) {
quanItem = sortList[i]
//每个券可以抢10次,必须抢完10次才能抢下一个券
//为了防止网络波动,强制循环抢同一个券直到失败
grabFlag = 1
grabCount = 0
while(grabFlag && grabCount<30) {
await getBondAdvertId(quanItem.face_price,quanItem.id)
}
}
}
//抢券列表
function getBondList(pageNo,balance,timeout = 0) {
if(logCaller) console.log("call "+ printCaller())
return new Promise((resolve, reject) => {
let request = {
url: `https://api.shatuvip.com/bond/getBondList?pageNo=${pageNo}`,
headers: {
"Host": "api.shatuvip.com",
"Origin": "https://shatuvip.com",
"Connection": "keep-alive",
"Authorization": shangtuoAuth,
"User-Agent": shangtuoUA,
"Content-Type": "application/json",
"Accept": "*/*",
"Referer": "https://shatuvip.com/",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh-Hans;q=0.9"
},
}
$.get(request, async (err, resp, data) => {
try {
if (err) {
console.log("API请求失败");
console.log(err + " at function " + printCaller());
} else {
if (safeGet(data)) {
let result = JSON.parse(data)
if(logDebug) console.log(result)
await $.wait(500)
if (result.code == 0) {
if(result.result && result.result[0]) {
let numList = result.result.length
console.log(`获取抢券列表第${pageNo}页成功,找到${numList}个抢券ID`)
for(let i=0; i<numList; i++) {
quanItem = result.result[i]
if(balance >= quanItem.price) {
quanList.push(quanItem)
}
}
} else {
//没有可抢的券了,停止查询
getBondListFlag = 0
}
} else {
console.log(`获取抢券列表失败:${result.msg}`)
getBondListFlag = 0
}
}
}
} catch (e) {
console.log(e + " at function " + printCaller(), resp);
} finally {
resolve();
}
})
})
}
//获取抢券广告id
function getBondAdvertId(face_price,id,timeout = 0) {
if(logCaller) console.log("call "+ printCaller())
return new Promise((resolve, reject) => {
let request = {
url: `https://api.shatuvip.com/advert/getBondAdvertId`,
headers: {
"Host": "api.shatuvip.com",
"Origin": "https://shatuvip.com",
"Connection": "keep-alive",
"Authorization": shangtuoAuth,
"User-Agent": shangtuoUA,
"Content-Type": "application/json",
"Accept": "*/*",
"Referer": "https://shatuvip.com/",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh-Hans;q=0.9"
},
}
$.get(request, async (err, resp, data) => {
try {
if (err) {
console.log("API请求失败");
console.log(err + " at function " + printCaller());
} else {
if (safeGet(data)) {
let result = JSON.parse(data)
if(logDebug) console.log(result)
if (result.code == 0) {
await getAdvertInfo(result.result.id);
await grab(face_price,id,result.result.token)
} else {
console.log(`获取抢券广告ID失败:${result.msg}`)
}
}
}
} catch (e) {
console.log(e + " at function " + printCaller(), resp);
} finally {
resolve();
}
})
})
}
//抢券
function grab(face_price,id,token,timeout = 0) {
if(logCaller) console.log("call "+ printCaller())
grabCount++
return new Promise((resolve, reject) => {
let request = {
url: `https://api.shatuvip.com/bond/grab`,
headers: {
"Host": "api.shatuvip.com",
"Origin": "https://shatuvip.com",
"Connection": "keep-alive",
"Authorization": shangtuoAuth,
"User-Agent": shangtuoUA,
"Content-Type": "application/json",
"Accept": "*/*",
"Referer": "https://shatuvip.com/",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh-Hans;q=0.9"
},
body: `{"bond_id": ${id}, "__token__": "${token}"}`,
}
$.post(request, async (err, resp, data) => {
try {
if (err) {
console.log("API请求失败");
console.log(err + " at function " + printCaller());
} else {
if (safeGet(data)) {
let result = JSON.parse(data)
if(logDebug) console.log(result)
if (result.code == 0) {
console.log(`抢${face_price}券成功:${result.msg}`)
await $.wait(1000)
} else {
console.log(`抢${face_price}券失败:${result.msg}`)
grabFlag = 0
}
}
}
} catch (e) {
console.log(e + " at function " + printCaller(), resp);
} finally {
resolve();
}
})
})
}
//团队人数
function getTeamData(timeout = 0) {
if(logCaller) console.log("call "+ printCaller())
return new Promise((resolve, reject) => {
let request = {
url: `https://api.shatuvip.com/team/getTeamData`,
headers: {
"Host": "api.shatuvip.com",
"Origin": "https://shatuvip.com",
"Connection": "keep-alive",
"Authorization": shangtuoAuth,
"User-Agent": shangtuoUA,
"Content-Type": "application/json",
"Accept": "*/*",
"Referer": "https://shatuvip.com/",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh-Hans;q=0.9"
},
}
$.get(request, async (err, resp, data) => {
try {
if (err) {
console.log("API请求失败");
console.log(err + " at function " + printCaller());
} else {
if (safeGet(data)) {
let result = JSON.parse(data)
if(logDebug) console.log(result)
if(result.code == 0) {
console.log(`推广总人数:${result.result.num}`)
console.log(`----直推人数:${result.result.sonNum}`)
console.log(`--------有效直推:${result.result.sonAttestationNum}`)
console.log(`--------无效直推:${result.result.songNoAttestationNum}`)
console.log(`----间推人数:${result.result.grandsonNum}`)
console.log(`--------有效间推:${result.result.grandsonAttestationNum}`)
console.log(`--------无效间推:${result.result.grandsonNoAttestationNum}`)
} else {
console.log(`查询团队人数失败:${result.msg}`)
}
}
}
} catch (e) {
console.log(e + " at function " + printCaller(), resp);
} finally {
resolve();
}
})
})
}
//团队列表
//type: 1 -- 直推, 2 -- 间推
function getALlRecommendAdvertListPage(pageNum,type,timeout = 0) {
if(logCaller) console.log("call "+ printCaller())
return new Promise((resolve, reject) => {
let request = {
url: `https://api.shatuvip.com/team/getALlRecommendAdvertListPage?pageNo=${pageNum}&type=${type}`,
headers: {
"Host": "api.shatuvip.com",
"Origin": "https://shatuvip.com",
"Connection": "keep-alive",
"Authorization": shangtuoAuth,
"User-Agent": shangtuoUA,
"Content-Type": "application/json",
"Accept": "*/*",
"Referer": "https://shatuvip.com/",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh-Hans;q=0.9"
},
}
$.get(request, async (err, resp, data) => {
try {
if (err) {
console.log("API请求失败");
console.log(err + " at function " + printCaller());
} else {
if (safeGet(data)) {
let result = JSON.parse(data)
if(logDebug) console.log(result)
if(result.code == 0) {
await $.wait(500)
if(result.result && result.result[0]){
for(let i=0; i<result.result.length; i++) {
let teamMember = result.result[i]
if(teamMember.receive == 1) {
await grabTeamWith(teamMember.recom_code)
}
}
await getALlRecommendAdvertListPage(pageNum+1,type)
} else {
//已查询完毕
}
} else {
console.log(`查询团队列表失败:${result.msg}`)
}
}
}
} catch (e) {
console.log(e + " at function " + printCaller(), resp);
} finally {
resolve();
}
})
})
}
//团队活跃红包
function grabTeamWith(recom_code,timeout = 0) {
if(logCaller) console.log("call "+ printCaller())
return new Promise((resolve, reject) => {
let request = {
url: `https://api.shatuvip.com/team/grabTeamWith`,
headers: {
"Host": "api.shatuvip.com",
"Origin": "https://shatuvip.com",
"Connection": "keep-alive",
"Authorization": shangtuoAuth,
"User-Agent": shangtuoUA,
"Content-Type": "application/json",
"Accept": "*/*",
"Referer": "https://shatuvip.com/",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh-Hans;q=0.9"
},
body: `{"recom_code":${recom_code}}`,
}
$.post(request, async (err, resp, data) => {
try {
if (err) {
console.log("API请求失败");
console.log(err + " at function " + printCaller());
} else {
if (safeGet(data)) {
await $.wait(500);
let result = JSON.parse(data)
if(logDebug) console.log(result)
if(result.code == 0) {
console.log(`收取团队活跃红包成功:${result.msg}`)
} else {
console.log(`收取团队活跃红包失败:${result.msg}`)
}
}
}
} catch (e) {
console.log(e + " at function " + printCaller(), resp);
} finally {
resolve();
}
})
})
}
//消费余额查询
function getUserBalance(timeout = 0) {
if(logCaller) console.log("call "+ printCaller())
return new Promise((resolve, reject) => {
let request = {
url: `https://api.shatuvip.com/user/getUserBalance`,
headers: {
"Host": "api.shatuvip.com",
"Origin": "https://shatuvip.com",
"Connection": "keep-alive",
"Authorization": shangtuoAuth,
"User-Agent": shangtuoUA,
"Content-Type": "application/json",
"Accept": "*/*",
"Referer": "https://shatuvip.com/",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh-Hans;q=0.9"
},
}
$.get(request, async (err, resp, data) => {
try {
if (err) {
console.log("API请求失败");
console.log(err + " at function " + printCaller());
} else {
if (safeGet(data)) {
let result = JSON.parse(data)
if(logDebug) console.log(result)
await $.wait(500);
if(result.code == 0) {
console.log(`\n消费余额:${result.result.balance},开始抢券`)
await getAllBondList(result.result.balance)
} else {