Built motion from commit (unavailable).|2.5.16
[motion2.git] / server / api / cmContact / cmContact.rpc.js
index d8ec607..316855c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8310=['map','model','catch','CreateCmContact','create','keys','body','length','cf_','update','table','set','id\x20=\x20?','toString','query','lodash','util','moment','randomstring','squel','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCmContact','CmContact','findAll','options','raw','where','attributes','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8310,0x113));var _0x0831=function(_0x364a36,_0x1e2677){_0x364a36=_0x364a36-0x0;var _0x5cd6fa=_0x8310[_0x364a36];return _0x5cd6fa;};'use strict';var _=require(_0x0831('0x0'));var util=require(_0x0831('0x1'));var moment=require(_0x0831('0x2'));var BPromise=require('bluebird');var rs=require(_0x0831('0x3'));var fs=require('fs');var Redis=require('ioredis');var squel=require(_0x0831('0x4'));var db=require(_0x0831('0x5'))['db'];var utils=require(_0x0831('0x6'));var logger=require(_0x0831('0x7'))('rpc');var config=require(_0x0831('0x8'));var jayson=require(_0x0831('0x9'));var client=jayson[_0x0831('0xa')][_0x0831('0xb')]({'port':0x232a});config['redis']=_[_0x0831('0xc')](config[_0x0831('0xd')],{'host':_0x0831('0xe'),'port':0x18eb});var socket=require(_0x0831('0xf'))(new Redis(config['redis']));require(_0x0831('0x10'))['register'](socket);function respondWithRpcPromise(_0xa45319,_0x448d4a,_0x3e2f12){return new BPromise(function(_0x15aaa7,_0xc2c69e){return client[_0x0831('0x11')](_0xa45319,_0x3e2f12)[_0x0831('0x12')](function(_0x23b89d){logger[_0x0831('0x13')](_0x0831('0x14'),_0x448d4a,_0x0831('0x15'));logger[_0x0831('0x16')](_0x0831('0x17'),_0x448d4a,_0x0831('0x15'),JSON[_0x0831('0x18')](_0x23b89d));if(_0x23b89d[_0x0831('0x19')]){if(_0x23b89d[_0x0831('0x19')][_0x0831('0x1a')]===0x1f4){logger['error'](_0x0831('0x14'),_0x448d4a,_0x23b89d[_0x0831('0x19')][_0x0831('0x1b')]);return _0xc2c69e(_0x23b89d[_0x0831('0x19')][_0x0831('0x1b')]);}logger[_0x0831('0x19')](_0x0831('0x14'),_0x448d4a,_0x23b89d[_0x0831('0x19')][_0x0831('0x1b')]);return _0x15aaa7(_0x23b89d[_0x0831('0x19')][_0x0831('0x1b')]);}else{logger[_0x0831('0x13')](_0x0831('0x14'),_0x448d4a,'request\x20sent');_0x15aaa7(_0x23b89d[_0x0831('0x1c')][_0x0831('0x1b')]);}})['catch'](function(_0xa254aa){logger['error']('CmContact,\x20%s,\x20%s',_0x448d4a,_0xa254aa);_0xc2c69e(_0xa254aa);});});}exports[_0x0831('0x1d')]=function(_0x2a03ea){var _0x50d478=this;return new Promise(function(_0x4ad056,_0x2e2852){return db[_0x0831('0x1e')][_0x0831('0x1f')]({'raw':_0x2a03ea[_0x0831('0x20')]?_0x2a03ea[_0x0831('0x20')][_0x0831('0x21')]===undefined?!![]:![]:!![],'where':_0x2a03ea['options']?_0x2a03ea['options'][_0x0831('0x22')]||null:null,'attributes':_0x2a03ea[_0x0831('0x20')]?_0x2a03ea['options'][_0x0831('0x23')]||null:null,'limit':_0x2a03ea[_0x0831('0x20')]?_0x2a03ea[_0x0831('0x20')]['limit']||null:null,'include':_0x2a03ea[_0x0831('0x20')]?_0x2a03ea[_0x0831('0x20')][_0x0831('0x24')]?_[_0x0831('0x25')](_0x2a03ea[_0x0831('0x20')]['include'],function(_0xea6d13){return{'model':db[_0xea6d13[_0x0831('0x26')]],'as':_0xea6d13['as'],'attributes':_0xea6d13[_0x0831('0x23')],'include':_0xea6d13['include']?_[_0x0831('0x25')](_0xea6d13[_0x0831('0x24')],function(_0x5ed573){return{'model':db[_0x5ed573[_0x0831('0x26')]],'as':_0x5ed573['as'],'attributes':_0x5ed573[_0x0831('0x23')],'include':_0x5ed573[_0x0831('0x24')]?_[_0x0831('0x25')](_0x5ed573['include'],function(_0x6c527d){return{'model':db[_0x6c527d[_0x0831('0x26')]],'as':_0x6c527d['as'],'attributes':_0x6c527d[_0x0831('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0831('0x12')](function(_0x232785){logger['info'](_0x0831('0x1d'),_0x2a03ea);logger[_0x0831('0x16')](_0x0831('0x1d'),_0x2a03ea,JSON[_0x0831('0x18')](_0x232785));_0x4ad056(_0x232785);})[_0x0831('0x27')](function(_0xc2007a){logger[_0x0831('0x19')](_0x0831('0x1d'),_0xc2007a[_0x0831('0x1b')],_0x2a03ea);_0x2e2852(_0x50d478[_0x0831('0x19')](0x1f4,_0xc2007a[_0x0831('0x1b')]));});});};exports[_0x0831('0x28')]=function(_0x5a3ac2){var _0x175349=this;return new Promise(function(_0x43cc18,_0x3d9199){return db['CmContact'][_0x0831('0x29')](_0x5a3ac2['body'],{'raw':_0x5a3ac2['options']?_0x5a3ac2[_0x0831('0x20')][_0x0831('0x21')]===undefined?!![]:![]:!![]})[_0x0831('0x12')](function(_0x3a44ae){var _0x25b15d;for(var _0x299090=0x0;_0x299090<Object[_0x0831('0x2a')](_0x5a3ac2[_0x0831('0x2b')])[_0x0831('0x2c')];_0x299090++){var _0x42ed9c=Object['keys'](_0x5a3ac2[_0x0831('0x2b')])[_0x299090];if(_0x42ed9c['startsWith'](_0x0831('0x2d'))){_0x25b15d=squel[_0x0831('0x2e')]()[_0x0831('0x2f')]('cm_contacts')[_0x0831('0x30')](_0x42ed9c,_0x5a3ac2[_0x0831('0x2b')][_0x42ed9c])[_0x0831('0x22')](_0x0831('0x31'),_0x3a44ae['id'])[_0x0831('0x32')]();break;}}if(!_0x25b15d)return _0x3a44ae;return db['sequelize'][_0x0831('0x33')](_0x25b15d)[_0x0831('0x12')](function(){return _0x3a44ae;});})[_0x0831('0x12')](function(_0x2358d9){logger[_0x0831('0x13')](_0x0831('0x28'),_0x5a3ac2);logger[_0x0831('0x16')](_0x0831('0x28'),_0x5a3ac2,JSON['stringify'](_0x2358d9));_0x43cc18(_0x2358d9);})[_0x0831('0x27')](function(_0x1c9969){logger[_0x0831('0x19')](_0x0831('0x28'),_0x1c9969['message'],_0x5a3ac2);_0x3d9199(_0x175349[_0x0831('0x19')](0x1f4,_0x1c9969[_0x0831('0x1b')]));});});};
\ No newline at end of file
+var _0x1c5f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetCmContact','CmContact','findAll','options','raw','where','attributes','limit','include','map','model','create','body','keys','length','startsWith','cm_contacts','set','id\x20=\x20?','toString','CreateCmContact','util','randomstring','ioredis','squel'];(function(_0x284c19,_0xe3672b){var _0x36e006=function(_0x1508ce){while(--_0x1508ce){_0x284c19['push'](_0x284c19['shift']());}};_0x36e006(++_0xe3672b);}(_0x1c5f,0x174));var _0xf1c5=function(_0x47f295,_0x2ec976){_0x47f295=_0x47f295-0x0;var _0x3450e6=_0x1c5f[_0x47f295];return _0x3450e6;};'use strict';var _=require('lodash');var util=require(_0xf1c5('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf1c5('0x1'));var fs=require('fs');var Redis=require(_0xf1c5('0x2'));var squel=require(_0xf1c5('0x3'));var db=require(_0xf1c5('0x4'))['db'];var utils=require(_0xf1c5('0x5'));var logger=require(_0xf1c5('0x6'))(_0xf1c5('0x7'));var config=require(_0xf1c5('0x8'));var jayson=require(_0xf1c5('0x9'));var client=jayson[_0xf1c5('0xa')][_0xf1c5('0xb')]({'port':0x232a});config[_0xf1c5('0xc')]=_[_0xf1c5('0xd')](config[_0xf1c5('0xc')],{'host':_0xf1c5('0xe'),'port':0x18eb});var socket=require(_0xf1c5('0xf'))(new Redis(config[_0xf1c5('0xc')]));require('./cmContact.socket')['register'](socket);function respondWithRpcPromise(_0x2af897,_0x5e9ac7,_0x287071){return new BPromise(function(_0x29fcdb,_0x43c67d){return client['request'](_0x2af897,_0x287071)[_0xf1c5('0x10')](function(_0x1213a3){logger[_0xf1c5('0x11')](_0xf1c5('0x12'),_0x5e9ac7,_0xf1c5('0x13'));logger[_0xf1c5('0x14')](_0xf1c5('0x15'),_0x5e9ac7,_0xf1c5('0x13'),JSON[_0xf1c5('0x16')](_0x1213a3));if(_0x1213a3['error']){if(_0x1213a3['error']['code']===0x1f4){logger[_0xf1c5('0x17')]('CmContact,\x20%s,\x20%s',_0x5e9ac7,_0x1213a3['error'][_0xf1c5('0x18')]);return _0x43c67d(_0x1213a3[_0xf1c5('0x17')][_0xf1c5('0x18')]);}logger['error'](_0xf1c5('0x12'),_0x5e9ac7,_0x1213a3['error']['message']);return _0x29fcdb(_0x1213a3[_0xf1c5('0x17')][_0xf1c5('0x18')]);}else{logger[_0xf1c5('0x11')]('CmContact,\x20%s,\x20%s',_0x5e9ac7,_0xf1c5('0x13'));_0x29fcdb(_0x1213a3['result'][_0xf1c5('0x18')]);}})[_0xf1c5('0x19')](function(_0x450de5){logger[_0xf1c5('0x17')]('CmContact,\x20%s,\x20%s',_0x5e9ac7,_0x450de5);_0x43c67d(_0x450de5);});});}exports[_0xf1c5('0x1a')]=function(_0x43db4c){var _0x3fb06c=this;return new Promise(function(_0x59da5d,_0x3b3a74){return db[_0xf1c5('0x1b')][_0xf1c5('0x1c')]({'raw':_0x43db4c['options']?_0x43db4c[_0xf1c5('0x1d')][_0xf1c5('0x1e')]===undefined?!![]:![]:!![],'where':_0x43db4c['options']?_0x43db4c[_0xf1c5('0x1d')][_0xf1c5('0x1f')]||null:null,'attributes':_0x43db4c['options']?_0x43db4c['options'][_0xf1c5('0x20')]||null:null,'limit':_0x43db4c[_0xf1c5('0x1d')]?_0x43db4c['options'][_0xf1c5('0x21')]||null:null,'include':_0x43db4c[_0xf1c5('0x1d')]?_0x43db4c['options'][_0xf1c5('0x22')]?_['map'](_0x43db4c[_0xf1c5('0x1d')][_0xf1c5('0x22')],function(_0xab2725){return{'model':db[_0xab2725['model']],'as':_0xab2725['as'],'attributes':_0xab2725[_0xf1c5('0x20')],'include':_0xab2725[_0xf1c5('0x22')]?_[_0xf1c5('0x23')](_0xab2725['include'],function(_0x4a27f9){return{'model':db[_0x4a27f9[_0xf1c5('0x24')]],'as':_0x4a27f9['as'],'attributes':_0x4a27f9[_0xf1c5('0x20')],'include':_0x4a27f9[_0xf1c5('0x22')]?_['map'](_0x4a27f9[_0xf1c5('0x22')],function(_0x23645e){return{'model':db[_0x23645e[_0xf1c5('0x24')]],'as':_0x23645e['as'],'attributes':_0x23645e[_0xf1c5('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf1c5('0x10')](function(_0x1baea6){logger[_0xf1c5('0x11')](_0xf1c5('0x1a'),_0x43db4c);logger[_0xf1c5('0x14')](_0xf1c5('0x1a'),_0x43db4c,JSON['stringify'](_0x1baea6));_0x59da5d(_0x1baea6);})[_0xf1c5('0x19')](function(_0x7b7a42){logger[_0xf1c5('0x17')](_0xf1c5('0x1a'),_0x7b7a42[_0xf1c5('0x18')],_0x43db4c);_0x3b3a74(_0x3fb06c[_0xf1c5('0x17')](0x1f4,_0x7b7a42[_0xf1c5('0x18')]));});});};exports['CreateCmContact']=function(_0x9f4d49){var _0x2b956d=this;return new Promise(function(_0x1b5fa7,_0x174465){return db[_0xf1c5('0x1b')][_0xf1c5('0x25')](_0x9f4d49[_0xf1c5('0x26')],{'raw':_0x9f4d49[_0xf1c5('0x1d')]?_0x9f4d49[_0xf1c5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xf1c5('0x10')](function(_0x51af83){var _0x49b7b0;for(var _0x3c27ac=0x0;_0x3c27ac<Object[_0xf1c5('0x27')](_0x9f4d49[_0xf1c5('0x26')])[_0xf1c5('0x28')];_0x3c27ac++){var _0x50d50b=Object[_0xf1c5('0x27')](_0x9f4d49['body'])[_0x3c27ac];if(_0x50d50b[_0xf1c5('0x29')]('cf_')){_0x49b7b0=squel['update']()['table'](_0xf1c5('0x2a'))[_0xf1c5('0x2b')](_0x50d50b,_0x9f4d49[_0xf1c5('0x26')][_0x50d50b])[_0xf1c5('0x1f')](_0xf1c5('0x2c'),_0x51af83['id'])[_0xf1c5('0x2d')]();break;}}if(!_0x49b7b0)return _0x51af83;return db['sequelize']['query'](_0x49b7b0)[_0xf1c5('0x10')](function(){return _0x51af83;});})[_0xf1c5('0x10')](function(_0x2830f3){logger[_0xf1c5('0x11')]('CreateCmContact',_0x9f4d49);logger[_0xf1c5('0x14')](_0xf1c5('0x2e'),_0x9f4d49,JSON[_0xf1c5('0x16')](_0x2830f3));_0x1b5fa7(_0x2830f3);})[_0xf1c5('0x19')](function(_0x2acb55){logger[_0xf1c5('0x17')](_0xf1c5('0x2e'),_0x2acb55['message'],_0x9f4d49);_0x174465(_0x2b956d[_0xf1c5('0x17')](0x1f4,_0x2acb55[_0xf1c5('0x18')]));});});};
\ No newline at end of file