-
Notifications
You must be signed in to change notification settings - Fork 1
/
raw_main_blackUnique.js
1652 lines (1588 loc) · 76.5 KB
/
raw_main_blackUnique.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:全球购骑士特权
直接appstore搜索下载,方便的话可以微信扫下面图片二维码走邀请注册,谢谢
https://raw.githubusercontent.com/leafxcy/JavaScript/main/blackUnique.jpg
定时为每小时一次,务必在0分到5分之间运行,目前每天大概1毛7
提现需要关注微信公众号,在公众号里申请提现
请手动点一下签到页面的【收零花钱】领一次金币,去【果园】里选择水果种子
青龙
捉https://market.chuxingyouhui.com/promo-bargain-api/activity/mqq/api/indexTopInfo的包
然后填在blackJSON里面,注意按照JSON格式填写。用青龙面板的环境变量或者外面用双引号的,字符串内需要用\"转义
export blackJSON='{"black-token":"", "token":"", "User-Agent":"", "appId":""}'
V2P,圈X:重写方法 -- 点击右下角【我的】-> 【每日签到赚现金】
[task_local]
#全球购骑士特权
0 * * * * , tag=全球购骑士特权, enabled=true
[rewrite_local]
https://market.chuxingyouhui.com/promo-bargain-api/activity/mqq/api/indexTopInfo? url script-request-header https://raw.githubusercontent.com/leafxcy/JavaScript/main/blackUnique.js
[MITM]
hostname = market.chuxingyouhui.com
*/
const jsname = '全球购骑士特权'
const $ = Env(jsname)
const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1
const logDebug = 0
//const notify = $.isNode() ? require('./sendNotify') : '';
let notifyStr = ''
let blackJSON = ($.isNode() ? (process.env.blackJSON) : ($.getval('blackJSON'))) || ''
let blackArr = []
let userIdx = 0
let reqTime = ''
let userSign = ''
let redPacketId = ''
let fruitId = ''
let userFruitId = ''
let activityId = ''
let redPacketCount = 0
let waterCount = 0
let fertilizerCount = 0
let clickTreeTimes = 1
let signRetryTimes = 3
let signRetryCount = 0
var todayDate = formatDateTime(new Date());
let bussinessInfo = '{}'
let rndtime = "" //毫秒
///////////////////////////////////////////////////////////////////
!(async () => {
if(typeof $request !== "undefined")
{
await getRewrite()
}
else
{
//检查环境变量
if(!(await checkEnv())){
return
}
console.log('\n提现需要关注微信公众号,在公众号里申请提现')
for(userIdx=0; userIdx<blackArr.length; userIdx++) {
console.log(`\n===== 开始用户${userIdx+1} =====`)
await querySignStatus()
await listUserTask()
//await listRedPacket()
//收取存钱罐看视频需要前置条件
//await queryPiggyInfo()
//翻卡看视频需要前置条件
//await getUserFlopRecord()
await userFruitDetail()
await waterTaskList()
await nutrientTaskList()
await userFertilizerDetail()
await getTreeCoupon()
await userInfo()
}
await showmsg()
}
})()
.catch((e) => $.logErr(e))
.finally(() => $.done())
//通知
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("mqq/api/indexTopInfo?appId=") > -1) {
let blackCk = {"black-token":"", "token":"", "User-Agent":"", "appId":""}
let msgStr = ''
let matchItem = $request.url.match(/appId=([\w]+)/)
blackCk['appId'] = matchItem[1]
msgStr += `获取到appId: ${blackCk['appId']}\n`
blackCk['black-token'] = $request.headers['black-token']
msgStr += `获取到black-token: ${blackCk['black-token']}\n`
blackCk['token'] = $request.headers['token']
msgStr += `获取到token: ${blackCk['token']}\n`
blackCk['User-Agent'] = $request.headers['User-Agent']
msgStr += `获取到User-Agent: ${blackCk['User-Agent']}\n`
if(blackCk['black-token']) {
if(blackJSON) {
if(blackJSON.indexOf(blackCk['black-token']) == -1) {
blackJSON = blackJSON + '@' + JSON.stringify(blackCk)
numUser = blackJSON.split('@')
msgStr = `获取到第${numUser.length}个账户ck\n` + msgStr
$.setdata(blackJSON,'blackJSON')
$.msg(msgStr)
} else {
$.log('检测到重复的账户ck')
}
} else {
msgStr = `获取到第一个账户ck\n` + msgStr
$.setdata(JSON.stringify(blackCk),'blackJSON')
$.msg(msgStr)
}
}
}
}
async function checkEnv()
{
if(blackJSON) {
for(let users of blackJSON.split('@')) {
blackArr.push(JSON.parse(users))
}
} else {
console.log('未找到blackJSON')
return false
}
if(blackArr.length == 0) {
console.log('未找到有效的blackJSON')
return false
}
console.log(`共找到${blackArr.length}个用户`)
return true
}
//==========================================================================
//获取视频信息
async function getBussinessInfo(adId,activityType,bussinessType,version) {
let caller = printCaller()
//rndtime = Math.round(new Date().getTime())
reqBody = `{"adId":"${adId}","activityType":${activityType},"bussinessType":"${bussinessType}","version":"${version}"}`
encodeBody = encodeURIComponent(reqBody)
return new Promise((resolve) => {
let url = {
url: 'https://market.chuxingyouhui.com/promo-bargain-api/video/api/v1_0/getBussinessInfo',
headers: {
'Host' : 'market.chuxingyouhui.com',
'request-body' : encodeBody,
'Accept' : 'application/json, text/plain, */*',
'Accept-Language' : 'zh-CN,zh-Hans;q=0.9',
'Accept-Encoding' : 'gzip, deflate, br',
'token' : blackArr[userIdx]['token'],
'Content-Type' : 'application/json;charset=utf-8',
'Origin' : 'https://m.black-unique.com',
'User-Agent' : blackArr[userIdx]['User-Agent'],
'black-token' : blackArr[userIdx]['black-token'],
'Referer' : 'https://m.black-unique.com/',
'Connection' : 'keep-alive',
},
body: reqBody
};
$.post(url, async (err, resp, data) => {
try {
if (err) {
console.log("Fucntion " + caller + ": API请求失败");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if(logDebug) console.log(result);
if(result.code == 200) {
bussinessInfo = result.data ? JSON.stringify(result.data) : '{}'
} else {
console.log(`获取视频信息失败:${result.msg}`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//获取签到状态
async function querySignStatus() {
let caller = printCaller()
//rndtime = Math.round(new Date().getTime())
return new Promise((resolve) => {
let url = {
url: 'https://market.chuxingyouhui.com/promo-bargain-api/activity/weekSign/api/v1_0/calendar?appId='+blackArr[userIdx]['appId'],
headers: {
'Host' : 'market.chuxingyouhui.com',
'Origin' : 'https://m.black-unique.com',
'Accept-Encoding' : 'gzip, deflate, br',
'Connection' : 'keep-alive',
'black-token' : blackArr[userIdx]['black-token'],
'Accept' : 'application/json, text/plain, */*',
'User-Agent' : blackArr[userIdx]['User-Agent'],
'Referer' : 'https://m.black-unique.com/',
'token' : blackArr[userIdx]['token'],
'Accept-Language' : 'zh-CN,zh-Hans;q=0.9',
},
};
$.get(url, async (err, resp, data) => {
try {
if (err) {
console.log("Fucntion " + caller + ": API请求失败");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if(logDebug) console.log(result);
if(result.code == 200) {
if(result.data && result.data.calendar && Array.isArray(result.data.calendar)) {
for(let i=0; i< result.data.calendar.length; i++) {
let signItem = result.data.calendar[i]
if(signItem.isToday == true) {
if(signItem.signStyle == 0) {
await doSign()
} else {
console.log(`\n今日已签到\n`)
}
}
}
}
} else {
console.log(`\n获取签到状态失败:${result.msg}\n`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//签到
async function doSign() {
let caller = printCaller()
//rndtime = Math.round(new Date().getTime())
reqBody = `{}`
encodeBody = encodeURIComponent(reqBody)
return new Promise((resolve) => {
let url = {
url: 'https://market.chuxingyouhui.com/promo-bargain-api/activity/weekSign/api/v1_0/sign?appId='+blackArr[userIdx]['appId'],
headers: {
'Host' : 'market.chuxingyouhui.com',
'request-body' : encodeBody,
'Accept' : 'application/json, text/plain, */*',
'Accept-Language' : 'zh-CN,zh-Hans;q=0.9',
'Accept-Encoding' : 'gzip, deflate, br',
'token' : blackArr[userIdx]['token'],
'Content-Type' : 'application/json;charset=utf-8',
'Origin' : 'https://m.black-unique.com',
'User-Agent' : blackArr[userIdx]['User-Agent'],
'black-token' : blackArr[userIdx]['black-token'],
'Referer' : 'https://m.black-unique.com/',
'Connection' : 'keep-alive',
},
body: reqBody
};
$.post(url, async (err, resp, data) => {
try {
if (err) {
console.log("Fucntion " + caller + ": API请求失败");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if(logDebug) console.log(result);
if(result.code == 200) {
console.log(`\n签到成功获得:${result.data.reward}金币,已连续签到${result.data.continuouslyDay}天\n`)
} else {
console.log(`\n签到失败:${result.msg}\n`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//日常-任务列表
async function listUserTask() {
let caller = printCaller()
rndtime = Math.round(new Date().getTime())
reqBody = `{"activityType":13}`
encodeBody = encodeURIComponent(reqBody)
return new Promise((resolve) => {
let url = {
url: 'https://market.chuxingyouhui.com/promo-bargain-api/activity/task/api/list_user_task',
headers: {
'Host' : 'market.chuxingyouhui.com',
'request-body' : encodeBody,
'Accept' : 'application/json, text/plain, */*',
'Accept-Language' : 'zh-CN,zh-Hans;q=0.9',
'Accept-Encoding' : 'gzip, deflate, br',
'token' : blackArr[userIdx]['token'],
'Content-Type' : 'application/json;charset=utf-8',
'Origin' : 'https://m.black-unique.com',
'User-Agent' : blackArr[userIdx]['User-Agent'],
'black-token' : blackArr[userIdx]['black-token'],
'Referer' : 'https://m.black-unique.com/',
'Connection' : 'keep-alive',
},
body: reqBody
};
$.post(url, async (err, resp, data) => {
try {
if (err) {
console.log("Fucntion " + caller + ": API请求失败");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if(logDebug) console.log(result);
if(result.code == 200) {
if(result.data && Array.isArray(result.data)) {
for(let i=0; i<result.data.length; i++) {
let taskItem = result.data[i]
if(taskItem.status == 0 && taskItem.finishedTimes < taskItem.totalTimes) {
if(taskItem.taskType.indexOf('RECEIVE_MEDAL') > -1 && (rndtime < taskItem.receiveStartTime || rndtime > taskItem.receiveEndTime)) {
//非整点领勋章时间
continue
} else if(taskItem.taskType.indexOf('SHOPPING') > -1) {
//跳过购物任务
continue
}
await $.wait(1000)
await doTask(taskItem.taskType,taskItem.userTaskId,taskItem.taskTitle)
}
}
}
} else {
console.log(`查询任务列表失败:${result.msg}`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//日常-完成任务
async function doTask(taskType,userTaskId,taskTitle) {
let caller = printCaller()
//rndtime = Math.round(new Date().getTime())
reqBody = `{"activityType":13,"taskType":"${taskType}","userTaskId":"${userTaskId}"}`
encodeBody = encodeURIComponent(reqBody)
return new Promise((resolve) => {
let url = {
url: 'https://market.chuxingyouhui.com/promo-bargain-api/activity/task/api/doTask',
headers: {
'Host' : 'market.chuxingyouhui.com',
'request-body' : encodeBody,
'Accept' : 'application/json, text/plain, */*',
'Accept-Language' : 'zh-CN,zh-Hans;q=0.9',
'Accept-Encoding' : 'gzip, deflate, br',
'token' : blackArr[userIdx]['token'],
'Content-Type' : 'application/json;charset=utf-8',
'Origin' : 'https://m.black-unique.com',
'User-Agent' : blackArr[userIdx]['User-Agent'],
'black-token' : blackArr[userIdx]['black-token'],
'Referer' : 'https://m.black-unique.com/',
'Connection' : 'keep-alive',
},
body: reqBody
};
$.post(url, async (err, resp, data) => {
try {
if (err) {
console.log("Fucntion " + caller + ": API请求失败");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if(logDebug) console.log(result);
if(result.code == 200) {
console.log(`完成任务【${result.data.taskTitle}】:获得${result.data.rewardScore}勋章`)
} else {
console.log(`完成任务【${taskTitle}】失败:${result.msg}`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//存钱罐状态
async function queryPiggyInfo() {
let caller = printCaller()
//rndtime = Math.round(new Date().getTime())
return new Promise((resolve) => {
let url = {
url: 'https://market.chuxingyouhui.com/promo-bargain-api/activity/golden/api/queryUserAccountInfo?appId='+blackArr[userIdx]['appId'],
headers: {
'Host' : 'market.chuxingyouhui.com',
'Origin' : 'https://m.black-unique.com',
'Accept-Encoding' : 'gzip, deflate, br',
'Connection' : 'keep-alive',
'black-token' : blackArr[userIdx]['black-token'],
'Accept' : 'application/json, text/plain, */*',
'User-Agent' : blackArr[userIdx]['User-Agent'],
'Referer' : 'https://m.black-unique.com/',
'token' : blackArr[userIdx]['token'],
'Accept-Language' : 'zh-CN,zh-Hans;q=0.9',
},
};
$.get(url, async (err, resp, data) => {
try {
if (err) {
console.log("Fucntion " + caller + ": API请求失败");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if(logDebug) console.log(result);
if(result.code == 200) {
if(parseFloat(result.data.goldenAmount) < parseFloat(result.data.dayCeil)) {
if(parseFloat(result.data.piggyAmount) >= 1) {
await getBussinessInfo(946088114,7,'GOLDEN_CLICK','v3')
await clickPiggy()
}
} else {
console.log(`\n存钱罐提取已达到当天上限:${result.data.dayCeil}\n`)
}
} else {
console.log(`\n查询存钱罐状态失败:${result.msg}\n`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//提取存钱罐金币
async function clickPiggy() {
let caller = printCaller()
//rndtime = Math.round(new Date().getTime())
reqBody = `{"appId":"${blackArr[userIdx]['appId']}","extraReq":${bussinessInfo}}`
encodeBody = encodeURIComponent(reqBody)
return new Promise((resolve) => {
let url = {
url: 'https://market.chuxingyouhui.com/promo-bargain-api/activity/golden/api/v1_0/click',
headers: {
'Host' : 'market.chuxingyouhui.com',
'request-body' : encodeBody,
'Accept' : 'application/json, text/plain, */*',
'Accept-Language' : 'zh-CN,zh-Hans;q=0.9',
'Accept-Encoding' : 'gzip, deflate, br',
'token' : blackArr[userIdx]['token'],
'Content-Type' : 'application/json;charset=utf-8',
'Origin' : 'https://m.black-unique.com',
'User-Agent' : blackArr[userIdx]['User-Agent'],
'black-token' : blackArr[userIdx]['black-token'],
'Referer' : 'https://m.black-unique.com/',
'Connection' : 'keep-alive',
},
body: reqBody
};
$.post(url, async (err, resp, data) => {
try {
if (err) {
console.log("Fucntion " + caller + ": API请求失败");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if(logDebug) console.log(result);
if(result.code == 200) {
console.log(`\n提取存钱罐金币成功,金币余额${result.data.goldenAmount}\n`)
} else {
console.log(`\n提取存钱罐金币失败:${result.msg}\n`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//查询翻牌领提现额度
async function getUserFlopRecord() {
let caller = printCaller()
//rndtime = Math.round(new Date().getTime())
reqBody = `{"appId":"${blackArr[userIdx]['appId']}","queryDay":"${todayDate}"}`
encodeBody = encodeURIComponent(reqBody)
return new Promise((resolve) => {
let url = {
url: 'https://market.chuxingyouhui.com/promo-bargain-api/activity/flop/api/getUserFlopRecord',
headers: {
'Host' : 'market.chuxingyouhui.com',
'request-body' : encodeBody,
'Accept' : 'application/json, text/plain, */*',
'Accept-Language' : 'zh-CN,zh-Hans;q=0.9',
'Accept-Encoding' : 'gzip, deflate, br',
'token' : blackArr[userIdx]['token'],
'Content-Type' : 'application/json;charset=utf-8',
'Origin' : 'https://m.black-unique.com',
'User-Agent' : blackArr[userIdx]['User-Agent'],
'black-token' : blackArr[userIdx]['black-token'],
'Referer' : 'https://m.black-unique.com/',
'Connection' : 'keep-alive',
},
body: reqBody
};
$.post(url, async (err, resp, data) => {
try {
if (err) {
console.log("Fucntion " + caller + ": API请求失败");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if(logDebug) console.log(result);
if(result.code == 200) {
if(result.data && result.data.recordList && Array.isArray(result.data.recordList)) {
for (let i=0; i<result.data.recordList.length; i++) {
let recordItem = result.data.recordList[i]
if(!recordItem.status) {
await getBussinessInfo(946087990,12,'WITHDRAWAL_WATCH_VIDEO','v3')
await $.wait(1000)
await userFlop(recordItem.serialNumber)
}
}
}
} else {
console.log(`查询翻牌状态失败:${result.msg}`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//翻牌领提现额度
async function userFlop(serialNumber) {
let caller = printCaller()
//rndtime = Math.round(new Date().getTime())
reqBody = `{"appId":"${blackArr[userIdx]['appId']}","serialNumber":${serialNumber},"flopDay":"${todayDate}","extraReq":${bussinessInfo}}`
encodeBody = encodeURIComponent(reqBody)
return new Promise((resolve) => {
let url = {
url: 'https://market.chuxingyouhui.com/promo-bargain-api/activity/flop/api/flop',
headers: {
'Host' : 'market.chuxingyouhui.com',
'request-body' : encodeBody,
'Accept' : 'application/json, text/plain, */*',
'Accept-Language' : 'zh-CN,zh-Hans;q=0.9',
'Accept-Encoding' : 'gzip, deflate, br',
'token' : blackArr[userIdx]['token'],
'Content-Type' : 'application/json;charset=utf-8',
'Origin' : 'https://m.black-unique.com',
'User-Agent' : blackArr[userIdx]['User-Agent'],
'black-token' : blackArr[userIdx]['black-token'],
'Referer' : 'https://m.black-unique.com/',
'Connection' : 'keep-alive',
},
body: reqBody
};
$.post(url, async (err, resp, data) => {
try {
if (err) {
console.log("Fucntion " + caller + ": API请求失败");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if(logDebug) console.log(result);
if(result.code == 200) {
console.log(`翻牌获得提现额度:${result.data.amount}元`)
} else {
console.log(`翻牌获得提现额度失败:${result.msg}`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//定点红包列表
async function listRedPacket() {
let caller = printCaller()
//rndtime = Math.round(new Date().getTime())
curTime = new Date()
currentHour = curTime.getHours()
let isGetRedTime = ((currentHour < 23) && (currentHour > 6)) ? 1 : 0
return new Promise((resolve) => {
let url = {
url: 'https://fanxian-api.chuxingyouhui.com/api/redPacketIncome/v1_0/listRedPacket',
headers: {
'Host' : 'fanxian-api.chuxingyouhui.com',
'Accept-Language' : 'zh-CN,zh-Hans;q=0.9',
'newcomer' : 'true',
'Accept-Encoding' : 'gzip, deflate, br',
'token' : blackArr[userIdx]['token'],
'Origin' : 'https://m.black-unique.com',
'User-Agent' : blackArr[userIdx]['User-Agent'],
'Referer' : 'https://m.black-unique.com/',
'Content-Length' : '0',
'Connection' : 'keep-alive',
'Accept' : 'application/json, text/plain, */*',
},
};
$.post(url, async (err, resp, data) => {
try {
if (err) {
console.log("Fucntion " + caller + ": API请求失败");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if(logDebug) console.log(result);
if(result.code == 200) {
if(isGetRedTime == 1 && result.data && result.data.redPacketList && Array.isArray(result.data.redPacketList)) {
redPacketCount = 0
for(let i=0; i<result.data.redPacketList.length; i++) {
let redItem = result.data.redPacketList[i]
if(redItem.money > 0) {
redPacketCount++
}
if(redItem.status == 2 && redItem.money == 0 && redPacketCount < 7) {
signRetryCount = 0
await getSignInfo('open')
await $.wait(500)
await openRedPacket()
}
}
}
} else {
console.log(`查询红包列表失败:${result.msg}`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//开定点红包
async function openRedPacket() {
let caller = printCaller()
//rndtime = Math.round(new Date().getTime()/1000)
return new Promise((resolve) => {
let url = {
url: 'https://pyp-api.chuxingyouhui.com/api/knightCard/redPacket/v1_0/openRedPacket',
headers: {
'Host' : 'pyp-api.chuxingyouhui.com',
'Accept' : 'application/json, text/plain, */*',
'ymd' : '0',
'newcomer' : 'true',
'token' : blackArr[userIdx]['token'],
'Accept-Language' : 'zh-CN,zh-Hans;q=0.9',
'Origin' : 'https://m.black-unique.com',
'User-Agent' : blackArr[userIdx]['User-Agent'],
'Referer' : 'https://m.black-unique.com/',
'Accept-Encoding' : 'gzip, deflate, br',
'Connection' : 'keep-alive',
'Content-Type' : 'application/json;charset=utf-8',
},
body: `{"click":false,"sign":"${userSign}","ts":"${reqTime}"}`
};
$.post(url, async (err, resp, data) => {
try {
if (err) {
console.log("Fucntion " + caller + ": API请求失败");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if(logDebug) console.log(result);
if(result.code == 200) {
console.log(`打开红包获得:${result.data.money}现金`)
signRetryCount = 0
await getSignInfo('boom')
await $.wait(2000)
await boomRedPacket()
} else {
console.log(`打开红包失败:${result.msg}`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//定点红包翻倍
async function boomRedPacket() {
let caller = printCaller()
//rndtime = Math.round(new Date().getTime()/1000)
return new Promise((resolve) => {
let url = {
url: 'https://fanxian-api.chuxingyouhui.com/api/redPacket/increase/v1_0/boom',
headers: {
'Host' : 'fanxian-api.chuxingyouhui.com',
'Accept' : 'application/json, text/plain, */*',
'Accept-Language' : 'zh-CN,zh-Hans;q=0.9',
'token' : blackArr[userIdx]['token'],
'Accept-Encoding' : 'gzip, deflate, br',
'Origin' : 'https://m.black-unique.com',
'User-Agent' : blackArr[userIdx]['User-Agent'],
'Referer' : 'https://m.black-unique.com/',
'Connection' : 'keep-alive',
'Content-Type' : 'application/json;charset=utf-8',
},
body: `{"redPacketId":"${redPacketId}","sign":"${userSign}","ts":"${reqTime}"}`,
};
$.post(url, async (err, resp, data) => {
try {
if (err) {
console.log("Fucntion " + caller + ": API请求失败");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if(logDebug) console.log(result);
if(result.code == 200) {
console.log(`红包翻倍获得:${result.data.redPacketIncreaseAmount}现金`)
} else {
console.log(`红包翻倍失败:${result.msg}`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//果园状态
async function userFruitDetail() {
let caller = printCaller()
//rndtime = Math.round(new Date().getTime()/1000)
reqBody = `{"appId":"${blackArr[userIdx]['appId']}","isMiniProgram":false}`
encodeBody = encodeURIComponent(reqBody)
return new Promise((resolve) => {
let url = {
url: 'https://market.chuxingyouhui.com/promo-bargain-api/garden/api/v1_0/userFruitDetail',
headers: {
'Host' : 'market.chuxingyouhui.com',
'request-body' : encodeBody,
'Accept' : 'application/json, text/plain, */*',
'Accept-Language' : 'zh-CN,zh-Hans;q=0.9',
'Accept-Encoding' : 'gzip, deflate, br',
'token' : blackArr[userIdx]['token'],
'Content-Type' : 'application/json;charset=utf-8',
'Origin' : 'https://m.black-unique.com',
'User-Agent' : blackArr[userIdx]['User-Agent'],
'black-token' : blackArr[userIdx]['black-token'],
'Connection' : 'keep-alive',
},
body: reqBody,
};
$.post(url, async (err, resp, data) => {
try {
if (err) {
console.log("Fucntion " + caller + ": API请求失败");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if(logDebug) console.log(result);
if(result.code == 200) {
console.log(`你现在种的水果是 ${result.data.fruitName} ${result.data.specification},${result.data.progressWord}`)
console.log(`今天已浇水${result.data.wateredTimes}次,剩余水滴数量:${result.data.remainAmount}`)
fruitId = result.data.fruitId
userFruitId = result.data.userFruitId
activityId = result.data.activityId
if(result.data.canReceiveStatus == 1 && result.data.canReceiveAmount > 0) {
await receiveWaterDrop('TOMORROW_REWARD','null','每日水滴')
}
if(result.data.gardenStageRewardResp && result.data.gardenStageRewardResp.status == 1) {
await fruitStageReward()
}
if(result.data.remainAmount >= 10) {
waterCount = 0
console.log(`开始浇水,请等候......`)
await wateringFruit()
console.log(`浇水结束,本次共浇水${waterCount}次`)
}
} else {
console.log(`查询果园状态失败:${result.msg}`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//果园水果进度奖励
async function fruitStageReward() {
let caller = printCaller()
//rndtime = Math.round(new Date().getTime()/1000)
reqBody = `{"userFruitId":"${userFruitId}","appId":"${blackArr[userIdx]['appId']}"}`
encodeBody = encodeURIComponent(reqBody)
return new Promise((resolve) => {
let url = {
url: 'https://market.chuxingyouhui.com/promo-bargain-api/garden/api/v1_0/receiveStageReward',
headers: {
'Host' : 'market.chuxingyouhui.com',
'request-body' : encodeBody,
'Accept' : 'application/json, text/plain, */*',
'Accept-Language' : 'zh-CN,zh-Hans;q=0.9',
'Accept-Encoding' : 'gzip, deflate, br',
'token' : blackArr[userIdx]['token'],
'Content-Type' : 'application/json;charset=utf-8',
'Origin' : 'https://m.black-unique.com',
'User-Agent' : blackArr[userIdx]['User-Agent'],
'black-token' : blackArr[userIdx]['black-token'],
'Connection' : 'keep-alive',
},
body: reqBody,
};
$.post(url, async (err, resp, data) => {
try {
if (err) {
console.log("Fucntion " + caller + ": API请求失败");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if(logDebug) console.log(result);
if(result.code == 200) {
console.log(`领取水果进度奖励:${result.data.rewardNum}水滴`)
} else {
console.log(`领取水果进度奖励失败:${result.msg}`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}
//果园浇水
async function wateringFruit() {
let caller = printCaller()
//rndtime = Math.round(new Date().getTime()/1000)
reqBody = `{"userFruitId":"${userFruitId}"}`
encodeBody = encodeURIComponent(reqBody)
return new Promise((resolve) => {
let url = {
url: 'https://market.chuxingyouhui.com/promo-bargain-api/garden/api/v1_0/watering',
headers: {
'Host' : 'market.chuxingyouhui.com',
'request-body' : encodeBody,
'Accept' : 'application/json, text/plain, */*',
'Accept-Language' : 'zh-CN,zh-Hans;q=0.9',
'Accept-Encoding' : 'gzip, deflate, br',
'token' : blackArr[userIdx]['token'],
'Content-Type' : 'application/json;charset=utf-8',
'Origin' : 'https://m.black-unique.com',
'User-Agent' : blackArr[userIdx]['User-Agent'],
'black-token' : blackArr[userIdx]['black-token'],
'Connection' : 'keep-alive',
},
body: reqBody,
};
$.post(url, async (err, resp, data) => {
try {
if (err) {
console.log("Fucntion " + caller + ": API请求失败");
console.log(JSON.stringify(err));
$.logErr(err);
} else {
if (safeGet(data)) {
let result = JSON.parse(data);
if(logDebug) console.log(result);
if(result.code == 200) {
if(result.data.level && !result.data.remindType) {
if(result.data.upgrade == true) {
console.log(`果树升级到 ${result.data.level} 获得:${result.data.upgradeReward}水滴`)
}
waterCount++
await $.wait(500)
await wateringFruit()
}
} else {
console.log(`浇水失败:${result.msg}`)
}
}
}
} catch (e) {
$.logErr(e, resp);
} finally {
resolve();
}
});
});
}