Built motion from commit (unavailable).|2.5.22
[motion2.git] / server / api / mailInteraction / mailInteraction.rpc.js
index 8d47582..35d6f6f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x25a3=['raw','where','attributes','limit','stringify','AddTagsToMailInteraction','omit','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateMailInteraction','MailInteraction','update','body','options'];(function(_0x509eec,_0x199d0c){var _0x27af7a=function(_0x5e472c){while(--_0x5e472c){_0x509eec['push'](_0x509eec['shift']());}};_0x27af7a(++_0x199d0c);}(_0x25a3,0x121));var _0x325a=function(_0x2f7cdf,_0x3dd24b){_0x2f7cdf=_0x2f7cdf-0x0;var _0x34fa6d=_0x25a3[_0x2f7cdf];return _0x34fa6d;};'use strict';var _=require(_0x325a('0x0'));var util=require(_0x325a('0x1'));var moment=require(_0x325a('0x2'));var BPromise=require('bluebird');var rs=require(_0x325a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x325a('0x4'))['db'];var utils=require(_0x325a('0x5'));var logger=require(_0x325a('0x6'))('rpc');var config=require(_0x325a('0x7'));var jayson=require(_0x325a('0x8'));var client=jayson[_0x325a('0x9')]['http']({'port':0x232a});config['redis']=_[_0x325a('0xa')](config[_0x325a('0xb')],{'host':_0x325a('0xc'),'port':0x18eb});var socket=require(_0x325a('0xd'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x325a('0xe')](socket);function respondWithRpcPromise(_0x4283df,_0x5623f6,_0x312787){return new BPromise(function(_0x27637c,_0x478156){return client['request'](_0x4283df,_0x312787)[_0x325a('0xf')](function(_0x9b3011){logger['info'](_0x325a('0x10'),_0x5623f6,_0x325a('0x11'));logger[_0x325a('0x12')](_0x325a('0x13'),_0x5623f6,'request\x20sent',JSON['stringify'](_0x9b3011));if(_0x9b3011[_0x325a('0x14')]){if(_0x9b3011['error'][_0x325a('0x15')]===0x1f4){logger[_0x325a('0x14')](_0x325a('0x10'),_0x5623f6,_0x9b3011[_0x325a('0x14')][_0x325a('0x16')]);return _0x478156(_0x9b3011[_0x325a('0x14')][_0x325a('0x16')]);}logger[_0x325a('0x14')](_0x325a('0x10'),_0x5623f6,_0x9b3011[_0x325a('0x14')][_0x325a('0x16')]);return _0x27637c(_0x9b3011[_0x325a('0x14')][_0x325a('0x16')]);}else{logger[_0x325a('0x17')]('MailInteraction,\x20%s,\x20%s',_0x5623f6,_0x325a('0x11'));_0x27637c(_0x9b3011[_0x325a('0x18')]['message']);}})[_0x325a('0x19')](function(_0x192aa2){logger[_0x325a('0x14')](_0x325a('0x10'),_0x5623f6,_0x192aa2);_0x478156(_0x192aa2);});});}exports[_0x325a('0x1a')]=function(_0x993bff){var _0x41484e=this;return new Promise(function(_0xc3ed69,_0x347f2d){return db[_0x325a('0x1b')][_0x325a('0x1c')](_0x993bff[_0x325a('0x1d')],{'raw':_0x993bff['options']?_0x993bff[_0x325a('0x1e')][_0x325a('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x993bff[_0x325a('0x1e')]?_0x993bff[_0x325a('0x1e')][_0x325a('0x20')]||null:null,'attributes':_0x993bff[_0x325a('0x1e')]?_0x993bff['options'][_0x325a('0x21')]||null:null,'limit':_0x993bff['options']?_0x993bff[_0x325a('0x1e')][_0x325a('0x22')]||null:null})[_0x325a('0xf')](function(_0x22c4a6){logger[_0x325a('0x17')]('UpdateMailInteraction',_0x993bff);logger[_0x325a('0x12')]('UpdateMailInteraction',_0x993bff,JSON[_0x325a('0x23')](_0x22c4a6));_0xc3ed69(_0x22c4a6);})[_0x325a('0x19')](function(_0x41d0d2){logger['error'](_0x325a('0x1a'),_0x41d0d2[_0x325a('0x16')],_0x993bff);_0x347f2d(_0x41484e[_0x325a('0x14')](0x1f4,_0x41d0d2[_0x325a('0x16')]));});});};exports[_0x325a('0x24')]=function(_0x18a8d7){return new Promise(function(_0x19b002,_0x49d93b){return db[_0x325a('0x1b')]['find']({'where':_0x18a8d7[_0x325a('0x1e')]?_0x18a8d7[_0x325a('0x1e')][_0x325a('0x20')]||null:null})[_0x325a('0xf')](function(_0x44311d){if(_0x44311d){return _0x44311d['addTags'](_0x18a8d7[_0x325a('0x1d')]['ids'],_[_0x325a('0x25')](_0x18a8d7[_0x325a('0x1d')],['ids','id'])||{});}})[_0x325a('0x26')](function(_0x23888d){logger[_0x325a('0x17')](_0x325a('0x27'),_0x18a8d7);logger['debug'](_0x325a('0x27'),_0x18a8d7,JSON[_0x325a('0x23')](_0x23888d));_0x19b002(_0x23888d);})[_0x325a('0x19')](function(_0x46b5b2){logger['error'](_0x325a('0x27'),_0x46b5b2[_0x325a('0x16')],_0x18a8d7);_0x49d93b(_this[_0x325a('0x14')](0x1f4,_0x46b5b2[_0x325a('0x16')]));});});};
\ No newline at end of file
+var _0x69e6=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','MailInteraction,\x20%s,\x20%s','error','message','result','update','body','options','raw','where','attributes','limit','UpdateMailInteraction','catch','AddTagsToMailInteraction','find','ids','omit','AddTags','util','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69e6,0x1e0));var _0x669e=function(_0x184aa9,_0x283c03){_0x184aa9=_0x184aa9-0x0;var _0x967354=_0x69e6[_0x184aa9];return _0x967354;};'use strict';var _=require('lodash');var util=require(_0x669e('0x0'));var moment=require(_0x669e('0x1'));var BPromise=require(_0x669e('0x2'));var rs=require(_0x669e('0x3'));var fs=require('fs');var Redis=require(_0x669e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x669e('0x5'));var logger=require(_0x669e('0x6'))(_0x669e('0x7'));var config=require(_0x669e('0x8'));var jayson=require(_0x669e('0x9'));var client=jayson[_0x669e('0xa')][_0x669e('0xb')]({'port':0x232a});config[_0x669e('0xc')]=_[_0x669e('0xd')](config[_0x669e('0xc')],{'host':_0x669e('0xe'),'port':0x18eb});var socket=require(_0x669e('0xf'))(new Redis(config['redis']));require(_0x669e('0x10'))[_0x669e('0x11')](socket);function respondWithRpcPromise(_0x23b057,_0x50cbb6,_0x47d875){return new BPromise(function(_0x50ba7d,_0x2bbcbe){return client[_0x669e('0x12')](_0x23b057,_0x47d875)[_0x669e('0x13')](function(_0x438271){logger[_0x669e('0x14')]('MailInteraction,\x20%s,\x20%s',_0x50cbb6,'request\x20sent');logger[_0x669e('0x15')](_0x669e('0x16'),_0x50cbb6,_0x669e('0x17'),JSON[_0x669e('0x18')](_0x438271));if(_0x438271['error']){if(_0x438271['error'][_0x669e('0x19')]===0x1f4){logger['error'](_0x669e('0x1a'),_0x50cbb6,_0x438271[_0x669e('0x1b')][_0x669e('0x1c')]);return _0x2bbcbe(_0x438271['error'][_0x669e('0x1c')]);}logger[_0x669e('0x1b')](_0x669e('0x1a'),_0x50cbb6,_0x438271[_0x669e('0x1b')]['message']);return _0x50ba7d(_0x438271[_0x669e('0x1b')]['message']);}else{logger[_0x669e('0x14')](_0x669e('0x1a'),_0x50cbb6,_0x669e('0x17'));_0x50ba7d(_0x438271[_0x669e('0x1d')][_0x669e('0x1c')]);}})['catch'](function(_0x48c385){logger[_0x669e('0x1b')](_0x669e('0x1a'),_0x50cbb6,_0x48c385);_0x2bbcbe(_0x48c385);});});}exports['UpdateMailInteraction']=function(_0x133b2c){var _0x6bdb7a=this;return new Promise(function(_0xdc8b90,_0x2db156){return db['MailInteraction'][_0x669e('0x1e')](_0x133b2c[_0x669e('0x1f')],{'raw':_0x133b2c['options']?_0x133b2c[_0x669e('0x20')][_0x669e('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x133b2c[_0x669e('0x20')]?_0x133b2c['options'][_0x669e('0x22')]||null:null,'attributes':_0x133b2c[_0x669e('0x20')]?_0x133b2c[_0x669e('0x20')][_0x669e('0x23')]||null:null,'limit':_0x133b2c[_0x669e('0x20')]?_0x133b2c[_0x669e('0x20')][_0x669e('0x24')]||null:null})[_0x669e('0x13')](function(_0x4f0762){logger['info'](_0x669e('0x25'),_0x133b2c);logger['debug'](_0x669e('0x25'),_0x133b2c,JSON['stringify'](_0x4f0762));_0xdc8b90(_0x4f0762);})[_0x669e('0x26')](function(_0x372ea3){logger[_0x669e('0x1b')](_0x669e('0x25'),_0x372ea3[_0x669e('0x1c')],_0x133b2c);_0x2db156(_0x6bdb7a[_0x669e('0x1b')](0x1f4,_0x372ea3['message']));});});};exports[_0x669e('0x27')]=function(_0x12045){return new Promise(function(_0x1a994a,_0x139cd7){return db['MailInteraction'][_0x669e('0x28')]({'where':_0x12045[_0x669e('0x20')]?_0x12045[_0x669e('0x20')][_0x669e('0x22')]||null:null})['then'](function(_0x478127){if(_0x478127){return _0x478127['addTags'](_0x12045[_0x669e('0x1f')][_0x669e('0x29')],_[_0x669e('0x2a')](_0x12045[_0x669e('0x1f')],[_0x669e('0x29'),'id'])||{});}})['spread'](function(_0x1bf748){logger[_0x669e('0x14')](_0x669e('0x2b'),_0x12045);logger['debug'](_0x669e('0x2b'),_0x12045,JSON[_0x669e('0x18')](_0x1bf748));_0x1a994a(_0x1bf748);})[_0x669e('0x26')](function(_0x3835e0){logger['error'](_0x669e('0x2b'),_0x3835e0['message'],_0x12045);_0x139cd7(_this['error'](0x1f4,_0x3835e0[_0x669e('0x1c')]));});});};
\ No newline at end of file