f7ab34b2343ee1a8e6cc7bad9407977356e10a9a
[motion2.git] / server / api / intDeskField / intDeskField.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 _0xc938=['DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x12e4fc,_0xf01a75){var _0x197c91=function(_0x3922bb){while(--_0x3922bb){_0x12e4fc['push'](_0x12e4fc['shift']());}};_0x197c91(++_0xf01a75);}(_0xc938,0x1e8));var _0x8c93=function(_0x2f778e,_0xa79f72){_0x2f778e=_0x2f778e-0x0;var _0x5d543b=_0xc938[_0x2f778e];return _0x5d543b;};'use strict';var _=require(_0x8c93('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c93('0x1'));var db=require(_0x8c93('0x2'))['db'];var utils=require(_0x8c93('0x3'));var logger=require(_0x8c93('0x4'))('rpc');var config=require(_0x8c93('0x5'));var jayson=require(_0x8c93('0x6'));var client=jayson[_0x8c93('0x7')][_0x8c93('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38a467,_0x2a4861,_0x4693d3){return new BPromise(function(_0x54b241,_0x40c1d1){return client[_0x8c93('0x9')](_0x38a467,_0x4693d3)[_0x8c93('0xa')](function(_0x4a9aa1){logger[_0x8c93('0xb')](_0x8c93('0xc'),_0x2a4861,_0x8c93('0xd'));logger['debug'](_0x8c93('0xe'),_0x2a4861,'request\x20sent',JSON['stringify'](_0x4a9aa1));if(_0x4a9aa1[_0x8c93('0xf')]){if(_0x4a9aa1[_0x8c93('0xf')][_0x8c93('0x10')]===0x1f4){logger[_0x8c93('0xf')]('DeskField,\x20%s,\x20%s',_0x2a4861,_0x4a9aa1[_0x8c93('0xf')][_0x8c93('0x11')]);return _0x40c1d1(_0x4a9aa1['error']['message']);}logger[_0x8c93('0xf')](_0x8c93('0xc'),_0x2a4861,_0x4a9aa1[_0x8c93('0xf')][_0x8c93('0x11')]);return _0x54b241(_0x4a9aa1[_0x8c93('0xf')][_0x8c93('0x11')]);}else{logger['info'](_0x8c93('0xc'),_0x2a4861,_0x8c93('0xd'));_0x54b241(_0x4a9aa1[_0x8c93('0x12')][_0x8c93('0x11')]);}})[_0x8c93('0x13')](function(_0x19e100){logger[_0x8c93('0xf')](_0x8c93('0xc'),_0x2a4861,_0x19e100);_0x40c1d1(_0x19e100);});});}