Built motion from commit d9028345.|2.5.43
[motion2.git] / server / api / trigger / trigger.rpc.js
index ca1d1ea..ecb6f11 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5569=['ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','code','error','message','Trigger,\x20%s,\x20%s','result','catch','GetTrigger','Trigger','options','raw','where','limit','map','model','attributes','include','ShowTrigger','find','lodash','bluebird','randomstring'];(function(_0x34e858,_0x4323ac){var _0x3c6c1b=function(_0x350652){while(--_0x350652){_0x34e858['push'](_0x34e858['shift']());}};_0x3c6c1b(++_0x4323ac);}(_0x5569,0xc9));var _0x9556=function(_0x4e21ba,_0x18097f){_0x4e21ba=_0x4e21ba-0x0;var _0x55b94b=_0x5569[_0x4e21ba];return _0x55b94b;};'use strict';var _=require(_0x9556('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9556('0x1'));var rs=require(_0x9556('0x2'));var fs=require('fs');var Redis=require(_0x9556('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9556('0x4'));var config=require(_0x9556('0x5'));var jayson=require(_0x9556('0x6'));var client=jayson[_0x9556('0x7')][_0x9556('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1fa896,_0x375795,_0x4e95b1){return new BPromise(function(_0x362768,_0x1d9680){return client[_0x9556('0x9')](_0x1fa896,_0x4e95b1)[_0x9556('0xa')](function(_0x144757){logger[_0x9556('0xb')]('Trigger,\x20%s,\x20%s',_0x375795,_0x9556('0xc'));logger[_0x9556('0xd')](_0x9556('0xe'),_0x375795,_0x9556('0xc'),JSON[_0x9556('0xf')](_0x144757));if(_0x144757['error']){if(_0x144757['error'][_0x9556('0x10')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x375795,_0x144757[_0x9556('0x11')][_0x9556('0x12')]);return _0x1d9680(_0x144757[_0x9556('0x11')]['message']);}logger['error']('Trigger,\x20%s,\x20%s',_0x375795,_0x144757['error'][_0x9556('0x12')]);return _0x362768(_0x144757[_0x9556('0x11')][_0x9556('0x12')]);}else{logger[_0x9556('0xb')](_0x9556('0x13'),_0x375795,_0x9556('0xc'));_0x362768(_0x144757[_0x9556('0x14')][_0x9556('0x12')]);}})[_0x9556('0x15')](function(_0x2909c9){logger[_0x9556('0x11')](_0x9556('0x13'),_0x375795,_0x2909c9);_0x1d9680(_0x2909c9);});});}exports[_0x9556('0x16')]=function(_0x22a377){var _0x1201f3=this;return new Promise(function(_0x30a8bb,_0x1f6d7e){return db[_0x9556('0x17')]['findAll']({'raw':_0x22a377['options']?_0x22a377[_0x9556('0x18')][_0x9556('0x19')]===undefined?!![]:![]:!![],'where':_0x22a377[_0x9556('0x18')]?_0x22a377[_0x9556('0x18')][_0x9556('0x1a')]||null:null,'attributes':_0x22a377[_0x9556('0x18')]?_0x22a377[_0x9556('0x18')]['attributes']||null:null,'limit':_0x22a377[_0x9556('0x18')]?_0x22a377[_0x9556('0x18')][_0x9556('0x1b')]||null:null,'include':_0x22a377['options']?_0x22a377[_0x9556('0x18')]['include']?_[_0x9556('0x1c')](_0x22a377[_0x9556('0x18')]['include'],function(_0x3a2edd){return{'model':db[_0x3a2edd[_0x9556('0x1d')]],'as':_0x3a2edd['as'],'attributes':_0x3a2edd[_0x9556('0x1e')],'include':_0x3a2edd[_0x9556('0x1f')]?_[_0x9556('0x1c')](_0x3a2edd['include'],function(_0x4c098d){return{'model':db[_0x4c098d[_0x9556('0x1d')]],'as':_0x4c098d['as'],'attributes':_0x4c098d[_0x9556('0x1e')],'include':_0x4c098d['include']?_[_0x9556('0x1c')](_0x4c098d[_0x9556('0x1f')],function(_0x8934c7){return{'model':db[_0x8934c7[_0x9556('0x1d')]],'as':_0x8934c7['as'],'attributes':_0x8934c7[_0x9556('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9556('0xa')](function(_0x8f961c){logger[_0x9556('0xb')](_0x9556('0x16'),_0x22a377);logger[_0x9556('0xd')](_0x9556('0x16'),_0x22a377,JSON[_0x9556('0xf')](_0x8f961c));_0x30a8bb(_0x8f961c);})[_0x9556('0x15')](function(_0x234570){logger[_0x9556('0x11')](_0x9556('0x16'),_0x234570[_0x9556('0x12')],_0x22a377);_0x1f6d7e(_0x1201f3[_0x9556('0x11')](0x1f4,_0x234570['message']));});});};exports[_0x9556('0x20')]=function(_0x1cee98){var _0x5eb9ed=this;return new Promise(function(_0x269e0f,_0x219a71){return db['Trigger'][_0x9556('0x21')]({'raw':_0x1cee98[_0x9556('0x18')]?_0x1cee98[_0x9556('0x18')][_0x9556('0x19')]===undefined?!![]:![]:!![],'where':_0x1cee98[_0x9556('0x18')]?_0x1cee98[_0x9556('0x18')]['where']||null:null,'attributes':_0x1cee98[_0x9556('0x18')]?_0x1cee98['options'][_0x9556('0x1e')]||null:null,'include':_0x1cee98['options']?_0x1cee98[_0x9556('0x18')]['include']?_[_0x9556('0x1c')](_0x1cee98[_0x9556('0x18')][_0x9556('0x1f')],function(_0x11fe38){return{'model':db[_0x11fe38[_0x9556('0x1d')]],'as':_0x11fe38['as'],'attributes':_0x11fe38[_0x9556('0x1e')],'include':_0x11fe38[_0x9556('0x1f')]?_['map'](_0x11fe38[_0x9556('0x1f')],function(_0x1d7cac){return{'model':db[_0x1d7cac[_0x9556('0x1d')]],'as':_0x1d7cac['as'],'attributes':_0x1d7cac[_0x9556('0x1e')],'include':_0x1d7cac[_0x9556('0x1f')]?_[_0x9556('0x1c')](_0x1d7cac[_0x9556('0x1f')],function(_0x2b1aa8){return{'model':db[_0x2b1aa8[_0x9556('0x1d')]],'as':_0x2b1aa8['as'],'attributes':_0x2b1aa8[_0x9556('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9556('0xa')](function(_0x49bb66){logger[_0x9556('0xb')](_0x9556('0x20'),_0x1cee98);logger['debug'](_0x9556('0x20'),_0x1cee98,JSON[_0x9556('0xf')](_0x49bb66));_0x269e0f(_0x49bb66);})['catch'](function(_0x4b46c2){logger[_0x9556('0x11')](_0x9556('0x20'),_0x4b46c2['message'],_0x1cee98);_0x219a71(_0x5eb9ed['error'](0x1f4,_0x4b46c2[_0x9556('0x12')]));});});};
\ No newline at end of file
+var _0xbf13=['raw','where','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetTrigger','Trigger','findAll','options','limit','include','map','model','attributes','catch','ShowTrigger','find'];(function(_0x2a126f,_0x37e513){var _0xe6f455=function(_0x5bbf7c){while(--_0x5bbf7c){_0x2a126f['push'](_0x2a126f['shift']());}};_0xe6f455(++_0x37e513);}(_0xbf13,0xa7));var _0x3bf1=function(_0x464bdc,_0xb0a019){_0x464bdc=_0x464bdc-0x0;var _0x1b1f84=_0xbf13[_0x464bdc];return _0x1b1f84;};'use strict';var _=require(_0x3bf1('0x0'));var util=require(_0x3bf1('0x1'));var moment=require(_0x3bf1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3bf1('0x3'));var db=require(_0x3bf1('0x4'))['db'];var utils=require(_0x3bf1('0x5'));var logger=require(_0x3bf1('0x6'))(_0x3bf1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3bf1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18cad2,_0x2aa21a,_0x54a0a3){return new BPromise(function(_0x45cb9b,_0x1a9496){return client['request'](_0x18cad2,_0x54a0a3)[_0x3bf1('0x9')](function(_0x65726a){logger[_0x3bf1('0xa')](_0x3bf1('0xb'),_0x2aa21a,_0x3bf1('0xc'));logger[_0x3bf1('0xd')](_0x3bf1('0xe'),_0x2aa21a,_0x3bf1('0xc'),JSON[_0x3bf1('0xf')](_0x65726a));if(_0x65726a[_0x3bf1('0x10')]){if(_0x65726a[_0x3bf1('0x10')][_0x3bf1('0x11')]===0x1f4){logger[_0x3bf1('0x10')](_0x3bf1('0xb'),_0x2aa21a,_0x65726a[_0x3bf1('0x10')][_0x3bf1('0x12')]);return _0x1a9496(_0x65726a[_0x3bf1('0x10')][_0x3bf1('0x12')]);}logger[_0x3bf1('0x10')](_0x3bf1('0xb'),_0x2aa21a,_0x65726a[_0x3bf1('0x10')]['message']);return _0x45cb9b(_0x65726a[_0x3bf1('0x10')][_0x3bf1('0x12')]);}else{logger['info'](_0x3bf1('0xb'),_0x2aa21a,_0x3bf1('0xc'));_0x45cb9b(_0x65726a['result'][_0x3bf1('0x12')]);}})['catch'](function(_0x59616f){logger[_0x3bf1('0x10')](_0x3bf1('0xb'),_0x2aa21a,_0x59616f);_0x1a9496(_0x59616f);});});}exports[_0x3bf1('0x13')]=function(_0x265e5a){var _0x187260=this;return new Promise(function(_0x1e07af,_0x1e2fd0){return db[_0x3bf1('0x14')][_0x3bf1('0x15')]({'raw':_0x265e5a['options']?_0x265e5a[_0x3bf1('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x265e5a[_0x3bf1('0x16')]?_0x265e5a[_0x3bf1('0x16')]['where']||null:null,'attributes':_0x265e5a[_0x3bf1('0x16')]?_0x265e5a[_0x3bf1('0x16')]['attributes']||null:null,'limit':_0x265e5a[_0x3bf1('0x16')]?_0x265e5a[_0x3bf1('0x16')][_0x3bf1('0x17')]||null:null,'include':_0x265e5a[_0x3bf1('0x16')]?_0x265e5a[_0x3bf1('0x16')][_0x3bf1('0x18')]?_[_0x3bf1('0x19')](_0x265e5a[_0x3bf1('0x16')]['include'],function(_0x328c4c){return{'model':db[_0x328c4c['model']],'as':_0x328c4c['as'],'attributes':_0x328c4c['attributes'],'include':_0x328c4c['include']?_['map'](_0x328c4c[_0x3bf1('0x18')],function(_0x24bb1e){return{'model':db[_0x24bb1e[_0x3bf1('0x1a')]],'as':_0x24bb1e['as'],'attributes':_0x24bb1e[_0x3bf1('0x1b')],'include':_0x24bb1e[_0x3bf1('0x18')]?_[_0x3bf1('0x19')](_0x24bb1e[_0x3bf1('0x18')],function(_0x5514ec){return{'model':db[_0x5514ec[_0x3bf1('0x1a')]],'as':_0x5514ec['as'],'attributes':_0x5514ec[_0x3bf1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3bf1('0x9')](function(_0x3d4bf2){logger['info'](_0x3bf1('0x13'),_0x265e5a);logger[_0x3bf1('0xd')](_0x3bf1('0x13'),_0x265e5a,JSON[_0x3bf1('0xf')](_0x3d4bf2));_0x1e07af(_0x3d4bf2);})[_0x3bf1('0x1c')](function(_0x5e10b6){logger['error'](_0x3bf1('0x13'),_0x5e10b6[_0x3bf1('0x12')],_0x265e5a);_0x1e2fd0(_0x187260[_0x3bf1('0x10')](0x1f4,_0x5e10b6[_0x3bf1('0x12')]));});});};exports[_0x3bf1('0x1d')]=function(_0x1fb081){var _0x1ef7ca=this;return new Promise(function(_0x5ac79d,_0x41a807){return db['Trigger'][_0x3bf1('0x1e')]({'raw':_0x1fb081[_0x3bf1('0x16')]?_0x1fb081['options'][_0x3bf1('0x1f')]===undefined?!![]:![]:!![],'where':_0x1fb081[_0x3bf1('0x16')]?_0x1fb081[_0x3bf1('0x16')][_0x3bf1('0x20')]||null:null,'attributes':_0x1fb081[_0x3bf1('0x16')]?_0x1fb081[_0x3bf1('0x16')]['attributes']||null:null,'include':_0x1fb081[_0x3bf1('0x16')]?_0x1fb081[_0x3bf1('0x16')][_0x3bf1('0x18')]?_[_0x3bf1('0x19')](_0x1fb081[_0x3bf1('0x16')]['include'],function(_0x13b45c){return{'model':db[_0x13b45c[_0x3bf1('0x1a')]],'as':_0x13b45c['as'],'attributes':_0x13b45c[_0x3bf1('0x1b')],'include':_0x13b45c['include']?_['map'](_0x13b45c[_0x3bf1('0x18')],function(_0x2e61ca){return{'model':db[_0x2e61ca[_0x3bf1('0x1a')]],'as':_0x2e61ca['as'],'attributes':_0x2e61ca[_0x3bf1('0x1b')],'include':_0x2e61ca[_0x3bf1('0x18')]?_[_0x3bf1('0x19')](_0x2e61ca[_0x3bf1('0x18')],function(_0x436e31){return{'model':db[_0x436e31[_0x3bf1('0x1a')]],'as':_0x436e31['as'],'attributes':_0x436e31['attributes']};}):[]};}):[]};}):[]:[]})[_0x3bf1('0x9')](function(_0x374563){logger[_0x3bf1('0xa')](_0x3bf1('0x1d'),_0x1fb081);logger['debug']('ShowTrigger',_0x1fb081,JSON['stringify'](_0x374563));_0x5ac79d(_0x374563);})[_0x3bf1('0x1c')](function(_0x9fbb74){logger[_0x3bf1('0x10')](_0x3bf1('0x1d'),_0x9fbb74[_0x3bf1('0x12')],_0x1fb081);_0x41a807(_0x1ef7ca[_0x3bf1('0x10')](0x1f4,_0x9fbb74[_0x3bf1('0x12')]));});});};
\ No newline at end of file