Built motion from commit 639a1a7f.|2.6.19
[motion2.git] / server / api / mailInteraction / mailInteraction.rpc.js
index 40f087e..ca7431d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6f46=['attributes','limit','then','UpdateMailInteraction','debug','AddTagsToMailInteraction','find','addTags','ids','spread','AddTags','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','MailInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','MailInteraction','body','options','where'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6f46,0xb8));var _0x66f4=function(_0x2479f7,_0x126ecc){_0x2479f7=_0x2479f7-0x0;var _0x420f4b=_0x6f46[_0x2479f7];return _0x420f4b;};'use strict';var _=require(_0x66f4('0x0'));var util=require('util');var moment=require(_0x66f4('0x1'));var BPromise=require(_0x66f4('0x2'));var rs=require(_0x66f4('0x3'));var fs=require('fs');var Redis=require(_0x66f4('0x4'));var db=require(_0x66f4('0x5'))['db'];var utils=require(_0x66f4('0x6'));var logger=require(_0x66f4('0x7'))(_0x66f4('0x8'));var config=require(_0x66f4('0x9'));var jayson=require(_0x66f4('0xa'));var client=jayson[_0x66f4('0xb')]['http']({'port':0x232a});config['redis']=_[_0x66f4('0xc')](config[_0x66f4('0xd')],{'host':_0x66f4('0xe'),'port':0x18eb});var socket=require(_0x66f4('0xf'))(new Redis(config[_0x66f4('0xd')]));require(_0x66f4('0x10'))[_0x66f4('0x11')](socket);function respondWithRpcPromise(_0x549a15,_0x5d0db9,_0x209717){return new BPromise(function(_0x2dca11,_0x41c102){return client[_0x66f4('0x12')](_0x549a15,_0x209717)['then'](function(_0x2c67a4){logger['info'](_0x66f4('0x13'),_0x5d0db9,_0x66f4('0x14'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x5d0db9,_0x66f4('0x14'),JSON[_0x66f4('0x15')](_0x2c67a4));if(_0x2c67a4[_0x66f4('0x16')]){if(_0x2c67a4[_0x66f4('0x16')][_0x66f4('0x17')]===0x1f4){logger['error'](_0x66f4('0x13'),_0x5d0db9,_0x2c67a4['error'][_0x66f4('0x18')]);return _0x41c102(_0x2c67a4[_0x66f4('0x16')]['message']);}logger[_0x66f4('0x16')](_0x66f4('0x13'),_0x5d0db9,_0x2c67a4[_0x66f4('0x16')][_0x66f4('0x18')]);return _0x2dca11(_0x2c67a4[_0x66f4('0x16')][_0x66f4('0x18')]);}else{logger[_0x66f4('0x19')](_0x66f4('0x13'),_0x5d0db9,'request\x20sent');_0x2dca11(_0x2c67a4[_0x66f4('0x1a')][_0x66f4('0x18')]);}})['catch'](function(_0x55a208){logger[_0x66f4('0x16')]('MailInteraction,\x20%s,\x20%s',_0x5d0db9,_0x55a208);_0x41c102(_0x55a208);});});}exports['UpdateMailInteraction']=function(_0x555832){var _0x18c5a0=this;return new Promise(function(_0x14de0e,_0x166487){return db[_0x66f4('0x1b')]['update'](_0x555832[_0x66f4('0x1c')],{'raw':_0x555832[_0x66f4('0x1d')]?_0x555832[_0x66f4('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x555832['options']?_0x555832[_0x66f4('0x1d')][_0x66f4('0x1e')]||null:null,'attributes':_0x555832['options']?_0x555832[_0x66f4('0x1d')][_0x66f4('0x1f')]||null:null,'limit':_0x555832[_0x66f4('0x1d')]?_0x555832['options'][_0x66f4('0x20')]||null:null})[_0x66f4('0x21')](function(_0x28e912){logger[_0x66f4('0x19')](_0x66f4('0x22'),_0x555832);logger[_0x66f4('0x23')](_0x66f4('0x22'),_0x555832,JSON['stringify'](_0x28e912));_0x14de0e(_0x28e912);})['catch'](function(_0x2904ec){logger['error'](_0x66f4('0x22'),_0x2904ec[_0x66f4('0x18')],_0x555832);_0x166487(_0x18c5a0[_0x66f4('0x16')](0x1f4,_0x2904ec[_0x66f4('0x18')]));});});};exports[_0x66f4('0x24')]=function(_0x1d877f){return new Promise(function(_0x2b6d71,_0x464a25){return db[_0x66f4('0x1b')][_0x66f4('0x25')]({'where':_0x1d877f['options']?_0x1d877f[_0x66f4('0x1d')][_0x66f4('0x1e')]||null:null})[_0x66f4('0x21')](function(_0x428b2b){if(_0x428b2b){return _0x428b2b[_0x66f4('0x26')](_0x1d877f[_0x66f4('0x1c')]['ids'],_['omit'](_0x1d877f['body'],[_0x66f4('0x27'),'id'])||{});}})[_0x66f4('0x28')](function(_0x2d09b0){logger[_0x66f4('0x19')](_0x66f4('0x29'),_0x1d877f);logger['debug'](_0x66f4('0x29'),_0x1d877f,JSON[_0x66f4('0x15')](_0x2d09b0));_0x2b6d71(_0x2d09b0);})[_0x66f4('0x2a')](function(_0x4652af){logger[_0x66f4('0x16')](_0x66f4('0x29'),_0x4652af[_0x66f4('0x18')],_0x1d877f);_0x464a25(_this[_0x66f4('0x16')](0x1f4,_0x4652af['message']));});});};
\ No newline at end of file
+var _0x6929=['request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','options','attributes','AddTagsToMailInteraction','find','addTags','body','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register'];(function(_0x5a7ec2,_0x583473){var _0x53c4ff=function(_0x1c190d){while(--_0x1c190d){_0x5a7ec2['push'](_0x5a7ec2['shift']());}};_0x53c4ff(++_0x583473);}(_0x6929,0xc0));var _0x9692=function(_0x59527a,_0x340652){_0x59527a=_0x59527a-0x0;var _0x143c0f=_0x6929[_0x59527a];return _0x143c0f;};'use strict';var _=require(_0x9692('0x0'));var util=require(_0x9692('0x1'));var moment=require(_0x9692('0x2'));var BPromise=require('bluebird');var rs=require(_0x9692('0x3'));var fs=require('fs');var Redis=require(_0x9692('0x4'));var db=require(_0x9692('0x5'))['db'];var utils=require(_0x9692('0x6'));var logger=require(_0x9692('0x7'))(_0x9692('0x8'));var config=require(_0x9692('0x9'));var jayson=require(_0x9692('0xa'));var client=jayson[_0x9692('0xb')][_0x9692('0xc')]({'port':0x232a});config[_0x9692('0xd')]=_['defaults'](config[_0x9692('0xd')],{'host':_0x9692('0xe'),'port':0x18eb});var socket=require(_0x9692('0xf'))(new Redis(config['redis']));require(_0x9692('0x10'))[_0x9692('0x11')](socket);function respondWithRpcPromise(_0x46c668,_0x498752,_0x454eac){return new BPromise(function(_0x48e046,_0x4f03c8){return client[_0x9692('0x12')](_0x46c668,_0x454eac)[_0x9692('0x13')](function(_0x1510df){logger[_0x9692('0x14')](_0x9692('0x15'),_0x498752,_0x9692('0x16'));logger[_0x9692('0x17')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x498752,_0x9692('0x16'),JSON[_0x9692('0x18')](_0x1510df));if(_0x1510df[_0x9692('0x19')]){if(_0x1510df[_0x9692('0x19')][_0x9692('0x1a')]===0x1f4){logger['error'](_0x9692('0x15'),_0x498752,_0x1510df[_0x9692('0x19')][_0x9692('0x1b')]);return _0x4f03c8(_0x1510df[_0x9692('0x19')][_0x9692('0x1b')]);}logger[_0x9692('0x19')](_0x9692('0x15'),_0x498752,_0x1510df[_0x9692('0x19')][_0x9692('0x1b')]);return _0x48e046(_0x1510df[_0x9692('0x19')][_0x9692('0x1b')]);}else{logger[_0x9692('0x14')](_0x9692('0x15'),_0x498752,_0x9692('0x16'));_0x48e046(_0x1510df[_0x9692('0x1c')][_0x9692('0x1b')]);}})[_0x9692('0x1d')](function(_0x5b45d4){logger[_0x9692('0x19')](_0x9692('0x15'),_0x498752,_0x5b45d4);_0x4f03c8(_0x5b45d4);});});}exports[_0x9692('0x1e')]=function(_0x354a56){var _0x5f5aa9=this;return new Promise(function(_0xb01e0c,_0x4f0daa){return db[_0x9692('0x1f')][_0x9692('0x20')](_0x354a56['body'],{'raw':_0x354a56[_0x9692('0x21')]?_0x354a56[_0x9692('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x354a56[_0x9692('0x21')]?_0x354a56[_0x9692('0x21')]['where']||null:null,'attributes':_0x354a56[_0x9692('0x21')]?_0x354a56[_0x9692('0x21')][_0x9692('0x22')]||null:null,'limit':_0x354a56[_0x9692('0x21')]?_0x354a56[_0x9692('0x21')]['limit']||null:null})['then'](function(_0x32ab85){logger['info'](_0x9692('0x1e'),_0x354a56);logger[_0x9692('0x17')](_0x9692('0x1e'),_0x354a56,JSON[_0x9692('0x18')](_0x32ab85));_0xb01e0c(_0x32ab85);})[_0x9692('0x1d')](function(_0x51e3bf){logger[_0x9692('0x19')](_0x9692('0x1e'),_0x51e3bf[_0x9692('0x1b')],_0x354a56);_0x4f0daa(_0x5f5aa9[_0x9692('0x19')](0x1f4,_0x51e3bf['message']));});});};exports[_0x9692('0x23')]=function(_0xd8761d){return new Promise(function(_0x2296dd,_0x52dff6){return db[_0x9692('0x1f')][_0x9692('0x24')]({'where':_0xd8761d[_0x9692('0x21')]?_0xd8761d[_0x9692('0x21')]['where']||null:null})['then'](function(_0x4c7b16){if(_0x4c7b16){return _0x4c7b16[_0x9692('0x25')](_0xd8761d[_0x9692('0x26')][_0x9692('0x27')],_['omit'](_0xd8761d[_0x9692('0x26')],[_0x9692('0x27'),'id'])||{});}})[_0x9692('0x28')](function(_0x5db140){logger['info'](_0x9692('0x29'),_0xd8761d);logger[_0x9692('0x17')]('AddTags',_0xd8761d,JSON['stringify'](_0x5db140));_0x2296dd(_0x5db140);})[_0x9692('0x1d')](function(_0x34d2d3){logger[_0x9692('0x19')](_0x9692('0x29'),_0x34d2d3[_0x9692('0x1b')],_0xd8761d);_0x52dff6(_this['error'](0x1f4,_0x34d2d3[_0x9692('0x1b')]));});});};
\ No newline at end of file