Built motion from commit 0900f080.|2.5.45
[motion2.git] / server / api / faxInteraction / faxInteraction.rpc.js
index e477ebb..870c569 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7823=['ids','omit','spread','AddTags','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','find','where','addTags'];(function(_0x454fe7,_0x492eba){var _0x30f729=function(_0x54f9c1){while(--_0x54f9c1){_0x454fe7['push'](_0x454fe7['shift']());}};_0x30f729(++_0x492eba);}(_0x7823,0xac));var _0x3782=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7823[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var util=require(_0x3782('0x0'));var moment=require(_0x3782('0x1'));var BPromise=require('bluebird');var rs=require(_0x3782('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3782('0x3'))['db'];var utils=require(_0x3782('0x4'));var logger=require('../../config/logger')(_0x3782('0x5'));var config=require(_0x3782('0x6'));var jayson=require(_0x3782('0x7'));var client=jayson[_0x3782('0x8')][_0x3782('0x9')]({'port':0x232a});config['redis']=_[_0x3782('0xa')](config[_0x3782('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3782('0xc'))(new Redis(config[_0x3782('0xb')]));require(_0x3782('0xd'))[_0x3782('0xe')](socket);function respondWithRpcPromise(_0x728539,_0x500f3c,_0x546341){return new BPromise(function(_0x39d518,_0x47e94d){return client[_0x3782('0xf')](_0x728539,_0x546341)[_0x3782('0x10')](function(_0x3f639d){logger[_0x3782('0x11')](_0x3782('0x12'),_0x500f3c,_0x3782('0x13'));logger[_0x3782('0x14')](_0x3782('0x15'),_0x500f3c,'request\x20sent',JSON[_0x3782('0x16')](_0x3f639d));if(_0x3f639d[_0x3782('0x17')]){if(_0x3f639d['error'][_0x3782('0x18')]===0x1f4){logger['error'](_0x3782('0x12'),_0x500f3c,_0x3f639d[_0x3782('0x17')][_0x3782('0x19')]);return _0x47e94d(_0x3f639d[_0x3782('0x17')][_0x3782('0x19')]);}logger['error'](_0x3782('0x12'),_0x500f3c,_0x3f639d[_0x3782('0x17')][_0x3782('0x19')]);return _0x39d518(_0x3f639d['error']['message']);}else{logger[_0x3782('0x11')](_0x3782('0x12'),_0x500f3c,_0x3782('0x13'));_0x39d518(_0x3f639d[_0x3782('0x1a')][_0x3782('0x19')]);}})[_0x3782('0x1b')](function(_0x460d38){logger['error'](_0x3782('0x12'),_0x500f3c,_0x460d38);_0x47e94d(_0x460d38);});});}exports[_0x3782('0x1c')]=function(_0x492f54){var _0x810c79=this;return new Promise(function(_0x2e395f,_0x585d0a){return db[_0x3782('0x1d')][_0x3782('0x1e')](_0x492f54[_0x3782('0x1f')],{'raw':_0x492f54[_0x3782('0x20')]?_0x492f54[_0x3782('0x20')][_0x3782('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x492f54['options']?_0x492f54[_0x3782('0x20')]['where']||null:null,'attributes':_0x492f54[_0x3782('0x20')]?_0x492f54[_0x3782('0x20')][_0x3782('0x22')]||null:null,'limit':_0x492f54[_0x3782('0x20')]?_0x492f54[_0x3782('0x20')]['limit']||null:null})[_0x3782('0x10')](function(_0x5587db){logger['info'](_0x3782('0x1c'),_0x492f54);logger[_0x3782('0x14')](_0x3782('0x1c'),_0x492f54,JSON[_0x3782('0x16')](_0x5587db));_0x2e395f(_0x5587db);})['catch'](function(_0xe9078e){logger[_0x3782('0x17')](_0x3782('0x1c'),_0xe9078e[_0x3782('0x19')],_0x492f54);_0x585d0a(_0x810c79[_0x3782('0x17')](0x1f4,_0xe9078e[_0x3782('0x19')]));});});};exports['AddTagsToFaxInteraction']=function(_0x2f5264){return new Promise(function(_0x41c533,_0x1b1c49){return db['FaxInteraction'][_0x3782('0x23')]({'where':_0x2f5264[_0x3782('0x20')]?_0x2f5264['options'][_0x3782('0x24')]||null:null})[_0x3782('0x10')](function(_0x1c63b1){if(_0x1c63b1){return _0x1c63b1[_0x3782('0x25')](_0x2f5264['body'][_0x3782('0x26')],_[_0x3782('0x27')](_0x2f5264['body'],[_0x3782('0x26'),'id'])||{});}})[_0x3782('0x28')](function(_0x3a24a2){logger['info']('AddTags',_0x2f5264);logger[_0x3782('0x14')](_0x3782('0x29'),_0x2f5264,JSON[_0x3782('0x16')](_0x3a24a2));_0x41c533(_0x3a24a2);})[_0x3782('0x1b')](function(_0x1398f8){logger[_0x3782('0x17')](_0x3782('0x29'),_0x1398f8['message'],_0x2f5264);_0x1b1c49(_this[_0x3782('0x17')](0x1f4,_0x1398f8[_0x3782('0x19')]));});});};
\ No newline at end of file
+var _0x201e=['AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','code','message','error','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','attributes','stringify','AddTagsToFaxInteraction','ids','omit','body'];(function(_0x5e1762,_0x1d111d){var _0x1c8327=function(_0x2ea153){while(--_0x2ea153){_0x5e1762['push'](_0x5e1762['shift']());}};_0x1c8327(++_0x1d111d);}(_0x201e,0xe5));var _0xe201=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x201e[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xe201('0x0'));var util=require(_0xe201('0x1'));var moment=require(_0xe201('0x2'));var BPromise=require('bluebird');var rs=require(_0xe201('0x3'));var fs=require('fs');var Redis=require(_0xe201('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe201('0x5'));var logger=require(_0xe201('0x6'))(_0xe201('0x7'));var config=require(_0xe201('0x8'));var jayson=require(_0xe201('0x9'));var client=jayson['client'][_0xe201('0xa')]({'port':0x232a});config[_0xe201('0xb')]=_['defaults'](config['redis'],{'host':_0xe201('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe201('0xb')]));require('./faxInteraction.socket')[_0xe201('0xd')](socket);function respondWithRpcPromise(_0x4a6aad,_0xa37d26,_0x3d3db3){return new BPromise(function(_0x4d8a25,_0x48d659){return client[_0xe201('0xe')](_0x4a6aad,_0x3d3db3)[_0xe201('0xf')](function(_0x58605f){logger[_0xe201('0x10')](_0xe201('0x11'),_0xa37d26,_0xe201('0x12'));logger[_0xe201('0x13')](_0xe201('0x14'),_0xa37d26,_0xe201('0x12'),JSON['stringify'](_0x58605f));if(_0x58605f['error']){if(_0x58605f['error'][_0xe201('0x15')]===0x1f4){logger['error'](_0xe201('0x11'),_0xa37d26,_0x58605f['error'][_0xe201('0x16')]);return _0x48d659(_0x58605f['error'][_0xe201('0x16')]);}logger[_0xe201('0x17')](_0xe201('0x11'),_0xa37d26,_0x58605f[_0xe201('0x17')][_0xe201('0x16')]);return _0x4d8a25(_0x58605f[_0xe201('0x17')]['message']);}else{logger[_0xe201('0x10')](_0xe201('0x11'),_0xa37d26,_0xe201('0x12'));_0x4d8a25(_0x58605f[_0xe201('0x18')][_0xe201('0x16')]);}})[_0xe201('0x19')](function(_0x3826b1){logger[_0xe201('0x17')](_0xe201('0x11'),_0xa37d26,_0x3826b1);_0x48d659(_0x3826b1);});});}exports[_0xe201('0x1a')]=function(_0x399672){var _0x5d831c=this;return new Promise(function(_0x5adbec,_0x31c602){return db[_0xe201('0x1b')][_0xe201('0x1c')](_0x399672['body'],{'raw':_0x399672[_0xe201('0x1d')]?_0x399672[_0xe201('0x1d')][_0xe201('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x399672[_0xe201('0x1d')]?_0x399672['options']['where']||null:null,'attributes':_0x399672[_0xe201('0x1d')]?_0x399672[_0xe201('0x1d')][_0xe201('0x1f')]||null:null,'limit':_0x399672[_0xe201('0x1d')]?_0x399672[_0xe201('0x1d')]['limit']||null:null})[_0xe201('0xf')](function(_0x52b9b4){logger['info'](_0xe201('0x1a'),_0x399672);logger[_0xe201('0x13')](_0xe201('0x1a'),_0x399672,JSON[_0xe201('0x20')](_0x52b9b4));_0x5adbec(_0x52b9b4);})[_0xe201('0x19')](function(_0x5a0a85){logger[_0xe201('0x17')](_0xe201('0x1a'),_0x5a0a85[_0xe201('0x16')],_0x399672);_0x31c602(_0x5d831c[_0xe201('0x17')](0x1f4,_0x5a0a85[_0xe201('0x16')]));});});};exports[_0xe201('0x21')]=function(_0x193915){return new Promise(function(_0x1a489f,_0x4c773a){return db['FaxInteraction']['find']({'where':_0x193915[_0xe201('0x1d')]?_0x193915[_0xe201('0x1d')]['where']||null:null})[_0xe201('0xf')](function(_0x1bca63){if(_0x1bca63){return _0x1bca63['addTags'](_0x193915['body'][_0xe201('0x22')],_[_0xe201('0x23')](_0x193915[_0xe201('0x24')],[_0xe201('0x22'),'id'])||{});}})['spread'](function(_0x516264){logger[_0xe201('0x10')]('AddTags',_0x193915);logger[_0xe201('0x13')]('AddTags',_0x193915,JSON[_0xe201('0x20')](_0x516264));_0x1a489f(_0x516264);})[_0xe201('0x19')](function(_0x102946){logger[_0xe201('0x17')](_0xe201('0x25'),_0x102946['message'],_0x193915);_0x4c773a(_this[_0xe201('0x17')](0x1f4,_0x102946[_0xe201('0x16')]));});});};
\ No newline at end of file