@@ -19,6 +19,8 @@ https://raw.githubusercontent.com/leafxcy/JavaScript/main/shangtuo.jpg
1919脚本默认红包余额满0.5自动提现,可以自己新建一个环境变量 stCash 设定红包余额提现金额,export stCash=20
2020!!!但是不建议提现20块以下,因为手续费高,只有0.5手续费低!!!
2121
22+ 脚本会自动把红包余额转换为消费余额来抢更高面额的券,如果不想换的自己建一个环境变量 stExchange 设为0,export stExchange=0
23+
2224CK有效期较短,可能几天后需要重新捉
2325只测试了IOS,测试过V2P,青龙可以跑
2426
@@ -56,6 +58,7 @@ let userNum = 0
5658let userInfo = ""
5759
5860var packWithdrawAmount = ( $ . isNode ( ) ? ( process . env . stCash ) : ( $ . getval ( 'stCash' ) ) ) || 0.5 ;
61+ var autoExchange = ( $ . isNode ( ) ? ( process . env . stExchange ) : ( $ . getval ( 'stExchange' ) ) ) || 1 ;
5962
6063let secretCode
6164
@@ -65,6 +68,9 @@ let grabCount
6568let getBondListFlag
6669let quanList
6770
71+ let retryLimit = 5
72+ let retryTime
73+
6874let logDebug = 0
6975let logCaller = 0
7076
@@ -95,8 +101,11 @@ const notify = $.isNode() ? require('./sendNotify') : '';
95101 if ( accountStatus ) {
96102
97103 //看广告得分红金
104+ retryTime = 0
98105 await getAdvertPage ( 1 ) ;
99106 await $ . wait ( 1000 ) ;
107+ await getAdvertPage ( 2 ) ;
108+ await $ . wait ( 1000 ) ;
100109
101110 //提取分红金
102111 await changeDividendBonusToBalance ( ) ;
@@ -292,6 +301,7 @@ function getUserInfoData(checkStatus,timeout = 0) {
292301//广告列表id
293302function getAdvertPage ( pageNo , timeout = 0 ) {
294303 if ( logCaller ) console . log ( "call " + printCaller ( ) )
304+ retryTime ++
295305 return new Promise ( ( resolve ) => {
296306 let request = {
297307 url : `https://api.shatuvip.com/advert/getAdvertPage?type=1&pageNo=${ pageNo } &column_id=1` ,
@@ -314,6 +324,9 @@ function getAdvertPage(pageNo,timeout = 0) {
314324 if ( err ) {
315325 console . log ( "API请求失败" ) ;
316326 console . log ( err + " at function " + printCaller ( ) ) ;
327+ if ( retryTime < retryLimit ) {
328+ await getAdvertPage ( pageNo )
329+ }
317330 } else {
318331 if ( safeGet ( data ) ) {
319332 let result = JSON . parse ( data )
@@ -323,7 +336,6 @@ function getAdvertPage(pageNo,timeout = 0) {
323336 adNum = result . result . length
324337 compTaskFlag = 1
325338 for ( let i = 0 ; i < adNum && compTaskFlag ; i ++ ) {
326- compTaskFlag = 0
327339 cid = result . result [ i ] . id
328340 await getAdvertInfo ( cid )
329341 await completeTask ( cid , secretCode )
@@ -422,9 +434,9 @@ function completeTask(cid,secret,timeout = 0) {
422434 if ( result . code == 0 ) {
423435 if ( result . msg ) {
424436 console . log ( `获得${ result . msg } ` )
425- compTaskFlag = 1
426437 } else {
427438 console . log ( `没有获得分红金,结束浏览广告` )
439+ compTaskFlag = 0
428440 }
429441 } else {
430442 console . log ( `获取分红金失败:${ result . msg } ` )
@@ -1045,6 +1057,7 @@ function getUserBalanceWith(timeout = 0) {
10451057 await $ . wait ( 1000 ) ;
10461058 if ( result . result . balance >= 88 ) {
10471059 console . log ( `\n分红金余额:${ result . result . balance } ,开始尝试提现` )
1060+ retryTime = 0
10481061 await getBalanceWithdrawalData ( 0 , result . result . balance )
10491062 } else {
10501063 console . log ( `\n分红金余额:${ result . result . balance } ,不执行提现` )
@@ -1096,6 +1109,7 @@ function getPopularizeBalance(timeout = 0) {
10961109 await $ . wait ( 1000 ) ;
10971110 if ( result . result . balance >= 1 ) {
10981111 console . log ( `\n推广余额:${ result . result . balance } ,开始尝试提现` )
1112+ retryTime = 0
10991113 await getBalanceWithdrawalData ( 2 , result . result . balance )
11001114 } else {
11011115 console . log ( `\n推广余额:${ result . result . balance } ,不执行提现` )
@@ -1147,12 +1161,19 @@ function getPackBalance(move,timeout = 0) {
11471161 if ( result . code == 0 ) {
11481162 await $ . wait ( 1000 ) ;
11491163 if ( move == 0 ) {
1150- if ( result . result . balance > 0 ) {
1151- console . log ( `` )
1152- await balancePackChangeBalance ( result . result . balance )
1164+ if ( autoExchange > 0 ) {
1165+ console . log ( `\n您当前设置为自动转换消费余额` )
1166+ if ( result . result . balance > 0.5 ) {
1167+ await balancePackChangeBalance ( result . result . balance - 0.5 )
1168+ } else {
1169+ console . log ( `\n红包余额${ result . result . balance } ,少于0.5,不转换消费余额` )
1170+ }
1171+ } else {
1172+ console . log ( `\n您当前设置为不转换消费余额` )
11531173 }
11541174 } else {
11551175 if ( result . result . balance >= packWithdrawAmount ) {
1176+ retryTime = 0
11561177 console . log ( `\n红包余额${ result . result . balance } ,尝试为你提现${ packWithdrawAmount } ` )
11571178 await getBalanceWithdrawalData ( 1 , result . result . balance , packWithdrawAmount )
11581179 } else {
@@ -1341,6 +1362,7 @@ function queryWithdrawId(id,balance,timeout = 0) {
13411362//提现
13421363function balanceWithdrawal ( id , withdrawMoney , timeout = 0 ) {
13431364 if ( logCaller ) console . log ( "call " + printCaller ( ) )
1365+ retryTime ++
13441366 return new Promise ( ( resolve , reject ) => {
13451367 let request = {
13461368 url : `https://api.shatuvip.com/withdrawal/balanceWithdrawal` ,
@@ -1364,6 +1386,9 @@ function balanceWithdrawal(id,withdrawMoney,timeout = 0) {
13641386 if ( err ) {
13651387 console . log ( "API请求失败" ) ;
13661388 console . log ( err + " at function " + printCaller ( ) ) ;
1389+ if ( retryTime < retryLimit ) {
1390+ await balanceWithdrawal ( id , withdrawMoney )
1391+ }
13671392 } else {
13681393 if ( safeGet ( data ) ) {
13691394 await $ . wait ( 1000 ) ;
0 commit comments