Built motion from commit da617fac.|2.6.6
[motion2.git] / server / api / trigger / trigger.rpc.js
index f33a205..f7c4ef0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9628=['model','attributes','map','find','then','ShowTrigger','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrigger','Trigger','findAll','raw','options','where','limit','include'];(function(_0x3e5b7b,_0x1ca279){var _0x441af8=function(_0x3931e7){while(--_0x3931e7){_0x3e5b7b['push'](_0x3e5b7b['shift']());}};_0x441af8(++_0x1ca279);}(_0x9628,0x1cd));var _0x8962=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x9628[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x8962('0x0'));var util=require(_0x8962('0x1'));var moment=require(_0x8962('0x2'));var BPromise=require(_0x8962('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8962('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8962('0x5'))('rpc');var config=require(_0x8962('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8962('0x7')][_0x8962('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23df8e,_0x2d324c,_0x2a6e3f){return new BPromise(function(_0x49630d,_0x5d9767){return client[_0x8962('0x9')](_0x23df8e,_0x2a6e3f)['then'](function(_0xdb7ed1){logger[_0x8962('0xa')](_0x8962('0xb'),_0x2d324c,_0x8962('0xc'));logger[_0x8962('0xd')](_0x8962('0xe'),_0x2d324c,_0x8962('0xc'),JSON[_0x8962('0xf')](_0xdb7ed1));if(_0xdb7ed1[_0x8962('0x10')]){if(_0xdb7ed1[_0x8962('0x10')][_0x8962('0x11')]===0x1f4){logger[_0x8962('0x10')]('Trigger,\x20%s,\x20%s',_0x2d324c,_0xdb7ed1[_0x8962('0x10')][_0x8962('0x12')]);return _0x5d9767(_0xdb7ed1[_0x8962('0x10')]['message']);}logger[_0x8962('0x10')](_0x8962('0xb'),_0x2d324c,_0xdb7ed1[_0x8962('0x10')][_0x8962('0x12')]);return _0x49630d(_0xdb7ed1[_0x8962('0x10')][_0x8962('0x12')]);}else{logger[_0x8962('0xa')](_0x8962('0xb'),_0x2d324c,'request\x20sent');_0x49630d(_0xdb7ed1[_0x8962('0x13')]['message']);}})[_0x8962('0x14')](function(_0x193383){logger[_0x8962('0x10')](_0x8962('0xb'),_0x2d324c,_0x193383);_0x5d9767(_0x193383);});});}exports[_0x8962('0x15')]=function(_0x47ae76){var _0xc1bf9c=this;return new Promise(function(_0xf66c16,_0x465544){return db[_0x8962('0x16')][_0x8962('0x17')]({'raw':_0x47ae76['options']?_0x47ae76['options'][_0x8962('0x18')]===undefined?!![]:![]:!![],'where':_0x47ae76['options']?_0x47ae76[_0x8962('0x19')][_0x8962('0x1a')]||null:null,'attributes':_0x47ae76[_0x8962('0x19')]?_0x47ae76[_0x8962('0x19')]['attributes']||null:null,'limit':_0x47ae76[_0x8962('0x19')]?_0x47ae76[_0x8962('0x19')][_0x8962('0x1b')]||null:null,'include':_0x47ae76[_0x8962('0x19')]?_0x47ae76[_0x8962('0x19')][_0x8962('0x1c')]?_['map'](_0x47ae76[_0x8962('0x19')][_0x8962('0x1c')],function(_0x27fd5e){return{'model':db[_0x27fd5e[_0x8962('0x1d')]],'as':_0x27fd5e['as'],'attributes':_0x27fd5e[_0x8962('0x1e')],'include':_0x27fd5e[_0x8962('0x1c')]?_[_0x8962('0x1f')](_0x27fd5e['include'],function(_0x383cb9){return{'model':db[_0x383cb9[_0x8962('0x1d')]],'as':_0x383cb9['as'],'attributes':_0x383cb9['attributes'],'include':_0x383cb9[_0x8962('0x1c')]?_['map'](_0x383cb9['include'],function(_0x2e1491){return{'model':db[_0x2e1491[_0x8962('0x1d')]],'as':_0x2e1491['as'],'attributes':_0x2e1491['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x21efba){logger[_0x8962('0xa')]('GetTrigger',_0x47ae76);logger[_0x8962('0xd')](_0x8962('0x15'),_0x47ae76,JSON['stringify'](_0x21efba));_0xf66c16(_0x21efba);})[_0x8962('0x14')](function(_0x2e00ea){logger[_0x8962('0x10')]('GetTrigger',_0x2e00ea[_0x8962('0x12')],_0x47ae76);_0x465544(_0xc1bf9c[_0x8962('0x10')](0x1f4,_0x2e00ea[_0x8962('0x12')]));});});};exports['ShowTrigger']=function(_0x3a0d7e){var _0x412ece=this;return new Promise(function(_0x4708fa,_0x53323b){return db[_0x8962('0x16')][_0x8962('0x20')]({'raw':_0x3a0d7e[_0x8962('0x19')]?_0x3a0d7e[_0x8962('0x19')][_0x8962('0x18')]===undefined?!![]:![]:!![],'where':_0x3a0d7e[_0x8962('0x19')]?_0x3a0d7e[_0x8962('0x19')][_0x8962('0x1a')]||null:null,'attributes':_0x3a0d7e[_0x8962('0x19')]?_0x3a0d7e[_0x8962('0x19')][_0x8962('0x1e')]||null:null,'include':_0x3a0d7e[_0x8962('0x19')]?_0x3a0d7e[_0x8962('0x19')][_0x8962('0x1c')]?_[_0x8962('0x1f')](_0x3a0d7e['options'][_0x8962('0x1c')],function(_0x36eb81){return{'model':db[_0x36eb81['model']],'as':_0x36eb81['as'],'attributes':_0x36eb81[_0x8962('0x1e')],'include':_0x36eb81[_0x8962('0x1c')]?_[_0x8962('0x1f')](_0x36eb81[_0x8962('0x1c')],function(_0x30b213){return{'model':db[_0x30b213[_0x8962('0x1d')]],'as':_0x30b213['as'],'attributes':_0x30b213['attributes'],'include':_0x30b213['include']?_[_0x8962('0x1f')](_0x30b213[_0x8962('0x1c')],function(_0x4581e5){return{'model':db[_0x4581e5[_0x8962('0x1d')]],'as':_0x4581e5['as'],'attributes':_0x4581e5[_0x8962('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8962('0x21')](function(_0x4165df){logger[_0x8962('0xa')](_0x8962('0x22'),_0x3a0d7e);logger['debug'](_0x8962('0x22'),_0x3a0d7e,JSON[_0x8962('0xf')](_0x4165df));_0x4708fa(_0x4165df);})[_0x8962('0x14')](function(_0x5af463){logger[_0x8962('0x10')](_0x8962('0x22'),_0x5af463[_0x8962('0x12')],_0x3a0d7e);_0x53323b(_0x412ece[_0x8962('0x10')](0x1f4,_0x5af463[_0x8962('0x12')]));});});};
\ No newline at end of file
+var _0x9ee3=['GetTrigger','Trigger','findAll','raw','options','where','attributes','limit','include','model','map','ShowTrigger','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x32bef6,_0x5cfe2b){var _0x20cb76=function(_0x4c6eaf){while(--_0x4c6eaf){_0x32bef6['push'](_0x32bef6['shift']());}};_0x20cb76(++_0x5cfe2b);}(_0x9ee3,0x6c));var _0x39ee=function(_0x18362f,_0x137297){_0x18362f=_0x18362f-0x0;var _0xe36dbc=_0x9ee3[_0x18362f];return _0xe36dbc;};'use strict';var _=require(_0x39ee('0x0'));var util=require(_0x39ee('0x1'));var moment=require(_0x39ee('0x2'));var BPromise=require(_0x39ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x39ee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x39ee('0x5'))('rpc');var config=require(_0x39ee('0x6'));var jayson=require(_0x39ee('0x7'));var client=jayson['client'][_0x39ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x37ca0c,_0x3b756c,_0x7dcd00){return new BPromise(function(_0x505245,_0x27ac65){return client['request'](_0x37ca0c,_0x7dcd00)[_0x39ee('0x9')](function(_0x18a6fb){logger[_0x39ee('0xa')](_0x39ee('0xb'),_0x3b756c,_0x39ee('0xc'));logger[_0x39ee('0xd')](_0x39ee('0xe'),_0x3b756c,_0x39ee('0xc'),JSON[_0x39ee('0xf')](_0x18a6fb));if(_0x18a6fb[_0x39ee('0x10')]){if(_0x18a6fb[_0x39ee('0x10')]['code']===0x1f4){logger[_0x39ee('0x10')](_0x39ee('0xb'),_0x3b756c,_0x18a6fb[_0x39ee('0x10')][_0x39ee('0x11')]);return _0x27ac65(_0x18a6fb['error'][_0x39ee('0x11')]);}logger[_0x39ee('0x10')]('Trigger,\x20%s,\x20%s',_0x3b756c,_0x18a6fb[_0x39ee('0x10')][_0x39ee('0x11')]);return _0x505245(_0x18a6fb['error'][_0x39ee('0x11')]);}else{logger[_0x39ee('0xa')](_0x39ee('0xb'),_0x3b756c,_0x39ee('0xc'));_0x505245(_0x18a6fb[_0x39ee('0x12')]['message']);}})[_0x39ee('0x13')](function(_0x569704){logger['error'](_0x39ee('0xb'),_0x3b756c,_0x569704);_0x27ac65(_0x569704);});});}exports[_0x39ee('0x14')]=function(_0x8d9e58){var _0x260e62=this;return new Promise(function(_0x4f37cf,_0x1beec6){return db[_0x39ee('0x15')][_0x39ee('0x16')]({'raw':_0x8d9e58['options']?_0x8d9e58['options'][_0x39ee('0x17')]===undefined?!![]:![]:!![],'where':_0x8d9e58['options']?_0x8d9e58[_0x39ee('0x18')][_0x39ee('0x19')]||null:null,'attributes':_0x8d9e58['options']?_0x8d9e58[_0x39ee('0x18')][_0x39ee('0x1a')]||null:null,'limit':_0x8d9e58['options']?_0x8d9e58[_0x39ee('0x18')][_0x39ee('0x1b')]||null:null,'include':_0x8d9e58['options']?_0x8d9e58[_0x39ee('0x18')][_0x39ee('0x1c')]?_['map'](_0x8d9e58['options']['include'],function(_0x476c11){return{'model':db[_0x476c11[_0x39ee('0x1d')]],'as':_0x476c11['as'],'attributes':_0x476c11[_0x39ee('0x1a')],'include':_0x476c11[_0x39ee('0x1c')]?_[_0x39ee('0x1e')](_0x476c11[_0x39ee('0x1c')],function(_0x46dc49){return{'model':db[_0x46dc49[_0x39ee('0x1d')]],'as':_0x46dc49['as'],'attributes':_0x46dc49[_0x39ee('0x1a')],'include':_0x46dc49[_0x39ee('0x1c')]?_[_0x39ee('0x1e')](_0x46dc49[_0x39ee('0x1c')],function(_0x4ec922){return{'model':db[_0x4ec922[_0x39ee('0x1d')]],'as':_0x4ec922['as'],'attributes':_0x4ec922[_0x39ee('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1853ac){logger['info'](_0x39ee('0x14'),_0x8d9e58);logger[_0x39ee('0xd')]('GetTrigger',_0x8d9e58,JSON['stringify'](_0x1853ac));_0x4f37cf(_0x1853ac);})[_0x39ee('0x13')](function(_0x38b644){logger[_0x39ee('0x10')](_0x39ee('0x14'),_0x38b644[_0x39ee('0x11')],_0x8d9e58);_0x1beec6(_0x260e62[_0x39ee('0x10')](0x1f4,_0x38b644[_0x39ee('0x11')]));});});};exports[_0x39ee('0x1f')]=function(_0x3f3a69){var _0x3e6866=this;return new Promise(function(_0x1b9f2a,_0x3982c9){return db[_0x39ee('0x15')]['find']({'raw':_0x3f3a69[_0x39ee('0x18')]?_0x3f3a69[_0x39ee('0x18')][_0x39ee('0x17')]===undefined?!![]:![]:!![],'where':_0x3f3a69['options']?_0x3f3a69['options'][_0x39ee('0x19')]||null:null,'attributes':_0x3f3a69[_0x39ee('0x18')]?_0x3f3a69[_0x39ee('0x18')]['attributes']||null:null,'include':_0x3f3a69[_0x39ee('0x18')]?_0x3f3a69['options']['include']?_[_0x39ee('0x1e')](_0x3f3a69[_0x39ee('0x18')][_0x39ee('0x1c')],function(_0x596f16){return{'model':db[_0x596f16[_0x39ee('0x1d')]],'as':_0x596f16['as'],'attributes':_0x596f16[_0x39ee('0x1a')],'include':_0x596f16[_0x39ee('0x1c')]?_[_0x39ee('0x1e')](_0x596f16[_0x39ee('0x1c')],function(_0x5c68ba){return{'model':db[_0x5c68ba[_0x39ee('0x1d')]],'as':_0x5c68ba['as'],'attributes':_0x5c68ba[_0x39ee('0x1a')],'include':_0x5c68ba[_0x39ee('0x1c')]?_['map'](_0x5c68ba[_0x39ee('0x1c')],function(_0x4f3119){return{'model':db[_0x4f3119[_0x39ee('0x1d')]],'as':_0x4f3119['as'],'attributes':_0x4f3119[_0x39ee('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x462edf){logger['info'](_0x39ee('0x1f'),_0x3f3a69);logger[_0x39ee('0xd')](_0x39ee('0x1f'),_0x3f3a69,JSON['stringify'](_0x462edf));_0x1b9f2a(_0x462edf);})['catch'](function(_0x8a2234){logger[_0x39ee('0x10')]('ShowTrigger',_0x8a2234[_0x39ee('0x11')],_0x3f3a69);_0x3982c9(_0x3e6866['error'](0x1f4,_0x8a2234[_0x39ee('0x11')]));});});};
\ No newline at end of file