Built motion from commit (unavailable).|2.5.22
[motion2.git] / server / api / cmContact / cmContact.rpc.js
index 536032c..1003a3b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-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
+var _0xad57=['startsWith','cf_','update','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','randomstring','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','./cmContact.socket','register','request','info','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','error','CmContact,\x20%s,\x20%s','message','result','catch','GetCmContact','options','attributes','limit','map','include','model','then','CreateCmContact','CmContact','create','body','raw','keys','length'];(function(_0x5aa20c,_0x28b6ca){var _0x5d0a3a=function(_0x4b6cc8){while(--_0x4b6cc8){_0x5aa20c['push'](_0x5aa20c['shift']());}};_0x5d0a3a(++_0x28b6ca);}(_0xad57,0x1ab));var _0x7ad5=function(_0x41e149,_0x53efd2){_0x41e149=_0x41e149-0x0;var _0x2fe9ac=_0xad57[_0x41e149];return _0x2fe9ac;};'use strict';var _=require(_0x7ad5('0x0'));var util=require(_0x7ad5('0x1'));var moment=require(_0x7ad5('0x2'));var BPromise=require('bluebird');var rs=require(_0x7ad5('0x3'));var fs=require('fs');var Redis=require(_0x7ad5('0x4'));var squel=require(_0x7ad5('0x5'));var db=require(_0x7ad5('0x6'))['db'];var utils=require(_0x7ad5('0x7'));var logger=require('../../config/logger')(_0x7ad5('0x8'));var config=require(_0x7ad5('0x9'));var jayson=require(_0x7ad5('0xa'));var client=jayson['client'][_0x7ad5('0xb')]({'port':0x232a});config[_0x7ad5('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ad5('0xc')]));require(_0x7ad5('0xd'))[_0x7ad5('0xe')](socket);function respondWithRpcPromise(_0x10bc78,_0xd9037c,_0x245e84){return new BPromise(function(_0x1d0d74,_0x41a29d){return client[_0x7ad5('0xf')](_0x10bc78,_0x245e84)['then'](function(_0x28189d){logger[_0x7ad5('0x10')]('CmContact,\x20%s,\x20%s',_0xd9037c,_0x7ad5('0x11'));logger[_0x7ad5('0x12')](_0x7ad5('0x13'),_0xd9037c,_0x7ad5('0x11'),JSON[_0x7ad5('0x14')](_0x28189d));if(_0x28189d[_0x7ad5('0x15')]){if(_0x28189d['error']['code']===0x1f4){logger[_0x7ad5('0x15')](_0x7ad5('0x16'),_0xd9037c,_0x28189d[_0x7ad5('0x15')][_0x7ad5('0x17')]);return _0x41a29d(_0x28189d[_0x7ad5('0x15')][_0x7ad5('0x17')]);}logger[_0x7ad5('0x15')](_0x7ad5('0x16'),_0xd9037c,_0x28189d['error'][_0x7ad5('0x17')]);return _0x1d0d74(_0x28189d[_0x7ad5('0x15')][_0x7ad5('0x17')]);}else{logger[_0x7ad5('0x10')](_0x7ad5('0x16'),_0xd9037c,_0x7ad5('0x11'));_0x1d0d74(_0x28189d[_0x7ad5('0x18')]['message']);}})[_0x7ad5('0x19')](function(_0x19b637){logger['error']('CmContact,\x20%s,\x20%s',_0xd9037c,_0x19b637);_0x41a29d(_0x19b637);});});}exports[_0x7ad5('0x1a')]=function(_0x19d947){var _0x407dc2=this;return new Promise(function(_0x3c66f8,_0x5b6cdc){return db['CmContact']['findAll']({'raw':_0x19d947[_0x7ad5('0x1b')]?_0x19d947[_0x7ad5('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x19d947[_0x7ad5('0x1b')]?_0x19d947[_0x7ad5('0x1b')]['where']||null:null,'attributes':_0x19d947[_0x7ad5('0x1b')]?_0x19d947['options'][_0x7ad5('0x1c')]||null:null,'limit':_0x19d947[_0x7ad5('0x1b')]?_0x19d947['options'][_0x7ad5('0x1d')]||null:null,'include':_0x19d947[_0x7ad5('0x1b')]?_0x19d947[_0x7ad5('0x1b')]['include']?_[_0x7ad5('0x1e')](_0x19d947[_0x7ad5('0x1b')][_0x7ad5('0x1f')],function(_0x417af8){return{'model':db[_0x417af8[_0x7ad5('0x20')]],'as':_0x417af8['as'],'attributes':_0x417af8[_0x7ad5('0x1c')],'include':_0x417af8['include']?_['map'](_0x417af8[_0x7ad5('0x1f')],function(_0x4433f5){return{'model':db[_0x4433f5[_0x7ad5('0x20')]],'as':_0x4433f5['as'],'attributes':_0x4433f5[_0x7ad5('0x1c')],'include':_0x4433f5[_0x7ad5('0x1f')]?_[_0x7ad5('0x1e')](_0x4433f5[_0x7ad5('0x1f')],function(_0x16d8a6){return{'model':db[_0x16d8a6[_0x7ad5('0x20')]],'as':_0x16d8a6['as'],'attributes':_0x16d8a6[_0x7ad5('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7ad5('0x21')](function(_0x3ab0cd){logger[_0x7ad5('0x10')](_0x7ad5('0x1a'),_0x19d947);logger[_0x7ad5('0x12')](_0x7ad5('0x1a'),_0x19d947,JSON[_0x7ad5('0x14')](_0x3ab0cd));_0x3c66f8(_0x3ab0cd);})[_0x7ad5('0x19')](function(_0x2c9c49){logger['error']('GetCmContact',_0x2c9c49[_0x7ad5('0x17')],_0x19d947);_0x5b6cdc(_0x407dc2[_0x7ad5('0x15')](0x1f4,_0x2c9c49['message']));});});};exports[_0x7ad5('0x22')]=function(_0x1f7e3c){var _0x3a0d6d=this;return new Promise(function(_0x4bb43d,_0x45019a){return db[_0x7ad5('0x23')][_0x7ad5('0x24')](_0x1f7e3c[_0x7ad5('0x25')],{'raw':_0x1f7e3c['options']?_0x1f7e3c[_0x7ad5('0x1b')][_0x7ad5('0x26')]===undefined?!![]:![]:!![]})[_0x7ad5('0x21')](function(_0x4854e8){var _0x3de64c;for(var _0x2b3ec7=0x0;_0x2b3ec7<Object[_0x7ad5('0x27')](_0x1f7e3c[_0x7ad5('0x25')])[_0x7ad5('0x28')];_0x2b3ec7++){var _0x5857b7=Object[_0x7ad5('0x27')](_0x1f7e3c[_0x7ad5('0x25')])[_0x2b3ec7];if(_0x5857b7[_0x7ad5('0x29')](_0x7ad5('0x2a'))){_0x3de64c=squel[_0x7ad5('0x2b')]()[_0x7ad5('0x2c')](_0x7ad5('0x2d'))[_0x7ad5('0x2e')](_0x5857b7,_0x1f7e3c[_0x7ad5('0x25')][_0x5857b7])[_0x7ad5('0x2f')](_0x7ad5('0x30'),_0x4854e8['id'])[_0x7ad5('0x31')]();break;}}if(!_0x3de64c)return _0x4854e8;return db[_0x7ad5('0x32')][_0x7ad5('0x33')](_0x3de64c)['then'](function(){return _0x4854e8;});})[_0x7ad5('0x21')](function(_0xd7dac2){logger[_0x7ad5('0x10')]('CreateCmContact',_0x1f7e3c);logger[_0x7ad5('0x12')](_0x7ad5('0x22'),_0x1f7e3c,JSON[_0x7ad5('0x14')](_0xd7dac2));_0x4bb43d(_0xd7dac2);})[_0x7ad5('0x19')](function(_0x162970){logger[_0x7ad5('0x15')](_0x7ad5('0x22'),_0x162970['message'],_0x1f7e3c);_0x45019a(_0x3a0d6d['error'](0x1f4,_0x162970[_0x7ad5('0x17')]));});});};
\ No newline at end of file