Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / cmContact / cmContact.rpc.js
index 932e223..298bdd4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7f64=['request\x20sent','debug','stringify','error','code','message','result','catch','ShowCmContact','CmContact','find','options','raw','where','map','attributes','include','CreateCmContact','create','body','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x7f64,0xb4));var _0x47f6=function(_0x16245b,_0x353df5){_0x16245b=_0x16245b-0x0;var _0x8bbb56=_0x7f64[_0x16245b];return _0x8bbb56;};'use strict';var _=require('lodash');var util=require(_0x47f6('0x0'));var moment=require(_0x47f6('0x1'));var BPromise=require(_0x47f6('0x2'));var rs=require(_0x47f6('0x3'));var fs=require('fs');var Redis=require(_0x47f6('0x4'));var db=require(_0x47f6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x47f6('0x6'))(_0x47f6('0x7'));var config=require('../../config/environment');var jayson=require(_0x47f6('0x8'));var client=jayson[_0x47f6('0x9')][_0x47f6('0xa')]({'port':0x232a});config[_0x47f6('0xb')]=_['defaults'](config[_0x47f6('0xb')],{'host':_0x47f6('0xc'),'port':0x18eb});var socket=require(_0x47f6('0xd'))(new Redis(config['redis']));require(_0x47f6('0xe'))[_0x47f6('0xf')](socket);function respondWithRpcPromise(_0x56aa67,_0x4f0e83,_0x6aa682){return new BPromise(function(_0x9d3210,_0x4212b8){return client[_0x47f6('0x10')](_0x56aa67,_0x6aa682)[_0x47f6('0x11')](function(_0x1668b8){logger[_0x47f6('0x12')](_0x47f6('0x13'),_0x4f0e83,_0x47f6('0x14'));logger[_0x47f6('0x15')]('CmContact,\x20%s,\x20%s,\x20%s',_0x4f0e83,'request\x20sent',JSON[_0x47f6('0x16')](_0x1668b8));if(_0x1668b8[_0x47f6('0x17')]){if(_0x1668b8['error'][_0x47f6('0x18')]===0x1f4){logger[_0x47f6('0x17')](_0x47f6('0x13'),_0x4f0e83,_0x1668b8[_0x47f6('0x17')]['message']);return _0x4212b8(_0x1668b8[_0x47f6('0x17')][_0x47f6('0x19')]);}logger[_0x47f6('0x17')]('CmContact,\x20%s,\x20%s',_0x4f0e83,_0x1668b8[_0x47f6('0x17')][_0x47f6('0x19')]);return _0x9d3210(_0x1668b8[_0x47f6('0x17')][_0x47f6('0x19')]);}else{logger['info']('CmContact,\x20%s,\x20%s',_0x4f0e83,_0x47f6('0x14'));_0x9d3210(_0x1668b8[_0x47f6('0x1a')][_0x47f6('0x19')]);}})[_0x47f6('0x1b')](function(_0x470774){logger[_0x47f6('0x17')](_0x47f6('0x13'),_0x4f0e83,_0x470774);_0x4212b8(_0x470774);});});}exports[_0x47f6('0x1c')]=function(_0x22026f){var _0x559cbd=this;return new Promise(function(_0x2e39e2,_0x509fa9){return db[_0x47f6('0x1d')][_0x47f6('0x1e')]({'raw':_0x22026f[_0x47f6('0x1f')]?_0x22026f[_0x47f6('0x1f')][_0x47f6('0x20')]===undefined?!![]:![]:!![],'where':_0x22026f[_0x47f6('0x1f')]?_0x22026f[_0x47f6('0x1f')][_0x47f6('0x21')]||null:null,'attributes':_0x22026f[_0x47f6('0x1f')]?_0x22026f[_0x47f6('0x1f')]['attributes']||null:null,'include':_0x22026f[_0x47f6('0x1f')]?_0x22026f['options']['include']?_[_0x47f6('0x22')](_0x22026f[_0x47f6('0x1f')]['include'],function(_0x56fe33){return{'model':db[_0x56fe33['model']],'as':_0x56fe33['as'],'attributes':_0x56fe33[_0x47f6('0x23')],'include':_0x56fe33[_0x47f6('0x24')]?_[_0x47f6('0x22')](_0x56fe33[_0x47f6('0x24')],function(_0xe23b12){return{'model':db[_0xe23b12['model']],'as':_0xe23b12['as'],'attributes':_0xe23b12[_0x47f6('0x23')],'include':_0xe23b12[_0x47f6('0x24')]?_[_0x47f6('0x22')](_0xe23b12[_0x47f6('0x24')],function(_0x5e9bd0){return{'model':db[_0x5e9bd0['model']],'as':_0x5e9bd0['as'],'attributes':_0x5e9bd0[_0x47f6('0x23')]};}):[]};}):[]};}):[]:[]})[_0x47f6('0x11')](function(_0x2b430e){logger[_0x47f6('0x12')](_0x47f6('0x1c'),_0x22026f);logger['debug'](_0x47f6('0x1c'),_0x22026f,JSON[_0x47f6('0x16')](_0x2b430e));_0x2e39e2(_0x2b430e);})['catch'](function(_0x58ce92){logger[_0x47f6('0x17')]('ShowCmContact',_0x58ce92[_0x47f6('0x19')],_0x22026f);_0x509fa9(_0x559cbd['error'](0x1f4,_0x58ce92[_0x47f6('0x19')]));});});};exports[_0x47f6('0x25')]=function(_0x5b8056){var _0x56c641=this;return new Promise(function(_0x50892a,_0x626edf){return db[_0x47f6('0x1d')][_0x47f6('0x26')](_0x5b8056[_0x47f6('0x27')],{'raw':_0x5b8056[_0x47f6('0x1f')]?_0x5b8056[_0x47f6('0x1f')][_0x47f6('0x20')]===undefined?!![]:![]:!![]})[_0x47f6('0x11')](function(_0xba0d2d){logger['info']('CreateCmContact',_0x5b8056);logger[_0x47f6('0x15')](_0x47f6('0x25'),_0x5b8056,JSON[_0x47f6('0x16')](_0xba0d2d));_0x50892a(_0xba0d2d);})[_0x47f6('0x1b')](function(_0x270e2c){logger['error'](_0x47f6('0x25'),_0x270e2c[_0x47f6('0x19')],_0x5b8056);_0x626edf(_0x56c641['error'](0x1f4,_0x270e2c[_0x47f6('0x19')]));});});};
\ No newline at end of file
+var _0x3fe3=['rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CmContact','findAll','options','raw','where','attributes','include','model','map','GetCmContact','catch','CreateCmContact','body','keys','length','startsWith','cf_','table','cm_contacts','id\x20=\x20?','toString','sequelize','query','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x3fe3,0x12c));var _0x33fe=function(_0x3d0e3a,_0x411cf1){_0x3d0e3a=_0x3d0e3a-0x0;var _0x42a430=_0x3fe3[_0x3d0e3a];return _0x42a430;};'use strict';var _=require(_0x33fe('0x0'));var util=require('util');var moment=require(_0x33fe('0x1'));var BPromise=require(_0x33fe('0x2'));var rs=require(_0x33fe('0x3'));var fs=require('fs');var Redis=require(_0x33fe('0x4'));var squel=require('squel');var db=require('../../mysqldb')['db'];var utils=require(_0x33fe('0x5'));var logger=require('../../config/logger')(_0x33fe('0x6'));var config=require(_0x33fe('0x7'));var jayson=require(_0x33fe('0x8'));var client=jayson[_0x33fe('0x9')][_0x33fe('0xa')]({'port':0x232a});config['redis']=_[_0x33fe('0xb')](config[_0x33fe('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x33fe('0xd'))(new Redis(config[_0x33fe('0xc')]));require(_0x33fe('0xe'))[_0x33fe('0xf')](socket);function respondWithRpcPromise(_0x1c5356,_0x13fe51,_0x48b77a){return new BPromise(function(_0x3d63d0,_0x27c77f){return client[_0x33fe('0x10')](_0x1c5356,_0x48b77a)[_0x33fe('0x11')](function(_0x4fdf24){logger[_0x33fe('0x12')](_0x33fe('0x13'),_0x13fe51,_0x33fe('0x14'));logger[_0x33fe('0x15')](_0x33fe('0x16'),_0x13fe51,_0x33fe('0x14'),JSON[_0x33fe('0x17')](_0x4fdf24));if(_0x4fdf24[_0x33fe('0x18')]){if(_0x4fdf24[_0x33fe('0x18')][_0x33fe('0x19')]===0x1f4){logger['error'](_0x33fe('0x13'),_0x13fe51,_0x4fdf24['error'][_0x33fe('0x1a')]);return _0x27c77f(_0x4fdf24['error'][_0x33fe('0x1a')]);}logger[_0x33fe('0x18')](_0x33fe('0x13'),_0x13fe51,_0x4fdf24[_0x33fe('0x18')][_0x33fe('0x1a')]);return _0x3d63d0(_0x4fdf24[_0x33fe('0x18')][_0x33fe('0x1a')]);}else{logger[_0x33fe('0x12')](_0x33fe('0x13'),_0x13fe51,_0x33fe('0x14'));_0x3d63d0(_0x4fdf24[_0x33fe('0x1b')][_0x33fe('0x1a')]);}})['catch'](function(_0x270a06){logger[_0x33fe('0x18')]('CmContact,\x20%s,\x20%s',_0x13fe51,_0x270a06);_0x27c77f(_0x270a06);});});}exports['GetCmContact']=function(_0x20d6d6){var _0x2a16c0=this;return new Promise(function(_0x1148be,_0xd40380){return db[_0x33fe('0x1c')][_0x33fe('0x1d')]({'raw':_0x20d6d6['options']?_0x20d6d6[_0x33fe('0x1e')][_0x33fe('0x1f')]===undefined?!![]:![]:!![],'where':_0x20d6d6[_0x33fe('0x1e')]?_0x20d6d6[_0x33fe('0x1e')][_0x33fe('0x20')]||null:null,'attributes':_0x20d6d6[_0x33fe('0x1e')]?_0x20d6d6['options'][_0x33fe('0x21')]||null:null,'limit':_0x20d6d6['options']?_0x20d6d6['options']['limit']||null:null,'include':_0x20d6d6[_0x33fe('0x1e')]?_0x20d6d6[_0x33fe('0x1e')][_0x33fe('0x22')]?_['map'](_0x20d6d6['options'][_0x33fe('0x22')],function(_0x5c29a1){return{'model':db[_0x5c29a1[_0x33fe('0x23')]],'as':_0x5c29a1['as'],'attributes':_0x5c29a1[_0x33fe('0x21')],'include':_0x5c29a1[_0x33fe('0x22')]?_[_0x33fe('0x24')](_0x5c29a1[_0x33fe('0x22')],function(_0x3ae9ce){return{'model':db[_0x3ae9ce[_0x33fe('0x23')]],'as':_0x3ae9ce['as'],'attributes':_0x3ae9ce[_0x33fe('0x21')],'include':_0x3ae9ce[_0x33fe('0x22')]?_[_0x33fe('0x24')](_0x3ae9ce[_0x33fe('0x22')],function(_0x1394bc){return{'model':db[_0x1394bc[_0x33fe('0x23')]],'as':_0x1394bc['as'],'attributes':_0x1394bc[_0x33fe('0x21')]};}):[]};}):[]};}):[]:[]})[_0x33fe('0x11')](function(_0x5c76fb){logger[_0x33fe('0x12')](_0x33fe('0x25'),_0x20d6d6);logger['debug'](_0x33fe('0x25'),_0x20d6d6,JSON[_0x33fe('0x17')](_0x5c76fb));_0x1148be(_0x5c76fb);})[_0x33fe('0x26')](function(_0x5c3af3){logger[_0x33fe('0x18')](_0x33fe('0x25'),_0x5c3af3[_0x33fe('0x1a')],_0x20d6d6);_0xd40380(_0x2a16c0[_0x33fe('0x18')](0x1f4,_0x5c3af3[_0x33fe('0x1a')]));});});};exports[_0x33fe('0x27')]=function(_0x5448a2){var _0x3180fa=this;return new Promise(function(_0x44c2bc,_0x452b3f){return db[_0x33fe('0x1c')]['create'](_0x5448a2[_0x33fe('0x28')],{'raw':_0x5448a2[_0x33fe('0x1e')]?_0x5448a2[_0x33fe('0x1e')][_0x33fe('0x1f')]===undefined?!![]:![]:!![]})[_0x33fe('0x11')](function(_0x2f8779){var _0x4eb426;for(var _0x2e1775=0x0;_0x2e1775<Object[_0x33fe('0x29')](_0x5448a2['body'])[_0x33fe('0x2a')];_0x2e1775++){var _0x2ba9cf=Object[_0x33fe('0x29')](_0x5448a2[_0x33fe('0x28')])[_0x2e1775];if(_0x2ba9cf[_0x33fe('0x2b')](_0x33fe('0x2c'))){_0x4eb426=squel['update']()[_0x33fe('0x2d')](_0x33fe('0x2e'))['set'](_0x2ba9cf,_0x5448a2[_0x33fe('0x28')][_0x2ba9cf])['where'](_0x33fe('0x2f'),_0x2f8779['id'])[_0x33fe('0x30')]();break;}}if(!_0x4eb426)return _0x2f8779;return db[_0x33fe('0x31')][_0x33fe('0x32')](_0x4eb426)[_0x33fe('0x11')](function(){return _0x2f8779;});})[_0x33fe('0x11')](function(_0x49c66e){logger['info']('CreateCmContact',_0x5448a2);logger[_0x33fe('0x15')](_0x33fe('0x27'),_0x5448a2,JSON['stringify'](_0x49c66e));_0x44c2bc(_0x49c66e);})[_0x33fe('0x26')](function(_0x41f9df){logger[_0x33fe('0x18')](_0x33fe('0x27'),_0x41f9df[_0x33fe('0x1a')],_0x5448a2);_0x452b3f(_0x3180fa[_0x33fe('0x18')](0x1f4,_0x41f9df[_0x33fe('0x1a')]));});});};
\ No newline at end of file