18 var _0x005f=['find','addTags','omit','AddTags','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxInteraction','body','raw','options','where','attributes','limit','debug','FaxInteraction'];(function(_0x36609d,_0x3cd233){var _0x4de915=function(_0x210952){while(--_0x210952){_0x36609d['push'](_0x36609d['shift']());}};_0x4de915(++_0x3cd233);}(_0x005f,0x1e4));var _0xf005=function(_0x3653b9,_0x2854f0){_0x3653b9=_0x3653b9-0x0;var _0x5ee19f=_0x005f[_0x3653b9];return _0x5ee19f;};'use strict';var _=require(_0xf005('0x0'));var util=require(_0xf005('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf005('0x2'));var db=require(_0xf005('0x3'))['db'];var utils=require(_0xf005('0x4'));var logger=require(_0xf005('0x5'))(_0xf005('0x6'));var config=require('../../config/environment');var jayson=require(_0xf005('0x7'));var client=jayson[_0xf005('0x8')][_0xf005('0x9')]({'port':0x232a});config[_0xf005('0xa')]=_[_0xf005('0xb')](config[_0xf005('0xa')],{'host':_0xf005('0xc'),'port':0x18eb});var socket=require(_0xf005('0xd'))(new Redis(config[_0xf005('0xa')]));require(_0xf005('0xe'))[_0xf005('0xf')](socket);function respondWithRpcPromise(_0x4f12dd,_0x4f5d4f,_0x52e450){return new BPromise(function(_0x1ec3f2,_0x51172e){return client[_0xf005('0x10')](_0x4f12dd,_0x52e450)[_0xf005('0x11')](function(_0x4abf6d){logger[_0xf005('0x12')](_0xf005('0x13'),_0x4f5d4f,_0xf005('0x14'));logger['debug'](_0xf005('0x15'),_0x4f5d4f,'request\x20sent',JSON[_0xf005('0x16')](_0x4abf6d));if(_0x4abf6d[_0xf005('0x17')]){if(_0x4abf6d[_0xf005('0x17')]['code']===0x1f4){logger[_0xf005('0x17')](_0xf005('0x13'),_0x4f5d4f,_0x4abf6d[_0xf005('0x17')][_0xf005('0x18')]);return _0x51172e(_0x4abf6d[_0xf005('0x17')][_0xf005('0x18')]);}logger[_0xf005('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x4f5d4f,_0x4abf6d[_0xf005('0x17')][_0xf005('0x18')]);return _0x1ec3f2(_0x4abf6d[_0xf005('0x17')]['message']);}else{logger['info'](_0xf005('0x13'),_0x4f5d4f,_0xf005('0x14'));_0x1ec3f2(_0x4abf6d[_0xf005('0x19')][_0xf005('0x18')]);}})[_0xf005('0x1a')](function(_0x5244f3){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x4f5d4f,_0x5244f3);_0x51172e(_0x5244f3);});});}exports[_0xf005('0x1b')]=function(_0xf374cf){var _0x1657f5=this;return new Promise(function(_0x567c73,_0x4e93e7){return db['FaxInteraction']['update'](_0xf374cf[_0xf005('0x1c')],{'raw':_0xf374cf['options']?_0xf374cf['options'][_0xf005('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf374cf[_0xf005('0x1e')]?_0xf374cf[_0xf005('0x1e')][_0xf005('0x1f')]||null:null,'attributes':_0xf374cf[_0xf005('0x1e')]?_0xf374cf['options'][_0xf005('0x20')]||null:null,'limit':_0xf374cf[_0xf005('0x1e')]?_0xf374cf[_0xf005('0x1e')][_0xf005('0x21')]||null:null})[_0xf005('0x11')](function(_0x5ce088){logger[_0xf005('0x12')]('UpdateFaxInteraction',_0xf374cf);logger[_0xf005('0x22')](_0xf005('0x1b'),_0xf374cf,JSON[_0xf005('0x16')](_0x5ce088));_0x567c73(_0x5ce088);})[_0xf005('0x1a')](function(_0x1da465){logger['error'](_0xf005('0x1b'),_0x1da465[_0xf005('0x18')],_0xf374cf);_0x4e93e7(_0x1657f5[_0xf005('0x17')](0x1f4,_0x1da465[_0xf005('0x18')]));});});};exports['AddTagsToFaxInteraction']=function(_0x8fc2dc){return new Promise(function(_0x11d795,_0x319eab){return db[_0xf005('0x23')][_0xf005('0x24')]({'where':_0x8fc2dc[_0xf005('0x1e')]?_0x8fc2dc[_0xf005('0x1e')]['where']||null:null})[_0xf005('0x11')](function(_0x52705d){if(_0x52705d){return _0x52705d[_0xf005('0x25')](_0x8fc2dc[_0xf005('0x1c')]['ids'],_[_0xf005('0x26')](_0x8fc2dc[_0xf005('0x1c')],['ids','id'])||{});}})['spread'](function(_0x3444a3){logger['info']('AddTags',_0x8fc2dc);logger[_0xf005('0x22')](_0xf005('0x27'),_0x8fc2dc,JSON[_0xf005('0x16')](_0x3444a3));_0x11d795(_0x3444a3);})[_0xf005('0x1a')](function(_0x44e7a3){logger[_0xf005('0x17')]('AddTags',_0x44e7a3[_0xf005('0x18')],_0x8fc2dc);_0x319eab(_this[_0xf005('0x17')](0x1f4,_0x44e7a3[_0xf005('0x18')]));});});};