5fe826942d05c1641dae90d47a38a5adb27c7600
[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 _0x6316=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','moment'];(function(_0x12fdeb,_0x376edf){var _0x363350=function(_0x411cf3){while(--_0x411cf3){_0x12fdeb['push'](_0x12fdeb['shift']());}};_0x363350(++_0x376edf);}(_0x6316,0x6b));var _0x6631=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6316[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x6631('0x0'));var util=require(_0x6631('0x1'));var moment=require(_0x6631('0x2'));var BPromise=require(_0x6631('0x3'));var rs=require(_0x6631('0x4'));var fs=require('fs');var Redis=require(_0x6631('0x5'));var db=require(_0x6631('0x6'))['db'];var utils=require(_0x6631('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6631('0x8'));var jayson=require(_0x6631('0x9'));var client=jayson[_0x6631('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12ca82,_0xae221e,_0x586964){return new BPromise(function(_0x20d559,_0x3a3889){return client[_0x6631('0xb')](_0x12ca82,_0x586964)[_0x6631('0xc')](function(_0x4f197d){logger['info'](_0x6631('0xd'),_0xae221e,_0x6631('0xe'));logger[_0x6631('0xf')](_0x6631('0x10'),_0xae221e,_0x6631('0xe'),JSON[_0x6631('0x11')](_0x4f197d));if(_0x4f197d[_0x6631('0x12')]){if(_0x4f197d[_0x6631('0x12')]['code']===0x1f4){logger[_0x6631('0x12')](_0x6631('0xd'),_0xae221e,_0x4f197d[_0x6631('0x12')][_0x6631('0x13')]);return _0x3a3889(_0x4f197d[_0x6631('0x12')]['message']);}logger['error'](_0x6631('0xd'),_0xae221e,_0x4f197d[_0x6631('0x12')][_0x6631('0x13')]);return _0x20d559(_0x4f197d['error']['message']);}else{logger[_0x6631('0x14')](_0x6631('0xd'),_0xae221e,_0x6631('0xe'));_0x20d559(_0x4f197d['result']['message']);}})[_0x6631('0x15')](function(_0x1b6040){logger[_0x6631('0x12')]('UserChatQueue,\x20%s,\x20%s',_0xae221e,_0x1b6040);_0x3a3889(_0x1b6040);});});}