Built motion from commit 9d7072cc.|2.5.39
[motion2.git] / server / api / cmContact / cmContact.rpc.js
index 69ef266..22a7237 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf230=['localhost','socket.io-emitter','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','message','GetCmContact','CmContact','findAll','options','raw','where','limit','include','model','attributes','stringify','catch','CreateCmContact','keys','body','length','startsWith','cf_','update','table','cm_contacts','set','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','randomstring','ioredis','squel','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0xf230,0x92));var _0x0f23=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf230[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x0f23('0x0'));var util=require(_0x0f23('0x1'));var moment=require(_0x0f23('0x2'));var BPromise=require(_0x0f23('0x3'));var rs=require(_0x0f23('0x4'));var fs=require('fs');var Redis=require(_0x0f23('0x5'));var squel=require(_0x0f23('0x6'));var db=require('../../mysqldb')['db'];var utils=require(_0x0f23('0x7'));var logger=require(_0x0f23('0x8'))(_0x0f23('0x9'));var config=require(_0x0f23('0xa'));var jayson=require(_0x0f23('0xb'));var client=jayson[_0x0f23('0xc')][_0x0f23('0xd')]({'port':0x232a});config[_0x0f23('0xe')]=_[_0x0f23('0xf')](config['redis'],{'host':_0x0f23('0x10'),'port':0x18eb});var socket=require(_0x0f23('0x11'))(new Redis(config[_0x0f23('0xe')]));require('./cmContact.socket')[_0x0f23('0x12')](socket);function respondWithRpcPromise(_0x8ef641,_0x270d3c,_0x3a3a6e){return new BPromise(function(_0x4966b8,_0x156fa7){return client[_0x0f23('0x13')](_0x8ef641,_0x3a3a6e)[_0x0f23('0x14')](function(_0x4b30c9){logger[_0x0f23('0x15')](_0x0f23('0x16'),_0x270d3c,_0x0f23('0x17'));logger[_0x0f23('0x18')](_0x0f23('0x19'),_0x270d3c,_0x0f23('0x17'),JSON['stringify'](_0x4b30c9));if(_0x4b30c9[_0x0f23('0x1a')]){if(_0x4b30c9[_0x0f23('0x1a')]['code']===0x1f4){logger[_0x0f23('0x1a')]('CmContact,\x20%s,\x20%s',_0x270d3c,_0x4b30c9[_0x0f23('0x1a')][_0x0f23('0x1b')]);return _0x156fa7(_0x4b30c9['error'][_0x0f23('0x1b')]);}logger[_0x0f23('0x1a')](_0x0f23('0x16'),_0x270d3c,_0x4b30c9[_0x0f23('0x1a')][_0x0f23('0x1b')]);return _0x4966b8(_0x4b30c9['error'][_0x0f23('0x1b')]);}else{logger[_0x0f23('0x15')](_0x0f23('0x16'),_0x270d3c,_0x0f23('0x17'));_0x4966b8(_0x4b30c9['result'][_0x0f23('0x1b')]);}})['catch'](function(_0x2af193){logger[_0x0f23('0x1a')]('CmContact,\x20%s,\x20%s',_0x270d3c,_0x2af193);_0x156fa7(_0x2af193);});});}exports[_0x0f23('0x1c')]=function(_0x47bcbe){var _0x4b0158=this;return new Promise(function(_0x471f9b,_0x26f37f){return db[_0x0f23('0x1d')][_0x0f23('0x1e')]({'raw':_0x47bcbe[_0x0f23('0x1f')]?_0x47bcbe[_0x0f23('0x1f')][_0x0f23('0x20')]===undefined?!![]:![]:!![],'where':_0x47bcbe['options']?_0x47bcbe[_0x0f23('0x1f')][_0x0f23('0x21')]||null:null,'attributes':_0x47bcbe[_0x0f23('0x1f')]?_0x47bcbe[_0x0f23('0x1f')]['attributes']||null:null,'limit':_0x47bcbe['options']?_0x47bcbe[_0x0f23('0x1f')][_0x0f23('0x22')]||null:null,'include':_0x47bcbe[_0x0f23('0x1f')]?_0x47bcbe[_0x0f23('0x1f')]['include']?_['map'](_0x47bcbe['options'][_0x0f23('0x23')],function(_0x350e64){return{'model':db[_0x350e64[_0x0f23('0x24')]],'as':_0x350e64['as'],'attributes':_0x350e64[_0x0f23('0x25')],'include':_0x350e64[_0x0f23('0x23')]?_['map'](_0x350e64[_0x0f23('0x23')],function(_0x24f038){return{'model':db[_0x24f038[_0x0f23('0x24')]],'as':_0x24f038['as'],'attributes':_0x24f038[_0x0f23('0x25')],'include':_0x24f038[_0x0f23('0x23')]?_['map'](_0x24f038['include'],function(_0x2de161){return{'model':db[_0x2de161[_0x0f23('0x24')]],'as':_0x2de161['as'],'attributes':_0x2de161[_0x0f23('0x25')]};}):[]};}):[]};}):[]:[]})[_0x0f23('0x14')](function(_0x23f32c){logger['info']('GetCmContact',_0x47bcbe);logger[_0x0f23('0x18')]('GetCmContact',_0x47bcbe,JSON[_0x0f23('0x26')](_0x23f32c));_0x471f9b(_0x23f32c);})[_0x0f23('0x27')](function(_0x9c5fc8){logger['error']('GetCmContact',_0x9c5fc8['message'],_0x47bcbe);_0x26f37f(_0x4b0158[_0x0f23('0x1a')](0x1f4,_0x9c5fc8[_0x0f23('0x1b')]));});});};exports[_0x0f23('0x28')]=function(_0x479c62){var _0x9ee449=this;return new Promise(function(_0x4cc674,_0x5536e0){return db[_0x0f23('0x1d')]['create'](_0x479c62['body'],{'raw':_0x479c62[_0x0f23('0x1f')]?_0x479c62[_0x0f23('0x1f')][_0x0f23('0x20')]===undefined?!![]:![]:!![]})[_0x0f23('0x14')](function(_0x43de73){var _0x5ecc3d;for(var _0xa3bb1d=0x0;_0xa3bb1d<Object[_0x0f23('0x29')](_0x479c62[_0x0f23('0x2a')])[_0x0f23('0x2b')];_0xa3bb1d++){var _0x5e8e0a=Object['keys'](_0x479c62[_0x0f23('0x2a')])[_0xa3bb1d];if(_0x5e8e0a[_0x0f23('0x2c')](_0x0f23('0x2d'))){_0x5ecc3d=squel[_0x0f23('0x2e')]()[_0x0f23('0x2f')](_0x0f23('0x30'))[_0x0f23('0x31')](_0x5e8e0a,_0x479c62[_0x0f23('0x2a')][_0x5e8e0a])['where'](_0x0f23('0x32'),_0x43de73['id'])[_0x0f23('0x33')]();break;}}if(!_0x5ecc3d)return _0x43de73;return db[_0x0f23('0x34')][_0x0f23('0x35')](_0x5ecc3d)['then'](function(){return _0x43de73;});})[_0x0f23('0x14')](function(_0x25a6fb){logger[_0x0f23('0x15')](_0x0f23('0x28'),_0x479c62);logger[_0x0f23('0x18')](_0x0f23('0x28'),_0x479c62,JSON[_0x0f23('0x26')](_0x25a6fb));_0x4cc674(_0x25a6fb);})[_0x0f23('0x27')](function(_0x4062b3){logger[_0x0f23('0x1a')](_0x0f23('0x28'),_0x4062b3[_0x0f23('0x1b')],_0x479c62);_0x5536e0(_0x9ee449['error'](0x1f4,_0x4062b3[_0x0f23('0x1b')]));});});};
\ No newline at end of file
+var _0x4b82=['../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','GetCmContact','CmContact','findAll','options','limit','map','include','model','attributes','debug','stringify','catch','CreateCmContact','create','body','keys','length','startsWith','update','table','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','randomstring','ioredis','squel'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x4b82,0x132));var _0x24b8=function(_0x1773f7,_0x54318f){_0x1773f7=_0x1773f7-0x0;var _0x1983fb=_0x4b82[_0x1773f7];return _0x1983fb;};'use strict';var _=require(_0x24b8('0x0'));var util=require(_0x24b8('0x1'));var moment=require(_0x24b8('0x2'));var BPromise=require('bluebird');var rs=require(_0x24b8('0x3'));var fs=require('fs');var Redis=require(_0x24b8('0x4'));var squel=require(_0x24b8('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x24b8('0x6'))(_0x24b8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x24b8('0x8')][_0x24b8('0x9')]({'port':0x232a});config[_0x24b8('0xa')]=_[_0x24b8('0xb')](config[_0x24b8('0xa')],{'host':_0x24b8('0xc'),'port':0x18eb});var socket=require(_0x24b8('0xd'))(new Redis(config[_0x24b8('0xa')]));require(_0x24b8('0xe'))[_0x24b8('0xf')](socket);function respondWithRpcPromise(_0x1c2c86,_0x5649e6,_0x21815d){return new BPromise(function(_0x4e085f,_0x24439d){return client[_0x24b8('0x10')](_0x1c2c86,_0x21815d)[_0x24b8('0x11')](function(_0x319f22){logger[_0x24b8('0x12')](_0x24b8('0x13'),_0x5649e6,_0x24b8('0x14'));logger['debug'](_0x24b8('0x15'),_0x5649e6,_0x24b8('0x14'),JSON['stringify'](_0x319f22));if(_0x319f22[_0x24b8('0x16')]){if(_0x319f22['error'][_0x24b8('0x17')]===0x1f4){logger['error'](_0x24b8('0x13'),_0x5649e6,_0x319f22[_0x24b8('0x16')][_0x24b8('0x18')]);return _0x24439d(_0x319f22[_0x24b8('0x16')][_0x24b8('0x18')]);}logger[_0x24b8('0x16')](_0x24b8('0x13'),_0x5649e6,_0x319f22[_0x24b8('0x16')][_0x24b8('0x18')]);return _0x4e085f(_0x319f22[_0x24b8('0x16')][_0x24b8('0x18')]);}else{logger[_0x24b8('0x12')]('CmContact,\x20%s,\x20%s',_0x5649e6,_0x24b8('0x14'));_0x4e085f(_0x319f22[_0x24b8('0x19')][_0x24b8('0x18')]);}})['catch'](function(_0x40ddb4){logger[_0x24b8('0x16')]('CmContact,\x20%s,\x20%s',_0x5649e6,_0x40ddb4);_0x24439d(_0x40ddb4);});});}exports[_0x24b8('0x1a')]=function(_0x532c29){var _0x2765f2=this;return new Promise(function(_0x3d1aeb,_0xf334dd){return db[_0x24b8('0x1b')][_0x24b8('0x1c')]({'raw':_0x532c29['options']?_0x532c29['options']['raw']===undefined?!![]:![]:!![],'where':_0x532c29[_0x24b8('0x1d')]?_0x532c29[_0x24b8('0x1d')]['where']||null:null,'attributes':_0x532c29[_0x24b8('0x1d')]?_0x532c29['options']['attributes']||null:null,'limit':_0x532c29[_0x24b8('0x1d')]?_0x532c29[_0x24b8('0x1d')][_0x24b8('0x1e')]||null:null,'include':_0x532c29['options']?_0x532c29[_0x24b8('0x1d')]['include']?_[_0x24b8('0x1f')](_0x532c29['options'][_0x24b8('0x20')],function(_0x3be0fa){return{'model':db[_0x3be0fa[_0x24b8('0x21')]],'as':_0x3be0fa['as'],'attributes':_0x3be0fa[_0x24b8('0x22')],'include':_0x3be0fa['include']?_[_0x24b8('0x1f')](_0x3be0fa[_0x24b8('0x20')],function(_0x563e63){return{'model':db[_0x563e63[_0x24b8('0x21')]],'as':_0x563e63['as'],'attributes':_0x563e63[_0x24b8('0x22')],'include':_0x563e63['include']?_[_0x24b8('0x1f')](_0x563e63['include'],function(_0x10631c){return{'model':db[_0x10631c[_0x24b8('0x21')]],'as':_0x10631c['as'],'attributes':_0x10631c[_0x24b8('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ff59a){logger[_0x24b8('0x12')]('GetCmContact',_0x532c29);logger[_0x24b8('0x23')](_0x24b8('0x1a'),_0x532c29,JSON[_0x24b8('0x24')](_0x1ff59a));_0x3d1aeb(_0x1ff59a);})[_0x24b8('0x25')](function(_0x3f2305){logger[_0x24b8('0x16')](_0x24b8('0x1a'),_0x3f2305[_0x24b8('0x18')],_0x532c29);_0xf334dd(_0x2765f2['error'](0x1f4,_0x3f2305[_0x24b8('0x18')]));});});};exports[_0x24b8('0x26')]=function(_0x58bd98){var _0x54a30a=this;return new Promise(function(_0xd0bd4b,_0x168b82){return db[_0x24b8('0x1b')][_0x24b8('0x27')](_0x58bd98[_0x24b8('0x28')],{'raw':_0x58bd98['options']?_0x58bd98[_0x24b8('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x24b8('0x11')](function(_0x38892b){var _0x584449;for(var _0x8cebd5=0x0;_0x8cebd5<Object[_0x24b8('0x29')](_0x58bd98[_0x24b8('0x28')])[_0x24b8('0x2a')];_0x8cebd5++){var _0x2c616c=Object['keys'](_0x58bd98[_0x24b8('0x28')])[_0x8cebd5];if(_0x2c616c[_0x24b8('0x2b')]('cf_')){_0x584449=squel[_0x24b8('0x2c')]()[_0x24b8('0x2d')]('cm_contacts')[_0x24b8('0x2e')](_0x2c616c,_0x58bd98[_0x24b8('0x28')][_0x2c616c])[_0x24b8('0x2f')](_0x24b8('0x30'),_0x38892b['id'])[_0x24b8('0x31')]();break;}}if(!_0x584449)return _0x38892b;return db[_0x24b8('0x32')][_0x24b8('0x33')](_0x584449)[_0x24b8('0x11')](function(){return _0x38892b;});})['then'](function(_0x2018cd){logger[_0x24b8('0x12')](_0x24b8('0x26'),_0x58bd98);logger[_0x24b8('0x23')](_0x24b8('0x26'),_0x58bd98,JSON[_0x24b8('0x24')](_0x2018cd));_0xd0bd4b(_0x2018cd);})['catch'](function(_0x546441){logger[_0x24b8('0x16')](_0x24b8('0x26'),_0x546441[_0x24b8('0x18')],_0x58bd98);_0x168b82(_0x54a30a[_0x24b8('0x16')](0x1f4,_0x546441['message']));});});};
\ No newline at end of file