@@ -30,7 +30,8 @@ console.log('\n====================Hello World====================\n')
30
30
//Node.js用户请在jdCookie.js处填写京东ck;
31
31
//ios等软件用户直接用NobyDa的jd cookie
32
32
let jdNotify = true ; //是否开启静默运行。默认true开启
33
- let cookiesArr = [ ] , cookie = '' , jdPlantBeanShareArr = [ ] , isBox = false , notify , newShareCodes , option , message , subTitle ;
33
+ let cookiesArr = [ ] , cookie = '' , jdPlantBeanShareArr = [ ] , isBox = false , notify , newShareCodes , option , message ,
34
+ subTitle ;
34
35
//京东接口地址
35
36
const JD_API_HOST = 'https://api.m.jd.com/client.action' ;
36
37
//助力好友分享码(最多3个,否则后面的助力失败)
@@ -281,14 +282,18 @@ async function doTask() {
281
282
const { data} = $ . shopTaskListRes ;
282
283
let goodShopListARR = [ ] , moreShopListARR = [ ] , shopList = [ ] ;
283
284
const { goodShopList, moreShopList} = data ;
284
- for ( let i of goodShopList ) {
285
- if ( i . taskState === '2' ) {
286
- goodShopListARR . push ( i ) ;
285
+ if ( goodShopList ) {
286
+ for ( let i of goodShopList ) {
287
+ if ( i . taskState === '2' ) {
288
+ goodShopListARR . push ( i ) ;
289
+ }
287
290
}
288
291
}
289
- for ( let j of moreShopList ) {
290
- if ( j . taskState === '2' ) {
291
- moreShopListARR . push ( j ) ;
292
+ if ( moreShopList ) {
293
+ for ( let j of moreShopList ) {
294
+ if ( j . taskState === '2' ) {
295
+ moreShopListARR . push ( j ) ;
296
+ }
292
297
}
293
298
}
294
299
shopList = goodShopListARR . concat ( moreShopListARR ) ;
@@ -498,7 +503,10 @@ async function collectUserNutr(paradiseUuid) {
498
503
}
499
504
500
505
async function receiveNutrients ( ) {
501
- $ . receiveNutrientsRes = await request ( 'receiveNutrients' , { "roundId" : currentRoundId , "monitor_refer" : "plant_receiveNutrients" } )
506
+ $ . receiveNutrientsRes = await request ( 'receiveNutrients' , {
507
+ "roundId" : currentRoundId ,
508
+ "monitor_refer" : "plant_receiveNutrients"
509
+ } )
502
510
// console.log(`定时领取营养液结果:${JSON.stringify($.receiveNutrientsRes)}`)
503
511
}
504
512
@@ -851,7 +859,11 @@ function Env(t, e) {
851
859
i = i ? i . replace ( / \n / g, "" ) . trim ( ) : i ;
852
860
let r = this . getdata ( "@chavy_boxjs_userCfgs.httpapi_timeout" ) ;
853
861
r = r ? 1 * r : 20 , r = e && e . timeout ? e . timeout : r ;
854
- const [ o , h ] = i . split ( "@" ) , n = { url : `http://${ h } /v1/scripting/evaluate` , body : { script_text : t , mock_type : "cron" , timeout : r } , headers : { "X-Key" : o , Accept : "*/*" } } ;
862
+ const [ o , h ] = i . split ( "@" ) , n = {
863
+ url : `http://${ h } /v1/scripting/evaluate` ,
864
+ body : { script_text : t , mock_type : "cron" , timeout : r } ,
865
+ headers : { "X-Key" : o , Accept : "*/*" }
866
+ } ;
855
867
this . post ( n , ( t , e , i ) => s ( i ) )
856
868
} ) . catch ( t => this . logErr ( t ) )
857
869
}
@@ -860,7 +872,8 @@ function Env(t, e) {
860
872
if ( ! this . isNode ( ) ) return { } ;
861
873
{
862
874
this . fs = this . fs ? this . fs : require ( "fs" ) , this . path = this . path ? this . path : require ( "path" ) ;
863
- const t = this . path . resolve ( this . dataFile ) , e = this . path . resolve ( process . cwd ( ) , this . dataFile ) , s = this . fs . existsSync ( t ) , i = ! s && this . fs . existsSync ( e ) ;
875
+ const t = this . path . resolve ( this . dataFile ) , e = this . path . resolve ( process . cwd ( ) , this . dataFile ) ,
876
+ s = this . fs . existsSync ( t ) , i = ! s && this . fs . existsSync ( e ) ;
864
877
if ( ! s && ! i ) return { } ;
865
878
{
866
879
const i = s ? t : e ;
@@ -876,7 +889,8 @@ function Env(t, e) {
876
889
writedata ( ) {
877
890
if ( this . isNode ( ) ) {
878
891
this . fs = this . fs ? this . fs : require ( "fs" ) , this . path = this . path ? this . path : require ( "path" ) ;
879
- const t = this . path . resolve ( this . dataFile ) , e = this . path . resolve ( process . cwd ( ) , this . dataFile ) , s = this . fs . existsSync ( t ) , i = ! s && this . fs . existsSync ( e ) , r = JSON . stringify ( this . data ) ;
892
+ const t = this . path . resolve ( this . dataFile ) , e = this . path . resolve ( process . cwd ( ) , this . dataFile ) ,
893
+ s = this . fs . existsSync ( t ) , i = ! s && this . fs . existsSync ( e ) , r = JSON . stringify ( this . data ) ;
880
894
s ? this . fs . writeFileSync ( t , r ) : i ? this . fs . writeFileSync ( e , r ) : this . fs . writeFileSync ( t , r )
881
895
}
882
896
}
@@ -980,7 +994,15 @@ function Env(t, e) {
980
994
981
995
time ( t , e = null ) {
982
996
const s = e ? new Date ( e ) : new Date ;
983
- let i = { "M+" : s . getMonth ( ) + 1 , "d+" : s . getDate ( ) , "H+" : s . getHours ( ) , "m+" : s . getMinutes ( ) , "s+" : s . getSeconds ( ) , "q+" : Math . floor ( ( s . getMonth ( ) + 3 ) / 3 ) , S : s . getMilliseconds ( ) } ;
997
+ let i = {
998
+ "M+" : s . getMonth ( ) + 1 ,
999
+ "d+" : s . getDate ( ) ,
1000
+ "H+" : s . getHours ( ) ,
1001
+ "m+" : s . getMinutes ( ) ,
1002
+ "s+" : s . getSeconds ( ) ,
1003
+ "q+" : Math . floor ( ( s . getMonth ( ) + 3 ) / 3 ) ,
1004
+ S : s . getMilliseconds ( )
1005
+ } ;
984
1006
/ ( y + ) / . test ( t ) && ( t = t . replace ( RegExp . $1 , ( s . getFullYear ( ) + "" ) . substr ( 4 - RegExp . $1 . length ) ) ) ;
985
1007
for ( let e in i ) new RegExp ( "(" + e + ")" ) . test ( t ) && ( t = t . replace ( RegExp . $1 , 1 == RegExp . $1 . length ? i [ e ] : ( "00" + i [ e ] ) . substr ( ( "" + i [ e ] ) . length ) ) ) ;
986
1008
return t
0 commit comments