Built motion from commit da617fac.|2.6.6
[motion2.git] / server / api / trigger / trigger.rpc.js
index 7b77857..f7c4ef0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7072=['model','then','ShowTrigger','Trigger','find','map','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetTrigger','options','raw','where','attributes','limit','include'];(function(_0x2b55b5,_0x78505e){var _0x103d28=function(_0x5095a2){while(--_0x5095a2){_0x2b55b5['push'](_0x2b55b5['shift']());}};_0x103d28(++_0x78505e);}(_0x7072,0x138));var _0x2707=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x7072[_0x58dc25];return _0x21b0a7;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var moment=require(_0x2707('0x1'));var BPromise=require(_0x2707('0x2'));var rs=require(_0x2707('0x3'));var fs=require('fs');var Redis=require(_0x2707('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2707('0x5'))('rpc');var config=require(_0x2707('0x6'));var jayson=require(_0x2707('0x7'));var client=jayson[_0x2707('0x8')][_0x2707('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fd8ff,_0x128205,_0x21b0a0){return new BPromise(function(_0x745cfd,_0x4062b6){return client[_0x2707('0xa')](_0x2fd8ff,_0x21b0a0)['then'](function(_0x597ff9){logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));logger[_0x2707('0xe')](_0x2707('0xf'),_0x128205,_0x2707('0xd'),JSON[_0x2707('0x10')](_0x597ff9));if(_0x597ff9[_0x2707('0x11')]){if(_0x597ff9[_0x2707('0x11')][_0x2707('0x12')]===0x1f4){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')]['message']);return _0x4062b6(_0x597ff9[_0x2707('0x11')]['message']);}logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')][_0x2707('0x13')]);return _0x745cfd(_0x597ff9[_0x2707('0x11')]['message']);}else{logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));_0x745cfd(_0x597ff9['result'][_0x2707('0x13')]);}})[_0x2707('0x14')](function(_0x1a979e){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x1a979e);_0x4062b6(_0x1a979e);});});}exports[_0x2707('0x15')]=function(_0x4a8b7f){var _0x119ac4=this;return new Promise(function(_0x449a61,_0x4009f3){return db['Trigger']['findAll']({'raw':_0x4a8b7f['options']?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x17')]===undefined?!![]:![]:!![],'where':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x18')]||null:null,'attributes':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x19')]||null:null,'limit':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x1a')]||null:null,'include':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x1b')]?_['map'](_0x4a8b7f[_0x2707('0x16')][_0x2707('0x1b')],function(_0x46259e){return{'model':db[_0x46259e[_0x2707('0x1c')]],'as':_0x46259e['as'],'attributes':_0x46259e[_0x2707('0x19')],'include':_0x46259e[_0x2707('0x1b')]?_['map'](_0x46259e[_0x2707('0x1b')],function(_0x3f6976){return{'model':db[_0x3f6976[_0x2707('0x1c')]],'as':_0x3f6976['as'],'attributes':_0x3f6976[_0x2707('0x19')],'include':_0x3f6976[_0x2707('0x1b')]?_['map'](_0x3f6976[_0x2707('0x1b')],function(_0x4ca05d){return{'model':db[_0x4ca05d[_0x2707('0x1c')]],'as':_0x4ca05d['as'],'attributes':_0x4ca05d[_0x2707('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2707('0x1d')](function(_0x57da26){logger[_0x2707('0xb')](_0x2707('0x15'),_0x4a8b7f);logger[_0x2707('0xe')]('GetTrigger',_0x4a8b7f,JSON[_0x2707('0x10')](_0x57da26));_0x449a61(_0x57da26);})[_0x2707('0x14')](function(_0x4a99ce){logger[_0x2707('0x11')]('GetTrigger',_0x4a99ce['message'],_0x4a8b7f);_0x4009f3(_0x119ac4[_0x2707('0x11')](0x1f4,_0x4a99ce['message']));});});};exports[_0x2707('0x1e')]=function(_0x3f153d){var _0x417a97=this;return new Promise(function(_0x36b2e9,_0x48832b){return db[_0x2707('0x1f')][_0x2707('0x20')]({'raw':_0x3f153d[_0x2707('0x16')]?_0x3f153d[_0x2707('0x16')][_0x2707('0x17')]===undefined?!![]:![]:!![],'where':_0x3f153d[_0x2707('0x16')]?_0x3f153d[_0x2707('0x16')][_0x2707('0x18')]||null:null,'attributes':_0x3f153d[_0x2707('0x16')]?_0x3f153d['options'][_0x2707('0x19')]||null:null,'include':_0x3f153d[_0x2707('0x16')]?_0x3f153d['options']['include']?_['map'](_0x3f153d['options']['include'],function(_0x137e04){return{'model':db[_0x137e04['model']],'as':_0x137e04['as'],'attributes':_0x137e04['attributes'],'include':_0x137e04[_0x2707('0x1b')]?_[_0x2707('0x21')](_0x137e04['include'],function(_0x473954){return{'model':db[_0x473954[_0x2707('0x1c')]],'as':_0x473954['as'],'attributes':_0x473954['attributes'],'include':_0x473954['include']?_[_0x2707('0x21')](_0x473954[_0x2707('0x1b')],function(_0x521edb){return{'model':db[_0x521edb['model']],'as':_0x521edb['as'],'attributes':_0x521edb[_0x2707('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2707('0x1d')](function(_0x5a18b0){logger[_0x2707('0xb')](_0x2707('0x1e'),_0x3f153d);logger[_0x2707('0xe')](_0x2707('0x1e'),_0x3f153d,JSON[_0x2707('0x10')](_0x5a18b0));_0x36b2e9(_0x5a18b0);})[_0x2707('0x14')](function(_0x5bd2e5){logger[_0x2707('0x11')](_0x2707('0x1e'),_0x5bd2e5[_0x2707('0x13')],_0x3f153d);_0x48832b(_0x417a97[_0x2707('0x11')](0x1f4,_0x5bd2e5[_0x2707('0x13')]));});});};
\ 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