-
Notifications
You must be signed in to change notification settings - Fork 0
/
txstock.js
2775 lines (2630 loc) · 116 KB
/
txstock.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
/*
腾讯自选股APP & 微信微证券公众号
只适配了IOS,测试了青龙和V2P,其他平台请自行测试,安卓请自行测试
多用户用#隔开
脚本只会在10点到13点之间进行猜涨跌,请务必在这段时间内跑一次脚本
上证和个股猜涨跌开奖时间为15:15和16:30,建议16:30后再跑一次领奖
有些任务会提示任务完成发奖失败 -- 可以忽略
或者任务完成前置条件不符合 -- 一般为需要分享,会在完成日常任务后尝试做互助
内置了多用户相互做分享任务,用户数多于一个才能用
测试了做分享任务的情况下,一天收益大概在15000金币
默认自动提现5元,做分享任务,不做新手任务
新手任务可能需要跑几次才能做完,不过每天跑的话总会做完的
提现条件设置:自己新建一个TxStockCash环境变量,0代表不提现,1代表提现1元,5代表提现5元
新手任务设置:新建一个TxStockNewbie环境变量,0代表不做新手任务,1代表做新手任务
分享任务设置:新建一个TxStockHelp环境变量,0代表不做分享互助,1代表做分享互助
互助顺序设置:新建一个TxStockHelpOrder环境变量,按顺序填入要帮助的用户,0代表不帮助其他用户,每个用户之间用@或者#隔开
青龙:
APP和微信都捉 https://wzq.tenpay.com/cgi-bin/activity_task_daily.fcgi? 开头的包,点击获取金币,看到任务应该就能捉到
APP捉包把整个URL放进去TxStockAppUrl,header转成JSON字符串之后放进去TxStockAppHeader
微信微证券公众号捉包后header转成JSON字符串之后放进去TxStockWxHeader
export TxStockAppUrl='https://wzq.ten....#https://wzq.ten....#https://wzq.ten....'
export TxStockAppHeader='{"Host":"...","Accept":"...",...}#{"Host":"...","Accept":"...",...}#{"Host":"...","Accept":"...",...}'
export TxStockWxHeader='{"Host":"...","Accept":"...",...}#{"Host":"...","Accept":"...",...}#{"Host":"...","Accept":"...",...}'
重写食用
TxStockAppUrl与TxStockAppHeader:打开APP,点击头像->右上角金币->获取金币
TxStockWxHeader:打开 腾讯自选股微信版|微证券 公众号,右下角好福利->福利中心
V2P:
重写: https://wzq.tenpay.com/cgi-bin/activity_task_daily.fcgi? https://raw.githubusercontent.com/leafxcy/JavaScript/main/txstock.js
MITM: wzq.tenpay.com
圈X:
[task_local]
#腾讯自选股
35 11,16 * * * https://raw.githubusercontent.com/leafxcy/JavaScript/main/txstock.js, tag=腾讯自选股, enabled=true
[rewrite_local]
#获取APP和微信微证券的URL和header
https://wzq.tenpay.com/cgi-bin/activity_task_daily.fcgi? url script-request-header https://raw.githubusercontent.com/leafxcy/JavaScript/main/txstock.js
[MITM]
hostname = wzq.tenpay.com
*/
const jsname = '腾讯自选股'
const $ = Env(jsname)
const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1
const notify = $.isNode() ? require('./sendNotify') : '';
let sessionTime = Math.round(new Date().getTime())
let rndtime = "" //毫秒
let todayDate = formatDateTime(new Date());
var cash = ($.isNode() ? (process.env.TxStockCash) : ($.getval('TxStockCash'))) || 5; //0为不自动提现,1为自动提现1元,5为自动提现5元
var help = ($.isNode() ? (process.env.TxStockHelp) : ($.getval('TxStockHelp'))) || 1; //0为不做分享助力任务,1为多用户互相分享助力
var newbie = ($.isNode() ? (process.env.TxStockNewbie) : ($.getval('TxStockNewbie'))) || 0; //0为不做新手任务,1为自动做新手任务
var helpOrder = ($.isNode() ? (process.env.TxStockHelpOrder) : ($.getval('TxStockHelpOrder'))) || "";
const appUrlArr = [];
let appUrlArrVal = "";
const appHeaderArr = [];
let appHeaderArrVal = "";
const wxHeaderArr = [];
let wxHeaderArrVal = "";
let rewardCoin = 0
let coinStart = []
let coinEnd = []
let coinInfo = ""
let notifyStr = ""
let numUser = 0
let totalUser = 0
let shareFlag = 0 //用户数多于1且打开助力开关,才会做助力任务
let helpUser = 0
let scanList = []
let nickname = []
let bullStatusFlag = 0
let guessOption = 0
let guessStockFlag = 0
let stockName = ''
let stockList = []
let marketCode = {'sz':0, 'sh':1, 'hk':2, }
let appShareFlag = 1
let wxShareFlag = 1
let appTaskFlag = 1
let wxTaskFlag = 1
let bullishFlag = 1
let bullHelpFlag = 0
//多用户情况下,可以控制每个用户帮助第几个用户,默认帮助上一个
let helpOrderArr = []
let logDebug = 0
let TEST_PRINT = 0
let userAppShareTaskList = {
"daily": ["news_share", "task_50_1111", "task_51_1111"/*, "task_72_1113", "task_74_1113"*/, ],
"newbie": [],
}
let userAppShareCodeArr = {
"daily": {},
"newbie": {},
"bull_invite": [],
"bull_help": [],
"guess_invite": [],
"guess_ticket": [],
"guess_time": [],
}
let userWxShareTaskList = {
"daily": ["task_50_1100", "task_51_1100", "task_66_1110", "task_50_1110", "task_51_1110", "task_51_1112", "task_51_1113", ],
"newbie": ["task_50_1032", "task_51_1032"],
}
let userWxShareCodeArr = {
"daily": {},
"newbie": {},
}
//APP任务
let appActidArray = {
"daily": [1101, 1103, 1104, 1105, 1109, 1111, 1112, 1113],
"newbie": [1023, 1033, ],
}
let appTaskArray = {
"daily": [],
"newbie": [],
}
//微信小程序任务
let wxActidArray = {
"daily": [1100, 1110, ],
"newbie": [1032, ],
}
let wxTaskArray = {
"daily": [],
"newbie": [],
}
//APP长牛任务
let bullTaskArray = {
"rock_bullish":{"taskName":"戳牛任务", "action":"rock_bullish", "actid":1105},
"open_box":{"taskName":"开宝箱", "action":"open_box", "actid":1105},
"open_blindbox":{"taskName":"开盲盒", "action":"open_blindbox", "actid":1105},
"query_blindbox":{"taskName":"查询皮肤数量", "action":"query_blindbox", "actid":1105},
"sell_skin":{"taskName":"卖皮肤", "action":"sell_skin", "actid":1105},
"feed":{"taskName":"喂长牛", "action":"feed", "actid":1105},
}
var TxStockAppUrl
var TxStockAppHeader
var TxStockWxHeader
///////////////////////////////////////////////////////////////////
!(async () => {
if(typeof $request !== "undefined")
{
await getRewrite()
}
else
{
//检查环境变量
if(!(await checkEnv())){
return
}
//初始化任务列表
await initTaskList()
//获取用户信息
await initAccountInfo()
//新手任务
await newbieTask()
for (numUser = 0; numUser < totalUser; numUser++)
{
await getEnvParam(numUser)
$.log(`\n======= 开始腾讯自选股用户${numUser+1} ${nickname[numUser]} 日常任务 =======\n`)
//await testFunction() //测试用,勿打开
await signStatus(2002,0); //签到
await $.wait(1000)
await appGuessStatus(); //猜涨跌和获取互助码
await $.wait(1000)
await dailyTask() //日常任务
await $.wait(1000)
await queryShareCode() //获取日常任务互助码
await $.wait(1000)
await bullTask() //长牛任务和获取互助码
await $.wait(1000)
$.log(`\n======= 结束腾讯自选股用户${numUser+1} ${nickname[numUser]} 日常任务 =======\n`)
}
await shareTask() //助力任务
await todayIncome()//收益查询,提现
await showmsg()
}
})()
.catch((e) => $.logErr(e))
.finally(() => $.done())
//测试用
async function testFunction() {
//扫描可查询的任务列表,
await scanAppTaskList(1000,2000,"task_daily","routine")
//await scanWxTaskList(1000,1400,"task_daily","routine") //每个大概花费86ms
}
//通知
async function showmsg() {
notifyBody = jsname + "运行通知\n\n" + notifyStr
if (notifyFlag != 1) {
console.log(notifyBody);
}
if (notifyFlag == 1) {
$.msg(notifyBody);
if ($.isNode()){await notify.sendNotify($.name, notifyBody );}
}
}
async function getRewrite()
{
if($request.url.indexOf("activity_task_daily.fcgi?") > -1 ||
$request.url.indexOf("activity_task_continue.fcgi?") > -1) {
if($request.url.indexOf("openid=") > -1)
{
//APP包
let msgStr = ''
$.setdata($request.url,'TxStockAppUrl')
$.log(`获取TxStockAppUrl成功: ${$request.url}\n`)
msgStr += `获取TxStockAppUrl成功: ${$request.url}\n`
$.setdata(JSON.stringify($request.headers),'TxStockAppHeader')
$.log(`获取TxStockAppHeader成功: ${JSON.stringify($request.headers)}\n`)
msgStr += `获取TxStockAppHeader成功: ${JSON.stringify($request.headers)}\n`
$.msg(msgStr)
}
else
{
//微信包
$.setdata(JSON.stringify($request.headers),'TxStockWxHeader')
$.log(`获取TxStockWxHeader成功: ${JSON.stringify($request.headers)}\n`)
$.msg(`获取TxStockAppHeader成功: ${JSON.stringify($request.headers)}\n`)
}
}
}
async function checkEnv()
{
if($.isNode())
{
TxStockAppUrl = process.env.TxStockAppUrl
TxStockAppHeader = process.env.TxStockAppHeader
TxStockWxHeader = process.env.TxStockWxHeader
}
else
{
TxStockAppUrl = $.getdata('TxStockAppUrl')
TxStockAppHeader = $.getdata('TxStockAppHeader')
TxStockWxHeader = $.getdata('TxStockWxHeader')
}
if(!TxStockAppUrl || !TxStockAppHeader || !TxStockWxHeader)
{
str1 = TxStockAppUrl ? "" : "TxStockAppUrl"
str2 = TxStockAppHeader ? "" : "TxStockAppHeader"
str3 = TxStockWxHeader ? "" : "TxStockWxHeader"
$.log(`未找到环境变量: ${str1} ${str2} ${str3}\n`)
return false
}
if (TxStockAppUrl.indexOf('#') > -1) {
appUrlArrs = TxStockAppUrl.split('#');
console.log(`您选择的是用"#"隔开TxStockAppUrl\n`)
} else if (TxStockAppUrl.indexOf('\n') > -1) {
appUrlArrs = TxStockAppUrl.split('\n');
console.log(`您选择的是用"\\n"隔开TxStockAppUrl\n`)
} else {
appUrlArrs = [TxStockAppUrl]
};
Object.keys(appUrlArrs).forEach((item) => {
if (appUrlArrs[item]) {
appUrlArr.push(appUrlArrs[item])
}
})
if (TxStockAppHeader.indexOf('#') > -1) {
appHeaderArrs = TxStockAppHeader.split('#');
console.log(`您选择的是用"#"隔开TxStockAppHeader\n`)
} else if (TxStockAppHeader.indexOf('\n') > -1) {
appHeaderArrs = TxStockAppHeader.split('\n');
console.log(`您选择的是用"\\n"隔开TxStockAppHeader\n`)
} else {
appHeaderArrs = [TxStockAppHeader]
};
Object.keys(appHeaderArrs).forEach((item) => {
if (appHeaderArrs[item]) {
appHeaderArr.push(appHeaderArrs[item])
}
})
if (TxStockWxHeader.indexOf('#') > -1) {
wxHeaderArrs = TxStockWxHeader.split('#');
console.log(`您选择的是用"#"隔开TxStockWxHeader\n`)
} else if (TxStockWxHeader.indexOf('\n') > -1) {
wxHeaderArrs = TxStockWxHeader.split('\n');
console.log(`您选择的是用"\\n"隔开TxStockWxHeader\n`)
} else {
wxHeaderArrs = [TxStockWxHeader]
};
Object.keys(wxHeaderArrs).forEach((item) => {
if (wxHeaderArrs[item]) {
wxHeaderArr.push(wxHeaderArrs[item])
}
})
if(helpOrder) {
if (helpOrder.indexOf('#') > -1) {
helpOrderArrs = helpOrder.split('#');
console.log(`您选择的是用"#"隔开TxStockHelpOrder\n`)
} else if (helpOrder.indexOf('@') > -1) {
helpOrderArrs = helpOrder.split('@');
console.log(`您选择的是用"@"隔开TxStockHelpOrder\n`)
} else {
helpOrderArrs = [helpOrder]
};
Object.keys(helpOrderArrs).forEach((item) => {
if (helpOrderArrs[item]) {
helpOrderArr.push(helpOrderArrs[item])
}
})
}
totalUser = appUrlArr.length
shareFlag = (help && totalUser > 1)
$.log(`共找到${totalUser}个用户\n`)
return true
}
async function getEnvParam(userNum)
{
appUrlArrVal = appUrlArr[userNum];
appHeaderArrVal = JSON.parse(appHeaderArr[userNum]);
wxHeaderArrVal = JSON.parse(wxHeaderArr[userNum]);
app_openid = appUrlArrVal.match(/&openid=([\w-]+)/)[1]
app_fskey = appUrlArrVal.match(/&fskey=([\w-]+)/)[1]
app_token = appUrlArrVal.match(/&access_token=([\w-]+)/)[1]
app_appName = appUrlArrVal.match(/&_appName=([\w\.,-]+)/)[1]
app_appver = appUrlArrVal.match(/&_appver=([\w\.,-]+)/)[1]
app_osVer = appUrlArrVal.match(/&_osVer=([\w\.,-]+)/)[1]
app_devId = appUrlArrVal.match(/&_devId=([\w-]+)/)[1]
app_ck = ""
app_UA = ""
Object.keys(appHeaderArrVal).forEach((item) => {
if(item.toLowerCase() == "cookie") {
//app_ck = appHeaderArrVal[item]
cookie = appHeaderArrVal[item]
pgv_info_ssid = cookie.match(/pgv_info=ssid=([\w]+)/)[1]
pgv_pvid = cookie.match(/pgv_pvid=([\w]+)/)[1]
ts_sid = cookie.match(/ts_sid=([\w]+)/)[1]
ts_uid = cookie.match(/ts_uid=([\w]+)/)[1]
} else if(item.toLowerCase() == "user-agent") {
app_UA = appHeaderArrVal[item]
}
})
app_ck = `pgv_info=ssid=${pgv_info_ssid}; pgv_pvid=${pgv_pvid}; ts_sid=${ts_sid}; ts_uid=${ts_uid}`
wx_ck_tmp = ""
wx_UA = ""
Object.keys(wxHeaderArrVal).forEach((item) => {
if(item.toLowerCase() == "cookie") {
wx_ck_tmp = wxHeaderArrVal[item]
} else if(item.toLowerCase() == "user-agent") {
wx_UA = wxHeaderArrVal[item]
}
})
pgv_info = wx_ck_tmp.match(/pgv_info=([\w=]+)/)[1]
pgv_pvid = wx_ck_tmp.match(/pgv_pvid=([\w]+)/)[1]
//ts_last = wx_ck_tmp.match(/ts_last=([\w\/]+)/)[1]
//ts_refer = wx_ck_tmp.match(/ts_refer=([\w\/\.]+)/)[1]
ts_sid = wx_ck_tmp.match(/ts_sid=([\w]+)/)[1]
ts_uid = wx_ck_tmp.match(/ts_uid=([\w]+)/)[1]
qlappid = wx_ck_tmp.match(/qlappid=([\w]+)/)[1]
qlskey = wx_ck_tmp.match(/qlskey=([\w]+)/)[1]
qluin = wx_ck_tmp.match(/qluin=([\w@\.]+)/)[1]
//qq_logtype = wx_ck_tmp.match(/qq_logtype=([\w]+)/)[1]
wzq_qlappid = wx_ck_tmp.match(/wzq_qlappid=([\w]+)/)[1]
wzq_qlskey = wx_ck_tmp.match(/wzq_qlskey=([\w]+)/)[1]
wzq_qluin = wx_ck_tmp.match(/wzq_qluin=([\w-]+)/)[1]
zxg_openid = wx_ck_tmp.match(/zxg_openid=([\w-]+)/)[1]
//wx_ck = `pgv_info=${pgv_info}; pgv_pvid=${pgv_pvid}; ts_last=${ts_last}; ts_refer=${ts_refer}; ts_sid=${ts_sid}; ts_uid=${ts_uid}; qlappid=${qlappid}; qlskey=${qlskey}; qluin=${qluin}; qq_logtype=${qq_logtype}; wx_session_time=${sessionTime}; wzq_qlappid=${wzq_qlappid}; wzq_qlskey=${wzq_qlskey}; wzq_qluin=${wzq_qluin}; zxg_openid=${zxg_openid}`
wx_ck = `pgv_info=${pgv_info}; pgv_pvid=${pgv_pvid}; ts_sid=${ts_sid}; ts_uid=${ts_uid}; qlappid=${qlappid}; qlskey=${qlskey}; qluin=${qluin}; wzq_qlappid=${wzq_qlappid}; wzq_qlskey=${wzq_qlskey}; wzq_qluin=${wzq_qluin}; zxg_openid=${zxg_openid}`
}
async function initAccountInfo()
{
for (numUser = 0; numUser < totalUser; numUser++)
{
await getEnvParam(numUser)
coinInfo = ""
await orderQuery(1,1,0,0); //获取用户名
coinStart.push(coinInfo)
await $.wait(500)
}
}
async function initTaskList()
{
$.log(`开始初始化任务列表\n`)
let taskItem = {}
for(let i=0; i<appActidArray["newbie"].length; i++){
taskItem = {"taskName":"APP新手任务","activity":"task_continue","type":"app_new_user","actid":appActidArray["newbie"][i]}
appTaskArray["newbie"].push(taskItem)
}
for(let i=0; i<appActidArray["daily"].length; i++){
taskItem = {"taskName":"APP日常任务","activity":"task_daily","type":"routine","actid":appActidArray["daily"][i]}
appTaskArray["daily"].push(taskItem)
}
for(let i=0; i<wxActidArray["newbie"].length; i++){
taskItem = {"taskName":"微信新手任务","activity":"task_continue","type":"wzq_welfare_growth","actid":wxActidArray["newbie"][i]}
wxTaskArray["newbie"].push(taskItem)
}
for(let i=0; i<wxActidArray["daily"].length; i++){
taskItem = {"taskName":"微信日常任务","activity":"task_daily","type":"routine","actid":wxActidArray["daily"][i]}
wxTaskArray["daily"].push(taskItem)
}
}
async function bullTask()
{
if(bullishFlag == 1) {
await bullStatus()
if(bullStatusFlag) {
await bullTaskDone(bullTaskArray["rock_bullish"])
for(let i=0; i<10; i++){
await bullTaskDone(bullTaskArray["open_box"])
await $.wait(5000)
}
await bullTaskDone(bullTaskArray["open_blindbox"])
await bullTaskDone(bullTaskArray["query_blindbox"])
await bullTaskDone(bullTaskArray["feed"])
}
}
}
async function dailyTask()
{
//APP端任务
if(appTaskFlag == 1) {
for(let i=0; i<appTaskArray["daily"].length; i++)
{
await appTaskList(appTaskArray["daily"][i]);
}
}
//微信端任务
if(wxTaskFlag == 1) {
for(let i=0; i<wxTaskArray["daily"].length; i++)
{
await wxTaskList(wxTaskArray["daily"][i]);
}
}
}
async function newbieTask()
{
if(newbie == 1) {
$.log(`\================= 开始新手任务 =================\n`)
for (numUser = 0; numUser < totalUser; numUser++)
{
await getEnvParam(numUser)
$.log(`\开始用户 ${nickname[numUser]} 新手任务:\n`)
for(let j=0; j<userAppShareTaskList["newbie"].length; j++)
{
await appShareTaskReq(userAppShareTaskList["newbie"][j],"newbie")
}
for(let j=0; j<userWxShareTaskList["newbie"].length; j++)
{
await wxShareTaskReq(userWxShareTaskList["newbie"][j],"newbie")
}
}
for (numUser = 0; numUser < totalUser; numUser++)
{
await getEnvParam(numUser)
await getHelpUser()
for(let j=0; j<userAppShareTaskList["newbie"].length; j++)
{
shareTaskName = userAppShareTaskList["newbie"][j]
if(userAppShareCodeArr["newbie"][shareTaskName]) {
await wxShareTaskDone(shareTaskName,userAppShareCodeArr["newbie"][shareTaskName][helpUser])
}
}
for(let j=0; j<userWxShareTaskList["newbie"].length; j++)
{
shareTaskName = userWxShareTaskList["newbie"][j]
if(userWxShareCodeArr["newbie"][shareTaskName]) {
await wxShareTaskDone(shareTaskName,userWxShareCodeArr["newbie"][shareTaskName][helpUser])
}
}
}
for (numUser = 0; numUser < totalUser; numUser++)
{
await getEnvParam(numUser)
for(let i=0; i<appTaskArray["newbie"].length; i++)
{
await appTaskList(appTaskArray["newbie"][i]);
}
}
$.log(`\================= 结束新手任务 =================\n`)
}
}
async function queryShareCode()
{
if(shareFlag == 1) {
$.log(`\n开始获取用户 ${nickname[numUser]} 日常任务互助码:\n`)
if(appShareFlag == 1) {
for(let j=0; j<userAppShareTaskList["daily"].length; j++)
{
await appShareTaskReq(userAppShareTaskList["daily"][j],"daily")
}
}
if(wxShareFlag == 1) {
for(let j=0; j<userWxShareTaskList["daily"].length; j++)
{
await wxShareTaskReq(userWxShareTaskList["daily"][j],"daily")
}
}
}
}
async function getHelpUser()
{
if(helpOrderArr[numUser] || helpOrderArr[numUser] == 0) {
helpUser = helpOrderArr[numUser] - 1
} else {
//循环帮助
helpUser = ((numUser-1) <0) ? (totalUser-1) : (numUser-1)
}
}
async function shareTask()
{
if(shareFlag == 1) {
$.log(`\n================= 开始分享任务 =================\n`)
for (numUser = 0; numUser < totalUser; numUser++)
{
await getEnvParam(numUser)
await getHelpUser()
if(helpUser >= 0) {
$.log(`\n======= 用户${numUser+1} ${nickname[numUser]} 开始帮助 用户${helpUser+1} ${nickname[helpUser]} =======\n`)
//长牛互助,同一用户只能相互助力3次,默认不跑
if(bullHelpFlag == 1) {
if(userAppShareCodeArr["bull_invite"][helpUser]&& userAppShareCodeArr["bull_help"][helpUser])
{
await bullInvite(userAppShareCodeArr["bull_invite"][helpUser],userAppShareCodeArr["bull_help"][helpUser])
}
}
//猜涨跌分享
if(userAppShareCodeArr["guess_invite"][helpUser] && userAppShareCodeArr["guess_ticket"][helpUser] && userAppShareCodeArr["guess_time"][helpUser])
{
await wxGuessHelp(userAppShareCodeArr["guess_invite"][helpUser],userAppShareCodeArr["guess_ticket"][helpUser],userAppShareCodeArr["guess_time"][helpUser]);
}
//APP助力任务
if(appShareFlag == 1) {
for(let j=0; j<userAppShareTaskList["daily"].length; j++)
{
shareTaskName = userAppShareTaskList["daily"][j]
if(userAppShareCodeArr["daily"][shareTaskName] && userAppShareCodeArr["daily"][shareTaskName][helpUser]) {
await wxShareTaskDone(shareTaskName,userAppShareCodeArr["daily"][shareTaskName][helpUser])
}
}
}
//微信助力任务
if(wxShareFlag == 1) {
for(let j=0; j<userWxShareTaskList["daily"].length; j++)
{
shareTaskName = userWxShareTaskList["daily"][j]
if(userWxShareCodeArr["daily"][shareTaskName] && userWxShareCodeArr["daily"][shareTaskName][helpUser]) {
await wxShareTaskDone(shareTaskName,userWxShareCodeArr["daily"][shareTaskName][helpUser])
}
}
}
$.log(`\n======= 用户 ${nickname[numUser]} 结束助力 =======\n`)
}
}
$.log(`\n================= 结束分享任务 =================\n`)
}
}
async function todayIncome()
{
for (numUser = 0; numUser < totalUser; numUser++)
{
await getEnvParam(numUser)
coinInfo = ""
await orderQuery(0,1,1,1)
coinEnd.push(coinInfo)
if(coinEnd[numUser] && coinStart[numUser])
{
rewardCoin = coinEnd[numUser] - coinStart[numUser];
$.log(`用户:${nickname[numUser]},本次运行获得${rewardCoin}金币\n\n`)
notifyStr += `用户:${nickname[numUser]},本次运行获得${rewardCoin}金币\n\n`
}
await $.wait(200)
}
}
//扫描可查询的APP任务列表
async function scanAppTaskList(actidStart,actidEnd,activity,type) {
console.log(`开始查询APP任务列表, activity=${activity}, type=${type}, from ${actidStart} to ${actidEnd}`)
for(let i=actidStart; i<actidEnd; i++){
titem = {"taskName":`扫描任务${i}`,"activity":activity,"type":type,"actid":i}
await appTaskListQuery(titem);
await $.wait(100)
}
console.log(`查询结束,得到列表:`)
console.log(scanList)
}
//扫描可查询的微信任务列表
async function scanWxTaskList(actidStart,actidEnd,activity,type) {
console.log(`开始查询微信任务列表, activity=${activity}, type=${type}, from ${actidStart} to ${actidEnd}`)
for(let i=actidStart; i<actidEnd; i++){
titem = {"taskName":`扫描任务${i}`,"activity":activity,"type":type,"actid":i}
await wxTaskListQuery(titem);
await $.wait(20)
}
console.log(`查询结束,得到列表:`)
console.log(scanList)
}
///////////////////////////////////////////////////////////////////
//签到信息查询
//signType -- 0: 签到, 1: 连续签到奖励
async function signStatus(actid,signType) {
rndtime = Math.round(new Date().getTime())
return new Promise((resolve) => {
let signurl = {
url: `https://wzq.tenpay.com/cgi-bin/activity_sign_task.fcgi?actid=${actid}&channel=1&type=welfare_sign&action=home&_=${rndtime}&openid=${app_openid}&fskey=${app_fskey}&access_token=${app_token}&_appName=${app_appName}&_appver=${app_appver}&_osVer=${app_osVer}&_devId=${app_devId}`,
headers: {
'Cookie': app_ck,
'Accept': `application/json, text/plain, */*`,
'Connection': `keep-alive`,
'Referer': `https://wzq.tenpay.com/activity/page/welwareCenter/`,
'Accept-Encoding': `gzip, deflate, br`,
'Host': `wzq.tenpay.com`,
'User-Agent': app_UA,
'Accept-Language': `zh-cn`
},
};
$.get(signurl, async (err, resp, data) => {
try {
if (err) {
console.log("腾讯自选股: API查询请求失败 ‼️‼️");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if(logDebug) console.log(result);
if (result.retcode == 0) {
if(!result.forbidden_code) {
if(signType == 0){
for(let i=0; i<result.task_pkg.tasks.length; i++){
resultItem = result.task_pkg.tasks[i]
if(resultItem.date == todayDate){
if(resultItem.status == 0){
//今天未签到,去签到
await $.wait(200);
await signtask(actid);
} else {
//今天已签到
$.log(`用户 ${nickname[numUser]} 今天已签到\n`);
}
}
}
} else if(signType == 1) {
$.log(`用户 ${nickname[numUser]} 已连续签到${result.task_pkg.continue_sign_days}天,总签到天数${result.task_pkg.total_sign_days}天\n`);
if(result.lotto_chance == 1 && result.lotto_ticket) {
await $.wait(200);
await sign7daysAward(actid,result.lotto_ticket);
}
}
} else {
console.log(`用户 ${nickname[numUser]} 查询签到信息失败,可能已黑号:${result.forbidden_reason}\n`)
}
} else {
console.log(`用户 ${nickname[numUser]} 查询签到信息失败:${result.retmsg}`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//签到
async function signtask(actid) {
rndtime = Math.round(new Date().getTime())
return new Promise((resolve) => {
let signurl = {
url: `https://wzq.tenpay.com/cgi-bin/activity_sign_task.fcgi?actid=${actid}&channel=1&action=signdone&date=${todayDate}&_=${rndtime}&openid=${app_openid}&fskey=${app_fskey}&access_token=${app_token}&_appName=${app_appName}&_appver=${app_appver}&_osVer=${app_osVer}&_devId=${app_devId}`,
headers: {
'Cookie': app_ck,
'Accept': `application/json, text/plain, */*`,
'Connection': `keep-alive`,
'Referer': `https://wzq.tenpay.com/activity/page/welwareCenter/`,
'Accept-Encoding': `gzip, deflate, br`,
'Host': `wzq.tenpay.com`,
'User-Agent': app_UA,
'Accept-Language': `zh-cn`
},
};
$.get(signurl, async (err, resp, data) => {
try {
if (err) {
console.log("腾讯自选股: API查询请求失败 ‼️‼️");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if (result.retcode == 0) {
$.log(`签到获得 ${result.reward_desc}\n`);
$.log(`签到时间:${time(rndtime)}\n`);
await $.wait(5000); //等待5秒
} else {
$.log(`签到失败:${result.retmsg}`)
}
await signStatus(actid,1)
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//连续签到奖励
async function sign7daysAward(actid,lotto_ticket) {
rndtime = Math.round(new Date().getTime())
return new Promise((resolve) => {
let signurl = {
url: `https://wzq.tenpay.com/cgi-bin/activity_sign_task.fcgi?actid=${actid}&action=award&reward_ticket=${lotto_ticket}&_=${rndtime}&openid=${app_openid}&fskey=${app_fskey}&channel=1&access_token=${app_token}&_appName=${app_appName}&_appver=${app_appver}&_osVer=${app_osVer}&_devId=${app_devId}`,
headers: {
'Cookie': app_ck,
'Accept': `application/json, text/plain, */*`,
'Connection': `keep-alive`,
'Referer': `https://wzq.tenpay.com/activity/page/welwareCenter/`,
'Accept-Encoding': `gzip, deflate, br`,
'Host': `wzq.tenpay.com`,
'User-Agent': app_UA,
'Accept-Language': `zh-cn`
},
};
$.get(signurl, async (err, resp, data) => {
try {
if (err) {
console.log("腾讯自选股: API查询请求失败 ‼️‼️");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if (result.retcode == 0) {
$.log(`获得连续签到奖励: ${result.reward_desc}\n`);
} else {
$.log(`领取连续签到奖励失败:${result.retmsg}`)
}
await $.wait(1000);
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//新手任务奖励
async function appNewbieAward(actid,ticket) {
return new Promise((resolve, reject) => {
let testurl = {
url: `https://wzq.tenpay.com/cgi-bin/activity_task.fcgi?action=award&channel=1&actid=${actid}&reward_ticket=${ticket}&openid=${app_openid}&fskey=${app_fskey}&channel=1&access_token=${app_token}&_appName=${app_appName}&_appver=${app_appver}&_osVer=${app_osVer}&_devId=${app_devId}`,
headers: {
'Cookie': app_ck,
'Accept': `*/*`,
'Connection': `keep-alive`,
'Referer': `http://zixuanguapp.finance.qq.com`,
'Accept-Encoding': `gzip,deflate`,
'Host': `wzq.tenpay.com`,
'User-Agent': app_UA,
'Accept-Language': `zh-Hans-CN;q=1, en-CN;q=0.9`
},
}
$.get(testurl, async (err, resp, data) => {
try {
if (err) {
console.log("腾讯自选股: API查询请求失败 ‼️‼️");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data)
if(logDebug) console.log(result)
if(result.retcode == 0){
$.log(`获得新手任务[actid:${actid}]阶段奖励: ${result.reward_desc}\n`);
await $.wait(1000); //等待10秒
} else {
$.log(`新手任务[actid:${actid}]阶段未完成:${result.retmsg}\n`);
await $.wait(100);
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
})
})
}
//APP任务列表查询
async function appTaskListQuery(taskItem) {
rndtime = Math.round(new Date().getTime())
return new Promise((resolve) => {
let url = {
url: `https://wzq.tenpay.com/cgi-bin/activity_${taskItem.activity}.fcgi?action=home&type=${taskItem.type}&actid=${taskItem.actid}&channel=1&invite_code=&_=${rndtime}&openid=${app_openid}&fskey=${app_fskey}&channel=1&access_token=${app_token}&_appName=${app_appName}&_appver=${app_appver}&_osVer=${app_osVer}&_devId=${app_devId}`,
headers: {
'Cookie': app_ck,
'Accept': `application/json, text/plain, */*`,
'Connection': `keep-alive`,
'Referer': `https://wzq.tenpay.com/activity/page/welwareCenter/`,
'Accept-Encoding': `gzip, deflate, br`,
'Host': `wzq.tenpay.com`,
'User-Agent': app_UA,
'Accept-Language': `zh-cn`
},
};
$.get(url, async (err, resp, data) => {
try {
if (err) {
console.log("腾讯自选股: API查询请求失败 ‼️‼️");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if (result.retcode == 0) {
if(result.task_pkg && result.task_pkg.length > 0){
scanList.push(taskItem.actid)
if(TEST_PRINT == 1) {
if(logDebug) console.log(result)
console.log(`===================== actid=${taskItem.actid} start ======================`)
for(let i=0; i<result.task_pkg[0].tasks.length; i++){
resultItem = result.task_pkg[0].tasks[i]
console.log(resultItem)
}
}
}
} else {
//console.log(`${taskItem.taskName}查询失败:${result.retmsg}`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//APP任务列表
async function appTaskList(taskItem) {
rndtime = Math.round(new Date().getTime())
return new Promise((resolve) => {
let url = {
url: `https://wzq.tenpay.com/cgi-bin/activity_${taskItem.activity}.fcgi?action=home&type=${taskItem.type}&actid=${taskItem.actid}&invite_code=&_=${rndtime}&openid=${app_openid}&fskey=${app_fskey}&channel=1&access_token=${app_token}&_appName=${app_appName}&_appver=${app_appver}&_osVer=${app_osVer}&_devId=${app_devId}`,
headers: {
'Cookie': app_ck,
'Accept': `application/json, text/plain, */*`,
'Connection': `keep-alive`,
'Referer': `https://wzq.tenpay.com/activity/page/welwareCenter/`,
'Accept-Encoding': `gzip, deflate, br`,
'Host': `wzq.tenpay.com`,
'User-Agent': app_UA,
'Accept-Language': `zh-cn`
},
};
$.get(url, async (err, resp, data) => {
try {
if (err) {
console.log("腾讯自选股: API查询请求失败 ‼️‼️");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if(logDebug) console.log(result)
if (result.retcode == 0) {
if(result.task_pkg != null){
let numPkg = result.task_pkg.length
for(let i=0; i<numPkg; i++){
//console.log(result.task_pkg[i])
if(result.task_pkg[i].lotto_ticket) {
//可领取新手奖励
await appNewbieAward(taskItem.actid,result.task_pkg[i].lotto_ticket)
continue
}
if(result.task_pkg[i].reward_type > 0) {
//已领取过新手奖励
continue
}
if(result.task_pkg[i].tasks && result.task_pkg[i].tasks[0]) {
let numTask = result.task_pkg[i].tasks.length
for(let j=0; j<numTask; j++){
resultItem = result.task_pkg[i].tasks[j]
//console.log(resultItem)
task_id = resultItem.id
task_tid = resultItem.tid
await appTaskStatus(taskItem,task_id,task_tid);
}
}
}
}
} else {
console.log(`${taskItem.taskName}[actid=${taskItem.actid}]查询失败:${result.retmsg}`)
}
}
}