Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / trigger / trigger.rpc.js
index 3d718c0..6fedf0f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5c3c=['jayson/promise','client','request','then','info','request\x20sent','debug','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','options','where','attributes','include','map','model','stringify','find','ShowTrigger','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5c3c,0x1ae));var _0xc5c3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x5c3c[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc5c3('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc5c3('0x1'))['db'];var utils=require(_0xc5c3('0x2'));var logger=require(_0xc5c3('0x3'))('rpc');var config=require(_0xc5c3('0x4'));var jayson=require(_0xc5c3('0x5'));var client=jayson[_0xc5c3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x141ce6,_0x20e653,_0x3ca607){return new BPromise(function(_0x442f61,_0x5c70e7){return client[_0xc5c3('0x7')](_0x141ce6,_0x3ca607)[_0xc5c3('0x8')](function(_0x1e445d){logger[_0xc5c3('0x9')]('Trigger,\x20%s,\x20%s',_0x20e653,_0xc5c3('0xa'));logger[_0xc5c3('0xb')]('Trigger,\x20%s,\x20%s,\x20%s',_0x20e653,_0xc5c3('0xa'),JSON['stringify'](_0x1e445d));if(_0x1e445d[_0xc5c3('0xc')]){if(_0x1e445d[_0xc5c3('0xc')][_0xc5c3('0xd')]===0x1f4){logger['error'](_0xc5c3('0xe'),_0x20e653,_0x1e445d[_0xc5c3('0xc')]['message']);return _0x5c70e7(_0x1e445d[_0xc5c3('0xc')][_0xc5c3('0xf')]);}logger[_0xc5c3('0xc')](_0xc5c3('0xe'),_0x20e653,_0x1e445d['error']['message']);return _0x442f61(_0x1e445d[_0xc5c3('0xc')][_0xc5c3('0xf')]);}else{logger[_0xc5c3('0x9')](_0xc5c3('0xe'),_0x20e653,_0xc5c3('0xa'));_0x442f61(_0x1e445d[_0xc5c3('0x10')][_0xc5c3('0xf')]);}})[_0xc5c3('0x11')](function(_0x1175af){logger['error'](_0xc5c3('0xe'),_0x20e653,_0x1175af);_0x5c70e7(_0x1175af);});});}exports[_0xc5c3('0x12')]=function(_0x41ecd9){var _0x42ec68=this;return new Promise(function(_0x29e7ab,_0x481144){return db[_0xc5c3('0x13')]['findAll']({'raw':_0x41ecd9[_0xc5c3('0x14')]?_0x41ecd9['options']['raw']===undefined?!![]:![]:!![],'where':_0x41ecd9[_0xc5c3('0x14')]?_0x41ecd9[_0xc5c3('0x14')][_0xc5c3('0x15')]||null:null,'attributes':_0x41ecd9[_0xc5c3('0x14')]?_0x41ecd9[_0xc5c3('0x14')][_0xc5c3('0x16')]||null:null,'limit':_0x41ecd9[_0xc5c3('0x14')]?_0x41ecd9[_0xc5c3('0x14')]['limit']||null:null,'include':_0x41ecd9['options']?_0x41ecd9['options'][_0xc5c3('0x17')]?_[_0xc5c3('0x18')](_0x41ecd9[_0xc5c3('0x14')][_0xc5c3('0x17')],function(_0x209531){return{'model':db[_0x209531['model']],'as':_0x209531['as'],'attributes':_0x209531[_0xc5c3('0x16')],'include':_0x209531[_0xc5c3('0x17')]?_[_0xc5c3('0x18')](_0x209531[_0xc5c3('0x17')],function(_0x118ac0){return{'model':db[_0x118ac0[_0xc5c3('0x19')]],'as':_0x118ac0['as'],'attributes':_0x118ac0[_0xc5c3('0x16')],'include':_0x118ac0['include']?_['map'](_0x118ac0['include'],function(_0x9359b1){return{'model':db[_0x9359b1[_0xc5c3('0x19')]],'as':_0x9359b1['as'],'attributes':_0x9359b1[_0xc5c3('0x16')]};}):[]};}):[]};}):[]:[]})[_0xc5c3('0x8')](function(_0xa3399d){logger[_0xc5c3('0x9')]('GetTrigger',_0x41ecd9);logger[_0xc5c3('0xb')]('GetTrigger',_0x41ecd9,JSON[_0xc5c3('0x1a')](_0xa3399d));_0x29e7ab(_0xa3399d);})['catch'](function(_0x13862f){logger[_0xc5c3('0xc')](_0xc5c3('0x12'),_0x13862f[_0xc5c3('0xf')],_0x41ecd9);_0x481144(_0x42ec68[_0xc5c3('0xc')](0x1f4,_0x13862f[_0xc5c3('0xf')]));});});};exports['ShowTrigger']=function(_0x403105){var _0x5f2583=this;return new Promise(function(_0x4030b5,_0x5ae31e){return db[_0xc5c3('0x13')][_0xc5c3('0x1b')]({'raw':_0x403105[_0xc5c3('0x14')]?_0x403105[_0xc5c3('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x403105[_0xc5c3('0x14')]?_0x403105['options'][_0xc5c3('0x15')]||null:null,'attributes':_0x403105[_0xc5c3('0x14')]?_0x403105[_0xc5c3('0x14')]['attributes']||null:null,'include':_0x403105[_0xc5c3('0x14')]?_0x403105[_0xc5c3('0x14')][_0xc5c3('0x17')]?_[_0xc5c3('0x18')](_0x403105[_0xc5c3('0x14')][_0xc5c3('0x17')],function(_0x4affe9){return{'model':db[_0x4affe9[_0xc5c3('0x19')]],'as':_0x4affe9['as'],'attributes':_0x4affe9['attributes'],'include':_0x4affe9['include']?_[_0xc5c3('0x18')](_0x4affe9[_0xc5c3('0x17')],function(_0xb40ecc){return{'model':db[_0xb40ecc[_0xc5c3('0x19')]],'as':_0xb40ecc['as'],'attributes':_0xb40ecc[_0xc5c3('0x16')],'include':_0xb40ecc[_0xc5c3('0x17')]?_[_0xc5c3('0x18')](_0xb40ecc[_0xc5c3('0x17')],function(_0x2e0c1d){return{'model':db[_0x2e0c1d[_0xc5c3('0x19')]],'as':_0x2e0c1d['as'],'attributes':_0x2e0c1d[_0xc5c3('0x16')]};}):[]};}):[]};}):[]:[]})[_0xc5c3('0x8')](function(_0x52b0ea){logger[_0xc5c3('0x9')]('ShowTrigger',_0x403105);logger[_0xc5c3('0xb')](_0xc5c3('0x1c'),_0x403105,JSON['stringify'](_0x52b0ea));_0x4030b5(_0x52b0ea);})[_0xc5c3('0x11')](function(_0x2326c7){logger[_0xc5c3('0xc')](_0xc5c3('0x1c'),_0x2326c7[_0xc5c3('0xf')],_0x403105);_0x5ae31e(_0x5f2583[_0xc5c3('0xc')](0x1f4,_0x2326c7[_0xc5c3('0xf')]));});});};
\ No newline at end of file
+var _0xc172=['lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','result','options','raw','where','attributes','limit','map','include','model','GetTrigger','debug','stringify','catch','ShowTrigger','Trigger','find'];(function(_0x276888,_0x588d38){var _0x28fa5b=function(_0x5543cc){while(--_0x5543cc){_0x276888['push'](_0x276888['shift']());}};_0x28fa5b(++_0x588d38);}(_0xc172,0x1d4));var _0x2c17=function(_0x1b2daa,_0x461568){_0x1b2daa=_0x1b2daa-0x0;var _0x4726e9=_0xc172[_0x1b2daa];return _0x4726e9;};'use strict';var _=require(_0x2c17('0x0'));var util=require(_0x2c17('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c17('0x2'));var db=require(_0x2c17('0x3'))['db'];var utils=require(_0x2c17('0x4'));var logger=require(_0x2c17('0x5'))(_0x2c17('0x6'));var config=require(_0x2c17('0x7'));var jayson=require(_0x2c17('0x8'));var client=jayson[_0x2c17('0x9')][_0x2c17('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4daa71,_0x42a781,_0x3911d0){return new BPromise(function(_0x3739a8,_0x1a9203){return client[_0x2c17('0xb')](_0x4daa71,_0x3911d0)[_0x2c17('0xc')](function(_0x3c6246){logger[_0x2c17('0xd')](_0x2c17('0xe'),_0x42a781,_0x2c17('0xf'));logger['debug'](_0x2c17('0x10'),_0x42a781,_0x2c17('0xf'),JSON['stringify'](_0x3c6246));if(_0x3c6246[_0x2c17('0x11')]){if(_0x3c6246['error'][_0x2c17('0x12')]===0x1f4){logger['error'](_0x2c17('0xe'),_0x42a781,_0x3c6246['error'][_0x2c17('0x13')]);return _0x1a9203(_0x3c6246[_0x2c17('0x11')][_0x2c17('0x13')]);}logger[_0x2c17('0x11')]('Trigger,\x20%s,\x20%s',_0x42a781,_0x3c6246[_0x2c17('0x11')][_0x2c17('0x13')]);return _0x3739a8(_0x3c6246[_0x2c17('0x11')]['message']);}else{logger[_0x2c17('0xd')](_0x2c17('0xe'),_0x42a781,_0x2c17('0xf'));_0x3739a8(_0x3c6246[_0x2c17('0x14')][_0x2c17('0x13')]);}})['catch'](function(_0x49a5b5){logger['error'](_0x2c17('0xe'),_0x42a781,_0x49a5b5);_0x1a9203(_0x49a5b5);});});}exports['GetTrigger']=function(_0xe5a3cc){var _0x2c522e=this;return new Promise(function(_0x35ca60,_0x45ae89){return db['Trigger']['findAll']({'raw':_0xe5a3cc[_0x2c17('0x15')]?_0xe5a3cc['options'][_0x2c17('0x16')]===undefined?!![]:![]:!![],'where':_0xe5a3cc[_0x2c17('0x15')]?_0xe5a3cc['options'][_0x2c17('0x17')]||null:null,'attributes':_0xe5a3cc[_0x2c17('0x15')]?_0xe5a3cc[_0x2c17('0x15')][_0x2c17('0x18')]||null:null,'limit':_0xe5a3cc[_0x2c17('0x15')]?_0xe5a3cc['options'][_0x2c17('0x19')]||null:null,'include':_0xe5a3cc[_0x2c17('0x15')]?_0xe5a3cc[_0x2c17('0x15')]['include']?_[_0x2c17('0x1a')](_0xe5a3cc['options'][_0x2c17('0x1b')],function(_0x55e62d){return{'model':db[_0x55e62d[_0x2c17('0x1c')]],'as':_0x55e62d['as'],'attributes':_0x55e62d[_0x2c17('0x18')],'include':_0x55e62d[_0x2c17('0x1b')]?_['map'](_0x55e62d['include'],function(_0x14c066){return{'model':db[_0x14c066[_0x2c17('0x1c')]],'as':_0x14c066['as'],'attributes':_0x14c066[_0x2c17('0x18')],'include':_0x14c066[_0x2c17('0x1b')]?_[_0x2c17('0x1a')](_0x14c066['include'],function(_0x841574){return{'model':db[_0x841574[_0x2c17('0x1c')]],'as':_0x841574['as'],'attributes':_0x841574[_0x2c17('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2c17('0xc')](function(_0x634c7e){logger[_0x2c17('0xd')](_0x2c17('0x1d'),_0xe5a3cc);logger[_0x2c17('0x1e')](_0x2c17('0x1d'),_0xe5a3cc,JSON[_0x2c17('0x1f')](_0x634c7e));_0x35ca60(_0x634c7e);})[_0x2c17('0x20')](function(_0x31f27a){logger[_0x2c17('0x11')]('GetTrigger',_0x31f27a['message'],_0xe5a3cc);_0x45ae89(_0x2c522e['error'](0x1f4,_0x31f27a[_0x2c17('0x13')]));});});};exports[_0x2c17('0x21')]=function(_0x4076d2){var _0x3302bf=this;return new Promise(function(_0x1d03df,_0x3dd2e5){return db[_0x2c17('0x22')][_0x2c17('0x23')]({'raw':_0x4076d2[_0x2c17('0x15')]?_0x4076d2['options'][_0x2c17('0x16')]===undefined?!![]:![]:!![],'where':_0x4076d2[_0x2c17('0x15')]?_0x4076d2[_0x2c17('0x15')][_0x2c17('0x17')]||null:null,'attributes':_0x4076d2[_0x2c17('0x15')]?_0x4076d2[_0x2c17('0x15')][_0x2c17('0x18')]||null:null,'include':_0x4076d2['options']?_0x4076d2[_0x2c17('0x15')][_0x2c17('0x1b')]?_['map'](_0x4076d2['options'][_0x2c17('0x1b')],function(_0x125085){return{'model':db[_0x125085[_0x2c17('0x1c')]],'as':_0x125085['as'],'attributes':_0x125085[_0x2c17('0x18')],'include':_0x125085[_0x2c17('0x1b')]?_[_0x2c17('0x1a')](_0x125085['include'],function(_0x23503a){return{'model':db[_0x23503a['model']],'as':_0x23503a['as'],'attributes':_0x23503a[_0x2c17('0x18')],'include':_0x23503a[_0x2c17('0x1b')]?_['map'](_0x23503a['include'],function(_0x52b032){return{'model':db[_0x52b032[_0x2c17('0x1c')]],'as':_0x52b032['as'],'attributes':_0x52b032[_0x2c17('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x240331){logger[_0x2c17('0xd')](_0x2c17('0x21'),_0x4076d2);logger[_0x2c17('0x1e')](_0x2c17('0x21'),_0x4076d2,JSON[_0x2c17('0x1f')](_0x240331));_0x1d03df(_0x240331);})[_0x2c17('0x20')](function(_0x5e9167){logger[_0x2c17('0x11')](_0x2c17('0x21'),_0x5e9167['message'],_0x4076d2);_0x3dd2e5(_0x3302bf[_0x2c17('0x11')](0x1f4,_0x5e9167['message']));});});};
\ No newline at end of file