Built motion from commit da617fac.|2.6.6
[motion2.git] / server / api / cmContact / cmContact.rpc.js
index 8574f77..c7f13ec 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb9f=['info','debug','CmContact,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','CmContact,\x20%s,\x20%s','message','result','catch','GetCmContact','CmContact','findAll','options','raw','where','attributes','limit','include','model','map','CreateCmContact','create','body','then','keys','startsWith','cf_','update','set','id\x20=\x20?','sequelize','lodash','util','moment','ioredis','squel','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./cmContact.socket','request'];(function(_0x54cef6,_0x146b0e){var _0x39aacf=function(_0x21993e){while(--_0x21993e){_0x54cef6['push'](_0x54cef6['shift']());}};_0x39aacf(++_0x146b0e);}(_0xcb9f,0x1c8));var _0xfcb9=function(_0x7c95a9,_0x52ea9f){_0x7c95a9=_0x7c95a9-0x0;var _0x70995c=_0xcb9f[_0x7c95a9];return _0x70995c;};'use strict';var _=require(_0xfcb9('0x0'));var util=require(_0xfcb9('0x1'));var moment=require(_0xfcb9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcb9('0x3'));var squel=require(_0xfcb9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfcb9('0x5'))(_0xfcb9('0x6'));var config=require(_0xfcb9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfcb9('0x8')]({'port':0x232a});config[_0xfcb9('0x9')]=_[_0xfcb9('0xa')](config[_0xfcb9('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xfcb9('0xb'))(new Redis(config[_0xfcb9('0x9')]));require(_0xfcb9('0xc'))['register'](socket);function respondWithRpcPromise(_0x9eb824,_0x2499fa,_0x1f30bf){return new BPromise(function(_0x28b843,_0xb0f960){return client[_0xfcb9('0xd')](_0x9eb824,_0x1f30bf)['then'](function(_0x4d3a15){logger[_0xfcb9('0xe')]('CmContact,\x20%s,\x20%s',_0x2499fa,'request\x20sent');logger[_0xfcb9('0xf')](_0xfcb9('0x10'),_0x2499fa,_0xfcb9('0x11'),JSON[_0xfcb9('0x12')](_0x4d3a15));if(_0x4d3a15['error']){if(_0x4d3a15[_0xfcb9('0x13')][_0xfcb9('0x14')]===0x1f4){logger[_0xfcb9('0x13')](_0xfcb9('0x15'),_0x2499fa,_0x4d3a15['error'][_0xfcb9('0x16')]);return _0xb0f960(_0x4d3a15[_0xfcb9('0x13')][_0xfcb9('0x16')]);}logger[_0xfcb9('0x13')]('CmContact,\x20%s,\x20%s',_0x2499fa,_0x4d3a15[_0xfcb9('0x13')][_0xfcb9('0x16')]);return _0x28b843(_0x4d3a15[_0xfcb9('0x13')][_0xfcb9('0x16')]);}else{logger['info'](_0xfcb9('0x15'),_0x2499fa,_0xfcb9('0x11'));_0x28b843(_0x4d3a15[_0xfcb9('0x17')][_0xfcb9('0x16')]);}})[_0xfcb9('0x18')](function(_0x35b3e2){logger[_0xfcb9('0x13')](_0xfcb9('0x15'),_0x2499fa,_0x35b3e2);_0xb0f960(_0x35b3e2);});});}exports[_0xfcb9('0x19')]=function(_0x1d6dc3){var _0xcc9640=this;return new Promise(function(_0x1c7989,_0x2927b9){return db[_0xfcb9('0x1a')][_0xfcb9('0x1b')]({'raw':_0x1d6dc3[_0xfcb9('0x1c')]?_0x1d6dc3[_0xfcb9('0x1c')][_0xfcb9('0x1d')]===undefined?!![]:![]:!![],'where':_0x1d6dc3[_0xfcb9('0x1c')]?_0x1d6dc3[_0xfcb9('0x1c')][_0xfcb9('0x1e')]||null:null,'attributes':_0x1d6dc3[_0xfcb9('0x1c')]?_0x1d6dc3[_0xfcb9('0x1c')][_0xfcb9('0x1f')]||null:null,'limit':_0x1d6dc3[_0xfcb9('0x1c')]?_0x1d6dc3[_0xfcb9('0x1c')][_0xfcb9('0x20')]||null:null,'include':_0x1d6dc3[_0xfcb9('0x1c')]?_0x1d6dc3[_0xfcb9('0x1c')][_0xfcb9('0x21')]?_['map'](_0x1d6dc3[_0xfcb9('0x1c')][_0xfcb9('0x21')],function(_0x46a26f){return{'model':db[_0x46a26f[_0xfcb9('0x22')]],'as':_0x46a26f['as'],'attributes':_0x46a26f[_0xfcb9('0x1f')],'include':_0x46a26f[_0xfcb9('0x21')]?_['map'](_0x46a26f['include'],function(_0x5aabc0){return{'model':db[_0x5aabc0[_0xfcb9('0x22')]],'as':_0x5aabc0['as'],'attributes':_0x5aabc0[_0xfcb9('0x1f')],'include':_0x5aabc0['include']?_[_0xfcb9('0x23')](_0x5aabc0['include'],function(_0x1685ed){return{'model':db[_0x1685ed['model']],'as':_0x1685ed['as'],'attributes':_0x1685ed[_0xfcb9('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x160524){logger['info']('GetCmContact',_0x1d6dc3);logger['debug'](_0xfcb9('0x19'),_0x1d6dc3,JSON[_0xfcb9('0x12')](_0x160524));_0x1c7989(_0x160524);})[_0xfcb9('0x18')](function(_0x59c9fd){logger[_0xfcb9('0x13')](_0xfcb9('0x19'),_0x59c9fd['message'],_0x1d6dc3);_0x2927b9(_0xcc9640['error'](0x1f4,_0x59c9fd['message']));});});};exports[_0xfcb9('0x24')]=function(_0x19e7d8){var _0x5c5457=this;return new Promise(function(_0x3cfc87,_0x38ea87){return db[_0xfcb9('0x1a')][_0xfcb9('0x25')](_0x19e7d8[_0xfcb9('0x26')],{'raw':_0x19e7d8[_0xfcb9('0x1c')]?_0x19e7d8[_0xfcb9('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xfcb9('0x27')](function(_0x269753){var _0x403723;for(var _0x2c59dd=0x0;_0x2c59dd<Object[_0xfcb9('0x28')](_0x19e7d8[_0xfcb9('0x26')])['length'];_0x2c59dd++){var _0x24b29a=Object[_0xfcb9('0x28')](_0x19e7d8['body'])[_0x2c59dd];if(_0x24b29a[_0xfcb9('0x29')](_0xfcb9('0x2a'))){_0x403723=squel[_0xfcb9('0x2b')]()['table']('cm_contacts')[_0xfcb9('0x2c')](_0x24b29a,_0x19e7d8[_0xfcb9('0x26')][_0x24b29a])[_0xfcb9('0x1e')](_0xfcb9('0x2d'),_0x269753['id'])['toString']();break;}}if(!_0x403723)return _0x269753;return db[_0xfcb9('0x2e')]['query'](_0x403723)[_0xfcb9('0x27')](function(){return _0x269753;});})[_0xfcb9('0x27')](function(_0x315e57){logger['info'](_0xfcb9('0x24'),_0x19e7d8);logger[_0xfcb9('0xf')](_0xfcb9('0x24'),_0x19e7d8,JSON[_0xfcb9('0x12')](_0x315e57));_0x3cfc87(_0x315e57);})[_0xfcb9('0x18')](function(_0x297c7e){logger[_0xfcb9('0x13')](_0xfcb9('0x24'),_0x297c7e['message'],_0x19e7d8);_0x38ea87(_0x5c5457[_0xfcb9('0x13')](0x1f4,_0x297c7e[_0xfcb9('0x16')]));});});};
\ No newline at end of file
+var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','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','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a<Object[_0x0a9e('0x2d')](_0x2cc7a0[_0x0a9e('0x2c')])[_0x0a9e('0x2e')];_0x24936a++){var _0x4f41ae=Object[_0x0a9e('0x2d')](_0x2cc7a0[_0x0a9e('0x2c')])[_0x24936a];if(_0x4f41ae[_0x0a9e('0x2f')]('cf_')){_0x5640eb=squel[_0x0a9e('0x30')]()[_0x0a9e('0x31')](_0x0a9e('0x32'))['set'](_0x4f41ae,_0x2cc7a0['body'][_0x4f41ae])[_0x0a9e('0x1d')](_0x0a9e('0x33'),_0x1e8694['id'])['toString']();break;}}if(!_0x5640eb)return _0x1e8694;return db[_0x0a9e('0x34')][_0x0a9e('0x35')](_0x5640eb)[_0x0a9e('0x23')](function(){return _0x1e8694;});})[_0x0a9e('0x23')](function(_0x4b38d9){logger['info'](_0x0a9e('0x36'),_0x2cc7a0);logger[_0x0a9e('0x12')]('CreateCmContact',_0x2cc7a0,JSON[_0x0a9e('0x24')](_0x4b38d9));_0x2b7e7f(_0x4b38d9);})[_0x0a9e('0x18')](function(_0x1459bb){logger['error'](_0x0a9e('0x36'),_0x1459bb[_0x0a9e('0x16')],_0x2cc7a0);_0x3f3d41(_0x14b13f[_0x0a9e('0x14')](0x1f4,_0x1459bb[_0x0a9e('0x16')]));});});};
\ No newline at end of file