Built motion from commit efa66e19.|2.6.22
[motion2.git] / server / api / mailInteraction / mailInteraction.rpc.js
index d248be9..f2b67ba 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1b03=['rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','body','options','raw','attributes','limit','find','where','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x257a28,_0x2cd00d){var _0x13bccc=function(_0x32c46f){while(--_0x32c46f){_0x257a28['push'](_0x257a28['shift']());}};_0x13bccc(++_0x2cd00d);}(_0x1b03,0x191));var _0x31b0=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1b03[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x31b0('0x0'));var util=require(_0x31b0('0x1'));var moment=require(_0x31b0('0x2'));var BPromise=require(_0x31b0('0x3'));var rs=require(_0x31b0('0x4'));var fs=require('fs');var Redis=require(_0x31b0('0x5'));var db=require(_0x31b0('0x6'))['db'];var utils=require(_0x31b0('0x7'));var logger=require(_0x31b0('0x8'))(_0x31b0('0x9'));var config=require(_0x31b0('0xa'));var jayson=require(_0x31b0('0xb'));var client=jayson[_0x31b0('0xc')]['http']({'port':0x232a});config[_0x31b0('0xd')]=_['defaults'](config[_0x31b0('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x31b0('0xe'))(new Redis(config[_0x31b0('0xd')]));require(_0x31b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x52f473,_0x215d10,_0x5994e8){return new BPromise(function(_0x4176e6,_0x27949e){return client[_0x31b0('0x10')](_0x52f473,_0x5994e8)[_0x31b0('0x11')](function(_0x311144){logger[_0x31b0('0x12')](_0x31b0('0x13'),_0x215d10,_0x31b0('0x14'));logger[_0x31b0('0x15')](_0x31b0('0x16'),_0x215d10,_0x31b0('0x14'),JSON[_0x31b0('0x17')](_0x311144));if(_0x311144[_0x31b0('0x18')]){if(_0x311144['error'][_0x31b0('0x19')]===0x1f4){logger['error'](_0x31b0('0x13'),_0x215d10,_0x311144['error'][_0x31b0('0x1a')]);return _0x27949e(_0x311144[_0x31b0('0x18')][_0x31b0('0x1a')]);}logger[_0x31b0('0x18')](_0x31b0('0x13'),_0x215d10,_0x311144[_0x31b0('0x18')][_0x31b0('0x1a')]);return _0x4176e6(_0x311144[_0x31b0('0x18')][_0x31b0('0x1a')]);}else{logger[_0x31b0('0x12')](_0x31b0('0x13'),_0x215d10,_0x31b0('0x14'));_0x4176e6(_0x311144['result'][_0x31b0('0x1a')]);}})[_0x31b0('0x1b')](function(_0x35fed7){logger[_0x31b0('0x18')]('MailInteraction,\x20%s,\x20%s',_0x215d10,_0x35fed7);_0x27949e(_0x35fed7);});});}exports[_0x31b0('0x1c')]=function(_0x110f34){var _0x213dd2=this;return new Promise(function(_0x1329d7,_0x3f6b6c){return db[_0x31b0('0x1d')]['update'](_0x110f34[_0x31b0('0x1e')],{'raw':_0x110f34[_0x31b0('0x1f')]?_0x110f34[_0x31b0('0x1f')][_0x31b0('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x110f34[_0x31b0('0x1f')]?_0x110f34[_0x31b0('0x1f')]['where']||null:null,'attributes':_0x110f34[_0x31b0('0x1f')]?_0x110f34[_0x31b0('0x1f')][_0x31b0('0x21')]||null:null,'limit':_0x110f34[_0x31b0('0x1f')]?_0x110f34['options'][_0x31b0('0x22')]||null:null})[_0x31b0('0x11')](function(_0x4eb8aa){logger[_0x31b0('0x12')]('UpdateMailInteraction',_0x110f34);logger[_0x31b0('0x15')](_0x31b0('0x1c'),_0x110f34,JSON[_0x31b0('0x17')](_0x4eb8aa));_0x1329d7(_0x4eb8aa);})[_0x31b0('0x1b')](function(_0x5aa126){logger[_0x31b0('0x18')](_0x31b0('0x1c'),_0x5aa126[_0x31b0('0x1a')],_0x110f34);_0x3f6b6c(_0x213dd2[_0x31b0('0x18')](0x1f4,_0x5aa126[_0x31b0('0x1a')]));});});};exports['AddTagsToMailInteraction']=function(_0x14c74b){return new Promise(function(_0x34b5b0,_0x4bc63d){return db['MailInteraction'][_0x31b0('0x23')]({'where':_0x14c74b['options']?_0x14c74b[_0x31b0('0x1f')][_0x31b0('0x24')]||null:null})['then'](function(_0x33aa70){if(_0x33aa70){return _0x33aa70[_0x31b0('0x25')](_0x14c74b[_0x31b0('0x1e')][_0x31b0('0x26')],_[_0x31b0('0x27')](_0x14c74b[_0x31b0('0x1e')],[_0x31b0('0x26'),'id'])||{});}})['spread'](function(_0x4868b8){logger['info'](_0x31b0('0x28'),_0x14c74b);logger[_0x31b0('0x15')](_0x31b0('0x28'),_0x14c74b,JSON['stringify'](_0x4868b8));_0x34b5b0(_0x4868b8);})['catch'](function(_0xe91562){logger[_0x31b0('0x18')](_0x31b0('0x28'),_0xe91562[_0x31b0('0x1a')],_0x14c74b);_0x4bc63d(_this[_0x31b0('0x18')](0x1f4,_0xe91562[_0x31b0('0x1a')]));});});};
\ No newline at end of file
+var _0xf431=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailInteraction','body','options','where','attributes','limit','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment'];(function(_0x35d45d,_0x4b71fe){var _0x2543bc=function(_0x1e75b5){while(--_0x1e75b5){_0x35d45d['push'](_0x35d45d['shift']());}};_0x2543bc(++_0x4b71fe);}(_0xf431,0xc5));var _0x1f43=function(_0x4496d4,_0x35a23c){_0x4496d4=_0x4496d4-0x0;var _0x549149=_0xf431[_0x4496d4];return _0x549149;};'use strict';var _=require(_0x1f43('0x0'));var util=require(_0x1f43('0x1'));var moment=require(_0x1f43('0x2'));var BPromise=require(_0x1f43('0x3'));var rs=require(_0x1f43('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f43('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1f43('0x6'));var config=require(_0x1f43('0x7'));var jayson=require(_0x1f43('0x8'));var client=jayson[_0x1f43('0x9')][_0x1f43('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1f43('0xb')],{'host':_0x1f43('0xc'),'port':0x18eb});var socket=require(_0x1f43('0xd'))(new Redis(config['redis']));require(_0x1f43('0xe'))[_0x1f43('0xf')](socket);function respondWithRpcPromise(_0x4563e0,_0x255f7c,_0x3dd6a5){return new BPromise(function(_0x1ca41c,_0x18f247){return client[_0x1f43('0x10')](_0x4563e0,_0x3dd6a5)[_0x1f43('0x11')](function(_0x4bf5c3){logger[_0x1f43('0x12')](_0x1f43('0x13'),_0x255f7c,_0x1f43('0x14'));logger[_0x1f43('0x15')](_0x1f43('0x16'),_0x255f7c,_0x1f43('0x14'),JSON[_0x1f43('0x17')](_0x4bf5c3));if(_0x4bf5c3[_0x1f43('0x18')]){if(_0x4bf5c3[_0x1f43('0x18')][_0x1f43('0x19')]===0x1f4){logger['error'](_0x1f43('0x13'),_0x255f7c,_0x4bf5c3[_0x1f43('0x18')][_0x1f43('0x1a')]);return _0x18f247(_0x4bf5c3[_0x1f43('0x18')][_0x1f43('0x1a')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x255f7c,_0x4bf5c3[_0x1f43('0x18')]['message']);return _0x1ca41c(_0x4bf5c3['error']['message']);}else{logger[_0x1f43('0x12')]('MailInteraction,\x20%s,\x20%s',_0x255f7c,_0x1f43('0x14'));_0x1ca41c(_0x4bf5c3['result'][_0x1f43('0x1a')]);}})[_0x1f43('0x1b')](function(_0x5de53f){logger[_0x1f43('0x18')](_0x1f43('0x13'),_0x255f7c,_0x5de53f);_0x18f247(_0x5de53f);});});}exports[_0x1f43('0x1c')]=function(_0x2314e7){var _0x49e379=this;return new Promise(function(_0x10640f,_0x493908){return db['MailInteraction']['update'](_0x2314e7[_0x1f43('0x1d')],{'raw':_0x2314e7[_0x1f43('0x1e')]?_0x2314e7[_0x1f43('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2314e7['options']?_0x2314e7[_0x1f43('0x1e')][_0x1f43('0x1f')]||null:null,'attributes':_0x2314e7['options']?_0x2314e7[_0x1f43('0x1e')][_0x1f43('0x20')]||null:null,'limit':_0x2314e7[_0x1f43('0x1e')]?_0x2314e7['options'][_0x1f43('0x21')]||null:null})['then'](function(_0x4735ae){logger[_0x1f43('0x12')](_0x1f43('0x1c'),_0x2314e7);logger[_0x1f43('0x15')](_0x1f43('0x1c'),_0x2314e7,JSON[_0x1f43('0x17')](_0x4735ae));_0x10640f(_0x4735ae);})[_0x1f43('0x1b')](function(_0x5e3bfc){logger['error'](_0x1f43('0x1c'),_0x5e3bfc[_0x1f43('0x1a')],_0x2314e7);_0x493908(_0x49e379[_0x1f43('0x18')](0x1f4,_0x5e3bfc['message']));});});};exports[_0x1f43('0x22')]=function(_0x28cc88){return new Promise(function(_0x387993,_0x5f54a4){return db['MailInteraction'][_0x1f43('0x23')]({'where':_0x28cc88[_0x1f43('0x1e')]?_0x28cc88['options'][_0x1f43('0x1f')]||null:null})[_0x1f43('0x11')](function(_0x6b42a){if(_0x6b42a){return _0x6b42a[_0x1f43('0x24')](_0x28cc88[_0x1f43('0x1d')][_0x1f43('0x25')],_[_0x1f43('0x26')](_0x28cc88['body'],[_0x1f43('0x25'),'id'])||{});}})[_0x1f43('0x27')](function(_0x24ed31){logger['info'](_0x1f43('0x28'),_0x28cc88);logger[_0x1f43('0x15')]('AddTags',_0x28cc88,JSON[_0x1f43('0x17')](_0x24ed31));_0x387993(_0x24ed31);})[_0x1f43('0x1b')](function(_0x2200da){logger[_0x1f43('0x18')](_0x1f43('0x28'),_0x2200da[_0x1f43('0x1a')],_0x28cc88);_0x5f54a4(_this[_0x1f43('0x18')](0x1f4,_0x2200da[_0x1f43('0x1a')]));});});};
\ No newline at end of file