6f85b6beb494955b95456ffb7c42b856bda92928
[motion2.git] / server / api / userChatQueue / userChatQueue.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 _0x63c0=['UserChatQueue,\x20%s,\x20%s','UserChatQueue,\x20%s,\x20%s,\x20%s','code','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','info'];(function(_0x133700,_0x5dd6ff){var _0x58cdfd=function(_0xeb670d){while(--_0xeb670d){_0x133700['push'](_0x133700['shift']());}};_0x58cdfd(++_0x5dd6ff);}(_0x63c0,0xde));var _0x063c=function(_0x457b64,_0x49a219){_0x457b64=_0x457b64-0x0;var _0x437111=_0x63c0[_0x457b64];return _0x437111;};'use strict';var _=require(_0x063c('0x0'));var util=require(_0x063c('0x1'));var moment=require(_0x063c('0x2'));var BPromise=require(_0x063c('0x3'));var rs=require(_0x063c('0x4'));var fs=require('fs');var Redis=require(_0x063c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x063c('0x6'));var logger=require(_0x063c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x063c('0x8'));var client=jayson[_0x063c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a05a7,_0x2528c0,_0x330c4a){return new BPromise(function(_0x146de6,_0x1fad7a){return client[_0x063c('0xa')](_0x2a05a7,_0x330c4a)['then'](function(_0x4093c0){logger[_0x063c('0xb')](_0x063c('0xc'),_0x2528c0,'request\x20sent');logger['debug'](_0x063c('0xd'),_0x2528c0,'request\x20sent',JSON['stringify'](_0x4093c0));if(_0x4093c0['error']){if(_0x4093c0['error'][_0x063c('0xe')]===0x1f4){logger[_0x063c('0xf')](_0x063c('0xc'),_0x2528c0,_0x4093c0[_0x063c('0xf')][_0x063c('0x10')]);return _0x1fad7a(_0x4093c0[_0x063c('0xf')][_0x063c('0x10')]);}logger['error'](_0x063c('0xc'),_0x2528c0,_0x4093c0[_0x063c('0xf')][_0x063c('0x10')]);return _0x146de6(_0x4093c0['error'][_0x063c('0x10')]);}else{logger[_0x063c('0xb')](_0x063c('0xc'),_0x2528c0,'request\x20sent');_0x146de6(_0x4093c0['result'][_0x063c('0x10')]);}})[_0x063c('0x11')](function(_0x57fc73){logger[_0x063c('0xf')](_0x063c('0xc'),_0x2528c0,_0x57fc73);_0x1fad7a(_0x57fc73);});});}