This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 248
/
txstockV2.js
1420 lines (1312 loc) · 72.4 KB
/
txstockV2.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
863
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
/*腾讯自选股V2 @leaf
cron 35 11,16 * * * https://raw.githubusercontent.com/leafTheFish/DeathNote/main/txstockV2.js
脚本库:https://github.com/leafTheFish/DeathNote/
[脚本说明]
任务端有2个,APP端和公众号端
[更新说明]
更新了一下脚本,精简了需要的CK,多账户用换行(\n)或者@或者#隔开,尽量用换行隔开
一天跑两次就够了,10点到13点之间运行一次猜涨跌做任务,16点半之后运行一次领猜涨跌奖励
[青龙变量]
需要APP和公众号2个数据,多账户用@隔开
1.APP端:抓wzq.tenpay.com包,把url里的openid和fskey用&连起来
2.公众号端:腾讯自选股微信版->右下角好福利->福利中心,抓wzq.tenpay.com包,把Cookie里的wzq_qlskey和wzq_qluin用&连起来
> 没有公众号的CK删掉微信的变量,也可以跑
————
提现设置:默认提现5元,需要改的话自己设置TxStockCash变量,0代表不提现,1代表提现1元,5代表提现5元
新手任务设置:默认不做新手任务,需要做的话设置TxStockNewbie为1
分享任务设置:默认会做互助任务,需要多账号。不想做的话设置TxStockHelp为0
#腾讯自选股
export TxStockCookie='openid=xx&fskey=yy&wzq_qlskey=zz&wzq_qluin=aa'
export TxStockCash='5'
export TxStockNewbie='1'
export TxStockHelp='0'
[QX重写]
[task_local]
#腾讯自选股
35 11,16 * * * https://raw.githubusercontent.com/leafTheFish/DeathNote/main/txstockV2.js, tag=腾讯自选股, enabled=true
[MITM]
hostname = wzq.tenpay.com
[rewrite_local]
https://wzq.tenpay.com/cgi-bin/.*user.*.fcgi url script-request-header https://raw.githubusercontent.com/leafTheFish/DeathNote/main/txstockV2.js
*/
const jsname = '腾讯自选股V2'
const $ = new Env(jsname);
const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1
let notifyStr = ''
let envSplitor = ['\n','@','#']
let httpResult //global buffer
let withdrawCash = ($.isNode() ? (process.env.TxStockCash) : ($.getval('TxStockCash'))) || 5; //0为不自动提现,1为自动提现1元,5为自动提现5元
let helpFlag = ($.isNode() ? (process.env.TxStockHelp) : ($.getval('TxStockHelp'))) || 1; //0为不做分享助力任务,1为多用户互相分享助力
let newbieFlag = ($.isNode() ? (process.env.TxStockNewbie) : ($.getval('TxStockNewbie'))) || 0; //0为不做新手任务,1为自动做新手任务
let userCookie = ($.isNode() ? process.env.TxStockCookie : $.getdata('TxStockCookie')) || '';
let userList = []
let userIdx = 0
let userCount = 0
let TASK_WAITTIME = 100
let BULL_WAITTIME = 5000
let test_taskList = []
let todayDate = formatDateTime();
let SCI_code = '000001' //上证指数
let marketCode = {'sz':0, 'sh':1, 'hk':2, }
let signType = {task:'home', sign:'signdone', award:'award'}
let taskList = {
app: {
daily: [1105, 1101, 1111, 1113],
newbie: [1023, 1033],
dailyShare: ["news_share", "task_50_1101", "task_51_1101", "task_50_1111", "task_51_1111", "task_51_1113", "task_72_1113", "task_74_1113", "task_75_1113", "task_76_1113"],
newbieShare: [],
},
wx: {
daily: [1100, 1110, 1112],
newbie: [1032],
dailyShare: ["task_50_1100", "task_51_1100", "task_50_1110", "task_51_1110", "task_66_1110", "task_51_1112", "task_75_1112"],
newbieShare: ["task_50_1032", "task_51_1032", "task_50_1033", "task_51_1033"],
},
}
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},
}
///////////////////////////////////////////////////////////////////
class UserInfo {
constructor(str) {
this.index = userIdx
this.name = this.index
this.canRun = true
this.hasWxCookie = true
this.valid = false
this.coin = -1
this.shareCodes = {task:{}, newbie:{}, bull:{}, guess:{}}
this.bullStatusFlag = false
let info = str2json(str)
this.openid = info['openid'] || ''
this.fskey = info['fskey'] || ''
this.wzq_qlskey = info['wzq_qlskey'] || ''
this.wzq_qluin = info['wzq_qluin'] || ''
this.task = info['task'] || 1
this.cookie = `wzq_qlskey=${this.wzq_qlskey}; wzq_qluin=${this.wzq_qluin}; zxg_openid=${this.openid};`
let checkParam = ['openid','fskey','wzq_qlskey','wzq_qluin']
let missEnv = []
for(let param of checkParam) {
if(!this[param]) missEnv.push(param);
}
if(missEnv.length > 0) {
let missStr = missEnv.join(', ')
let notiStr = `账号[${this.index}]缺少参数:${missStr}`
if(missStr.indexOf('openid') > -1 || missStr.indexOf('fskey') > -1 ) {
notiStr = ',无法运行脚本'
this.canRun = false
} else if(missStr.indexOf('wzq_qlskey') > -1 || missStr.indexOf('wzq_qluin') > -1) {
notiStr = ',尝试用APP的CK去完成微信任务和助力,可能出现失败情况'
this.hasWxCookie = false
}
console.log(notiStr)
}
}
async getUserName() {
try {
let url = `https://proxy.finance.qq.com/group/newstockgroup/RssService/getSightByUser2?g_openid=${this.openid}&openid=${this.openid}&fskey=${this.fskey}`
let body = `g_openid=${this.openid}&search_openid=${this.openid}`
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('post',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.code==0) {
this.name = result.data.user_name
} else {
console.log(`账号[${this.name}]查询账户昵称失败: ${result.msg}`)
}
} catch(e) {
console.log(e)
} finally {}
}
async getUserInfo(isWithdraw=false) {
try {
let url = `https://wzq.tenpay.com/cgi-bin/shop.fcgi?action=home_v2&type=2&openid=${this.openid}&fskey=${this.fskey}&channel=1`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
this.valid = true
let lastCoin = this.coin
this.coin = result.shop_asset ? result.shop_asset.amount : 0
if(lastCoin > -1) {
logAndNotify(`账号[${this.name}]金币余额:${this.coin},本次运行共获得${this.coin-lastCoin}金币`)
} else {
console.log(`账号[${this.name}]金币余额:${this.coin}`)
}
if(isWithdraw && withdrawCash > 0) {
if(result.cash && result.cash.length > 0) {
let cashStr = `${withdrawCash}元现金`
for(let cashItem of result.cash) {
if(cashItem.item_desc == cashStr){
if(parseInt(this.coin) >= parseInt(cashItem.coins)){
logAndNotify(`账号[${this.name}]金币余额多于${cashItem.coins},开始提现${cashStr}`);
await $.wait(TASK_WAITTIME);
await this.getWithdrawTicket(cashItem.item_id);
} else {
console.log(`账号[${this.name}]金币余额不足${cashItem.coins},不提现`);
}
break;
}
}
}
}
} else {
console.log(`账号[${this.name}]查询账户余额失败: ${result.retmsg}`)
}
} catch(e) {
console.log(e)
} finally {}
}
async signTask(actid,action,ticket='') {
try {
let url = `https://wzq.tenpay.com/cgi-bin/activity_sign_task.fcgi?actid=${actid}&channel=1&action=${action}&openid=${this.openid}&fskey=${this.fskey}`
if(action == signType.task) {
url = `&type=welfare_sign`
} else if(action == signType.sign) {
url = `&date=${todayDate}`
} else if (action == signType.award) {
url = `&reward_ticket=${ticket}`
}
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
if(result.forbidden_code) {
console.log(`查询签到任务失败,可能已黑号: ${result.forbidden_reason}`)
} else {
if(action == signType.task) {
console.log(`已连续签到${result.task_pkg.continue_sign_days}天,总签到天数${result.task_pkg.total_sign_days}天`)
for(let item of result.task_pkg.tasks) {
if(item.date == todayDate){
if(item.status == 0){
//今天未签到,去签到
await $.wait(TASK_WAITTIME);
await this.signTask(actid,signType.sign);
} else {
//今天已签到
console.log(`今天已签到`);
}
}
}
if(result.lotto_chance > 0 && result.lotto_ticket) {
await $.wait(TASK_WAITTIME);
await this.signTask(actid,signType.award,result.lotto_ticket);
}
} else if(action == signType.sign) {
console.log(`签到获得${result.reward_desc}`);
} else if(action == signType.award) {
console.log(`领取连续签到奖励获得${result.reward_desc}`);
}
}
} else {
console.log(`查询签到任务失败: ${result.retmsg}`)
}
} catch(e) {
console.log(e)
} finally {}
}
async guessHome() {
try {
let url = `https://zqact.tenpay.com/cgi-bin/guess_home.fcgi?channel=1&source=2&new_version=3&openid=${this.openid}&fskey=${this.fskey}`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
let curTime = new Date()
let currentHour = curTime.getHours()
let currentDay = curTime.getDay()
let isGuessTime = ((currentHour < 13) && (currentHour > 9) && (currentDay < 6) && (currentDay > 0)) ? 1 : 0
//上期猜上证指数奖励
if(result.notice_info && result.notice_info[0]) {
if(result.notice_info[0].answer_status == 1) {
console.log(`上期猜上证指数涨跌回答正确,准备领取奖励...`)
await $.wait(TASK_WAITTIME);
await this.getGuessAward(result.notice_info[0].date)
} else {
console.log(`上期猜上证指数涨跌回答错误`)
}
}
//上期猜个股奖励
if(result.stock_notice_info && result.stock_notice_info[0]) {
if(result.stock_notice_info[0].guess_correct == 1) {
console.log(`上期猜个股涨跌回答正确,准备领取奖励...`)
await $.wait(TASK_WAITTIME);
await this.getGuessStockAward(result.stock_notice_info[0].date)
} else {
console.log(`上期猜个股涨跌回答错误`)
}
}
if(isGuessTime) {
//猜上证指数
if((result.T_info && result.T_info[0] && result.T_info[0].user_answer == 0) ||
(result.T1_info && result.T1_info[0] && result.T1_info[0].user_answer == 0)) {
if(result.date_list) {
for(let item of result.date_list) {
if(item.status == 3 && item.date == todayDate) {
await $.wait(TASK_WAITTIME);
await this.getStockInfo(SCI_code,marketCode['sh'])
await $.wait(TASK_WAITTIME);
await this.guessRiseFall(this.guessOption)
}
}
}
} else {
console.log(`已竞猜当期上证指数涨跌`)
}
//猜个股
if(result.recommend && result.recommend.length > 0) {
this.guessStockFlag = true
for(let item of result.recommend.sort(function(a,b){return Math.abs(b["zdf"])-Math.abs(a["zdf"])})) {
await $.wait(TASK_WAITTIME);
await this.guessStockStatus(item)
if(this.guessStockFlag==false) break;
}
}
} else {
console.log(`脚本只会在10点到13点之间进行竞猜,当前为非竞猜时段`)
}
if(result.invite_info) {
this.shareCodes.guess = result.invite_info
console.log(`猜涨跌互助码获取成功`)
}
} else {
console.log(`进入猜涨跌页面失败: ${result.retmsg}`)
}
} catch(e) {
console.log(e)
} finally {}
}
async getGuessAward(guessDate) {
try {
let url = `https://zqact.tenpay.com/cgi-bin/activity.fcgi?channel=1&activity=guess_new&guess_act_id=3&guess_date=${guessDate}&guess_reward_type=1&openid=${this.openid}&fskey=${this.fskey}`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
console.log(`猜中上证指数涨跌获得${result.reward_value}金币`);
} else {
console.log(`领取猜上证指数奖励失败: ${result.retmsg}`)
}
} catch(e) {
console.log(e)
} finally {}
}
async getGuessStockAward(guessDate) {
try {
let url = `https://zqact.tenpay.com/cgi-bin/activity/activity.fcgi?activity=guess_new&action=guess_stock_reward&guess_date=${guessDate}&channel=1&openid=${this.openid}&fskey=${this.fskey}`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
if(result.stock_rewards && result.stock_rewards.length > 0) {
for(let item of result.stock_rewards) {
console.log(`猜中个股[${item.stock_name}]涨跌获得${item.reward_desc}`);
}
}
console.log(`猜中个股涨跌总奖励${result.stock_reward_desc}`);
} else {
console.log(`领取猜个股奖励失败: ${result.retmsg}`)
}
} catch(e) {
console.log(e)
} finally {}
}
async getStockInfo(scode,markets) {
try {
let url = `https://zqact.tenpay.com/cgi-bin/open_stockinfo.fcgi?scode=${scode}&markets=${markets}&needfive=0&needquote=1&needfollow=0&type=0&channel=1&openid=${this.openid}&fskey=${this.fskey}`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.body) {
result = JSON.parse(result.body.replace(/\\x/g,''))
}
if(result.retcode==0) {
let stockName = result.secu_info.secu_name || ''
if(stockName) {
let dqj = result.secu_quote.dqj || 0
let zsj = result.secu_quote.zsj || 0
let raise = dqj - zsj
let ratio = raise/zsj*100
let guessStr = (raise < 0) ? '跌' : '涨'
this.guessOption = (raise < 0) ? 2 : 1
console.log(`${stockName}:当前价格${dqj},前天收市价${zsj},涨幅${Math.floor(ratio*100)/100}% (${Math.floor(raise*100)/100}),猜${guessStr}`);
}
} else {
console.log(`获取股票涨跌信息失败: ${result.retmsg}`)
}
} catch(e) {
console.log(e)
} finally {}
}
async guessRiseFall(answer) {
try {
let url = `https://zqact.tenpay.com/cgi-bin/guess_op.fcgi?action=2&act_id=3&user_answer=${answer}&date=${todayDate}&channel=1&openid=${this.openid}&fskey=${this.fskey}`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
let guessStr = (answer==1) ? "猜涨" : "猜跌"
if(result.retcode==0) {
console.log(`竞猜上证指数${guessStr}成功`)
} else {
console.log(`竞猜上证指数${guessStr}失败: ${result.retmsg}`)
}
} catch(e) {
console.log(e)
} finally {}
}
async guessStockRiseFall(stockItem,answer) {
try {
let url = `https://wzq.tenpay.com/cgi-bin/guess_op.fcgi?openid=${this.openid}&fskey=${this.fskey}&check=11`
let body = `source=3&channel=1&outer_src=0&new_version=3&symbol=${stockItem.symbol}&date=${todayDate}&action=2&user_answer=${answer}&openid=${this.openid}&fskey=${this.fskey}&check=11`
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('post',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
let guessStr = (answer==1) ? "猜涨" : "猜跌"
if(result.retcode==0) {
console.log(`竞猜个股${guessStr}成功`)
} else {
console.log(`竞猜个股${guessStr}失败: ${result.retmsg}`)
}
} catch(e) {
console.log(e)
} finally {}
}
async guessStockStatus(stockItem) {
try {
let url = `https://wzq.tenpay.com/cgi-bin/guess_home.fcgi?openid=${this.openid}&fskey=${this.fskey}&check=11&source=3&channel=1&symbol=${stockItem.symbol}&new_version=3`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
console.log(`剩余猜个股涨跌次数:${result.guess_times_left}`);
if(result.guess_times_left > 0) {
if(result.T_info.user_answer > 0) {
console.log(`已竞猜:${stockItem.stockname}`);
} else {
let guessStr = (stockItem.zdf < 0) ? '跌' : '涨'
let answer = (stockItem.zdf < 0) ? 2 : 1
console.log(`${stockItem.stockname}今天涨幅为${stockItem.zdf}%,猜${guessStr}`)
await $.wait(TASK_WAITTIME);
await this.guessStockRiseFall(stockItem,answer)
}
} else {
console.log(`竞猜个股次数已用完`);
this.guessStockFlag = false
}
} else {
console.log(`获取竞猜个股次数失败: ${result.retmsg}`)
this.guessStockFlag = false
}
} catch(e) {
console.log(e)
} finally {}
}
async queryTaskList(taskItem) {
try {
let url = `https://wzq.tenpay.com/cgi-bin/activity_${taskItem.activity}.fcgi?action=home&type=${taskItem.type}&actid=${taskItem.actid}&invite_code=&openid=${this.openid}&fskey=${this.fskey}&channel=1`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
if(result.task_pkg && result.task_pkg.length > 0){
console.log(`[${taskItem.actid}]有${result.task_pkg.length}个任务`)
test_taskList.push(taskItem.actid)
}
} else {
//console.log(`查询[${taskItem.actid}]列表失败: ${result.retmsg}`)
}
} catch(e) {
console.log(e)
} finally {}
}
async getNewbieAward(actid,ticket) {
try {
let url = `https://wzq.tenpay.com/cgi-bin/activity_task.fcgi?action=award&channel=1&actid=${actid}&reward_ticket=${ticket}&openid=${this.openid}&fskey=${this.fskey}&channel=1`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
console.log(`获得新手任务[actid:${actid}]阶段奖励: ${result.reward_desc}`);
} else {
console.log(`新手任务[actid:${actid}]阶段未完成:${result.retmsg}`)
}
} catch(e) {
console.log(e)
} finally {}
}
async appGetTaskList(taskItem) {
try {
let url = `https://wzq.tenpay.com/cgi-bin/activity_${taskItem.activity}.fcgi?action=home&type=${taskItem.type}&actid=${taskItem.actid}&invite_code=&openid=${this.openid}&fskey=${this.fskey}&channel=1`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
if(result.forbidden_code) {
console.log(`获取${taskItem.taskName}[${taskItem.actid}]列表失败: ${result.forbidden_reason}`)
} else {
if(result.task_pkg && result.task_pkg.length > 0){
for(let item of result.task_pkg) {
if(item.lotto_ticket) {
//可领取新手奖励
await this.getNewbieAward(taskItem.actid,item.lotto_ticket)
continue;
}
if(item.reward_type > 0) {
//已领取过新手奖励
continue;
}
if(item.tasks && item.tasks.length > 0) {
for(let task of item.tasks) {
await $.wait(TASK_WAITTIME);
await this.appGetTaskStatus(taskItem,task.id,task.tid);
}
}
}
}
}
} else {
console.log(`获取${taskItem.taskName}[${taskItem.actid}]列表失败: ${result.retmsg}`)
}
} catch(e) {
console.log(e)
} finally {}
}
async appGetTaskStatus(taskItem,id,tid) {
try {
let url = `https://wzq.tenpay.com/cgi-bin/activity_task.fcgi?id=${id}&tid=${tid}&actid=${taskItem.actid}&channel=1&action=taskstatus&openid=${this.openid}&fskey=${this.fskey}`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
if(result.done == 0) {
await $.wait(TASK_WAITTIME);
await this.appGetTaskTicket(taskItem,id,tid);
} else {
console.log(`${taskItem.taskName}[${taskItem.actid}-${id}-${tid}]已完成`);
}
} else {
console.log(`查询[${taskItem.actid}-${id}-${tid}]状态失败: ${result.retmsg}`)
}
} catch(e) {
console.log(e)
} finally {}
}
async appGetTaskTicket(taskItem,id,tid) {
try {
let url = `https://wzq.tenpay.com/cgi-bin/activity_task.fcgi?action=taskticket&channel=1&actid=${taskItem.actid}&openid=${this.openid}&fskey=${this.fskey}&channel=1`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
await $.wait(TASK_WAITTIME);
await this.appTaskDone(taskItem,result.task_ticket,id,tid);
} else {
console.log(`申请任务票据失败: ${result.retmsg}`)
}
} catch(e) {
console.log(e)
} finally {}
}
async appTaskDone(taskItem,ticket,id,tid) {
try {
let url = `https://wzq.tenpay.com/cgi-bin/activity_task.fcgi?action=taskdone&channel=1&actid=${taskItem.actid}&id=${id}&tid=${tid}&task_ticket=${ticket}&openid=${this.openid}&fskey=${this.fskey}&channel=1`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
console.log(`完成${taskItem.taskName}[${taskItem.actid}-${id}-${tid}]:获得 ${result.reward_desc}`);
} else {
console.log(`${taskItem.taskName}[${taskItem.actid}-${id}-${tid}]未完成:${result.retmsg}`);
}
} catch(e) {
console.log(e)
} finally {}
}
async wxGetTaskList(taskItem) {
try {
let url = `https://wzq.tenpay.com/cgi-bin/activity_${taskItem.activity}.fcgi?action=home&type=${taskItem.type}&actid=${taskItem.actid}&invite_code=`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
if(result.forbidden_code) {
console.log(`获取${taskItem.taskName}[${taskItem.actid}]列表失败: ${result.forbidden_reason}`)
} else {
if(result.task_pkg && result.task_pkg.length > 0){
for(let item of result.task_pkg) {
if(item.lotto_ticket) {
//可领取新手奖励
await this.getNewbieAward(taskItem.actid,item.lotto_ticket)
continue;
}
if(item.reward_type > 0) {
//已领取过新手奖励
continue;
}
if(item.tasks && item.tasks.length > 0) {
for(let task of item.tasks) {
await $.wait(TASK_WAITTIME);
await this.wxGetTaskStatus(taskItem,task.id,task.tid);
}
}
}
}
}
} else {
console.log(`获取${taskItem.taskName}[${taskItem.actid}]列表失败: ${result.retmsg}`)
}
} catch(e) {
console.log(e)
} finally {}
}
async wxGetTaskStatus(taskItem,id,tid,task_ticket='') {
try {
let url = `https://wzq.tenpay.com/cgi-bin/activity_task.fcgi`
let body = `actid=${taskItem.actid}&id=${id}&tid=${tid}&action=taskstatus`
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('post',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
if(result.done == 0) {
await $.wait(TASK_WAITTIME);
await this.wxGetTaskTicket(taskItem,id,tid);
} else {
console.log(`${taskItem.taskName}[${taskItem.actid}-${id}-${tid}]已完成`);
}
} else {
console.log(`查询[${taskItem.actid}-${id}-${tid}]状态失败: ${result.retmsg}`)
}
} catch(e) {
console.log(e)
} finally {}
}
async wxGetTaskTicket(taskItem,id,tid) {
try {
let url = `https://wzq.tenpay.com/cgi-bin/activity_task.fcgi`
let body = `actid=${taskItem.actid}&action=taskticket`
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('post',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
await $.wait(TASK_WAITTIME);
await this.wxTaskDone(taskItem,result.task_ticket,id,tid);
} else {
console.log(`申请任务票据失败: ${result.retmsg}`)
}
} catch(e) {
console.log(e)
} finally {}
}
async wxTaskDone(taskItem,ticket,id,tid) {
try {
let url = `https://wzq.tenpay.com/cgi-bin/activity_task.fcgi`
let body = `actid=${taskItem.actid}&id=${id}&tid=${tid}&action=taskdone&task_ticket=${ticket}`
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('post',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
console.log(`完成${taskItem.taskName}[${taskItem.actid}-${id}-${tid}]:获得 ${result.reward_desc}`);
} else {
console.log(`${taskItem.taskName}[${taskItem.actid}-${id}-${tid}]未完成:${result.retmsg}`);
}
} catch(e) {
console.log(e)
} finally {}
}
async getWithdrawTicket(item_id) {
try {
let url = `https://zqact03.tenpay.com/cgi-bin/shop.fcgi?action=order_ticket&type=2&openid=${this.openid}&fskey=${this.fskey}&channel=1`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
if(result.ticket) {
await $.wait(TASK_WAITTIME);
await this.withdraw(result.ticket,item_id);
} else {
console.log(`申请提现票据失败`);
}
} else {
console.log(`申请提现票据失败: ${result.retmsg}`)
}
} catch(e) {
console.log(e)
} finally {}
}
async withdraw(ticket,item_id) {
try {
let url = `https://zqact03.tenpay.com/cgi-bin/shop.fcgi?action=order&type=2&ticket=${ticket}&item_id=${item_id}&openid=${this.openid}&fskey=${this.fskey}&channel=1`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
logAndNotify(`提现结果:${result.retmsg}`);
} else {
logAndNotify(`提现失败:${result.retmsg}`);
}
} catch(e) {
console.log(e)
} finally {}
}
async bullStatus() {
try {
let url = `https://zqact03.tenpay.com/cgi-bin/activity_year_party.fcgi?invite_code=&help_code=&share_date=&type=bullish&action=home&actid=1105&openid=${this.openid}&fskey=${this.fskey}&channel=1`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
if(result.forbidden_code) {
console.log(`长牛可能已黑号:${result.forbidden_reason}`);
} else {
this.bullStatusFlag = true
this.shareCodes.bull.invite = result.invite_code || ''
this.shareCodes.bull.help = result.help_code || ''
console.log(`长牛状态:`)
console.log(`等级: ${result.bullish_info.level}`)
console.log(`下一级需要经验: ${result.bullish_info.next_level_exp}`)
console.log(`现有经验: ${result.bullish_info.exp_value}`)
console.log(`现有牛气: ${result.bullish_info.bullish_value}`)
}
} else {
console.log(`查询长牛状态失败:${result.retmsg}`);
}
} catch(e) {
console.log(e)
} finally {}
}
async bullTaskDone(taskItem,extra='') {
try {
let url = `https://zqact03.tenpay.com/cgi-bin/activity_year_party.fcgi?type=bullish&action=${taskItem.action}&actid=${taskItem.actid}${extra}&openid=${this.openid}&fskey=${this.fskey}&channel=1`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
if(result.forbidden_code > 0) {
console.log(`结束${taskItem.taskName}:${result.forbidden_reason}`);
} else if(result.reward_info) {
console.log(`${taskItem.taskName}获得: ${result.reward_info[0].reward_desc}`);
await $.wait(BULL_WAITTIME);
await this.bullTaskDone(taskItem)
} else if(result.award_desc) {
console.log(`${taskItem.taskName}获得: ${result.award_desc}`);
await $.wait(BULL_WAITTIME);
await this.bullTaskDone(taskItem,extra)
} else if(result.skin_info) {
console.log(`${taskItem.taskName}获得: ${result.skin_info.skin_desc}`);
await $.wait(BULL_WAITTIME);
await this.bullTaskDone(taskItem)
} else if(result.skin_list && result.skin_list.length > 0) {
for(let skinItem of result.skin_list) {
if(skinItem.skin_num > 1) {
await $.wait(BULL_WAITTIME);
await this.bullTaskDone(bullTaskArray["sell_skin"],`&skin_type=${skinItem.skin_type}`)
}
}
} else if(result.feed_reward_info) {
console.log(`${taskItem.taskName}获得: ${result.feed_reward_info.reward_desc}`);
if(result.level_up_status == 1) {
console.log(`长牛升级到等级${result.update_new_level},获得: ${result.level_reward_info.reward_desc}`);
}
await $.wait(BULL_WAITTIME);
await this.bullTaskDone(taskItem)
} else {
console.log(result)
}
} else {
console.log(`${taskItem.taskName}失败:${result.retmsg}`);
}
} catch(e) {
console.log(e)
} finally {}
}
async userBullTask() {
try {
await this.bullStatus();
if(!this.bullStatusFlag) return;
await $.wait(TASK_WAITTIME);
await this.bullTaskDone(bullTaskArray["rock_bullish"])
await $.wait(TASK_WAITTIME);
for(let i=0; i<10; i ){
await this.bullTaskDone(bullTaskArray["open_box"])
if(i < 9) await $.wait(BULL_WAITTIME)
}
await $.wait(TASK_WAITTIME);
await this.bullTaskDone(bullTaskArray["open_blindbox"])
await $.wait(TASK_WAITTIME);
await this.bullTaskDone(bullTaskArray["query_blindbox"])
await $.wait(TASK_WAITTIME);
await this.bullTaskDone(bullTaskArray["feed"])
await $.wait(TASK_WAITTIME);
} catch(e) {
console.log(e)
} finally {}
}
async appGetShareCode(share_type,type='daily') {
try {
let url = `https://wzq.tenpay.com/cgi-bin/activity/activity_share.fcgi?channel=1&action=query_share_code&share_type=${share_type}&openid=${this.openid}&fskey=${this.fskey}&buildType=store&check=11&_idfa=&lang=zh_CN`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
if(type == 'newbie') {
this.shareCodes.newbie[share_type] = result.share_code
console.log(`获取新手任务[${share_type}]互助码:${result.share_code}`)
} else {
this.shareCodes.task[share_type] = result.share_code
console.log(`获取日常任务[${share_type}]互助码:${result.share_code}`)
}
} else {
console.log(`获取[${share_type}]互助码失败:${result.retmsg}`);
}
} catch(e) {
console.log(e)
} finally {}
}
async wxGetShareCode(share_type,type='daily') {
try {
let url = `https://wzq.tenpay.com/cgi-bin/activity_share.fcgi`
let body = `action=query_share_code&share_type=${share_type}`
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('post',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
if(type == 'newbie') {
this.shareCodes.newbie[share_type] = result.share_code
console.log(`获取新手任务[${share_type}]互助码:${result.share_code}`)
} else {
this.shareCodes.task[share_type] = result.share_code
console.log(`获取日常任务[${share_type}]互助码:${result.share_code}`)
}
} else {
console.log(`获取[${share_type}]互助码失败:${result.retmsg}`);
}
} catch(e) {
console.log(e)
} finally {}
}
async appDoShare(share_type,share_code) {
try {
let url = `https://wzq.tenpay.com/cgi-bin/activity_share.fcgi?action=share_code_info&share_type=${share_type}&share_code=${share_code}&openid=${this.openid}&fskey=${this.fskey}&channel=1`
let body = ``
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('get',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
if(result.share_code_info && result.share_code_info.status == 1) {
console.log(`[${share_type}]助力成功,对方昵称:[${result.share_code_info.nickname}]`);
} else if(result.retmsg == "OK") {
console.log(`[${share_type}]已经助力过了`);
} else {
console.log(result)
}
} else {
console.log(`[${share_type}]助力失败:${result.retmsg}`);
}
} catch(e) {
console.log(e)
} finally {}
}
async wxDoShare(share_type,share_code) {
try {
let url = `https://wzq.tenpay.com/cgi-bin/activity_share.fcgi`
let body = `action=share_code_info&share_type=${share_type}&share_code=${share_code}`
let urlObject = populateUrlObject(url,this.cookie,body)
await httpRequest('post',urlObject)
let result = httpResult;
if(!result) return
//console.log(result)
if(result.retcode==0) {
if(result.share_code_info && result.share_code_info.status == 1) {
console.log(`[${share_type}]助力成功,对方昵称:[${result.share_code_info.nickname}]`);
} else if(result.retmsg == "OK") {
console.log(`[${share_type}]已经助力过了`);
} else {
console.log(result)
}
} else {
console.log(`[${share_type}]助力失败:${result.retmsg}`);
}
} catch(e) {
console.log(e)
} finally {}
}
}
!(async () => {
if (typeof $request !== "undefined") {
await GetRewrite()
}else {
console.log('\n变量填写格式,多账号用换行(\\n)或者@或者#隔开:\nopenid=xx&fskey=yy&wzq_qlskey=zz&wzq_qluin=aa\n')
if(!(await checkEnv())) return;
console.log('\n=================== 用户信息 ===================')
for(let user of userList.filter(x => x.canRun)) {
await user.getUserName();
await $.wait(TASK_WAITTIME);
await user.getUserInfo();
await $.wait(TASK_WAITTIME);
}