Built motion from commit a679711e.|2.6.15
[motion2.git] / server / api / trigger / trigger.rpc.js
index 74c761e..ce9c6c1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xac4a=['info','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','limit','include','model','attributes','map','ShowTrigger','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then'];(function(_0x3e3022,_0x4e20da){var _0x10f89e=function(_0x257849){while(--_0x257849){_0x3e3022['push'](_0x3e3022['shift']());}};_0x10f89e(++_0x4e20da);}(_0xac4a,0x13f));var _0xaac4=function(_0x449691,_0x3c82ce){_0x449691=_0x449691-0x0;var _0x274983=_0xac4a[_0x449691];return _0x274983;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('Trigger,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('Trigger,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});}exports[_0xaac4('0x15')]=function(_0x52085a){var _0x220630=this;return new Promise(function(_0x5b6fd6,_0x3ce35a){return db[_0xaac4('0x16')][_0xaac4('0x17')]({'raw':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x19')]===undefined?!![]:![]:!![],'where':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x1a')]||null:null,'attributes':_0x52085a['options']?_0x52085a[_0xaac4('0x18')]['attributes']||null:null,'limit':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x1b')]||null:null,'include':_0x52085a[_0xaac4('0x18')]?_0x52085a[_0xaac4('0x18')][_0xaac4('0x1c')]?_['map'](_0x52085a[_0xaac4('0x18')][_0xaac4('0x1c')],function(_0x174860){return{'model':db[_0x174860[_0xaac4('0x1d')]],'as':_0x174860['as'],'attributes':_0x174860[_0xaac4('0x1e')],'include':_0x174860[_0xaac4('0x1c')]?_[_0xaac4('0x1f')](_0x174860['include'],function(_0x24186b){return{'model':db[_0x24186b['model']],'as':_0x24186b['as'],'attributes':_0x24186b['attributes'],'include':_0x24186b['include']?_['map'](_0x24186b[_0xaac4('0x1c')],function(_0x17d25f){return{'model':db[_0x17d25f[_0xaac4('0x1d')]],'as':_0x17d25f['as'],'attributes':_0x17d25f[_0xaac4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xaac4('0xa')](function(_0x249a5d){logger[_0xaac4('0xb')](_0xaac4('0x15'),_0x52085a);logger[_0xaac4('0xc')](_0xaac4('0x15'),_0x52085a,JSON['stringify'](_0x249a5d));_0x5b6fd6(_0x249a5d);})[_0xaac4('0x14')](function(_0x16b33c){logger[_0xaac4('0x10')](_0xaac4('0x15'),_0x16b33c[_0xaac4('0x12')],_0x52085a);_0x3ce35a(_0x220630[_0xaac4('0x10')](0x1f4,_0x16b33c['message']));});});};exports[_0xaac4('0x20')]=function(_0x5d2c9a){var _0x2df7e3=this;return new Promise(function(_0xab5d04,_0x182343){return db[_0xaac4('0x16')]['find']({'raw':_0x5d2c9a['options']?_0x5d2c9a['options'][_0xaac4('0x19')]===undefined?!![]:![]:!![],'where':_0x5d2c9a[_0xaac4('0x18')]?_0x5d2c9a[_0xaac4('0x18')][_0xaac4('0x1a')]||null:null,'attributes':_0x5d2c9a[_0xaac4('0x18')]?_0x5d2c9a[_0xaac4('0x18')][_0xaac4('0x1e')]||null:null,'include':_0x5d2c9a[_0xaac4('0x18')]?_0x5d2c9a[_0xaac4('0x18')][_0xaac4('0x1c')]?_[_0xaac4('0x1f')](_0x5d2c9a[_0xaac4('0x18')][_0xaac4('0x1c')],function(_0x3b93e5){return{'model':db[_0x3b93e5[_0xaac4('0x1d')]],'as':_0x3b93e5['as'],'attributes':_0x3b93e5['attributes'],'include':_0x3b93e5['include']?_[_0xaac4('0x1f')](_0x3b93e5[_0xaac4('0x1c')],function(_0xa07d0){return{'model':db[_0xa07d0['model']],'as':_0xa07d0['as'],'attributes':_0xa07d0[_0xaac4('0x1e')],'include':_0xa07d0[_0xaac4('0x1c')]?_[_0xaac4('0x1f')](_0xa07d0[_0xaac4('0x1c')],function(_0x1ec59d){return{'model':db[_0x1ec59d[_0xaac4('0x1d')]],'as':_0x1ec59d['as'],'attributes':_0x1ec59d[_0xaac4('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36591a){logger[_0xaac4('0xb')](_0xaac4('0x20'),_0x5d2c9a);logger['debug'](_0xaac4('0x20'),_0x5d2c9a,JSON['stringify'](_0x36591a));_0xab5d04(_0x36591a);})['catch'](function(_0x344d05){logger[_0xaac4('0x10')](_0xaac4('0x20'),_0x344d05['message'],_0x5d2c9a);_0x182343(_0x2df7e3['error'](0x1f4,_0x344d05[_0xaac4('0x12')]));});});};
\ No newline at end of file
+var _0x0294=['include','model','attributes','GetTrigger','ShowTrigger','Trigger','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','Trigger,\x20%s,\x20%s','result','catch','findAll','options','where','map'];(function(_0x379296,_0xb721a1){var _0x2461d0=function(_0x3ee5c6){while(--_0x3ee5c6){_0x379296['push'](_0x379296['shift']());}};_0x2461d0(++_0xb721a1);}(_0x0294,0x17a));var _0x4029=function(_0x228f13,_0x550e4a){_0x228f13=_0x228f13-0x0;var _0x2921f0=_0x0294[_0x228f13];return _0x2921f0;};'use strict';var _=require(_0x4029('0x0'));var util=require(_0x4029('0x1'));var moment=require(_0x4029('0x2'));var BPromise=require(_0x4029('0x3'));var rs=require(_0x4029('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4029('0x5'))['db'];var utils=require(_0x4029('0x6'));var logger=require(_0x4029('0x7'))(_0x4029('0x8'));var config=require(_0x4029('0x9'));var jayson=require(_0x4029('0xa'));var client=jayson[_0x4029('0xb')][_0x4029('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39700a,_0x1f383,_0x3fccfd){return new BPromise(function(_0x3efcb8,_0x53d000){return client[_0x4029('0xd')](_0x39700a,_0x3fccfd)[_0x4029('0xe')](function(_0x15ff4e){logger[_0x4029('0xf')]('Trigger,\x20%s,\x20%s',_0x1f383,_0x4029('0x10'));logger[_0x4029('0x11')]('Trigger,\x20%s,\x20%s,\x20%s',_0x1f383,_0x4029('0x10'),JSON[_0x4029('0x12')](_0x15ff4e));if(_0x15ff4e[_0x4029('0x13')]){if(_0x15ff4e['error'][_0x4029('0x14')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x1f383,_0x15ff4e['error']['message']);return _0x53d000(_0x15ff4e['error'][_0x4029('0x15')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x1f383,_0x15ff4e['error'][_0x4029('0x15')]);return _0x3efcb8(_0x15ff4e['error'][_0x4029('0x15')]);}else{logger['info'](_0x4029('0x16'),_0x1f383,'request\x20sent');_0x3efcb8(_0x15ff4e[_0x4029('0x17')][_0x4029('0x15')]);}})[_0x4029('0x18')](function(_0x393bdc){logger[_0x4029('0x13')](_0x4029('0x16'),_0x1f383,_0x393bdc);_0x53d000(_0x393bdc);});});}exports['GetTrigger']=function(_0x419baf){var _0x440fc5=this;return new Promise(function(_0x55e6d1,_0xae2912){return db['Trigger'][_0x4029('0x19')]({'raw':_0x419baf[_0x4029('0x1a')]?_0x419baf[_0x4029('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x419baf[_0x4029('0x1a')]?_0x419baf[_0x4029('0x1a')][_0x4029('0x1b')]||null:null,'attributes':_0x419baf['options']?_0x419baf[_0x4029('0x1a')]['attributes']||null:null,'limit':_0x419baf[_0x4029('0x1a')]?_0x419baf['options']['limit']||null:null,'include':_0x419baf[_0x4029('0x1a')]?_0x419baf[_0x4029('0x1a')]['include']?_[_0x4029('0x1c')](_0x419baf[_0x4029('0x1a')][_0x4029('0x1d')],function(_0x3b305f){return{'model':db[_0x3b305f[_0x4029('0x1e')]],'as':_0x3b305f['as'],'attributes':_0x3b305f[_0x4029('0x1f')],'include':_0x3b305f[_0x4029('0x1d')]?_[_0x4029('0x1c')](_0x3b305f[_0x4029('0x1d')],function(_0x3c1909){return{'model':db[_0x3c1909[_0x4029('0x1e')]],'as':_0x3c1909['as'],'attributes':_0x3c1909[_0x4029('0x1f')],'include':_0x3c1909['include']?_[_0x4029('0x1c')](_0x3c1909[_0x4029('0x1d')],function(_0x21d1db){return{'model':db[_0x21d1db[_0x4029('0x1e')]],'as':_0x21d1db['as'],'attributes':_0x21d1db[_0x4029('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35c60c){logger[_0x4029('0xf')]('GetTrigger',_0x419baf);logger['debug']('GetTrigger',_0x419baf,JSON['stringify'](_0x35c60c));_0x55e6d1(_0x35c60c);})[_0x4029('0x18')](function(_0xa05cbe){logger[_0x4029('0x13')](_0x4029('0x20'),_0xa05cbe['message'],_0x419baf);_0xae2912(_0x440fc5[_0x4029('0x13')](0x1f4,_0xa05cbe[_0x4029('0x15')]));});});};exports[_0x4029('0x21')]=function(_0x2f7e9d){var _0x3d8fbc=this;return new Promise(function(_0x53b043,_0x5de2e8){return db[_0x4029('0x22')][_0x4029('0x23')]({'raw':_0x2f7e9d[_0x4029('0x1a')]?_0x2f7e9d[_0x4029('0x1a')][_0x4029('0x24')]===undefined?!![]:![]:!![],'where':_0x2f7e9d[_0x4029('0x1a')]?_0x2f7e9d[_0x4029('0x1a')]['where']||null:null,'attributes':_0x2f7e9d[_0x4029('0x1a')]?_0x2f7e9d['options']['attributes']||null:null,'include':_0x2f7e9d['options']?_0x2f7e9d[_0x4029('0x1a')][_0x4029('0x1d')]?_[_0x4029('0x1c')](_0x2f7e9d[_0x4029('0x1a')][_0x4029('0x1d')],function(_0x195633){return{'model':db[_0x195633[_0x4029('0x1e')]],'as':_0x195633['as'],'attributes':_0x195633[_0x4029('0x1f')],'include':_0x195633[_0x4029('0x1d')]?_[_0x4029('0x1c')](_0x195633['include'],function(_0x5c9388){return{'model':db[_0x5c9388['model']],'as':_0x5c9388['as'],'attributes':_0x5c9388[_0x4029('0x1f')],'include':_0x5c9388['include']?_[_0x4029('0x1c')](_0x5c9388[_0x4029('0x1d')],function(_0x1eece6){return{'model':db[_0x1eece6[_0x4029('0x1e')]],'as':_0x1eece6['as'],'attributes':_0x1eece6[_0x4029('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40df67){logger[_0x4029('0xf')](_0x4029('0x21'),_0x2f7e9d);logger['debug']('ShowTrigger',_0x2f7e9d,JSON['stringify'](_0x40df67));_0x53b043(_0x40df67);})[_0x4029('0x18')](function(_0x4ec0c0){logger[_0x4029('0x13')](_0x4029('0x21'),_0x4ec0c0['message'],_0x2f7e9d);_0x5de2e8(_0x3d8fbc[_0x4029('0x13')](0x1f4,_0x4ec0c0['message']));});});};
\ No newline at end of file