-
Notifications
You must be signed in to change notification settings - Fork 0
/
txstockqx_leaf.js
1369 lines (1288 loc) · 43.9 KB
/
txstockqx_leaf.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&微信小程序
改自@CenBoMin大佬的脚本
重写: https://wzq.tenpay.com/cgi-bin/activity_task_daily.fcgi? txstockqx_leaf.js
MITM: wzq.tenpay.com
重写食用
TxStockAppUrl与TxStockAppHeader:打开APP,点击头像->右上角金币->获取金币
TxStockWxHeader:打开小程序,我的->猜涨跌->下方兑换->获取金币
*/
const jsname = '腾讯自选股'
const $ = Env(jsname)
const logs = 0; //0为关闭日志,1为开启,默认为0
const notifyInterval = 1; //0为关闭通知,1为所有通知,默认为0
let rndtime = Math.round(new Date().getTime()) //毫秒
let signday = formatDateTime(new Date());
var cash = $.getval('cash') || 5; //0为不自动提现,1为自动提现1元,5为自动提现5元,
const appUrlArr = [];
let appUrlArrVal = "";
const appHeaderArr = [];
let appHeaderArrVal = "";
const wxHeaderArr = [];
let wxHeaderArrVal = "";
let coinInfo = 0
let i = 0
let j = 0
let k = 0
let NOT_PRINT = 0
let PRINT = 1
let scanList = []
//APP任务
let appDailyArray = [1100, 1101, 1103, 1104, 1105, 1109, 1110, 1111, 1112, 1113];
let appNewbieArray = [1030];
let appBullArray = [1105];
let appTaskArray = [];
//微信小程序任务
let wxDailyArray = [1100, 1101, 1103, 1104, 1105, 1109, 1110, 1111, 1112, 1113];
let wxNewbieArray = [1031];
let wxBullArray = [1106];
let wxTaskArray = [];
var TxStockAppUrl
var TxStockAppHeader
var TxStockWxHeader
///////////////////////////////////////////////////////////////////
!(async () => {
if(typeof $request !== "undefined")
{
if($request.url.indexOf("activity_task_daily.fcgi?") > -1) {
if($request.url.indexOf("openid=") > -1)
{
//APP包
$.setdata($request.url,'TxStockAppUrl')
$.log(`获取TxStockAppUrl成功: ${$request.url}\n`)
$.setdata(JSON.stringify($request.headers),'TxStockAppHeader')
$.log(`获取TxStockAppHeader成功: ${JSON.stringify($request.headers)}\n`)
}
else
{
//微信包
$.setdata(JSON.stringify($request.headers),'TxStockWxHeader')
$.log(`获取TxStockWxHeader成功: ${JSON.stringify($request.headers)}\n`)
}
}
}
else
{
await Jsname()
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)
{
if (TxStockAppUrl.indexOf('#') > -1) {
appUrlArrs = TxStockAppUrl.split('#');
console.log(`您选择的是用"#"隔开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 {
appHeaderArrs = [TxStockAppHeader]
};
Object.keys(appHeaderArrs).forEach((item) => {
if (appHeaderArrs[item]) {
appHeaderArr.push(appHeaderArrs[item])
}
})
}
else
{
$.log("未找到环境变量 TxStockAppUrl或TxStockAppHeader。无法做APP任务,签到和提现\n")
}
if(TxStockWxHeader)
{
if (TxStockWxHeader.indexOf('#') > -1) {
wxHeaderArrs = TxStockWxHeader.split('#');
console.log(`您选择的是用"#"隔开TxStockWxHeader\n`)
} else {
wxHeaderArrs = [TxStockWxHeader]
};
Object.keys(wxHeaderArrs).forEach((item) => {
if (wxHeaderArrs[item]) {
wxHeaderArr.push(wxHeaderArrs[item])
}
})
}
else
{
$.log("未找到环境变量 TxStockWxHeader,无法做微信小程序任务\n")
}
await initTaskList()
for (let numUser = 0; numUser < appUrlArr.length; numUser++)
{
await getEnvParam(numUser)
$.log(`\n======= 开始腾讯自选股账号 ${numUser+1} =======\n`)
//扫描可查询的任务列表,
//await scanAppTaskList(1000,1400,"task_daily","routine",NOT_PRINT)
//await scanWxTaskList(1000,1400,"task_daily","routine",NOT_PRINT) //每个大概花费86ms
if(TxStockAppUrl && TxStockAppHeader)
{
await userhome(); //金币查询
coinStart = coinInfo
await signStatus()
for(j=0; j<appTaskArray.length; j++)
{
await appTaskList(appTaskArray[j]);
}
}
if(TxStockWxHeader)
{
for(j=0; j<wxTaskArray.length; j++)
{
await wxTaskList(wxTaskArray[j]);
}
}
if(TxStockAppUrl && TxStockAppHeader)
{
await userhome(); //第二次金币查询
coinEnd = coinInfo
rewardCoin = coinStart - coinEnd;
$.log(`本次运行获得${rewardCoin}金币\n`)
if(cash != 0)
{
await orderQuery()
}
}
$.log(`\n======= 结束腾讯自选股账号 ${numUser+1} =======\n`)
}
//暂时不支持多用户
await getEnvParam(0)
//扫描可查询的任务列表,
//await scanAppTaskList(1000,1400,"task_daily","routine",NOT_PRINT)
//await scanWxTaskList(1000,1400,"task_daily","routine",NOT_PRINT) //每个大概花费86ms
if(TxStockAppUrl && TxStockAppHeader)
{
await userhome(); //金币查询
coinStart = coinInfo
await signStatus()
for(j=0; j<appTaskArray.length; j++)
{
await appTaskList(appTaskArray[j]);
}
}
if(TxStockWxHeader)
{
for(j=0; j<wxTaskArray.length; j++)
{
await wxTaskList(wxTaskArray[j]);
}
}
if(TxStockAppUrl && TxStockAppHeader)
{
await userhome(); //第二次金币查询
coinEnd = coinInfo
rewardCoin = coinStart - coinEnd;
$.log(`本次运行获得${rewardCoin}金币\n`)
if(cash != 0)
{
await orderQuery()
}
}
}
})()
.catch((e) => $.logErr(e))
.finally(() => $.done())
function getEnvParam(userNum)
{
if(TxStockAppUrl && TxStockAppHeader)
{
appUrlArrVal = appUrlArr[userNum];
appHeaderArrVal = JSON.parse(appHeaderArr[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 = appHeaderArrVal["Cookie"]
app_UA = appHeaderArrVal["User-Agent"]
}
if(TxStockWxHeader)
{
wxHeaderArrVal = JSON.parse(wxHeaderArr[userNum]);
wx_ck = wxHeaderArrVal["Cookie"]
wx_UA = wxHeaderArrVal["User-Agent"]
}
}
function initTaskList() {
$.log(`开始初始化任务列表\n`)
let taskItem = {}
//默认不做新手任务
/*
for(i=0; i<appNewbieArray.length; i++){
taskItem = {"taskName":"APP新手任务","activity":"task_continue","type":"app_new_user","actid":appNewbieArray[i]}
appTaskArray.push(taskItem)
}
*/
//todo: 长牛任务
/*
for(i=0; i<appBullArray.length; i++){
taskItem = {"taskName":"APP长牛任务","activity":"year_party","type":"bullish","actid":appBullArray[i]}
appTaskArray.push(taskItem)
}
*/
for(i=0; i<appDailyArray.length; i++){
taskItem = {"taskName":"APP日常任务","activity":"task_daily","type":"routine","actid":appDailyArray[i]}
appTaskArray.push(taskItem)
}
//默认不做新手任务
/*
for(i=0; i<wxNewbieArray.length; i++){
taskItem = {"taskName":"微信新手任务","activity":"task_continue","type":"wzq_welfare_growth","actid":wxNewbieArray[i]}
wxTaskArray.push(taskItem)
}
*/
//todo: 长牛任务
/*
for(i=0; i<wxBullArray.length; i++){
taskItem = {"taskName":"微信长牛任务","activity":"year_party","type":"bullish","actid":wxBullArray[i]}
wxTaskArray.push(taskItem)
}
*/
for(i=0; i<wxDailyArray.length; i++){
taskItem = {"taskName":"微信日常任务","activity":"task_daily","type":"routine","actid":wxDailyArray[i]}
wxTaskArray.push(taskItem)
}
}
//扫描可查询的APP任务列表
async function scanAppTaskList(actidStart,actidEnd,activity,type,debugPrint) {
console.log(`开始查询APP任务列表, activity=${activity}, type=${type}, from ${actidStart} to ${actidEnd}`)
for(i=actidStart; i<actidEnd; i++){
titem = {"taskName":`扫描任务${i}`,"activity":activity,"type":type,"actid":i}
await appTaskListQuery(titem,debugPrint);
await $.wait(100)
}
console.log(`查询结束,得到列表:`)
console.log(scanList)
}
//扫描可查询的微信任务列表
async function scanWxTaskList(actidStart,actidEnd,activity,type,debugPrint) {
console.log(`开始查询微信任务列表, activity=${activity}, type=${type}, from ${actidStart} to ${actidEnd}`)
for(i=actidStart; i<actidEnd; i++){
titem = {"taskName":`扫描任务${i}`,"activity":activity,"type":type,"actid":i}
await wxTaskListQuery(titem,debugPrint);
await $.wait(20)
}
console.log(`查询结束,得到列表:`)
console.log(scanList)
}
///////////////////////////////////////////////////////////////////
//签到信息查询
async function signStatus() {
return new Promise((resolve) => {
let signurl = {
url: `https://wzq.tenpay.com/cgi-bin/activity_sign_task.fcgi?actid=2002&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)) {
data = JSON.parse(data);
//console.log(data);
if (data.retcode == 0) {
$.log(`已连续签到${data.task_pkg.continue_sign_days}天,总签到天数${data.task_pkg.total_sign_days}天\n`);
for(i=0; i<data.task_pkg.tasks.length; i++){
resultItem = data.task_pkg.tasks[i]
if(resultItem.date == signday){
if(resultItem.status == 0){
//今天未签到,去签到
await $.wait(200);
await signtask();
} else {
//今天已签到
$.log(`签到:今天已签到\n`);
}
}
}
} else {
console.log(`任务完成失败,错误信息:${JSON.stringify(data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//签到
async function signtask() {
return new Promise((resolve) => {
let signurl = {
url: `https://wzq.tenpay.com/cgi-bin/activity_sign_task.fcgi?actid=2002&channel=1&action=signdone&date=${signday}&_=${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)) {
data = JSON.parse(data);
if (data.retcode == 0) {
$.log(`签到:获得 ${data.reward_desc}\n`);
$.log(`签到时间:${time(rndtime)}\n`);
await $.wait(5000); //等待5秒
} else {
console.log(`任务完成失败,错误信息:${JSON.stringify(data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//APP任务列表
async function appTaskList(taskItem) {
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)) {
data = JSON.parse(data);
//console.log(data)
if (data.retcode == 0) {
if(data.task_pkg != null && data.task_pkg.length > 0){
for(i=0; i<data.task_pkg[0].tasks.length; i++){
resultItem = data.task_pkg[0].tasks[i]
//console.log(resultItem)
task_id = resultItem.id
task_tid = resultItem.tid
if(resultItem.status == 0)
{
await appTaskticket(taskItem); //申请票据
await appTaskDone(taskItem,ticket,task_id,task_tid);
} else {
$.log(`${taskItem.taskName}[actid:${taskItem.actid},id:${task_id},tid:${task_tid}]已完成\n`);
await $.wait(100);
}
}
}
} else {
console.log(`${taskItem.taskName}查询失败,错误信息:${JSON.stringify(data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//APP票据申请
function appTaskticket(taskItem) {
return new Promise((resolve, reject) => {
let testurl = {
url: `https://wzq.tenpay.com/cgi-bin/activity_task.fcgi?action=taskticket&channel=1&actid=${taskItem.actid}&_rndtime=${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': `*/*`,
'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 (error, resp, data) => {
let test2 = JSON.parse(data)
ticket = test2.task_ticket
resolve()
})
})
}
//APP任务列表查询
async function appTaskListQuery(taskItem,printDebug=0) {
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)) {
data = JSON.parse(data);
if (data.retcode == 0) {
if(data.task_pkg != null && data.task_pkg.length > 0){
scanList.push(taskItem.actid)
if(printDebug) {
//console.log(data)
console.log(`===================== actid=${taskItem.actid} start ======================`)
for(i=0; i<data.task_pkg[0].tasks.length; i++){
resultItem = data.task_pkg[0].tasks[i]
console.log(resultItem)
}
console.log(`===================== actid=${taskItem.actid} end ======================`)
}
}
} else {
//console.log(`${taskItem.taskName}查询失败,错误信息:${JSON.stringify(data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//APP任务状态
function appTaskStatus(actid,task_id,task_tid) {
return new Promise((resolve, reject) => {
let testurl = {
url: `https://wzq.tenpay.com/cgi-bin/activity_task.fcgi?id=${task_id}&tid=${task_tid}&actid=${actid}&channel=1&action=taskstatus&_rndtime=${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': `*/*`,
'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 (error, resp, data) => {
let task = JSON.parse(data)
console.log(task)
resolve()
})
})
}
//做APP任务
function appTaskDone(taskItem,ticket,task_id,task_tid) {
return new Promise((resolve, reject) => {
let testurl = {
url: `https://wzq.tenpay.com/cgi-bin/activity_task.fcgi?action=taskdone&channel=1&actid=${taskItem.actid}&id=${task_id}&tid=${task_tid}&task_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 (error, resp, data) => {
let task = JSON.parse(data)
//console.log(task)
if(task.retcode == 0){
$.log(`完成${taskItem.taskName}[actid:${taskItem.actid},id:${task_id},tid:${task_tid}]:获得 ${task.reward_desc}\n`);
await $.wait(10000); //等待10秒
} else {
$.log(`${taskItem.taskName}[actid:${taskItem.actid},id:${task_id},tid:${task_tid}]未完成:${task.retmsg}\n`);
await $.wait(100);
}
resolve()
})
})
}
//WX任务列表
async function wxTaskList(taskItem) {
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}`,
headers: {
'Cookie': wx_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': wx_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)) {
data = JSON.parse(data);
//console.log(data)
if (data.retcode == 0) {
if(data.task_pkg != null && data.task_pkg.length > 0){
for(i=0; i<data.task_pkg[0].tasks.length; i++){
resultItem = data.task_pkg[0].tasks[i]
//console.log(resultItem)
task_id = resultItem.id
task_tid = resultItem.tid
if(resultItem.status == 0){
await wxtaskticket(taskItem); //申请票据
await wxTaskDone(taskItem,wxticket,task_id,task_tid);
} else {
$.log(`${taskItem.taskName}[actid:${taskItem.actid},id:${task_id},tid:${task_tid}]已完成\n`);
await $.wait(100);
}
}
}
} else {
console.log(`${taskItem.taskName}查询失败,错误信息:${JSON.stringify(data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//WX票据申请
function wxtaskticket(taskItem) {
return new Promise((resolve) => {
let url = {
url: `https://wzq.tenpay.com/cgi-bin/activity_task.fcgi?t=${rndtime}`,
body: `_h5ver=2.0.1&actid=${taskItem.actid}&action=taskticket`,
headers: {
'Accept': `application/json, text/plain, */*`,
'Origin': `https://wzq.tenpay.com`,
'Accept-Encoding': `gzip, deflate, br`,
'Cookie': wx_ck,
'Content-Type': `application/x-www-form-urlencoded`,
'Host': `wzq.tenpay.com`,
'Connection': `keep-alive`,
'User-Agent': wx_UA,
'Referer': `https://wzq.tenpay.com/mp/v2/index.html`,
'Accept-Language': `zh-cn`
},
};
$.post(url, async (err, resp, data) => {
try {
if (err) {
console.log("腾讯自选股: API查询请求失败 ‼️‼️");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
data = JSON.parse(data);
wxticket = data.task_ticket
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//微信任务列表查询
async function wxTaskListQuery(taskItem,printDebug=0) {
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}`,
headers: {
'Cookie': wx_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': wx_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)) {
data = JSON.parse(data);
if (data.retcode == 0) {
if(data.task_pkg != null && data.task_pkg.length > 0){
scanList.push(taskItem.actid)
if(printDebug) {
//console.log(data)
console.log(`===================== actid=${taskItem.actid} start ======================`)
for(i=0; i<data.task_pkg[0].tasks.length; i++){
resultItem = data.task_pkg[0].tasks[i]
console.log(resultItem)
}
console.log(`===================== actid=${taskItem.actid} end ======================`)
}
}
} else {
console.log(`${taskItem.taskName}查询失败,错误信息:${JSON.stringify(data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//做WX任务
function wxTaskDone(taskItem,wxticket,task_id,task_tid) {
return new Promise((resolve, reject) => {
let url = {
url: `https://wzq.tenpay.com/cgi-bin/activity_task.fcgi?t=${rndtime}`,
body: `_h5ver=2.0.1&actid=${taskItem.actid}&tid=${task_tid}&id=${task_id}&task_ticket=${wxticket}&action=taskdone`,
headers: {
'Accept': `application/json, text/plain, */*`,
'Origin': `https://wzq.tenpay.com`,
'Accept-Encoding': `gzip, deflate, br`,
'Cookie': wx_ck,
'Content-Type': `application/x-www-form-urlencoded`,
'Host': `wzq.tenpay.com`,
'Connection': `keep-alive`,
'User-Agent': wx_UA,
'Referer': `https://wzq.tenpay.com/mp/v2/index.html`,
'Accept-Language': `zh-cn`
},
};
$.post(url, async (error, resp, data) => {
let task = JSON.parse(data)
//console.log(task)
if(task.retcode == 0){
$.log(`完成${taskItem.taskName}[actid:${taskItem.actid},id:${task_id},tid:${task_tid}]:获得 ${task.reward_desc}\n`);
await $.wait(10000); //等待10秒
} else {
$.log(`${taskItem.taskName}[actid:${taskItem.actid},id:${task_id},tid:${task_tid}]未完成:${task.retmsg}\n`);
await $.wait(100);
}
resolve()
})
})
}
//提现查询
function orderQuery() {
return new Promise((resolve, reject) => {
let testurl = {
url: `https://zqact03.tenpay.com/cgi-bin/shop.fcgi?action=home_v2&type=2&channel=1&_=${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': `*/*`,
'Connection': `keep-alive`,
'Referer': `https://zqact03.tenpay.com/activity/page/exchangeRights/`,
'Accept-Encoding': `gzip, deflate, br`,
'Host': `zqact03.tenpay.com`,
'User-Agent': app_UA,
'Accept-Language': `zh-CN,zh-Hans;q=0.9`
},
}
$.get(testurl, async (error, resp, data) => {
let result = JSON.parse(data)
//console.log(result)
if(result.retcode == 0){
if(result.cash != null && result.cash.length > 0){
let cashStr = `${cash}元现金`
for(k=0; k<result.cash.length; k++){
cashItem = result.cash[k]
//console.log(cashItem)
if(cashItem.item_desc == cashStr){
$.log(`提现${cashItem.item_desc},需要${cashItem.coins}金币\n`);
if(coinInfo-cashItem.coins >= 0){
$.log(`账户金币余额多于${cashItem.coins},开始提现\n`);
await cashticket()
await getcash(cashticket,cashItem.item_id)
} else {
$.log(`账户金币余额少于${cashItem.coins}\n`);
}
}
}
}
} else {
$.log(`提现列表获取失败:${task.retmsg}\n`);
}
resolve()
})
})
}
//提现票据
function cashticket() {
return new Promise((resolve) => {
let url = {
url: `https://zqact.tenpay.com/cgi-bin/shop.fcgi?action=order_ticket&channel=1&type=${cash}&_=${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': `*/*`,
'Connection': `keep-alive`,
'Referer': `https://zqact03.tenpay.com/activity/page/exchangeRights/`,
'Accept-Encoding': `gzip, deflate, br`,
'Host': `zqact03.tenpay.com`,
'User-Agent': app_UA,
'Accept-Language': `zh-CN,zh-Hans;q=0.9`
},
};
$.get(url, async (err, resp, data) => {
try {
if (err) {
console.log("腾讯自选股: API查询请求失败 ‼️‼️");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
data = JSON.parse(data);
cashticket = data.ticket
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//提现请求
function getcash(cashticket,item_id) {
return new Promise((resolve) => {
let url = {
url: `https://zqact.tenpay.com/cgi-bin/shop.fcgi?action=order&type=2&channel=1&ticket=${cashticket}&item_id=${item_id}&_=${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': `*/*`,
'Connection': `keep-alive`,
'Referer': `https://zqact03.tenpay.com/activity/page/exchangeRights/`,
'Accept-Encoding': `gzip, deflate, br`,
'Host': `zqact03.tenpay.com`,
'User-Agent': app_UA,
'Accept-Language': `zh-CN,zh-Hans;q=0.9`
},
};
$.get(url, async (err, resp, data) => {
try {
if (err) {
console.log("腾讯自选股: API查询请求失败 ‼️‼️");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if(data.retcode == 0){
$.log(`提现结果:${data.retmsg}`);
$.log(`查询剩余金额:\n`);
await userhome();
} else {
$.log(`提现失败:${data.retmsg}\n`)
}
}else {
console.log(`提现失败,错误信息:${JSON.stringify(data)}`)
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//金币查询
async function userhome() {
return new Promise((resolve) => {
let signurl = {
url: `https://wzq.tenpay.com/cgi-bin/activity_usercenter.fcgi?channel=1&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`,
'Content-Type': `application/x-www-form-urlencoded`,
'Referer': `http://zixuanguapp.finance.qq.com`,
'Host': `wzq.tenpay.com`,
'User-Agent': app_UA,
'Accept-Encoding': `gzip,deflate`,
'Accept-Language': `zh-Hans-CN;q=1`
},
};
$.get(signurl, async (err, resp, data) => {
try {
if (err) {
console.log("腾讯自选股: API查询请求失败 ‼️‼️");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
money = JSON.parse(data);
$.log(`账户金币:${money.icon_amount}金币\n`);
coinInfo = money.icon_amount
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
////////////////////////////////////////////////////////////////////
function Jsname() {
$.log(`╭┉┉╮╭╮╭╮╭┉┉╮╭┉┉╮╭┉┉╮╭┉┉╮╭╮╭╮`)
$.log(`╰╮╭╯┋╰╯┋┋╭┉╯╰╮╭╯┋╭╮┋┋╭┉╯┋╰╯┋`)
$.log(` ┋┋ ╰╮╭╯┋╰┉╮ ┋┋ ┋┋┋┋┋┋ ┋ ╭╯`)
$.log(` ┋┋ ╭╯╰╮╰┉╮┋ ┋┋ ┋┋┋┋┋┋ ┋ ╰╮`)
$.log(` ┋┋ ┋╭╮┋╭┉╯┋ ┋┋ ┋╰╯┋┋╰┉╮┋╭╮┋`)
$.log(` ╰╯ ╰╯╰╯╰┉┉╯ ╰╯ ╰┉┉╯╰┉┉╯╰╯╰╯`)
}
function time(time) {
var date = new Date(time + 8 * 3600 * 1000);