-
Notifications
You must be signed in to change notification settings - Fork 0
/
jkd.js
1310 lines (1272 loc) · 47.4 KB
/
jkd.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
/*
聚看点,所有任务+阅读
欢迎填写邀请码:24224873
点我的获取Cookie
=============环境变量=============
JKD_COOKIE cookies,可选择用&、@、换行隔开
JKD_USER_AGENT 用户ua,默认为ios
JKD_WITHDRAW 提现金额
================Qx==============
[task_local]
0,30 * * * * https://raw.githubusercontent.com/shylocks/Loon/main/jkd.js, tag=聚看点
[rewrite_local]
https:\/\/www\.xiaodouzhuan\.cn\/jkd\/newMobileMenu\/infoMe\.action url script-request-body https://raw.githubusercontent.com/shylocks/Loon/main/jkd.js
================Loon==============
[Script]
http-request https:\/\/www\.xiaodouzhuan\.cn\/jkd\/newMobileMenu\/infoMe\.action script-path=https://raw.githubusercontent.com/shylocks/Loon/main/jkd.js, requires-body=true, timeout=100, tag=聚看点
cron "0,30 * * * *" script-path=https://raw.githubusercontent.com/shylocks/Loon/main/jkd.js
===============Surge=================
[Script]
聚看点 = type=http-request,pattern=https:\/\/www\.xiaodouzhuan\.cn\/jkd\/newMobileMenu\/infoMe\.action ,script-path=https://raw.githubusercontent.com/shylocks/Loon/main/jkd.js
聚看点 = type=cron,cronexp="0,30 * * * *",wake-system=1,timeout=900,script-path=https://raw.githubusercontent.com/shylocks/Loon/main/jkd.js
===============MITM=================
[MITM]
hostname = www.xiaodouzhuan.cn
*/
const API_HOST = 'https://www.xiaodouzhuan.cn'
const UA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148'
const $ = new Env("聚看点")
let sum = 0
let cookiesArr = [
// '', // xz_jkd_appkey=xxx; JSESSIONID=xxx; UM_distinctid=xxx; (账号1ck)
// '', // xz_jkd_appkey=xxx; JSESSIONID=xxx; UM_distinctid=xxx; (账号2ck)
], cookie = '', message;
async function getCookie() {
if ($request && $request.method !== `OPTIONS`) {
const bodyVal = $request.body
let cks = $.getdata('CookiesJKD2') || "[]"
cks = jsonParse(cks);
const Cookieval = $request.headers['Cookie']
$.log(`Cookie:${Cookieval}`)
$.log(`bodyVal:${bodyVal}`)
if (Cookieval) {
let os = []
for (let i = 0; i < cks.length; ++i) {
cookie = cks[i]
await getOpenId()
os.push($.openId)
}
cookie = Cookieval
await getOpenId()
if ($.openId && !os.includes($.openId)) {
cks.push(Cookieval)
$.setdata(JSON.stringify(cks), "CookiesJKD2")
$.msg($.name, `获取Cookie ${$.openId} 成功`)
} else {
if(!$.openId){
$.msg($.name, `无法获取openId,请检查是否绑定微信`)
}else{
$.msg($.name, `openId ${$.openId} 已存在`)
}
// $.msg($.name, `${$.userName}已存在,请注释脚本`)
}
}
}
}
if (typeof $request !== 'undefined') {
getCookie().then(r => {
$.done()
}).finally(() => {
$.done()
})
} else {
!(async () => {
if ($.isNode()) {
let JKCookie = []
if (process.env.JKD_COOKIE && process.env.JKD_COOKIE.indexOf('@') > -1) {
JKCookie = process.env.JKD_COOKIE.split('@');
console.log(`您的JKD_COOKIE选择的是用@隔开,共计 ${JKCookie.length} 个Cookie\n`)
} else if (process.env.JKD_COOKIE && process.env.JKD_COOKIE.indexOf('&') > -1) {
JKCookie = process.env.JKD_COOKIE.split('&');
console.log(`您的JKD_COOKIE选择的是用&隔开,共计 ${JKCookie.length} 个Cookie\n`)
} else if (process.env.JKD_COOKIE && process.env.JKD_COOKIE.indexOf('\n') > -1) {
JKCookie = process.env.JKD_COOKIE.split('\n');
console.log(`您的JKD_COOKIE选择的是用换行符隔开,共计 ${JKCookie.length} 个Cookie\n`)
} else if (process.env.JKD_COOKIE) {
JKCookie = process.env.JKD_COOKIE.split()
}
if (process.env.JKD_WITHDRAW){
sum = process.env.JKD_WITHDRAW
}
Object.keys(JKCookie).forEach((item) => {
if (JKCookie[item]) {
cookiesArr.push(JKCookie[item])
}
})
if (process.env.JKD_DEBUG && process.env.JKD_DEBUG === 'false') console.log = () => {
};
} else {
let cookiesData = $.getdata('CookiesJKD2') || "[]";
sum = $.getdata("JKD_WITHDRAW") || 0;
cookiesData = jsonParse(cookiesData);
cookiesArr = cookiesData;
cookiesArr.reverse();
cookiesArr = cookiesArr.filter(item => item !== "" && item !== null && item !== undefined);
}
if (!cookiesArr[0]) {
$.msg($.name, '【提示】请先获取聚看点账号一cookie');
return;
}
for (let i = 0; i < cookiesArr.length; i++) {
if (cookiesArr[i]) {
cookie = cookiesArr[i];
if(cookie.match(/UM_distinctid=(\S*);/)){
$.uuid = cookie.match(/UM_distinctid=(\S*);/)[1]
}
else $.uuid = ""
await getOpenId()
$.index = i + 1;
if (!$.openId) {
console.log(`Cookies${$.index}已失效!`)
break
}
await getUserInfo()
console.log(`\n******开始【聚看点账号${$.index}】${$.userName || $.openId}*********\n`);
console.log(`${$.gold},当前${$.current},${$.sum}`)
if(cookie.indexOf('iOS')>0){
console.log(`${$.userName}的cookie来自iOS客户端`)
} else if(cookie.indexOf('android')>0){
console.log(`${$.userName}的cookie来自安卓客户端,替换Cookie`)
cookie = cookie.replace('!android!753','!iOS!5.6.5')
}
await jkd()
}
}
})()
.catch((e) => $.logErr(e))
.finally(() => $.done())
}
async function jkd() {
if( sum!==0 && $.current > sum){
console.log(`触发提现条件,去提现`)
await withDraw()
}
$.profit = 0
await bindTeacher()
if (!$.isSign) await sign() // 签到
$.log(`去领取阶段奖励`)
await getStageState() // 阶段奖励
$.luckyDrawNum = 50
if ($.luckyDrawNum > 0) {
$.log(`去转转盘`)
for (let i = 0; i < 10 && $.luckyDrawNum > 0; ++i) {
await getLuckyLevel()
if($.luckyDrawNum===0) break
await luckyDraw()
await luckyProfit()
await $.wait(1000)
}
}
// await getTaskList() // 任务
for (let i = 0; i < $.videoPacketNum; ++i) {
$.log(`去看激励视频`)
await adv(17)
}
await openTimeBox() // 宝箱
await getTaskBoxProfit() // 摇钱树1
await getTaskBoxProfit(2) // 摇钱树2
$.artList = []
// 看视频
await getArticleList(53)
for (let i = 0; i < $.artList.length; ++i) {
const art = $.artList[i]
if (art['art_id']) {
let artId = art['art_id']
$.log(`去看视频:${artId}`)
await call2($.uuid)
if ($.videocount === 0) {
$.log(`观看视屏次数已满,跳出`)
break
}
// await call1(artId)
await getVideo(artId, true)
// await video(artId)
// await call1(uuid)
await $.wait(31 * 1000)
await videoAccount(artId)
await $.wait(5 * 1000)
}
}
$.artList = []
// 看文章
await getArticleList()
for (let i = 0; i < $.artList.length; ++i) {
const art = $.artList[i]
if (art['art_id']) {
await call2($.uuid)
if ($.artcount === 0) {
$.log(`观看文章次数已满,跳出`)
break
}
let artId = art['art_id']
await getArticle(artId)
await call1($.uuid, artId)
await article(artId)
await openArticle(artId)
await $.wait(31 * 1000)
await readAccount(artId)
await $.wait(5 * 1000)
}
}
$.log(`本次运行完成,共计获得 ${$.profit} 金币`)
}
function bindTeacher() {
return new Promise(resolve => {
$.get(taskGetUrl("jkd/weixin20/member/bindTeacher.action","teacherCode=24224873"), async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
// console.log(data)
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function getStageState() {
return new Promise(resolve => {
$.post(taskGetUrl("jkd/weixin20/newactivity/readStageReward.action",), async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
for (let i = 1; i <= 3; ++i) {
let str = `var readtime${i} = "(.*)";`
switch (parseInt(data.match(str)[1])) {
case 1:
$.log(`第${i}阶段奖励可领取`)
await getStageReward(i)
break
case 2:
$.log(`第${i}阶段奖励已领取过`)
break
default:
$.log(`第${i}阶段未完成`)
break
}
}
//$.isSign = data.match(/var readtime1 = "(.*)";/)[1]
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function getTaskList() {
let body = {
"appid": "xzwl",
"channel": "iOS",
"psign": "92dea068b6c271161be05ed358b59932",
"appversioncode": $.version,
"time": new Date().getTime(),
"apptoken": "xzwltoken070704",
"appversion": "5.6.5",
"openid": $.openId,
"os": "iOS",
"listtype": "wealnews",
"ua": $.isNode() ?
(process.env.JKD_USER_AGENT ? process.env.JKD_USER_AGENT : UA) : ($.getdata('JKDUA')
? $.getdata('JKDUA') : UA),
"pageNo": 0,
"pageSize": 20
}
return new Promise(resolve => {
$.post(taskGetUrl("jkd/mobile/base/welfaretask/indexList.action",
`jsondata=${escape(JSON.stringify(body))}`), async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data['ret'] === 'ok') {
const taskList = data.data.data.list
for (let i = 0; i < taskList.length; ++i) {
const task = taskList[i]
if (task['tstatus'] === 1) {
$.log(`去做任务【${task['name']}】`)
await doTask(task['pid'], task['name'], "doTask")
await doTask(task['pid'], task['name'], "getMoney")
await $.wait(15 * 1000)
}
}
} else {
$.log(`获取任务列表失败,错误信息:${JSON.stringify(data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function doTask(taskId, taskName, action) {
let body = {
"appid": "xzwl",
//"exporturl": "https:\/\/kyshiman.com\/kkz\/channel?ref=436",
//"pageurl": "https:\/\/new.huanzhuti.com\/news\/26382197?cid=qsbk02",
"slidenum": 1,
"channel": "iOS",
"psign": "92dea068b6c271161be05ed358b59932",
"appversioncode": `${$.version}`,
"time": `${new Date().getTime()}`,
"apptoken": "xzwltoken070704",
"appversion": "5.6.5",
"openid": $.openID,
"os": "iOS",
"operatepath": "adDetail",
"taskId": taskId,
"billingtype": 2,
"pagetype": "adDetail",
// "name": taskName,
"taskExecuteId": 0
}
$.log(`jsondata=${escape(JSON.stringify(body))}`)
return new Promise(resolve => {
$.post(taskPostUrl(`jkd/mobile/base/welfaretask/${action}.action`,
`jsondata=${escape(JSON.stringify(body))}`), async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
//$.log(resp)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data['ret'] === 'ok') {
const taskList = data.data.data.list
for (let i = 0; i < taskList.length; ++i) {
const task = taskList[i]
if (task['tstatus'] === 1) {
await doTask()
}
}
} else {
$.log(`获取任务列表失败,错误信息:${JSON.stringify(data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function getOpenId() {
return new Promise(resolve => {
$.post(taskGetUrl("jkd/task/userSign.action", "channel=iO"), async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
$.openId = data.match(/var openid = "(\S*)"/)[1]
$.version = data.match(/var myversions = parseInt\("(.*)"\)/)[1]
if ($.openId) {
$.log(`获取openId成功`)
}
$.isSign = data.match(/var issign = parseInt\("(.*)"\)/)[1]
$.videoPacketNum = data.match(/var videoPacketNum = (\S*);/)[1]
$.newsTaskNum = data.match(/var newsTaskNum = (\S*);/)[1]
$.luckyDrawNum = (data.match(/var luckDrawTaskNum = (\S*);/)[1])
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function getUserInfo() {
let body = {
"openid": $.openId,
"channel": "iOS",
"os": "iOS",
"appversioncode": $.version,
"time": new Date().getTime().toString(),
"psign": "92dea068b6c271161be05ed358b59932",
"apptoken": "xzwltoken070704",
"appid": "xzwl",
"appversion": "5.6.5"
}
return new Promise(resolve => {
$.post(taskPostUrl("jkd/newMobileMenu/infoMe.action",
`jsondata=${escape(JSON.stringify(body))}`), async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data['ret'] === 'ok') {
$.userName = data.userinfo.username
$.sum = data.userinfo.infoMeSumCashItem.title + data.userinfo.infoMeSumCashItem.value
// $.current = data.userinfo.infoMeCurCashItem.title + data.userinfo.infoMeCurCashItem.value
$.gold = data.userinfo.infoMeGoldItem.title + ": " + data.userinfo.infoMeGoldItem.value
$.current = data.userinfo.infoMeCurCashItem.value
} else {
$.log(`个人信息获取失败,错误信息:${JSON.stringify(data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function sign() {
let body = `openID=${$.openId}&accountType=0`
return new Promise(resolve => {
$.get(taskGetUrl("jkd/task/sign.action", body), async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data['ret'] === 'ok') {
$.profit += data.datas.signAmt
$.log(`签到成功,获得 ${data.datas.signAmt} 金币,已签到 ${data.datas.signDays}天,下次签到金币:${data.datas.nextSignAmt}`)
$.log(`去做签到分享任务`)
await signShare(data.datas.position)
} else {
$.log(`签到失败,错误信息:${JSON.stringify(data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function getTaskBoxProfit(boxType = 1) {
let body = `box_type=${boxType}`
return new Promise(resolve => {
$.post(taskPostUrl("jkd/task/getTaskBoxProfit.action", body), async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data['ret'] === 'ok') {
$.log(`摇钱树开启成功,获得 ${data.profit} 金币`)
$.profit += data.profit
if (data.advertPopup && data.advertPopup.advert) {
$.log(`去做额外翻倍任务`)
await adv(data.advertPopup.position)
}
} else if (data['ret'] === 'fail') {
$.log(`摇钱树开启失败,错误信息:${data.rtn_msg}`)
} else {
$.log(`未知错误:${JSON.stringify(data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function signShare(position) {
let body = {
"openid": $.openId,
"channel": "iOS",
"os": "iOS",
"appversioncode": `${$.version}`,
"time": `${new Date().getTime()}`,
"psign": "92dea068b6c271161be05ed358b59932",
"position": position,
"apptoken": "xzwltoken070704",
"appid": "xzwl",
"appversion": "5.6.5"
}
return new Promise(resolve => {
$.post(taskPostUrl("jkd/account/signShareAccount.action",
`jsondata=${escape(JSON.stringify(body))}`), async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data['ret'] === 'ok') {
$.log(`签到分享成功,获得 ${data.profit} 金币`)
$.profit += data.profit
if (data.advertPopup && data.advertPopup.advert) {
$.log(`去做额外【${data.advertPopup.buttonText}】任务`)
await adv(data.advertPopup.position)
}
} else if (data['ret'] === 'fail') {
$.log(`签到失败,错误信息:${data.rtn_msg}`)
} else {
$.log(`未知错误:${JSON.stringify(data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function adv(position) {
let body = {
"openid": $.openId,
"channel": "iOS",
"os": "iOS",
"appversioncode": `${$.version}`,
"time": `${new Date().getTime()}`,
"psign": "92dea068b6c271161be05ed358b59932",
"position": position,
"apptoken": "xzwltoken070704",
"appid": "xzwl",
"appversion": "5.6.5"
}
return new Promise(resolve => {
$.post(taskPostUrl("jkd/newmobile/stimulateAdv.action",
`jsondata=${escape(JSON.stringify(body))}`), async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data['ret'] === 'ok') {
$.log(`点击视频成功,预计获得 ${data.rewardAmount ? data.rewardAmount : 0} 金币,等待 30 秒`)
await $.wait(31 * 1000)
body['time'] = `${new Date().getTime()}`
await rewardAdv(body)
} else if (data['ret'] === 'fail') {
$.log(`点击视频失败,错误信息:${data.rtn_msg}`)
} else {
$.log(`未知错误:${JSON.stringify(data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function rewardAdv(body) {
return new Promise(resolve => {
$.post(taskPostUrl("jkd/account/stimulateAdvAccount.action",
`jsondata=${escape(JSON.stringify(body))}`), async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data['ret'] === 'ok') {
$.log(`观看视频成功,获得${data.profit}金币`)
$.profit += data.profit
} else if (data['ret'] === 'fail') {
$.log(`观看视频失败,错误信息:${data.rtn_msg}`)
} else {
$.log(`未知错误:${JSON.stringify(data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function getArticleList(categoryId = 3) {
let body = {
"appid": "xzwl",
"connectionType": 100,
"optaction": "down",
"pagesize": 12,
"channel": "iOS",
"psign": "92dea068b6c271161be05ed358b59932",
"appversioncode": "565",
"time": "1609437200",
"apptoken": "xzwltoken070704",
"cateid": categoryId,
"openid": $.openId,
"os": "iOS",
"appversion": "5.6.5",
"operatorType": 2,
"page": 12
}
return new Promise(resolve => {
$.post(taskPostUrl("jkd/newmobile/artlist.action",
`jsondata=${escape(JSON.stringify(body))}`),
async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data['ret'] === 'ok') {
$.artList = data.artlist
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function openTimeBox() {
let body = {
"openid": $.openId,
"channel": "iOS",
"os": "iOS",
"appversioncode": `${$.version}`,
"time": `${new Date().getTime()}`,
"psign": "92dea068b6c271161be05ed358b59932",
"apptoken": "xzwltoken070704",
"appid": "xzwl",
"appversion": "5.6.5"
}
return new Promise(resolve => {
$.post(taskPostUrl("jkd/account/openTimeBoxAccount.action",
`jsondata=${escape(JSON.stringify(body))}`), async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data['ret'] === 'ok') {
$.log(`宝箱奖励领取成功,获得 ${data.profit} 金币`)
$.profit += data.profit
if (data.advertPopup && data.advertPopup.position) {
$.log(`去做额外【${data.advertPopup.buttonText}】任务`)
await adv(data.advertPopup.position)
}
} else if (data['ret'] === 'fail') {
$.log(`签到失败,错误信息:${data.rtn_msg}`)
} else {
$.log(`未知错误:${JSON.stringify(data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function getArticle(artId) {
let body = {
"time": `${new Date().getTime()}`,
"apptoken": "xzwltoken070704",
"appversion": "5.6.5",
"openid": $.openId,
"channel": "iOS",
"os": "iOS",
"psign": "92dea068b6c271161be05ed358b59932",
"artid": artId,
"appid": "xzwl"
}
return new Promise(resolve => {
$.post(taskPostUrl("jkd/newmobile/articleDetail.action",
`jsondata=${escape(JSON.stringify(body))}`), async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data['ret'] === 'ok') {
$.log(`articleDetail 记录成功`)
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function getVideo(artId) {
let body = {
"appid": "xzwl",
"channel": "iOS",
"psign": "92dea068b6c271161be05ed358b59932",
"appversioncode": $.version.toString(),
"time": new Date().getTime().toString(),
"apptoken": "xzwltoken070704",
"requestid": new Date().getTime().toString(),
"openid": $.openId,
"os": "iOS",
"artid": artId,
"appversion": "5.6.5",
"relate": "1",
"scenetype": ""
}
return new Promise(resolve => {
$.post(taskPostUrl("jkd/newmobile/artDetail.action",
`jsondata=${escape(JSON.stringify(body))}`), async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data['ret'] === 'ok') {
$.log(`artDetail 记录成功`)
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function getStageReward(stage) {
return new Promise(resolve => {
$.post(taskPostUrl("jkd/weixin20/newactivity/getStageReward.action",
`stage=${stage}`), async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data['ret'] === 'ok') {
$.log(`阶段奖励${stage}获取成功,获得 ${data.profit} 金币`)
$.profit += data.profit
} else if (data['ret'] === 'fail') {
$.log(`阶段奖励获取失败,错误信息:${data.rtn_msg}`)
} else {
$.log(`未知错误:${JSON.stringify(data)}`)
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function call2(uuid) {
let body = {
"openID": $.openId,
"openid": $.openId,
"app_id": "xzwl",
"version_token": `${$.version}`,
"channel": "iOS",
"vercode": `${$.version}`,
"psign": "92dea068b6c271161be05ed358b59932",
"app_token": "xzwltoken070704",
"version": "5.6.5",
"pars": {
"openID": $.openId,
"uniqueid": uuid,
"os": "iOS",
"channel": "iOS",
"openid": $.openId
}
}
return new Promise(resolve => {
$.post(taskPostUrl("jkd/minfo/call.action",
`jdata=${escape(JSON.stringify(body))}&opttype=ART_READ`),
async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
if (data['ret'] === 'ok') {
$.artcount = data.datas.artcount
$.videocount = data.datas.videocount
$.log(`文章剩余观看次数:${$.artcount},视频剩余观看次数:${$.videocount}`)
}
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function call1(uuid, article_id) {
let body = {
"openID": $.openId,
"openid": $.openId,
"app_id": "xzwl",
"version_token": `${$.version}`,
"channel": "iOS",
"vercode": `${$.version}`,
"psign": "92dea068b6c271161be05ed358b59932",
"app_token": "xzwltoken070704",
"version": "5.6.5",
"pars": {
"openID": $.openId,
"uniqueid": uuid,
"os": "iOS",
"channel": "iOS",
"openid": $.openId,
"article_id": article_id
}
}
return new Promise(resolve => {
$.post(taskPostUrl("jkd/minfo/call.action",
`jdata=${escape(JSON.stringify(body))}&opttype=INF_ART_COMMENTS`),
async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
if (safeGet(data)) {
data = JSON.parse(data);
// $.log(data)
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function article(artId) {
let body = `articleid=${artId}&openID=${$.openId}&ce=iOS&request_id=${new Date().getTime()}&scene_type=art_recommend_iOS&articlevideo=0&version=5.6.5&account_type=1&channel=iOS&shade=1&a=zv8lS5d9LnyV7Bdoyt0NHQ==&font_size=1&scene_type=&request_id=${new Date().getTime()}`
let config = {
'url': 'https://www.jukandiannews.com/jkd/weixin20/station/stationarticle.action?' + body,
'Host': 'www.jukandiannews.com',
'origin': 'https://www.jukandiannews.com',
'accept-language': 'zh-cn',
'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148',
'Cookie': cookie,
}
return new Promise(resolve => {
$.get(config, async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
$.log(`article 记录成功`)
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function openArticle(artId) {
let body = `openID=${$.openId}&articleID=${artId}&ce=iOS&articlevideo=0&event=oa&advCodeRandom=0&isShowAdv=1`
let config = {
'url': 'https://www.jukandiannews.com/jkd/weixin20/station/articleOpen.action',
body: body,
'Host': 'www.jukandiannews.com',
'accept': 'application/json, text/javascript, */*; q=0.01',
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
'origin': 'https://www.jukandiannews.com',
'accept-language': 'zh-cn',
'x-requested-with': 'XMLHttpRequest',
'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148',
'Cookie': cookie,
}
return new Promise(resolve => {
$.post(config, async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
$.log(`openArticle 记录成功`)
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function video(artId) {
let body = `platfrom_id=qtt-video&articleid=${artId}&openID=${$.openId}`
return new Promise(resolve => {
$.get(taskGetUrl('jkd/weixin20/station/cnzzinVideo.action', body), async (err, resp, data) => {
try {
if (err) {
$.log(`${JSON.stringify(err)}`)
$.log(`${$.name} API请求失败,请检查网路重试`)
} else {
$.log(`video 记录成功`)
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(data);
}
})
})
}
function readAccount(artId, payType = 1) {
let body = {
"appid": "xzwl",
"read_weal": 0,