Built motion from commit a61a4a20.|2.5.46
[motion2.git] / server / api / trigger / trigger.rpc.js
index dc03aff..5f30053 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6719=['include','model','map','then','catch','ShowTrigger','find','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','result','GetTrigger','Trigger','options','where','attributes'];(function(_0x2fee96,_0x2f735d){var _0x2e6ad1=function(_0x2c55ad){while(--_0x2c55ad){_0x2fee96['push'](_0x2fee96['shift']());}};_0x2e6ad1(++_0x2f735d);}(_0x6719,0x1ac));var _0x9671=function(_0x353856,_0x5ce89d){_0x353856=_0x353856-0x0;var _0xa58048=_0x6719[_0x353856];return _0xa58048;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9671('0x0'));var BPromise=require(_0x9671('0x1'));var rs=require(_0x9671('0x2'));var fs=require('fs');var Redis=require(_0x9671('0x3'));var db=require(_0x9671('0x4'))['db'];var utils=require(_0x9671('0x5'));var logger=require(_0x9671('0x6'))(_0x9671('0x7'));var config=require(_0x9671('0x8'));var jayson=require(_0x9671('0x9'));var client=jayson[_0x9671('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5754f8,_0x54cd47,_0xcd12b3){return new BPromise(function(_0x27acd7,_0x2214e9){return client[_0x9671('0xb')](_0x5754f8,_0xcd12b3)['then'](function(_0x52b616){logger['info'](_0x9671('0xc'),_0x54cd47,_0x9671('0xd'));logger[_0x9671('0xe')](_0x9671('0xf'),_0x54cd47,'request\x20sent',JSON[_0x9671('0x10')](_0x52b616));if(_0x52b616['error']){if(_0x52b616['error'][_0x9671('0x11')]===0x1f4){logger['error'](_0x9671('0xc'),_0x54cd47,_0x52b616['error'][_0x9671('0x12')]);return _0x2214e9(_0x52b616[_0x9671('0x13')]['message']);}logger['error'](_0x9671('0xc'),_0x54cd47,_0x52b616[_0x9671('0x13')][_0x9671('0x12')]);return _0x27acd7(_0x52b616[_0x9671('0x13')]['message']);}else{logger[_0x9671('0x14')]('Trigger,\x20%s,\x20%s',_0x54cd47,_0x9671('0xd'));_0x27acd7(_0x52b616[_0x9671('0x15')][_0x9671('0x12')]);}})['catch'](function(_0x1a023a){logger['error'](_0x9671('0xc'),_0x54cd47,_0x1a023a);_0x2214e9(_0x1a023a);});});}exports[_0x9671('0x16')]=function(_0x2ca757){var _0x3e61fb=this;return new Promise(function(_0xa55d29,_0x3464e9){return db[_0x9671('0x17')]['findAll']({'raw':_0x2ca757['options']?_0x2ca757[_0x9671('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2ca757[_0x9671('0x18')]?_0x2ca757[_0x9671('0x18')][_0x9671('0x19')]||null:null,'attributes':_0x2ca757[_0x9671('0x18')]?_0x2ca757['options'][_0x9671('0x1a')]||null:null,'limit':_0x2ca757['options']?_0x2ca757[_0x9671('0x18')]['limit']||null:null,'include':_0x2ca757[_0x9671('0x18')]?_0x2ca757[_0x9671('0x18')][_0x9671('0x1b')]?_['map'](_0x2ca757['options']['include'],function(_0x1ae3c6){return{'model':db[_0x1ae3c6[_0x9671('0x1c')]],'as':_0x1ae3c6['as'],'attributes':_0x1ae3c6[_0x9671('0x1a')],'include':_0x1ae3c6[_0x9671('0x1b')]?_[_0x9671('0x1d')](_0x1ae3c6[_0x9671('0x1b')],function(_0x4ae1f4){return{'model':db[_0x4ae1f4[_0x9671('0x1c')]],'as':_0x4ae1f4['as'],'attributes':_0x4ae1f4['attributes'],'include':_0x4ae1f4[_0x9671('0x1b')]?_[_0x9671('0x1d')](_0x4ae1f4['include'],function(_0x38ef55){return{'model':db[_0x38ef55[_0x9671('0x1c')]],'as':_0x38ef55['as'],'attributes':_0x38ef55[_0x9671('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9671('0x1e')](function(_0x38b756){logger[_0x9671('0x14')](_0x9671('0x16'),_0x2ca757);logger['debug'](_0x9671('0x16'),_0x2ca757,JSON[_0x9671('0x10')](_0x38b756));_0xa55d29(_0x38b756);})[_0x9671('0x1f')](function(_0x2f5e0e){logger[_0x9671('0x13')]('GetTrigger',_0x2f5e0e[_0x9671('0x12')],_0x2ca757);_0x3464e9(_0x3e61fb[_0x9671('0x13')](0x1f4,_0x2f5e0e[_0x9671('0x12')]));});});};exports[_0x9671('0x20')]=function(_0xcb1f2c){var _0x4f8753=this;return new Promise(function(_0x595e23,_0x464dae){return db[_0x9671('0x17')][_0x9671('0x21')]({'raw':_0xcb1f2c[_0x9671('0x18')]?_0xcb1f2c[_0x9671('0x18')][_0x9671('0x22')]===undefined?!![]:![]:!![],'where':_0xcb1f2c[_0x9671('0x18')]?_0xcb1f2c[_0x9671('0x18')]['where']||null:null,'attributes':_0xcb1f2c[_0x9671('0x18')]?_0xcb1f2c['options'][_0x9671('0x1a')]||null:null,'include':_0xcb1f2c['options']?_0xcb1f2c['options'][_0x9671('0x1b')]?_[_0x9671('0x1d')](_0xcb1f2c[_0x9671('0x18')][_0x9671('0x1b')],function(_0x534434){return{'model':db[_0x534434[_0x9671('0x1c')]],'as':_0x534434['as'],'attributes':_0x534434[_0x9671('0x1a')],'include':_0x534434['include']?_[_0x9671('0x1d')](_0x534434[_0x9671('0x1b')],function(_0x5b4615){return{'model':db[_0x5b4615[_0x9671('0x1c')]],'as':_0x5b4615['as'],'attributes':_0x5b4615[_0x9671('0x1a')],'include':_0x5b4615['include']?_[_0x9671('0x1d')](_0x5b4615[_0x9671('0x1b')],function(_0x53f658){return{'model':db[_0x53f658['model']],'as':_0x53f658['as'],'attributes':_0x53f658[_0x9671('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9671('0x1e')](function(_0x59bb3f){logger['info'](_0x9671('0x20'),_0xcb1f2c);logger['debug'](_0x9671('0x20'),_0xcb1f2c,JSON['stringify'](_0x59bb3f));_0x595e23(_0x59bb3f);})[_0x9671('0x1f')](function(_0x29ce0f){logger[_0x9671('0x13')](_0x9671('0x20'),_0x29ce0f[_0x9671('0x12')],_0xcb1f2c);_0x464dae(_0x4f8753[_0x9671('0x13')](0x1f4,_0x29ce0f[_0x9671('0x12')]));});});};
\ No newline at end of file
+var _0x026a=['result','catch','GetTrigger','Trigger','findAll','options','raw','where','limit','include','map','model','attributes','find','ShowTrigger','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2aa30b,_0x31e9f2){var _0x5d9c3c=function(_0x238db9){while(--_0x238db9){_0x2aa30b['push'](_0x2aa30b['shift']());}};_0x5d9c3c(++_0x31e9f2);}(_0x026a,0x138));var _0xa026=function(_0x59f5b7,_0x27856d){_0x59f5b7=_0x59f5b7-0x0;var _0x3092c3=_0x026a[_0x59f5b7];return _0x3092c3;};'use strict';var _=require(_0xa026('0x0'));var util=require(_0xa026('0x1'));var moment=require(_0xa026('0x2'));var BPromise=require(_0xa026('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa026('0x4'));var db=require(_0xa026('0x5'))['db'];var utils=require(_0xa026('0x6'));var logger=require('../../config/logger')(_0xa026('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa026('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a1d20,_0x251e00,_0x2c060f){return new BPromise(function(_0xa6076c,_0x12952d){return client['request'](_0x3a1d20,_0x2c060f)[_0xa026('0x9')](function(_0x75b419){logger[_0xa026('0xa')](_0xa026('0xb'),_0x251e00,_0xa026('0xc'));logger['debug'](_0xa026('0xd'),_0x251e00,_0xa026('0xc'),JSON[_0xa026('0xe')](_0x75b419));if(_0x75b419[_0xa026('0xf')]){if(_0x75b419[_0xa026('0xf')][_0xa026('0x10')]===0x1f4){logger[_0xa026('0xf')](_0xa026('0xb'),_0x251e00,_0x75b419[_0xa026('0xf')][_0xa026('0x11')]);return _0x12952d(_0x75b419[_0xa026('0xf')][_0xa026('0x11')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x251e00,_0x75b419[_0xa026('0xf')]['message']);return _0xa6076c(_0x75b419[_0xa026('0xf')][_0xa026('0x11')]);}else{logger[_0xa026('0xa')]('Trigger,\x20%s,\x20%s',_0x251e00,_0xa026('0xc'));_0xa6076c(_0x75b419[_0xa026('0x12')][_0xa026('0x11')]);}})[_0xa026('0x13')](function(_0x5d400c){logger[_0xa026('0xf')](_0xa026('0xb'),_0x251e00,_0x5d400c);_0x12952d(_0x5d400c);});});}exports[_0xa026('0x14')]=function(_0x2b7381){var _0x1d109e=this;return new Promise(function(_0x8ef943,_0x32e31e){return db[_0xa026('0x15')][_0xa026('0x16')]({'raw':_0x2b7381[_0xa026('0x17')]?_0x2b7381[_0xa026('0x17')][_0xa026('0x18')]===undefined?!![]:![]:!![],'where':_0x2b7381[_0xa026('0x17')]?_0x2b7381[_0xa026('0x17')][_0xa026('0x19')]||null:null,'attributes':_0x2b7381[_0xa026('0x17')]?_0x2b7381[_0xa026('0x17')]['attributes']||null:null,'limit':_0x2b7381[_0xa026('0x17')]?_0x2b7381[_0xa026('0x17')][_0xa026('0x1a')]||null:null,'include':_0x2b7381[_0xa026('0x17')]?_0x2b7381[_0xa026('0x17')][_0xa026('0x1b')]?_[_0xa026('0x1c')](_0x2b7381[_0xa026('0x17')][_0xa026('0x1b')],function(_0x24e975){return{'model':db[_0x24e975[_0xa026('0x1d')]],'as':_0x24e975['as'],'attributes':_0x24e975[_0xa026('0x1e')],'include':_0x24e975[_0xa026('0x1b')]?_[_0xa026('0x1c')](_0x24e975[_0xa026('0x1b')],function(_0xeef41d){return{'model':db[_0xeef41d[_0xa026('0x1d')]],'as':_0xeef41d['as'],'attributes':_0xeef41d[_0xa026('0x1e')],'include':_0xeef41d[_0xa026('0x1b')]?_[_0xa026('0x1c')](_0xeef41d[_0xa026('0x1b')],function(_0x21fda8){return{'model':db[_0x21fda8[_0xa026('0x1d')]],'as':_0x21fda8['as'],'attributes':_0x21fda8[_0xa026('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa026('0x9')](function(_0x38756c){logger['info'](_0xa026('0x14'),_0x2b7381);logger['debug'](_0xa026('0x14'),_0x2b7381,JSON[_0xa026('0xe')](_0x38756c));_0x8ef943(_0x38756c);})['catch'](function(_0x33bbea){logger[_0xa026('0xf')](_0xa026('0x14'),_0x33bbea[_0xa026('0x11')],_0x2b7381);_0x32e31e(_0x1d109e[_0xa026('0xf')](0x1f4,_0x33bbea[_0xa026('0x11')]));});});};exports['ShowTrigger']=function(_0x3f35f2){var _0x49a64e=this;return new Promise(function(_0x4c4236,_0x2ca9bb){return db[_0xa026('0x15')][_0xa026('0x1f')]({'raw':_0x3f35f2['options']?_0x3f35f2[_0xa026('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3f35f2[_0xa026('0x17')]?_0x3f35f2[_0xa026('0x17')][_0xa026('0x19')]||null:null,'attributes':_0x3f35f2[_0xa026('0x17')]?_0x3f35f2[_0xa026('0x17')]['attributes']||null:null,'include':_0x3f35f2['options']?_0x3f35f2[_0xa026('0x17')][_0xa026('0x1b')]?_[_0xa026('0x1c')](_0x3f35f2['options'][_0xa026('0x1b')],function(_0x40cb28){return{'model':db[_0x40cb28[_0xa026('0x1d')]],'as':_0x40cb28['as'],'attributes':_0x40cb28[_0xa026('0x1e')],'include':_0x40cb28[_0xa026('0x1b')]?_[_0xa026('0x1c')](_0x40cb28['include'],function(_0x4b01b7){return{'model':db[_0x4b01b7[_0xa026('0x1d')]],'as':_0x4b01b7['as'],'attributes':_0x4b01b7[_0xa026('0x1e')],'include':_0x4b01b7[_0xa026('0x1b')]?_['map'](_0x4b01b7[_0xa026('0x1b')],function(_0x198afa){return{'model':db[_0x198afa[_0xa026('0x1d')]],'as':_0x198afa['as'],'attributes':_0x198afa[_0xa026('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa026('0x9')](function(_0x35ede7){logger['info']('ShowTrigger',_0x3f35f2);logger['debug'](_0xa026('0x20'),_0x3f35f2,JSON[_0xa026('0xe')](_0x35ede7));_0x4c4236(_0x35ede7);})[_0xa026('0x13')](function(_0x10e91e){logger['error'](_0xa026('0x20'),_0x10e91e[_0xa026('0x11')],_0x3f35f2);_0x2ca9bb(_0x49a64e['error'](0x1f4,_0x10e91e['message']));});});};
\ No newline at end of file