Built motion from commit b5413ace.|2.6.9
[motion2.git] / server / config / schedule / index.js
index 419a4af..489f35a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xba4a=['Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','service','Smtp','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','name','email','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','basename','extname','zip','existsSync','status','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','email\x20sent','data','isNil','subtractNumber','subtract','YYYY-MM-DD\x20HH:mm:ss','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','catch','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','keys','jobs','map','toString','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','active','isBetween','startAt','endAt','add','start','update','update\x20cron','stop\x20cron','run','util','path','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','info'];(function(_0x262a91,_0x4d3739){var _0x5dcb6b=function(_0x5df927){while(--_0x5df927){_0x262a91['push'](_0x262a91['shift']());}};_0x5dcb6b(++_0x4d3739);}(_0xba4a,0x15c));var _0xaba4=function(_0x4dfcc1,_0x30f0f5){_0x4dfcc1=_0x4dfcc1-0x0;var _0x588569=_0xba4a[_0x4dfcc1];return _0x588569;};'use strict';var fs=require('fs');var util=require(_0xaba4('0x0'));var path=require(_0xaba4('0x1'));var _=require(_0xaba4('0x2'));var moment=require(_0xaba4('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xaba4('0x4'));var BPromise=require(_0xaba4('0x5'));var logger=require(_0xaba4('0x6'))(_0xaba4('0x7'));var db=require(_0xaba4('0x8'))['db'];var analyticCustomReportController=require(_0xaba4('0x9'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xaba4('0xa')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x7da3b5,_0x28d082){return function(){logger[_0xaba4('0xb')](_0xaba4('0xc'),_0x7da3b5['email']);var _0x1b8788=!![];var _0x265ee5={'tls':{'rejectUnauthorized':![]}};if(_0x7da3b5[_0xaba4('0xd')]['Smtp'][_0xaba4('0xe')]){_0x265ee5[_0xaba4('0xe')]=_0x7da3b5[_0xaba4('0xd')][_0xaba4('0xf')][_0xaba4('0xe')];}else{_0x265ee5[_0xaba4('0x10')]=_0x7da3b5[_0xaba4('0xd')][_0xaba4('0xf')][_0xaba4('0x10')];_0x265ee5[_0xaba4('0x11')]=_0x7da3b5['MailAccount']['Smtp']['port'];_0x265ee5['secure']=_0x7da3b5[_0xaba4('0xd')][_0xaba4('0xf')][_0xaba4('0x12')];}if(_0x7da3b5['MailAccount'][_0xaba4('0xf')][_0xaba4('0x13')]){_0x265ee5[_0xaba4('0x14')]={'user':_0x7da3b5[_0xaba4('0xd')]['Smtp']['user'],'pass':_0x7da3b5[_0xaba4('0xd')]['Smtp'][_0xaba4('0x15')]};}var _0x462e89={'account':_0x265ee5,'message':{'from':util[_0xaba4('0x16')](_0xaba4('0x17'),_0x7da3b5[_0xaba4('0xd')][_0xaba4('0x18')],_0x7da3b5[_0xaba4('0xd')][_0xaba4('0x19')]||_0x7da3b5[_0xaba4('0xd')]['Smtp'][_0xaba4('0x1a')]),'to':_0x7da3b5[_0xaba4('0x19')],'cc':_0x7da3b5['cc'],'bcc':_0x7da3b5[_0xaba4('0x1b')],'subject':util[_0xaba4('0x16')](_0xaba4('0x1c'),_0x28d082[_0xaba4('0x18')],_0x7da3b5['subtractNumber'],_0x7da3b5[_0xaba4('0x1d')])}};var _0x2bb40c=path[_0xaba4('0x1e')](__dirname,_0xaba4('0x1f'));var _0x504232=_0x28d082[_0xaba4('0x20')];var _0x4429d8=util[_0xaba4('0x16')]('%s.%s',path[_0xaba4('0x21')](_0x28d082[_0xaba4('0x20')],path[_0xaba4('0x22')](_0x28d082[_0xaba4('0x20')])),_0xaba4('0x23'));var _0x3c5805=path[_0xaba4('0x1e')](_0x2bb40c,_0x504232);var _0x3486ec=path[_0xaba4('0x1e')](_0x2bb40c,_0x4429d8);if(fs[_0xaba4('0x24')](_0x3c5805)){_0x28d082[_0xaba4('0x25')]='Sent';_0x462e89['message'][_0xaba4('0x26')]=[{'filename':_0x504232,'path':_0x3c5805}];_0x462e89[_0xaba4('0x27')][_0xaba4('0x28')]=util[_0xaba4('0x16')](_0xaba4('0x29'),JSON[_0xaba4('0x2a')](_0x28d082,null,0x2));}else if(fs[_0xaba4('0x24')](_0x3486ec)){_0x28d082[_0xaba4('0x25')]='Sent';_0x462e89['message'][_0xaba4('0x26')]=[{'filename':_0x4429d8,'path':_0x3486ec}];}else{_0x462e89[_0xaba4('0x27')][_0xaba4('0x28')]=_0xaba4('0x2b');if(!_0x7da3b5[_0xaba4('0x2c')]){_0x1b8788=![];logger[_0xaba4('0xb')](_0xaba4('0x2d'));}}if(_0x1b8788){return client[_0xaba4('0x2e')]('SendMail',_0x462e89)[_0xaba4('0x2f')](function(_0x9ee6bf){if(_0x9ee6bf[_0xaba4('0x30')]){return logger[_0xaba4('0x30')](_0xaba4('0x31'),JSON[_0xaba4('0x2a')](_0x9ee6bf));}return logger[_0xaba4('0xb')](_0xaba4('0x32'));})['catch'](function(_0x58bebf){return logger[_0xaba4('0x30')]('error\x20mail',JSON[_0xaba4('0x2a')](_0x58bebf));});}};}function handleError(){return function(_0x2c3138){return logger['error'](JSON['stringify'](_0x2c3138));};}function handleResult(_0x2de847){return function(_0x1c507e){logger[_0xaba4('0xb')](_0xaba4('0x33'),JSON['stringify'](_0x1c507e));if(_0x2de847[_0xaba4('0xd')]&&_0x2de847['MailAccount'][_0xaba4('0xf')]&&!_[_0xaba4('0x34')](_0x2de847[_0xaba4('0x19')])){setTimeout(handleSendEmail(_0x2de847,_0x1c507e),0x3c*0x3e8);}};}function handleJob(_0x4dee31){return function(){try{if(_[_0xaba4('0x34')](_0x4dee31[_0xaba4('0x35')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xaba4('0x34')](_0x4dee31['subtractUnit'])){return logger[_0xaba4('0xb')]('subtractUnit\x20null\x20or\x20undefined');}var _0x543fcb={'startDate':moment()[_0xaba4('0x36')](_0x4dee31['subtractNumber'],_0x4dee31[_0xaba4('0x1d')])[_0xaba4('0x16')](_0xaba4('0x37')),'endDate':moment()[_0xaba4('0x16')](_0xaba4('0x37')),'type':'scheduled','output':_0x4dee31['output'],'name':_0x4dee31[_0xaba4('0x18')]};if(!_['isNil'](_0x4dee31['DefaultReportId'])){logger[_0xaba4('0xb')](_0xaba4('0x38'),_0x4dee31['DefaultReportId']);return analyticDefaultReportController[_0xaba4('0x39')]({'id':_0x4dee31[_0xaba4('0x3a')]},_0x543fcb)['then'](handleResult(_0x4dee31))[_0xaba4('0x3b')](handleError());}if(!_[_0xaba4('0x34')](_0x4dee31['CustomReportId'])){logger[_0xaba4('0xb')](_0xaba4('0x3c'),_0x4dee31[_0xaba4('0x3d')]);return analyticCustomReportController[_0xaba4('0x39')]({'id':_0x4dee31[_0xaba4('0x3d')]},_0x543fcb)['then'](handleResult(_0x4dee31))[_0xaba4('0x3b')](handleError());}}catch(_0x18d00f){logger[_0xaba4('0x30')](JSON[_0xaba4('0x2a')](_0x18d00f));}return logger['info'](_0xaba4('0x3e'));};}function getJobs(_0x2e5e4b){var _0x25c912={};if(_0x2e5e4b){_0x25c912['id']=_0x2e5e4b;}return db[_0xaba4('0x3f')]['findAll']({'where':_0x25c912,'include':[{'model':db[_0xaba4('0xd')],'attributes':['id',_0xaba4('0x18'),_0xaba4('0x19')],'include':[{'model':db['MailServerOut'],'as':_0xaba4('0xf')}]}]})[_0xaba4('0x2f')](function(_0xb2aa7c){var _0x30e8fa=_[_0xaba4('0x40')](manager[_0xaba4('0x41')]);var _0x57b7ef=_[_0xaba4('0x42')](_0xb2aa7c,function(_0x4b1833){return _0x4b1833['id'][_0xaba4('0x43')]();});var _0x50d285=_['keyBy'](_0xb2aa7c,function(_0x25c153){return _0x25c153['id'][_0xaba4('0x43')]();});var _0x33267c=_0x2e5e4b?_0x57b7ef:_[_0xaba4('0x44')](_0x57b7ef,_0x30e8fa);var _0x5ddb6a=_[_0xaba4('0x45')](_0x57b7ef,_0x30e8fa);var _0x4302f9=_[_0xaba4('0x44')](_0x30e8fa,_0x57b7ef);var _0x561f04;var _0x2f87b0;for(_0x561f04=0x0;_0x561f04<_0x4302f9[_0xaba4('0x46')]&&!_0x2e5e4b;_0x561f04+=0x1){_0x2f87b0=_0x4302f9[_0x561f04][_0xaba4('0x43')]();if(manager[_0xaba4('0x47')](_0x2f87b0)){manager[_0xaba4('0x48')](_0x2f87b0);manager[_0xaba4('0x49')](_0x2f87b0);logger[_0xaba4('0xb')](_0xaba4('0x4a'),_0x2f87b0);}}logger[_0xaba4('0xb')](_0xaba4('0x4b'),JSON[_0xaba4('0x2a')](_0x33267c));for(_0x561f04=0x0;_0x561f04<_0x33267c[_0xaba4('0x46')];_0x561f04+=0x1){_0x2f87b0=_0x33267c[_0x561f04][_0xaba4('0x43')]();logger['info'](_0xaba4('0x4c'),_0x2f87b0);if(_0x2e5e4b){logger[_0xaba4('0xb')](_0xaba4('0x4d'),_0x2e5e4b);logger[_0xaba4('0xb')](JSON['stringify'](_0x50d285[_0x2f87b0]));BPromise['resolve']()['then'](handleJob(_0x50d285[_0x2f87b0]));logger[_0xaba4('0xb')](_0xaba4('0x4e'),_0x50d285[_0x2f87b0]['name'],_0x50d285[_0x2f87b0][_0xaba4('0x4f')]);}else if(_0x50d285[_0x2f87b0][_0xaba4('0x4f')]&&_0x50d285[_0x2f87b0][_0xaba4('0x50')]&&moment()[_0xaba4('0x51')](_0x50d285[_0x2f87b0][_0xaba4('0x52')],_0x50d285[_0x2f87b0][_0xaba4('0x53')])){manager[_0xaba4('0x54')](_0x2f87b0,_0x50d285[_0x2f87b0][_0xaba4('0x4f')],handleJob(_0x50d285[_0x2f87b0]));manager[_0xaba4('0x55')](_0x2f87b0);logger[_0xaba4('0xb')]('add\x20cron',_0x50d285[_0x2f87b0][_0xaba4('0x18')],_0x50d285[_0x2f87b0][_0xaba4('0x4f')]);}else if(manager[_0xaba4('0x47')](_0x2f87b0)){manager['stop'](_0x2f87b0);manager[_0xaba4('0x49')](_0x2f87b0);logger['info']('stop\x20cron',_0x50d285[_0x2f87b0][_0xaba4('0x18')],_0x50d285[_0x2f87b0][_0xaba4('0x4f')]);}}for(_0x561f04=0x0,_0x2f87b0;_0x561f04<_0x5ddb6a[_0xaba4('0x46')]&&!_0x2e5e4b;_0x561f04+=0x1){_0x2f87b0=_0x5ddb6a[_0x561f04][_0xaba4('0x43')]();if(manager[_0xaba4('0x47')](_0x2f87b0)){if(_0x50d285[_0x2f87b0]['cron']&&_0x50d285[_0x2f87b0][_0xaba4('0x50')]&&moment()[_0xaba4('0x51')](_0x50d285[_0x2f87b0][_0xaba4('0x52')],_0x50d285[_0x2f87b0][_0xaba4('0x53')])){manager[_0xaba4('0x56')](_0x2f87b0,_0x50d285[_0x2f87b0][_0xaba4('0x4f')],handleJob(_0x50d285[_0x2f87b0]));logger['info'](_0xaba4('0x57'),_0x50d285[_0x2f87b0][_0xaba4('0x18')],_0x50d285[_0x2f87b0]['cron']);}else{manager[_0xaba4('0x48')](_0x2f87b0);manager[_0xaba4('0x49')](_0x2f87b0);logger[_0xaba4('0xb')](_0xaba4('0x58'),_0x50d285[_0x2f87b0][_0xaba4('0x18')],_0x50d285[_0x2f87b0]['cron']);}}}})[_0xaba4('0x3b')](function(_0x2443e1){logger[_0xaba4('0x30')](JSON[_0xaba4('0x2a')](_0x2443e1));});}exports[_0xaba4('0x59')]=function(_0x4c3da7){return getJobs(_0x4c3da7);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();};
\ No newline at end of file
+var _0xc8b4=['CustomReportId','catch','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','difference','intersection','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','add','start','exists','active','update','update\x20cron','stop\x20cron','run','util','lodash','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','info','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','existsSync','status','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','email\x20sent','error\x20mail','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','exec\x20custom\x20report\x20id:%s'];(function(_0x169200,_0x42aab1){var _0x28e864=function(_0x5e89ca){while(--_0x5e89ca){_0x169200['push'](_0x169200['shift']());}};_0x28e864(++_0x42aab1);}(_0xc8b4,0x12e));var _0x4c8b=function(_0x30d723,_0x5bcfb9){_0x30d723=_0x30d723-0x0;var _0x4a074b=_0xc8b4[_0x30d723];return _0x4a074b;};'use strict';var fs=require('fs');var util=require(_0x4c8b('0x0'));var path=require('path');var _=require(_0x4c8b('0x1'));var moment=require(_0x4c8b('0x2'));var CronJobManager=require(_0x4c8b('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x4c8b('0x4'));var logger=require(_0x4c8b('0x5'))(_0x4c8b('0x6'));var db=require(_0x4c8b('0x7'))['db'];var analyticCustomReportController=require(_0x4c8b('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0x4c8b('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5af66c,_0x43bf7f){return function(){logger[_0x4c8b('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x5af66c[_0x4c8b('0xb')]);var _0x43b5a2=!![];var _0x270c5b=_0x5af66c['MailAccount'][_0x4c8b('0xc')]();var _0x42a8ed={'account':_0x270c5b,'message':{'from':util[_0x4c8b('0xd')](_0x4c8b('0xe'),_0x5af66c[_0x4c8b('0xf')][_0x4c8b('0x10')],_0x5af66c[_0x4c8b('0xf')][_0x4c8b('0xb')]||_0x5af66c[_0x4c8b('0xf')][_0x4c8b('0x11')]['user']),'to':_0x5af66c[_0x4c8b('0xb')],'cc':_0x5af66c['cc'],'bcc':_0x5af66c[_0x4c8b('0x12')],'subject':util[_0x4c8b('0xd')](_0x4c8b('0x13'),_0x43bf7f['name'],_0x5af66c['subtractNumber'],_0x5af66c[_0x4c8b('0x14')])}};var _0x152eb2=path[_0x4c8b('0x15')](__dirname,_0x4c8b('0x16'));var _0x44bfe9=_0x43bf7f[_0x4c8b('0x17')];var _0x613e7d=util[_0x4c8b('0xd')](_0x4c8b('0x18'),path[_0x4c8b('0x19')](_0x43bf7f[_0x4c8b('0x17')],path[_0x4c8b('0x1a')](_0x43bf7f['savename'])),'zip');var _0x5c81b7=path[_0x4c8b('0x15')](_0x152eb2,_0x44bfe9);var _0x537d12=path[_0x4c8b('0x15')](_0x152eb2,_0x613e7d);if(fs[_0x4c8b('0x1b')](_0x5c81b7)){_0x43bf7f[_0x4c8b('0x1c')]='Sent';_0x42a8ed[_0x4c8b('0x1d')][_0x4c8b('0x1e')]=[{'filename':_0x44bfe9,'path':_0x5c81b7}];_0x42a8ed[_0x4c8b('0x1d')][_0x4c8b('0x1f')]=util[_0x4c8b('0xd')](_0x4c8b('0x20'),JSON[_0x4c8b('0x21')](_0x43bf7f,null,0x2));}else if(fs[_0x4c8b('0x1b')](_0x537d12)){_0x43bf7f[_0x4c8b('0x1c')]=_0x4c8b('0x22');_0x42a8ed[_0x4c8b('0x1d')]['attachments']=[{'filename':_0x613e7d,'path':_0x537d12}];}else{_0x42a8ed[_0x4c8b('0x1d')]['text']=_0x4c8b('0x23');if(!_0x5af66c[_0x4c8b('0x24')]){_0x43b5a2=![];logger[_0x4c8b('0xa')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x43b5a2){return client[_0x4c8b('0x25')](_0x4c8b('0x26'),_0x42a8ed)[_0x4c8b('0x27')](function(_0x2ea999){if(_0x2ea999[_0x4c8b('0x28')]){return logger[_0x4c8b('0x28')]('error\x20mail',JSON[_0x4c8b('0x21')](_0x2ea999));}return logger['info'](_0x4c8b('0x29'));})['catch'](function(_0x1a1f42){return logger[_0x4c8b('0x28')](_0x4c8b('0x2a'),JSON[_0x4c8b('0x21')](_0x1a1f42));});}};}function handleError(){return function(_0x2cf4bd){return logger['error'](JSON[_0x4c8b('0x21')](_0x2cf4bd));};}function handleResult(_0x3629c3){return function(_0x3a5064){logger['info'](_0x4c8b('0x2b'),JSON['stringify'](_0x3a5064));if(_0x3629c3[_0x4c8b('0xf')]&&_0x3629c3[_0x4c8b('0xf')]['Smtp']&&!_[_0x4c8b('0x2c')](_0x3629c3[_0x4c8b('0xb')])){setTimeout(handleSendEmail(_0x3629c3,_0x3a5064),0x3c*0x3e8);}};}function handleJob(_0x2c91b7){return function(){try{if(_[_0x4c8b('0x2c')](_0x2c91b7[_0x4c8b('0x2d')])){return logger[_0x4c8b('0xa')](_0x4c8b('0x2e'));}if(_[_0x4c8b('0x2c')](_0x2c91b7[_0x4c8b('0x14')])){return logger[_0x4c8b('0xa')](_0x4c8b('0x2f'));}var _0x29e265={'startDate':moment()[_0x4c8b('0x30')](_0x2c91b7[_0x4c8b('0x2d')],_0x2c91b7[_0x4c8b('0x14')])['format'](_0x4c8b('0x31')),'endDate':moment()[_0x4c8b('0xd')](_0x4c8b('0x31')),'type':'scheduled','output':_0x2c91b7[_0x4c8b('0x32')],'name':_0x2c91b7['name']};if(!_['isNil'](_0x2c91b7[_0x4c8b('0x33')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x2c91b7['DefaultReportId']);return analyticDefaultReportController[_0x4c8b('0x34')]({'id':_0x2c91b7[_0x4c8b('0x33')]},_0x29e265)[_0x4c8b('0x27')](handleResult(_0x2c91b7))['catch'](handleError());}if(!_[_0x4c8b('0x2c')](_0x2c91b7['CustomReportId'])){logger['info'](_0x4c8b('0x35'),_0x2c91b7[_0x4c8b('0x36')]);return analyticCustomReportController[_0x4c8b('0x34')]({'id':_0x2c91b7[_0x4c8b('0x36')]},_0x29e265)['then'](handleResult(_0x2c91b7))[_0x4c8b('0x37')](handleError());}}catch(_0x95ceac){logger[_0x4c8b('0x28')](JSON[_0x4c8b('0x21')](_0x95ceac));}return logger[_0x4c8b('0xa')](_0x4c8b('0x38'));};}function getJobs(_0x20bf8b){var _0x1902a0={};if(_0x20bf8b){_0x1902a0['id']=_0x20bf8b;}return db[_0x4c8b('0x39')][_0x4c8b('0x3a')]({'where':_0x1902a0,'include':[{'model':db['MailAccount'],'attributes':['id',_0x4c8b('0x10'),_0x4c8b('0xb')],'include':[{'model':db[_0x4c8b('0x3b')],'as':_0x4c8b('0x11'),'include':[{'model':db['CloudProvider'],'as':_0x4c8b('0x3c')}]}]}]})[_0x4c8b('0x27')](function(_0x224114){var _0x34cee2=_[_0x4c8b('0x3d')](manager[_0x4c8b('0x3e')]);var _0x352750=_[_0x4c8b('0x3f')](_0x224114,function(_0x482654){return _0x482654['id'][_0x4c8b('0x40')]();});var _0x38f0d6=_[_0x4c8b('0x41')](_0x224114,function(_0x863138){return _0x863138['id']['toString']();});var _0x4f9585=_0x20bf8b?_0x352750:_[_0x4c8b('0x42')](_0x352750,_0x34cee2);var _0x280886=_[_0x4c8b('0x43')](_0x352750,_0x34cee2);var _0x54dc5e=_[_0x4c8b('0x42')](_0x34cee2,_0x352750);var _0x406098;var _0x2dbb4e;for(_0x406098=0x0;_0x406098<_0x54dc5e[_0x4c8b('0x44')]&&!_0x20bf8b;_0x406098+=0x1){_0x2dbb4e=_0x54dc5e[_0x406098][_0x4c8b('0x40')]();if(manager['exists'](_0x2dbb4e)){manager[_0x4c8b('0x45')](_0x2dbb4e);manager[_0x4c8b('0x46')](_0x2dbb4e);logger[_0x4c8b('0xa')](_0x4c8b('0x47'),_0x2dbb4e);}}logger['info'](_0x4c8b('0x48'),JSON[_0x4c8b('0x21')](_0x4f9585));for(_0x406098=0x0;_0x406098<_0x4f9585['length'];_0x406098+=0x1){_0x2dbb4e=_0x4f9585[_0x406098][_0x4c8b('0x40')]();logger[_0x4c8b('0xa')](_0x4c8b('0x49'),_0x2dbb4e);if(_0x20bf8b){logger[_0x4c8b('0xa')](_0x4c8b('0x4a'),_0x20bf8b);logger[_0x4c8b('0xa')](JSON['stringify'](_0x38f0d6[_0x2dbb4e]));BPromise[_0x4c8b('0x4b')]()[_0x4c8b('0x27')](handleJob(_0x38f0d6[_0x2dbb4e]));logger[_0x4c8b('0xa')](_0x4c8b('0x4c'),_0x38f0d6[_0x2dbb4e][_0x4c8b('0x10')],_0x38f0d6[_0x2dbb4e][_0x4c8b('0x4d')]);}else if(_0x38f0d6[_0x2dbb4e]['cron']&&_0x38f0d6[_0x2dbb4e]['active']&&moment()[_0x4c8b('0x4e')](_0x38f0d6[_0x2dbb4e][_0x4c8b('0x4f')],_0x38f0d6[_0x2dbb4e][_0x4c8b('0x50')])){manager[_0x4c8b('0x51')](_0x2dbb4e,_0x38f0d6[_0x2dbb4e]['cron'],handleJob(_0x38f0d6[_0x2dbb4e]));manager[_0x4c8b('0x52')](_0x2dbb4e);logger['info']('add\x20cron',_0x38f0d6[_0x2dbb4e][_0x4c8b('0x10')],_0x38f0d6[_0x2dbb4e][_0x4c8b('0x4d')]);}else if(manager['exists'](_0x2dbb4e)){manager[_0x4c8b('0x45')](_0x2dbb4e);manager[_0x4c8b('0x46')](_0x2dbb4e);logger[_0x4c8b('0xa')]('stop\x20cron',_0x38f0d6[_0x2dbb4e][_0x4c8b('0x10')],_0x38f0d6[_0x2dbb4e][_0x4c8b('0x4d')]);}}for(_0x406098=0x0,_0x2dbb4e;_0x406098<_0x280886[_0x4c8b('0x44')]&&!_0x20bf8b;_0x406098+=0x1){_0x2dbb4e=_0x280886[_0x406098][_0x4c8b('0x40')]();if(manager[_0x4c8b('0x53')](_0x2dbb4e)){if(_0x38f0d6[_0x2dbb4e][_0x4c8b('0x4d')]&&_0x38f0d6[_0x2dbb4e][_0x4c8b('0x54')]&&moment()[_0x4c8b('0x4e')](_0x38f0d6[_0x2dbb4e][_0x4c8b('0x4f')],_0x38f0d6[_0x2dbb4e][_0x4c8b('0x50')])){manager[_0x4c8b('0x55')](_0x2dbb4e,_0x38f0d6[_0x2dbb4e][_0x4c8b('0x4d')],handleJob(_0x38f0d6[_0x2dbb4e]));logger[_0x4c8b('0xa')](_0x4c8b('0x56'),_0x38f0d6[_0x2dbb4e]['name'],_0x38f0d6[_0x2dbb4e][_0x4c8b('0x4d')]);}else{manager[_0x4c8b('0x45')](_0x2dbb4e);manager[_0x4c8b('0x46')](_0x2dbb4e);logger['info'](_0x4c8b('0x57'),_0x38f0d6[_0x2dbb4e]['name'],_0x38f0d6[_0x2dbb4e][_0x4c8b('0x4d')]);}}}})['catch'](function(_0x2537a0){logger[_0x4c8b('0x28')](JSON[_0x4c8b('0x21')](_0x2537a0));});}exports[_0x4c8b('0x58')]=function(_0x1b05df){return getJobs(_0x1b05df);};exports[_0x4c8b('0x52')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();};
\ No newline at end of file