8d70aa627193b004166b3672e7c39ac56dddadba
[motion2.git] / server / api / team / team.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 _0xa014=['debug','stringify','error','code','message','Team,\x20%s,\x20%s','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','then','info','request\x20sent'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0xa014,0xb6));var _0x4a01=function(_0x1edcb6,_0x1fd6c8){_0x1edcb6=_0x1edcb6-0x0;var _0x5aafcd=_0xa014[_0x1edcb6];return _0x5aafcd;};'use strict';var _=require(_0x4a01('0x0'));var util=require('util');var moment=require(_0x4a01('0x1'));var BPromise=require(_0x4a01('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a01('0x3'));var db=require(_0x4a01('0x4'))['db'];var utils=require(_0x4a01('0x5'));var logger=require(_0x4a01('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4a01('0x7'));var client=jayson['client'][_0x4a01('0x8')]({'port':0x232a});config[_0x4a01('0x9')]=_[_0x4a01('0xa')](config['redis'],{'host':_0x4a01('0xb'),'port':0x18eb});var socket=require(_0x4a01('0xc'))(new Redis(config[_0x4a01('0x9')]));require(_0x4a01('0xd'))[_0x4a01('0xe')](socket);function respondWithRpcPromise(_0x39e506,_0x4192f2,_0x4b6f63){return new BPromise(function(_0x437727,_0x190ce9){return client['request'](_0x39e506,_0x4b6f63)[_0x4a01('0xf')](function(_0x592306){logger[_0x4a01('0x10')]('Team,\x20%s,\x20%s',_0x4192f2,_0x4a01('0x11'));logger[_0x4a01('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x4192f2,_0x4a01('0x11'),JSON[_0x4a01('0x13')](_0x592306));if(_0x592306['error']){if(_0x592306[_0x4a01('0x14')][_0x4a01('0x15')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x4192f2,_0x592306['error'][_0x4a01('0x16')]);return _0x190ce9(_0x592306[_0x4a01('0x14')][_0x4a01('0x16')]);}logger['error'](_0x4a01('0x17'),_0x4192f2,_0x592306[_0x4a01('0x14')][_0x4a01('0x16')]);return _0x437727(_0x592306['error'][_0x4a01('0x16')]);}else{logger[_0x4a01('0x10')](_0x4a01('0x17'),_0x4192f2,_0x4a01('0x11'));_0x437727(_0x592306['result']['message']);}})[_0x4a01('0x18')](function(_0x3792c1){logger['error'](_0x4a01('0x17'),_0x4192f2,_0x3792c1);_0x190ce9(_0x3792c1);});});}