Built motion from commit 092f8824.|2.5.49
[motion2.git] / server / api / cmContact / cmContact.rpc.js
index cc49a5c..7f5f211 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9f0b=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetCmContact','CmContact','findAll','raw','options','where','limit','map','model','include','attributes','stringify','CreateCmContact','create','keys','body','length','startsWith','cf_','update','table','cm_contacts','id\x20=\x20?','toString','sequelize','query','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xb6269b,_0x19a5c8){var _0x1c26cb=function(_0x4e5a54){while(--_0x4e5a54){_0xb6269b['push'](_0xb6269b['shift']());}};_0x1c26cb(++_0x19a5c8);}(_0x9f0b,0xfd));var _0xb9f0=function(_0x3e8270,_0x293590){_0x3e8270=_0x3e8270-0x0;var _0x1ccde9=_0x9f0b[_0x3e8270];return _0x1ccde9;};'use strict';var _=require('lodash');var util=require(_0xb9f0('0x0'));var moment=require(_0xb9f0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9f0('0x2'));var squel=require('squel');var db=require('../../mysqldb')['db'];var utils=require(_0xb9f0('0x3'));var logger=require(_0xb9f0('0x4'))(_0xb9f0('0x5'));var config=require(_0xb9f0('0x6'));var jayson=require(_0xb9f0('0x7'));var client=jayson[_0xb9f0('0x8')][_0xb9f0('0x9')]({'port':0x232a});config[_0xb9f0('0xa')]=_[_0xb9f0('0xb')](config['redis'],{'host':_0xb9f0('0xc'),'port':0x18eb});var socket=require(_0xb9f0('0xd'))(new Redis(config[_0xb9f0('0xa')]));require('./cmContact.socket')[_0xb9f0('0xe')](socket);function respondWithRpcPromise(_0x493daa,_0x4981e3,_0x406d73){return new BPromise(function(_0xb6b859,_0x274e8d){return client[_0xb9f0('0xf')](_0x493daa,_0x406d73)[_0xb9f0('0x10')](function(_0x3ca2fc){logger[_0xb9f0('0x11')](_0xb9f0('0x12'),_0x4981e3,_0xb9f0('0x13'));logger[_0xb9f0('0x14')]('CmContact,\x20%s,\x20%s,\x20%s',_0x4981e3,_0xb9f0('0x13'),JSON['stringify'](_0x3ca2fc));if(_0x3ca2fc[_0xb9f0('0x15')]){if(_0x3ca2fc[_0xb9f0('0x15')][_0xb9f0('0x16')]===0x1f4){logger['error'](_0xb9f0('0x12'),_0x4981e3,_0x3ca2fc[_0xb9f0('0x15')][_0xb9f0('0x17')]);return _0x274e8d(_0x3ca2fc['error'][_0xb9f0('0x17')]);}logger['error'](_0xb9f0('0x12'),_0x4981e3,_0x3ca2fc[_0xb9f0('0x15')][_0xb9f0('0x17')]);return _0xb6b859(_0x3ca2fc[_0xb9f0('0x15')][_0xb9f0('0x17')]);}else{logger['info'](_0xb9f0('0x12'),_0x4981e3,_0xb9f0('0x13'));_0xb6b859(_0x3ca2fc[_0xb9f0('0x18')][_0xb9f0('0x17')]);}})[_0xb9f0('0x19')](function(_0x4278cb){logger[_0xb9f0('0x15')](_0xb9f0('0x12'),_0x4981e3,_0x4278cb);_0x274e8d(_0x4278cb);});});}exports[_0xb9f0('0x1a')]=function(_0x3d1f2f){var _0x3e2623=this;return new Promise(function(_0x2f30c5,_0x26f1d4){return db[_0xb9f0('0x1b')][_0xb9f0('0x1c')]({'raw':_0x3d1f2f['options']?_0x3d1f2f['options'][_0xb9f0('0x1d')]===undefined?!![]:![]:!![],'where':_0x3d1f2f[_0xb9f0('0x1e')]?_0x3d1f2f[_0xb9f0('0x1e')][_0xb9f0('0x1f')]||null:null,'attributes':_0x3d1f2f[_0xb9f0('0x1e')]?_0x3d1f2f[_0xb9f0('0x1e')]['attributes']||null:null,'limit':_0x3d1f2f[_0xb9f0('0x1e')]?_0x3d1f2f[_0xb9f0('0x1e')][_0xb9f0('0x20')]||null:null,'include':_0x3d1f2f[_0xb9f0('0x1e')]?_0x3d1f2f[_0xb9f0('0x1e')]['include']?_[_0xb9f0('0x21')](_0x3d1f2f[_0xb9f0('0x1e')]['include'],function(_0x540d3c){return{'model':db[_0x540d3c[_0xb9f0('0x22')]],'as':_0x540d3c['as'],'attributes':_0x540d3c['attributes'],'include':_0x540d3c[_0xb9f0('0x23')]?_[_0xb9f0('0x21')](_0x540d3c[_0xb9f0('0x23')],function(_0x55b314){return{'model':db[_0x55b314[_0xb9f0('0x22')]],'as':_0x55b314['as'],'attributes':_0x55b314['attributes'],'include':_0x55b314[_0xb9f0('0x23')]?_[_0xb9f0('0x21')](_0x55b314[_0xb9f0('0x23')],function(_0x37794b){return{'model':db[_0x37794b[_0xb9f0('0x22')]],'as':_0x37794b['as'],'attributes':_0x37794b[_0xb9f0('0x24')]};}):[]};}):[]};}):[]:[]})[_0xb9f0('0x10')](function(_0x8c508b){logger[_0xb9f0('0x11')]('GetCmContact',_0x3d1f2f);logger[_0xb9f0('0x14')](_0xb9f0('0x1a'),_0x3d1f2f,JSON[_0xb9f0('0x25')](_0x8c508b));_0x2f30c5(_0x8c508b);})['catch'](function(_0x4e6e33){logger[_0xb9f0('0x15')](_0xb9f0('0x1a'),_0x4e6e33['message'],_0x3d1f2f);_0x26f1d4(_0x3e2623['error'](0x1f4,_0x4e6e33[_0xb9f0('0x17')]));});});};exports[_0xb9f0('0x26')]=function(_0x240d69){var _0x13024a=this;return new Promise(function(_0x3fec55,_0x16025a){return db[_0xb9f0('0x1b')][_0xb9f0('0x27')](_0x240d69['body'],{'raw':_0x240d69[_0xb9f0('0x1e')]?_0x240d69[_0xb9f0('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xb9f0('0x10')](function(_0x43684b){var _0xa489f4;for(var _0x2f7a4f=0x0;_0x2f7a4f<Object[_0xb9f0('0x28')](_0x240d69[_0xb9f0('0x29')])[_0xb9f0('0x2a')];_0x2f7a4f++){var _0x1c48bb=Object[_0xb9f0('0x28')](_0x240d69['body'])[_0x2f7a4f];if(_0x1c48bb[_0xb9f0('0x2b')](_0xb9f0('0x2c'))){_0xa489f4=squel[_0xb9f0('0x2d')]()[_0xb9f0('0x2e')](_0xb9f0('0x2f'))['set'](_0x1c48bb,_0x240d69[_0xb9f0('0x29')][_0x1c48bb])[_0xb9f0('0x1f')](_0xb9f0('0x30'),_0x43684b['id'])[_0xb9f0('0x31')]();break;}}if(!_0xa489f4)return _0x43684b;return db[_0xb9f0('0x32')][_0xb9f0('0x33')](_0xa489f4)[_0xb9f0('0x10')](function(){return _0x43684b;});})[_0xb9f0('0x10')](function(_0x21926a){logger['info'](_0xb9f0('0x26'),_0x240d69);logger[_0xb9f0('0x14')](_0xb9f0('0x26'),_0x240d69,JSON['stringify'](_0x21926a));_0x3fec55(_0x21926a);})[_0xb9f0('0x19')](function(_0x3a3863){logger[_0xb9f0('0x15')](_0xb9f0('0x26'),_0x3a3863['message'],_0x240d69);_0x16025a(_0x13024a[_0xb9f0('0x15')](0x1f4,_0x3a3863['message']));});});};
\ No newline at end of file
+var _0xfa14=['limit','include','map','model','then','CreateCmContact','body','length','keys','startsWith','cf_','table','cm_contacts','id\x20=\x20?','toString','query','stringify','lodash','util','moment','bluebird','randomstring','ioredis','squel','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./cmContact.socket','register','request','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','raw','where','attributes'];(function(_0x257224,_0x23b664){var _0x5b29a8=function(_0x438508){while(--_0x438508){_0x257224['push'](_0x257224['shift']());}};_0x5b29a8(++_0x23b664);}(_0xfa14,0x11f));var _0x4fa1=function(_0x434ddc,_0x1f9e59){_0x434ddc=_0x434ddc-0x0;var _0x283bf5=_0xfa14[_0x434ddc];return _0x283bf5;};'use strict';var _=require(_0x4fa1('0x0'));var util=require(_0x4fa1('0x1'));var moment=require(_0x4fa1('0x2'));var BPromise=require(_0x4fa1('0x3'));var rs=require(_0x4fa1('0x4'));var fs=require('fs');var Redis=require(_0x4fa1('0x5'));var squel=require(_0x4fa1('0x6'));var db=require(_0x4fa1('0x7'))['db'];var utils=require(_0x4fa1('0x8'));var logger=require(_0x4fa1('0x9'))('rpc');var config=require(_0x4fa1('0xa'));var jayson=require(_0x4fa1('0xb'));var client=jayson[_0x4fa1('0xc')][_0x4fa1('0xd')]({'port':0x232a});config[_0x4fa1('0xe')]=_[_0x4fa1('0xf')](config[_0x4fa1('0xe')],{'host':_0x4fa1('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4fa1('0xe')]));require(_0x4fa1('0x11'))[_0x4fa1('0x12')](socket);function respondWithRpcPromise(_0x4ade5b,_0x1d6d45,_0x30bd3d){return new BPromise(function(_0x3b24e6,_0x2a1996){return client[_0x4fa1('0x13')](_0x4ade5b,_0x30bd3d)['then'](function(_0x4f39d9){logger[_0x4fa1('0x14')](_0x4fa1('0x15'),_0x1d6d45,_0x4fa1('0x16'));logger[_0x4fa1('0x17')](_0x4fa1('0x18'),_0x1d6d45,_0x4fa1('0x16'),JSON['stringify'](_0x4f39d9));if(_0x4f39d9[_0x4fa1('0x19')]){if(_0x4f39d9[_0x4fa1('0x19')][_0x4fa1('0x1a')]===0x1f4){logger[_0x4fa1('0x19')](_0x4fa1('0x15'),_0x1d6d45,_0x4f39d9['error']['message']);return _0x2a1996(_0x4f39d9[_0x4fa1('0x19')]['message']);}logger[_0x4fa1('0x19')](_0x4fa1('0x15'),_0x1d6d45,_0x4f39d9[_0x4fa1('0x19')][_0x4fa1('0x1b')]);return _0x3b24e6(_0x4f39d9['error'][_0x4fa1('0x1b')]);}else{logger[_0x4fa1('0x14')](_0x4fa1('0x15'),_0x1d6d45,'request\x20sent');_0x3b24e6(_0x4f39d9[_0x4fa1('0x1c')][_0x4fa1('0x1b')]);}})[_0x4fa1('0x1d')](function(_0x12cf50){logger['error'](_0x4fa1('0x15'),_0x1d6d45,_0x12cf50);_0x2a1996(_0x12cf50);});});}exports[_0x4fa1('0x1e')]=function(_0x3f4be9){var _0x470fb5=this;return new Promise(function(_0x45a23e,_0x5c4340){return db[_0x4fa1('0x1f')][_0x4fa1('0x20')]({'raw':_0x3f4be9[_0x4fa1('0x21')]?_0x3f4be9['options'][_0x4fa1('0x22')]===undefined?!![]:![]:!![],'where':_0x3f4be9[_0x4fa1('0x21')]?_0x3f4be9[_0x4fa1('0x21')][_0x4fa1('0x23')]||null:null,'attributes':_0x3f4be9[_0x4fa1('0x21')]?_0x3f4be9[_0x4fa1('0x21')][_0x4fa1('0x24')]||null:null,'limit':_0x3f4be9['options']?_0x3f4be9[_0x4fa1('0x21')][_0x4fa1('0x25')]||null:null,'include':_0x3f4be9[_0x4fa1('0x21')]?_0x3f4be9['options'][_0x4fa1('0x26')]?_[_0x4fa1('0x27')](_0x3f4be9[_0x4fa1('0x21')][_0x4fa1('0x26')],function(_0x21f893){return{'model':db[_0x21f893['model']],'as':_0x21f893['as'],'attributes':_0x21f893['attributes'],'include':_0x21f893[_0x4fa1('0x26')]?_[_0x4fa1('0x27')](_0x21f893[_0x4fa1('0x26')],function(_0x2ec273){return{'model':db[_0x2ec273[_0x4fa1('0x28')]],'as':_0x2ec273['as'],'attributes':_0x2ec273[_0x4fa1('0x24')],'include':_0x2ec273[_0x4fa1('0x26')]?_[_0x4fa1('0x27')](_0x2ec273[_0x4fa1('0x26')],function(_0x32e606){return{'model':db[_0x32e606[_0x4fa1('0x28')]],'as':_0x32e606['as'],'attributes':_0x32e606[_0x4fa1('0x24')]};}):[]};}):[]};}):[]:[]})[_0x4fa1('0x29')](function(_0x5d0cf6){logger[_0x4fa1('0x14')](_0x4fa1('0x1e'),_0x3f4be9);logger[_0x4fa1('0x17')](_0x4fa1('0x1e'),_0x3f4be9,JSON['stringify'](_0x5d0cf6));_0x45a23e(_0x5d0cf6);})[_0x4fa1('0x1d')](function(_0x2f2ab1){logger[_0x4fa1('0x19')](_0x4fa1('0x1e'),_0x2f2ab1[_0x4fa1('0x1b')],_0x3f4be9);_0x5c4340(_0x470fb5['error'](0x1f4,_0x2f2ab1['message']));});});};exports[_0x4fa1('0x2a')]=function(_0x303e50){var _0x59b066=this;return new Promise(function(_0x2af737,_0xdd4315){return db[_0x4fa1('0x1f')]['create'](_0x303e50[_0x4fa1('0x2b')],{'raw':_0x303e50[_0x4fa1('0x21')]?_0x303e50['options'][_0x4fa1('0x22')]===undefined?!![]:![]:!![]})[_0x4fa1('0x29')](function(_0x92172e){var _0x3ae2f0;for(var _0x41e4d3=0x0;_0x41e4d3<Object['keys'](_0x303e50[_0x4fa1('0x2b')])[_0x4fa1('0x2c')];_0x41e4d3++){var _0x222080=Object[_0x4fa1('0x2d')](_0x303e50[_0x4fa1('0x2b')])[_0x41e4d3];if(_0x222080[_0x4fa1('0x2e')](_0x4fa1('0x2f'))){_0x3ae2f0=squel['update']()[_0x4fa1('0x30')](_0x4fa1('0x31'))['set'](_0x222080,_0x303e50[_0x4fa1('0x2b')][_0x222080])[_0x4fa1('0x23')](_0x4fa1('0x32'),_0x92172e['id'])[_0x4fa1('0x33')]();break;}}if(!_0x3ae2f0)return _0x92172e;return db['sequelize'][_0x4fa1('0x34')](_0x3ae2f0)[_0x4fa1('0x29')](function(){return _0x92172e;});})[_0x4fa1('0x29')](function(_0x2cb38d){logger[_0x4fa1('0x14')](_0x4fa1('0x2a'),_0x303e50);logger[_0x4fa1('0x17')](_0x4fa1('0x2a'),_0x303e50,JSON[_0x4fa1('0x35')](_0x2cb38d));_0x2af737(_0x2cb38d);})[_0x4fa1('0x1d')](function(_0x49f730){logger[_0x4fa1('0x19')](_0x4fa1('0x2a'),_0x49f730['message'],_0x303e50);_0xdd4315(_0x59b066[_0x4fa1('0x19')](0x1f4,_0x49f730[_0x4fa1('0x1b')]));});});};
\ No newline at end of file