2ebebc0e5d90b0acb9f1a499984f30c75f0168d7
[motion2.git] / server / api / userProfile / userProfile.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x5655=['./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter'];(function(_0x5ebabb,_0x3b9d64){var _0x184d82=function(_0x566bc7){while(--_0x566bc7){_0x5ebabb['push'](_0x5ebabb['shift']());}};_0x184d82(++_0x3b9d64);}(_0x5655,0x15e));var _0x5565=function(_0x52f3b0,_0x2ea792){_0x52f3b0=_0x52f3b0-0x0;var _0x3077dc=_0x5655[_0x52f3b0];return _0x3077dc;};'use strict';var _=require(_0x5565('0x0'));var util=require(_0x5565('0x1'));var moment=require(_0x5565('0x2'));var BPromise=require(_0x5565('0x3'));var rs=require(_0x5565('0x4'));var fs=require('fs');var Redis=require(_0x5565('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5565('0x6'))('rpc');var config=require(_0x5565('0x7'));var jayson=require(_0x5565('0x8'));var client=jayson[_0x5565('0x9')][_0x5565('0xa')]({'port':0x232a});config[_0x5565('0xb')]=_['defaults'](config[_0x5565('0xb')],{'host':_0x5565('0xc'),'port':0x18eb});var socket=require(_0x5565('0xd'))(new Redis(config[_0x5565('0xb')]));require(_0x5565('0xe'))[_0x5565('0xf')](socket);function respondWithRpcPromise(_0x4ac5e3,_0x581dca,_0x367ce8){return new BPromise(function(_0x52db0e,_0x498370){return client[_0x5565('0x10')](_0x4ac5e3,_0x367ce8)[_0x5565('0x11')](function(_0x5d0d99){logger['info'](_0x5565('0x12'),_0x581dca,_0x5565('0x13'));logger[_0x5565('0x14')](_0x5565('0x15'),_0x581dca,_0x5565('0x13'),JSON[_0x5565('0x16')](_0x5d0d99));if(_0x5d0d99[_0x5565('0x17')]){if(_0x5d0d99[_0x5565('0x17')]['code']===0x1f4){logger[_0x5565('0x17')](_0x5565('0x12'),_0x581dca,_0x5d0d99[_0x5565('0x17')][_0x5565('0x18')]);return _0x498370(_0x5d0d99['error'][_0x5565('0x18')]);}logger[_0x5565('0x17')](_0x5565('0x12'),_0x581dca,_0x5d0d99[_0x5565('0x17')][_0x5565('0x18')]);return _0x52db0e(_0x5d0d99['error']['message']);}else{logger[_0x5565('0x19')](_0x5565('0x12'),_0x581dca,'request\x20sent');_0x52db0e(_0x5d0d99[_0x5565('0x1a')][_0x5565('0x18')]);}})[_0x5565('0x1b')](function(_0x5712ad){logger['error']('UserProfile,\x20%s,\x20%s',_0x581dca,_0x5712ad);_0x498370(_0x5712ad);});});}