Built motion from commit (unavailable).|2.5.17
[motion2.git] / server / api / cmContact / cmContact.rpc.js
index 7b49133..707f482 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfd39=['request','then','info','debug','request\x20sent','stringify','error','code','CmContact,\x20%s,\x20%s','message','result','catch','GetCmContact','CmContact','options','raw','where','limit','include','map','model','attributes','body','keys','cf_','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','util','moment','bluebird','randomstring','ioredis','squel','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register'];(function(_0x4fb2ba,_0x413aff){var _0x1de00f=function(_0x4a6f7c){while(--_0x4a6f7c){_0x4fb2ba['push'](_0x4fb2ba['shift']());}};_0x1de00f(++_0x413aff);}(_0xfd39,0x14c));var _0x9fd3=function(_0x5bce2e,_0x25261b){_0x5bce2e=_0x5bce2e-0x0;var _0x2cf130=_0xfd39[_0x5bce2e];return _0x2cf130;};'use strict';var _=require('lodash');var util=require(_0x9fd3('0x0'));var moment=require(_0x9fd3('0x1'));var BPromise=require(_0x9fd3('0x2'));var rs=require(_0x9fd3('0x3'));var fs=require('fs');var Redis=require(_0x9fd3('0x4'));var squel=require(_0x9fd3('0x5'));var db=require(_0x9fd3('0x6'))['db'];var utils=require(_0x9fd3('0x7'));var logger=require(_0x9fd3('0x8'))(_0x9fd3('0x9'));var config=require(_0x9fd3('0xa'));var jayson=require(_0x9fd3('0xb'));var client=jayson[_0x9fd3('0xc')][_0x9fd3('0xd')]({'port':0x232a});config[_0x9fd3('0xe')]=_[_0x9fd3('0xf')](config[_0x9fd3('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x9fd3('0x10'))(new Redis(config['redis']));require('./cmContact.socket')[_0x9fd3('0x11')](socket);function respondWithRpcPromise(_0x3efa0e,_0x25a118,_0x19404e){return new BPromise(function(_0x8f64c2,_0x46b138){return client[_0x9fd3('0x12')](_0x3efa0e,_0x19404e)[_0x9fd3('0x13')](function(_0x526352){logger[_0x9fd3('0x14')]('CmContact,\x20%s,\x20%s',_0x25a118,'request\x20sent');logger[_0x9fd3('0x15')]('CmContact,\x20%s,\x20%s,\x20%s',_0x25a118,_0x9fd3('0x16'),JSON[_0x9fd3('0x17')](_0x526352));if(_0x526352[_0x9fd3('0x18')]){if(_0x526352[_0x9fd3('0x18')][_0x9fd3('0x19')]===0x1f4){logger['error'](_0x9fd3('0x1a'),_0x25a118,_0x526352[_0x9fd3('0x18')][_0x9fd3('0x1b')]);return _0x46b138(_0x526352[_0x9fd3('0x18')][_0x9fd3('0x1b')]);}logger[_0x9fd3('0x18')](_0x9fd3('0x1a'),_0x25a118,_0x526352[_0x9fd3('0x18')][_0x9fd3('0x1b')]);return _0x8f64c2(_0x526352['error']['message']);}else{logger[_0x9fd3('0x14')](_0x9fd3('0x1a'),_0x25a118,'request\x20sent');_0x8f64c2(_0x526352[_0x9fd3('0x1c')][_0x9fd3('0x1b')]);}})[_0x9fd3('0x1d')](function(_0x1c4f18){logger[_0x9fd3('0x18')](_0x9fd3('0x1a'),_0x25a118,_0x1c4f18);_0x46b138(_0x1c4f18);});});}exports[_0x9fd3('0x1e')]=function(_0x43e85f){var _0x35e8ac=this;return new Promise(function(_0x2bab89,_0x1abbe2){return db[_0x9fd3('0x1f')]['findAll']({'raw':_0x43e85f[_0x9fd3('0x20')]?_0x43e85f['options'][_0x9fd3('0x21')]===undefined?!![]:![]:!![],'where':_0x43e85f[_0x9fd3('0x20')]?_0x43e85f['options'][_0x9fd3('0x22')]||null:null,'attributes':_0x43e85f[_0x9fd3('0x20')]?_0x43e85f[_0x9fd3('0x20')]['attributes']||null:null,'limit':_0x43e85f[_0x9fd3('0x20')]?_0x43e85f[_0x9fd3('0x20')][_0x9fd3('0x23')]||null:null,'include':_0x43e85f[_0x9fd3('0x20')]?_0x43e85f[_0x9fd3('0x20')][_0x9fd3('0x24')]?_[_0x9fd3('0x25')](_0x43e85f[_0x9fd3('0x20')][_0x9fd3('0x24')],function(_0x419d37){return{'model':db[_0x419d37[_0x9fd3('0x26')]],'as':_0x419d37['as'],'attributes':_0x419d37['attributes'],'include':_0x419d37[_0x9fd3('0x24')]?_[_0x9fd3('0x25')](_0x419d37[_0x9fd3('0x24')],function(_0x2d5497){return{'model':db[_0x2d5497[_0x9fd3('0x26')]],'as':_0x2d5497['as'],'attributes':_0x2d5497[_0x9fd3('0x27')],'include':_0x2d5497[_0x9fd3('0x24')]?_[_0x9fd3('0x25')](_0x2d5497['include'],function(_0x58967d){return{'model':db[_0x58967d['model']],'as':_0x58967d['as'],'attributes':_0x58967d['attributes']};}):[]};}):[]};}):[]:[]})[_0x9fd3('0x13')](function(_0xb102c9){logger[_0x9fd3('0x14')](_0x9fd3('0x1e'),_0x43e85f);logger[_0x9fd3('0x15')]('GetCmContact',_0x43e85f,JSON['stringify'](_0xb102c9));_0x2bab89(_0xb102c9);})[_0x9fd3('0x1d')](function(_0x52718b){logger['error'](_0x9fd3('0x1e'),_0x52718b['message'],_0x43e85f);_0x1abbe2(_0x35e8ac['error'](0x1f4,_0x52718b[_0x9fd3('0x1b')]));});});};exports['CreateCmContact']=function(_0x954069){var _0x1b4f03=this;return new Promise(function(_0x42cd93,_0x2ab41a){return db['CmContact']['create'](_0x954069[_0x9fd3('0x28')],{'raw':_0x954069['options']?_0x954069[_0x9fd3('0x20')][_0x9fd3('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x2bd3e3){var _0x459b32;for(var _0x47e20e=0x0;_0x47e20e<Object[_0x9fd3('0x29')](_0x954069[_0x9fd3('0x28')])['length'];_0x47e20e++){var _0x537d07=Object['keys'](_0x954069[_0x9fd3('0x28')])[_0x47e20e];if(_0x537d07['startsWith'](_0x9fd3('0x2a'))){_0x459b32=squel[_0x9fd3('0x2b')]()[_0x9fd3('0x2c')](_0x9fd3('0x2d'))['set'](_0x537d07,_0x954069[_0x9fd3('0x28')][_0x537d07])[_0x9fd3('0x22')](_0x9fd3('0x2e'),_0x2bd3e3['id'])['toString']();break;}}if(!_0x459b32)return _0x2bd3e3;return db[_0x9fd3('0x2f')][_0x9fd3('0x30')](_0x459b32)[_0x9fd3('0x13')](function(){return _0x2bd3e3;});})[_0x9fd3('0x13')](function(_0x39a339){logger[_0x9fd3('0x14')]('CreateCmContact',_0x954069);logger[_0x9fd3('0x15')](_0x9fd3('0x31'),_0x954069,JSON[_0x9fd3('0x17')](_0x39a339));_0x42cd93(_0x39a339);})[_0x9fd3('0x1d')](function(_0x4da480){logger['error'](_0x9fd3('0x31'),_0x4da480['message'],_0x954069);_0x2ab41a(_0x1b4f03['error'](0x1f4,_0x4da480[_0x9fd3('0x1b')]));});});};
\ No newline at end of file
+var _0x56f6=['create','body','raw','keys','length','startsWith','cf_','table','cm_contacts','set','id\x20=\x20?','toString','query','lodash','moment','bluebird','randomstring','ioredis','squel','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','register','info','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContact,\x20%s,\x20%s','message','result','GetCmContact','CmContact','findAll','options','where','attributes','limit','include','map','model','then','catch','CreateCmContact'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x56f6,0x79));var _0x656f=function(_0x2a5d22,_0x5cfd8e){_0x2a5d22=_0x2a5d22-0x0;var _0x1ab928=_0x56f6[_0x2a5d22];return _0x1ab928;};'use strict';var _=require(_0x656f('0x0'));var util=require('util');var moment=require(_0x656f('0x1'));var BPromise=require(_0x656f('0x2'));var rs=require(_0x656f('0x3'));var fs=require('fs');var Redis=require(_0x656f('0x4'));var squel=require(_0x656f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x656f('0x6'));var logger=require(_0x656f('0x7'))(_0x656f('0x8'));var config=require(_0x656f('0x9'));var jayson=require(_0x656f('0xa'));var client=jayson[_0x656f('0xb')]['http']({'port':0x232a});config['redis']=_[_0x656f('0xc')](config[_0x656f('0xd')],{'host':_0x656f('0xe'),'port':0x18eb});var socket=require(_0x656f('0xf'))(new Redis(config[_0x656f('0xd')]));require(_0x656f('0x10'))[_0x656f('0x11')](socket);function respondWithRpcPromise(_0x1bae71,_0x5a5c16,_0x16cd41){return new BPromise(function(_0x45dc54,_0x46cbf5){return client['request'](_0x1bae71,_0x16cd41)['then'](function(_0x138528){logger[_0x656f('0x12')]('CmContact,\x20%s,\x20%s',_0x5a5c16,_0x656f('0x13'));logger[_0x656f('0x14')](_0x656f('0x15'),_0x5a5c16,_0x656f('0x13'),JSON[_0x656f('0x16')](_0x138528));if(_0x138528[_0x656f('0x17')]){if(_0x138528[_0x656f('0x17')][_0x656f('0x18')]===0x1f4){logger[_0x656f('0x17')](_0x656f('0x19'),_0x5a5c16,_0x138528[_0x656f('0x17')][_0x656f('0x1a')]);return _0x46cbf5(_0x138528[_0x656f('0x17')][_0x656f('0x1a')]);}logger['error'](_0x656f('0x19'),_0x5a5c16,_0x138528['error']['message']);return _0x45dc54(_0x138528[_0x656f('0x17')]['message']);}else{logger[_0x656f('0x12')](_0x656f('0x19'),_0x5a5c16,_0x656f('0x13'));_0x45dc54(_0x138528[_0x656f('0x1b')][_0x656f('0x1a')]);}})['catch'](function(_0x3d3305){logger[_0x656f('0x17')]('CmContact,\x20%s,\x20%s',_0x5a5c16,_0x3d3305);_0x46cbf5(_0x3d3305);});});}exports[_0x656f('0x1c')]=function(_0x16dd19){var _0x51d461=this;return new Promise(function(_0x483255,_0x1bfa04){return db[_0x656f('0x1d')][_0x656f('0x1e')]({'raw':_0x16dd19[_0x656f('0x1f')]?_0x16dd19['options']['raw']===undefined?!![]:![]:!![],'where':_0x16dd19['options']?_0x16dd19[_0x656f('0x1f')][_0x656f('0x20')]||null:null,'attributes':_0x16dd19[_0x656f('0x1f')]?_0x16dd19[_0x656f('0x1f')][_0x656f('0x21')]||null:null,'limit':_0x16dd19['options']?_0x16dd19[_0x656f('0x1f')][_0x656f('0x22')]||null:null,'include':_0x16dd19[_0x656f('0x1f')]?_0x16dd19[_0x656f('0x1f')][_0x656f('0x23')]?_[_0x656f('0x24')](_0x16dd19[_0x656f('0x1f')][_0x656f('0x23')],function(_0x2914a4){return{'model':db[_0x2914a4['model']],'as':_0x2914a4['as'],'attributes':_0x2914a4[_0x656f('0x21')],'include':_0x2914a4[_0x656f('0x23')]?_['map'](_0x2914a4[_0x656f('0x23')],function(_0x11a742){return{'model':db[_0x11a742[_0x656f('0x25')]],'as':_0x11a742['as'],'attributes':_0x11a742[_0x656f('0x21')],'include':_0x11a742[_0x656f('0x23')]?_[_0x656f('0x24')](_0x11a742[_0x656f('0x23')],function(_0x4e9703){return{'model':db[_0x4e9703[_0x656f('0x25')]],'as':_0x4e9703['as'],'attributes':_0x4e9703[_0x656f('0x21')]};}):[]};}):[]};}):[]:[]})[_0x656f('0x26')](function(_0x488744){logger[_0x656f('0x12')]('GetCmContact',_0x16dd19);logger[_0x656f('0x14')]('GetCmContact',_0x16dd19,JSON[_0x656f('0x16')](_0x488744));_0x483255(_0x488744);})[_0x656f('0x27')](function(_0x1cf050){logger[_0x656f('0x17')](_0x656f('0x1c'),_0x1cf050[_0x656f('0x1a')],_0x16dd19);_0x1bfa04(_0x51d461[_0x656f('0x17')](0x1f4,_0x1cf050['message']));});});};exports[_0x656f('0x28')]=function(_0x2731fc){var _0x862289=this;return new Promise(function(_0x121f74,_0xb99b69){return db[_0x656f('0x1d')][_0x656f('0x29')](_0x2731fc[_0x656f('0x2a')],{'raw':_0x2731fc[_0x656f('0x1f')]?_0x2731fc[_0x656f('0x1f')][_0x656f('0x2b')]===undefined?!![]:![]:!![]})[_0x656f('0x26')](function(_0x42379a){var _0x2b59d4;for(var _0x410d01=0x0;_0x410d01<Object[_0x656f('0x2c')](_0x2731fc[_0x656f('0x2a')])[_0x656f('0x2d')];_0x410d01++){var _0x4004eb=Object[_0x656f('0x2c')](_0x2731fc[_0x656f('0x2a')])[_0x410d01];if(_0x4004eb[_0x656f('0x2e')](_0x656f('0x2f'))){_0x2b59d4=squel['update']()[_0x656f('0x30')](_0x656f('0x31'))[_0x656f('0x32')](_0x4004eb,_0x2731fc[_0x656f('0x2a')][_0x4004eb])['where'](_0x656f('0x33'),_0x42379a['id'])[_0x656f('0x34')]();break;}}if(!_0x2b59d4)return _0x42379a;return db['sequelize'][_0x656f('0x35')](_0x2b59d4)[_0x656f('0x26')](function(){return _0x42379a;});})[_0x656f('0x26')](function(_0xd80a0b){logger[_0x656f('0x12')](_0x656f('0x28'),_0x2731fc);logger[_0x656f('0x14')](_0x656f('0x28'),_0x2731fc,JSON[_0x656f('0x16')](_0xd80a0b));_0x121f74(_0xd80a0b);})[_0x656f('0x27')](function(_0x33abe7){logger[_0x656f('0x17')](_0x656f('0x28'),_0x33abe7[_0x656f('0x1a')],_0x2731fc);_0xb99b69(_0x862289[_0x656f('0x17')](0x1f4,_0x33abe7['message']));});});};
\ No newline at end of file