Built motion from commit 616d3211.|2.6.4
[motion2.git] / server / api / cmContact / cmContact.rpc.js
index 646ce9a..6ecc150 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x515f=['find','options','raw','where','attributes','include','map','model','debug','stringify','catch','CmContact','create','body','CreateCmContact','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','./cmContact.socket','register','then','info','CmContact,\x20%s,\x20%s','request\x20sent','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','ShowCmContact'];(function(_0x352c13,_0x1a91cb){var _0x5b48e8=function(_0x1afcc2){while(--_0x1afcc2){_0x352c13['push'](_0x352c13['shift']());}};_0x5b48e8(++_0x1a91cb);}(_0x515f,0x147));var _0xf515=function(_0x20c5cd,_0x11d0c2){_0x20c5cd=_0x20c5cd-0x0;var _0x1788c9=_0x515f[_0x20c5cd];return _0x1788c9;};'use strict';var _=require(_0xf515('0x0'));var util=require(_0xf515('0x1'));var moment=require(_0xf515('0x2'));var BPromise=require(_0xf515('0x3'));var rs=require(_0xf515('0x4'));var fs=require('fs');var Redis=require(_0xf515('0x5'));var db=require(_0xf515('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf515('0x7'))(_0xf515('0x8'));var config=require(_0xf515('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf515('0xa')]['http']({'port':0x232a});config[_0xf515('0xb')]=_['defaults'](config[_0xf515('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf515('0xb')]));require(_0xf515('0xc'))[_0xf515('0xd')](socket);function respondWithRpcPromise(_0x969cb2,_0x4c5da2,_0x16493f){return new BPromise(function(_0x3cbefa,_0x6399c){return client['request'](_0x969cb2,_0x16493f)[_0xf515('0xe')](function(_0x26a395){logger[_0xf515('0xf')](_0xf515('0x10'),_0x4c5da2,_0xf515('0x11'));logger['debug'](_0xf515('0x12'),_0x4c5da2,_0xf515('0x11'),JSON['stringify'](_0x26a395));if(_0x26a395[_0xf515('0x13')]){if(_0x26a395[_0xf515('0x13')][_0xf515('0x14')]===0x1f4){logger[_0xf515('0x13')]('CmContact,\x20%s,\x20%s',_0x4c5da2,_0x26a395['error'][_0xf515('0x15')]);return _0x6399c(_0x26a395[_0xf515('0x13')][_0xf515('0x15')]);}logger[_0xf515('0x13')](_0xf515('0x10'),_0x4c5da2,_0x26a395[_0xf515('0x13')][_0xf515('0x15')]);return _0x3cbefa(_0x26a395['error']['message']);}else{logger[_0xf515('0xf')](_0xf515('0x10'),_0x4c5da2,'request\x20sent');_0x3cbefa(_0x26a395[_0xf515('0x16')]['message']);}})['catch'](function(_0x24c641){logger['error'](_0xf515('0x10'),_0x4c5da2,_0x24c641);_0x6399c(_0x24c641);});});}exports[_0xf515('0x17')]=function(_0x3b3cb2){var _0x55a1fc=this;return new Promise(function(_0x5b3a9e,_0x2ddc99){return db['CmContact'][_0xf515('0x18')]({'raw':_0x3b3cb2[_0xf515('0x19')]?_0x3b3cb2[_0xf515('0x19')][_0xf515('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b3cb2[_0xf515('0x19')]?_0x3b3cb2[_0xf515('0x19')][_0xf515('0x1b')]||null:null,'attributes':_0x3b3cb2[_0xf515('0x19')]?_0x3b3cb2['options'][_0xf515('0x1c')]||null:null,'include':_0x3b3cb2[_0xf515('0x19')]?_0x3b3cb2[_0xf515('0x19')][_0xf515('0x1d')]?_[_0xf515('0x1e')](_0x3b3cb2[_0xf515('0x19')]['include'],function(_0x232c1f){return{'model':db[_0x232c1f[_0xf515('0x1f')]],'as':_0x232c1f['as'],'attributes':_0x232c1f['attributes'],'include':_0x232c1f['include']?_[_0xf515('0x1e')](_0x232c1f['include'],function(_0xfcab02){return{'model':db[_0xfcab02[_0xf515('0x1f')]],'as':_0xfcab02['as'],'attributes':_0xfcab02[_0xf515('0x1c')],'include':_0xfcab02['include']?_[_0xf515('0x1e')](_0xfcab02[_0xf515('0x1d')],function(_0x21b0b5){return{'model':db[_0x21b0b5['model']],'as':_0x21b0b5['as'],'attributes':_0x21b0b5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x533068){logger[_0xf515('0xf')](_0xf515('0x17'),_0x3b3cb2);logger[_0xf515('0x20')](_0xf515('0x17'),_0x3b3cb2,JSON[_0xf515('0x21')](_0x533068));_0x5b3a9e(_0x533068);})[_0xf515('0x22')](function(_0x299982){logger[_0xf515('0x13')](_0xf515('0x17'),_0x299982[_0xf515('0x15')],_0x3b3cb2);_0x2ddc99(_0x55a1fc['error'](0x1f4,_0x299982[_0xf515('0x15')]));});});};exports['CreateCmContact']=function(_0x4c30d9){var _0x890758=this;return new Promise(function(_0x401a10,_0x581267){return db[_0xf515('0x23')][_0xf515('0x24')](_0x4c30d9[_0xf515('0x25')],{'raw':_0x4c30d9[_0xf515('0x19')]?_0x4c30d9[_0xf515('0x19')][_0xf515('0x1a')]===undefined?!![]:![]:!![]})[_0xf515('0xe')](function(_0x5ad794){logger[_0xf515('0xf')]('CreateCmContact',_0x4c30d9);logger[_0xf515('0x20')](_0xf515('0x26'),_0x4c30d9,JSON['stringify'](_0x5ad794));_0x401a10(_0x5ad794);})[_0xf515('0x22')](function(_0x349a6a){logger[_0xf515('0x13')]('CreateCmContact',_0x349a6a[_0xf515('0x15')],_0x4c30d9);_0x581267(_0x890758[_0xf515('0x13')](0x1f4,_0x349a6a[_0xf515('0x15')]));});});};
\ No newline at end of file
+var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x350597,_0x45b82b){var _0x569078=function(_0x13fc47){while(--_0x13fc47){_0x350597['push'](_0x350597['shift']());}};_0x569078(++_0x45b82b);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6<Object[_0x7995('0x32')](_0x5e67fe['body'])[_0x7995('0x26')];_0xf612e6++){var _0x235df7=Object[_0x7995('0x32')](_0x5e67fe[_0x7995('0x31')])[_0xf612e6];if(_0x235df7[_0x7995('0x33')](_0x7995('0x34'))){_0x242713=squel['update']()[_0x7995('0x35')](_0x7995('0x36'))[_0x7995('0x37')](_0x235df7,_0x5e67fe[_0x7995('0x31')][_0x235df7])[_0x7995('0x38')](_0x7995('0x39'),_0x2d4285['id'])[_0x7995('0x3a')]();break;}}if(!_0x242713)return _0x2d4285;return db[_0x7995('0x3b')][_0x7995('0x3c')](_0x242713)[_0x7995('0x12')](function(){return _0x2d4285;});})[_0x7995('0x12')](function(_0x270d52){logger[_0x7995('0x13')]('CreateCmContact',_0x5e67fe);logger['debug'](_0x7995('0x2f'),_0x5e67fe,JSON[_0x7995('0x18')](_0x270d52));_0x3e99cd(_0x270d52);})['catch'](function(_0x4b0855){logger[_0x7995('0x1a')]('CreateCmContact',_0x4b0855['message'],_0x5e67fe);_0xe328b1(_0x5d2428[_0x7995('0x1a')](0x1f4,_0x4b0855[_0x7995('0x1b')]));});});};
\ No newline at end of file