Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / api / cmContact / cmContact.rpc.js
index e5a2005..536032c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc99c=['redis','socket.io-emitter','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CmContact','find','options','where','attributes','include','map','model','ShowCmContact','CreateCmContact','body','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x5d23f9,_0x12dafb){var _0x19de7f=function(_0x1a6ba7){while(--_0x1a6ba7){_0x5d23f9['push'](_0x5d23f9['shift']());}};_0x19de7f(++_0x12dafb);}(_0xc99c,0xde));var _0xcc99=function(_0x4fa743,_0x4e2a21){_0x4fa743=_0x4fa743-0x0;var _0x315626=_0xc99c[_0x4fa743];return _0x315626;};'use strict';var _=require(_0xcc99('0x0'));var util=require('util');var moment=require(_0xcc99('0x1'));var BPromise=require(_0xcc99('0x2'));var rs=require(_0xcc99('0x3'));var fs=require('fs');var Redis=require(_0xcc99('0x4'));var db=require(_0xcc99('0x5'))['db'];var utils=require(_0xcc99('0x6'));var logger=require(_0xcc99('0x7'))('rpc');var config=require(_0xcc99('0x8'));var jayson=require(_0xcc99('0x9'));var client=jayson[_0xcc99('0xa')][_0xcc99('0xb')]({'port':0x232a});config[_0xcc99('0xc')]=_['defaults'](config[_0xcc99('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xcc99('0xd'))(new Redis(config['redis']));require('./cmContact.socket')[_0xcc99('0xe')](socket);function respondWithRpcPromise(_0x4b784e,_0x376c8a,_0x329304){return new BPromise(function(_0xa6a95d,_0x3efcf6){return client[_0xcc99('0xf')](_0x4b784e,_0x329304)[_0xcc99('0x10')](function(_0x17bf64){logger[_0xcc99('0x11')](_0xcc99('0x12'),_0x376c8a,_0xcc99('0x13'));logger[_0xcc99('0x14')](_0xcc99('0x15'),_0x376c8a,'request\x20sent',JSON[_0xcc99('0x16')](_0x17bf64));if(_0x17bf64['error']){if(_0x17bf64[_0xcc99('0x17')][_0xcc99('0x18')]===0x1f4){logger[_0xcc99('0x17')](_0xcc99('0x12'),_0x376c8a,_0x17bf64[_0xcc99('0x17')][_0xcc99('0x19')]);return _0x3efcf6(_0x17bf64['error'][_0xcc99('0x19')]);}logger[_0xcc99('0x17')]('CmContact,\x20%s,\x20%s',_0x376c8a,_0x17bf64[_0xcc99('0x17')][_0xcc99('0x19')]);return _0xa6a95d(_0x17bf64[_0xcc99('0x17')]['message']);}else{logger[_0xcc99('0x11')](_0xcc99('0x12'),_0x376c8a,_0xcc99('0x13'));_0xa6a95d(_0x17bf64['result'][_0xcc99('0x19')]);}})[_0xcc99('0x1a')](function(_0x4a2a97){logger[_0xcc99('0x17')](_0xcc99('0x12'),_0x376c8a,_0x4a2a97);_0x3efcf6(_0x4a2a97);});});}exports['ShowCmContact']=function(_0x5c5f52){var _0x51b403=this;return new Promise(function(_0x59d4e6,_0x48cac7){return db[_0xcc99('0x1b')][_0xcc99('0x1c')]({'raw':_0x5c5f52[_0xcc99('0x1d')]?_0x5c5f52['options']['raw']===undefined?!![]:![]:!![],'where':_0x5c5f52[_0xcc99('0x1d')]?_0x5c5f52[_0xcc99('0x1d')][_0xcc99('0x1e')]||null:null,'attributes':_0x5c5f52[_0xcc99('0x1d')]?_0x5c5f52['options'][_0xcc99('0x1f')]||null:null,'include':_0x5c5f52[_0xcc99('0x1d')]?_0x5c5f52[_0xcc99('0x1d')][_0xcc99('0x20')]?_[_0xcc99('0x21')](_0x5c5f52['options'][_0xcc99('0x20')],function(_0x28684a){return{'model':db[_0x28684a[_0xcc99('0x22')]],'as':_0x28684a['as'],'attributes':_0x28684a[_0xcc99('0x1f')],'include':_0x28684a['include']?_['map'](_0x28684a['include'],function(_0x2d0f82){return{'model':db[_0x2d0f82[_0xcc99('0x22')]],'as':_0x2d0f82['as'],'attributes':_0x2d0f82['attributes'],'include':_0x2d0f82['include']?_[_0xcc99('0x21')](_0x2d0f82['include'],function(_0x12d122){return{'model':db[_0x12d122[_0xcc99('0x22')]],'as':_0x12d122['as'],'attributes':_0x12d122[_0xcc99('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xcc99('0x10')](function(_0x119910){logger[_0xcc99('0x11')]('ShowCmContact',_0x5c5f52);logger[_0xcc99('0x14')](_0xcc99('0x23'),_0x5c5f52,JSON[_0xcc99('0x16')](_0x119910));_0x59d4e6(_0x119910);})[_0xcc99('0x1a')](function(_0x1ab7a9){logger[_0xcc99('0x17')](_0xcc99('0x23'),_0x1ab7a9[_0xcc99('0x19')],_0x5c5f52);_0x48cac7(_0x51b403[_0xcc99('0x17')](0x1f4,_0x1ab7a9[_0xcc99('0x19')]));});});};exports[_0xcc99('0x24')]=function(_0x432a58){var _0x537b78=this;return new Promise(function(_0x503b5f,_0x11671d){return db[_0xcc99('0x1b')]['create'](_0x432a58[_0xcc99('0x25')],{'raw':_0x432a58[_0xcc99('0x1d')]?_0x432a58['options'][_0xcc99('0x26')]===undefined?!![]:![]:!![]})[_0xcc99('0x10')](function(_0x4c8b7e){logger['info'](_0xcc99('0x24'),_0x432a58);logger[_0xcc99('0x14')](_0xcc99('0x24'),_0x432a58,JSON['stringify'](_0x4c8b7e));_0x503b5f(_0x4c8b7e);})[_0xcc99('0x1a')](function(_0x2cba60){logger[_0xcc99('0x17')]('CreateCmContact',_0x2cba60[_0xcc99('0x19')],_0x432a58);_0x11671d(_0x537b78[_0xcc99('0x17')](0x1f4,_0x2cba60[_0xcc99('0x19')]));});});};
\ No newline at end of file
+var _0xd67e=['socket.io-emitter','./cmContact.socket','request','then','CmContact,\x20%s,\x20%s','debug','CmContact,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','result','findAll','options','raw','where','limit','map','include','attributes','model','GetCmContact','stringify','catch','CreateCmContact','CmContact','body','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0xd67e,0xb3));var _0xed67=function(_0x152369,_0x5a2b80){_0x152369=_0x152369-0x0;var _0x459415=_0xd67e[_0x152369];return _0x459415;};'use strict';var _=require(_0xed67('0x0'));var util=require(_0xed67('0x1'));var moment=require('moment');var BPromise=require(_0xed67('0x2'));var rs=require(_0xed67('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xed67('0x4'))(_0xed67('0x5'));var config=require(_0xed67('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xed67('0x7')][_0xed67('0x8')]({'port':0x232a});config[_0xed67('0x9')]=_[_0xed67('0xa')](config[_0xed67('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xed67('0xb'))(new Redis(config[_0xed67('0x9')]));require(_0xed67('0xc'))['register'](socket);function respondWithRpcPromise(_0x5d3a65,_0x256b4c,_0xb9c77d){return new BPromise(function(_0x3014b1,_0x209255){return client[_0xed67('0xd')](_0x5d3a65,_0xb9c77d)[_0xed67('0xe')](function(_0x3e85e0){logger['info'](_0xed67('0xf'),_0x256b4c,'request\x20sent');logger[_0xed67('0x10')](_0xed67('0x11'),_0x256b4c,'request\x20sent',JSON['stringify'](_0x3e85e0));if(_0x3e85e0[_0xed67('0x12')]){if(_0x3e85e0[_0xed67('0x12')]['code']===0x1f4){logger[_0xed67('0x12')](_0xed67('0xf'),_0x256b4c,_0x3e85e0[_0xed67('0x12')][_0xed67('0x13')]);return _0x209255(_0x3e85e0[_0xed67('0x12')][_0xed67('0x13')]);}logger[_0xed67('0x12')](_0xed67('0xf'),_0x256b4c,_0x3e85e0[_0xed67('0x12')][_0xed67('0x13')]);return _0x3014b1(_0x3e85e0['error'][_0xed67('0x13')]);}else{logger[_0xed67('0x14')](_0xed67('0xf'),_0x256b4c,_0xed67('0x15'));_0x3014b1(_0x3e85e0[_0xed67('0x16')][_0xed67('0x13')]);}})['catch'](function(_0x536bd7){logger[_0xed67('0x12')](_0xed67('0xf'),_0x256b4c,_0x536bd7);_0x209255(_0x536bd7);});});}exports['GetCmContact']=function(_0x159b92){var _0x4536fb=this;return new Promise(function(_0x1abcc2,_0x24d798){return db['CmContact'][_0xed67('0x17')]({'raw':_0x159b92[_0xed67('0x18')]?_0x159b92[_0xed67('0x18')][_0xed67('0x19')]===undefined?!![]:![]:!![],'where':_0x159b92['options']?_0x159b92['options'][_0xed67('0x1a')]||null:null,'attributes':_0x159b92[_0xed67('0x18')]?_0x159b92[_0xed67('0x18')]['attributes']||null:null,'limit':_0x159b92[_0xed67('0x18')]?_0x159b92['options'][_0xed67('0x1b')]||null:null,'include':_0x159b92[_0xed67('0x18')]?_0x159b92[_0xed67('0x18')]['include']?_[_0xed67('0x1c')](_0x159b92[_0xed67('0x18')][_0xed67('0x1d')],function(_0x17784f){return{'model':db[_0x17784f['model']],'as':_0x17784f['as'],'attributes':_0x17784f[_0xed67('0x1e')],'include':_0x17784f[_0xed67('0x1d')]?_[_0xed67('0x1c')](_0x17784f['include'],function(_0x1699fb){return{'model':db[_0x1699fb[_0xed67('0x1f')]],'as':_0x1699fb['as'],'attributes':_0x1699fb['attributes'],'include':_0x1699fb[_0xed67('0x1d')]?_['map'](_0x1699fb[_0xed67('0x1d')],function(_0x30d912){return{'model':db[_0x30d912[_0xed67('0x1f')]],'as':_0x30d912['as'],'attributes':_0x30d912['attributes']};}):[]};}):[]};}):[]:[]})[_0xed67('0xe')](function(_0x13e1a0){logger[_0xed67('0x14')](_0xed67('0x20'),_0x159b92);logger[_0xed67('0x10')]('GetCmContact',_0x159b92,JSON[_0xed67('0x21')](_0x13e1a0));_0x1abcc2(_0x13e1a0);})[_0xed67('0x22')](function(_0x45360b){logger[_0xed67('0x12')](_0xed67('0x20'),_0x45360b[_0xed67('0x13')],_0x159b92);_0x24d798(_0x4536fb['error'](0x1f4,_0x45360b[_0xed67('0x13')]));});});};exports[_0xed67('0x23')]=function(_0x2b02f8){var _0x37f247=this;return new Promise(function(_0x35b605,_0x45400a){return db[_0xed67('0x24')]['create'](_0x2b02f8[_0xed67('0x25')],{'raw':_0x2b02f8[_0xed67('0x18')]?_0x2b02f8[_0xed67('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xed67('0xe')](function(_0x44121e){logger['info']('CreateCmContact',_0x2b02f8);logger[_0xed67('0x10')](_0xed67('0x23'),_0x2b02f8,JSON[_0xed67('0x21')](_0x44121e));_0x35b605(_0x44121e);})['catch'](function(_0x5b1659){logger[_0xed67('0x12')](_0xed67('0x23'),_0x5b1659[_0xed67('0x13')],_0x2b02f8);_0x45400a(_0x37f247[_0xed67('0x12')](0x1f4,_0x5b1659[_0xed67('0x13')]));});});};
\ No newline at end of file