@@ -49,8 +49,8 @@ cron设置30min循环
4949const jsname = '葱花视频'
5050const $ = Env ( jsname )
5151const logs = $ . getdata ( 'logbutton' ) ; //0为关闭日志,1为开启,默认为0
52+ const notify = $ . isNode ( ) ?require ( './sendNotify' ) : '' ;
5253const notifyInterval = $ . getdata ( 'tzbutton' ) ; //0为关闭通知,1为所有通知,默认为0
53- now = new Date ( new Date ( ) . getTime ( ) + new Date ( ) . getTimezoneOffset ( ) * 60 * 1000 + 8 * 60 * 60 * 1000 ) ;
5454
5555let task = '' ;
5656let tz = '' ;
@@ -65,6 +65,35 @@ let headerVal = {
6565 'Accept-Language' : `zh-Hans-CN;q=1, en-CN;q=0.9`
6666} ;
6767
68+ //time
69+ var hour = '' ;
70+ var minute = '' ;
71+ if ( $ . isNode ( ) ) {
72+ hour = new Date ( new Date ( ) . getTime ( ) + 8 * 60 * 60 * 1000 ) . getHours ( ) ;
73+ minute = new Date ( new Date ( ) . getTime ( ) + 8 * 60 * 60 * 1000 ) . getMinutes ( ) ;
74+ } else {
75+ hour = ( new Date ( ) ) . getHours ( ) ;
76+ minute = ( new Date ( ) ) . getMinutes ( ) ;
77+ }
78+
79+ //time+msg
80+ async function showmsg ( ) {
81+ if ( notifyInterval == 1 ) {
82+ $ . log ( message )
83+ if ( $ . isNode ( ) ) {
84+ if ( ( hour == 12 && minute <= 20 ) || ( hour == 23 && minute >= 40 ) ) {
85+ await notify . sendNotify ( $ . name , tz )
86+ }
87+ } else {
88+ $ . log ( message )
89+ if ( ( hour == 12 && minute <= 20 ) || ( hour == 23 && minute >= 40 ) ) {
90+ $ . msg ( msgstyle , '' , tz ) ;
91+ }
92+ }
93+ } else {
94+ console . log ( msgstyle + '' + tz ) ;
95+ }
96+ }
6897
6998const taskcenterbodyArr = [ ] ;
7099let taskcenterbodyVal = "" ;
@@ -158,7 +187,7 @@ if ($.isNode()) {
158187
159188! ( async ( ) => {
160189 await Jsname ( )
161- O = ( `🥦${ jsname } 任务执行通知🔔` ) ;
190+ msgstyle = ( `🥦${ jsname } 任务执行通知🔔` ) ;
162191 taskcenterbodyVal = taskcenterbodyArr [ 0 ] ;
163192 timeredbodyVal = timeredbodyArr [ 0 ] ;
164193 console . log ( `\n✅ 查询账户明细\n` )
@@ -174,9 +203,9 @@ if ($.isNode()) {
174203 ) ;
175204 }
176205
177- if ( now . getHours ( ) == 18 ) {
206+ if ( hour == 18 ) {
178207 await videoread ( ) ; //自动刷视频
179- } else if ( now . getHours ( ) == 20 ) {
208+ } else if ( hour == 20 ) {
180209 await videoread ( ) ; //自动刷视频
181210 } else {
182211 console . log ( `\n✅ 打印任务状态清单` )
@@ -191,15 +220,7 @@ if ($.isNode()) {
191220. catch ( ( e ) => $ . logErr ( e ) )
192221 . finally ( ( ) => $ . done ( ) )
193222
194- function showmsg ( ) {
195- if ( notifyInterval != 1 ) {
196- console . log ( O + '' + tz ) ;
197- }
198223
199- if ( notifyInterval == 1 ) {
200- $ . msg ( O , '' , tz ) ;
201- }
202- }
203224
204225////////////////////////////////////////////////////////////////////////
205226async function videoread ( ) {
0 commit comments