6c736b9a3dbe0391af0cc00e3f36ad98e59192a1
[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 _0x8a97=['info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x54c9dd,_0x233a86){var _0x855156=function(_0x2dd60b){while(--_0x2dd60b){_0x54c9dd['push'](_0x54c9dd['shift']());}};_0x855156(++_0x233a86);}(_0x8a97,0x1c3));var _0x78a9=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x8a97[_0x2ec461];return _0x28603d;};'use strict';var _=require('lodash');var util=require(_0x78a9('0x0'));var moment=require(_0x78a9('0x1'));var BPromise=require(_0x78a9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x78a9('0x3'));var db=require(_0x78a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x78a9('0x5'))(_0x78a9('0x6'));var config=require(_0x78a9('0x7'));var jayson=require(_0x78a9('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a0534,_0x1da317,_0x30b089){return new BPromise(function(_0x54cdef,_0x68fd3e){return client[_0x78a9('0x9')](_0x4a0534,_0x30b089)[_0x78a9('0xa')](function(_0x36f88f){logger[_0x78a9('0xb')](_0x78a9('0xc'),_0x1da317,'request\x20sent');logger[_0x78a9('0xd')](_0x78a9('0xe'),_0x1da317,_0x78a9('0xf'),JSON[_0x78a9('0x10')](_0x36f88f));if(_0x36f88f[_0x78a9('0x11')]){if(_0x36f88f['error'][_0x78a9('0x12')]===0x1f4){logger[_0x78a9('0x11')](_0x78a9('0xc'),_0x1da317,_0x36f88f[_0x78a9('0x11')][_0x78a9('0x13')]);return _0x68fd3e(_0x36f88f[_0x78a9('0x11')][_0x78a9('0x13')]);}logger['error'](_0x78a9('0xc'),_0x1da317,_0x36f88f['error'][_0x78a9('0x13')]);return _0x54cdef(_0x36f88f['error'][_0x78a9('0x13')]);}else{logger['info'](_0x78a9('0xc'),_0x1da317,_0x78a9('0xf'));_0x54cdef(_0x36f88f['result'][_0x78a9('0x13')]);}})[_0x78a9('0x14')](function(_0x1bfd0f){logger[_0x78a9('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x1da317,_0x1bfd0f);_0x68fd3e(_0x1bfd0f);});});}