b395e07d697f4b34b4b2e1912d4e50fbe97c32f8
[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 _0x9ec2=['request\x20sent','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug'];(function(_0x22b2e6,_0x15e9d4){var _0x278077=function(_0x11a7bb){while(--_0x11a7bb){_0x22b2e6['push'](_0x22b2e6['shift']());}};_0x278077(++_0x15e9d4);}(_0x9ec2,0xee));var _0x29ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ec2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x29ec('0x0'));var BPromise=require(_0x29ec('0x1'));var rs=require(_0x29ec('0x2'));var fs=require('fs');var Redis=require(_0x29ec('0x3'));var db=require(_0x29ec('0x4'))['db'];var utils=require(_0x29ec('0x5'));var logger=require(_0x29ec('0x6'))('rpc');var config=require(_0x29ec('0x7'));var jayson=require(_0x29ec('0x8'));var client=jayson[_0x29ec('0x9')][_0x29ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x95ee31,_0x126d99,_0x39e30c){return new BPromise(function(_0x121dd3,_0x140c2b){return client[_0x29ec('0xb')](_0x95ee31,_0x39e30c)[_0x29ec('0xc')](function(_0x5ea113){logger[_0x29ec('0xd')]('DeskField,\x20%s,\x20%s',_0x126d99,'request\x20sent');logger[_0x29ec('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x126d99,_0x29ec('0xf'),JSON[_0x29ec('0x10')](_0x5ea113));if(_0x5ea113[_0x29ec('0x11')]){if(_0x5ea113['error'][_0x29ec('0x12')]===0x1f4){logger[_0x29ec('0x11')](_0x29ec('0x13'),_0x126d99,_0x5ea113[_0x29ec('0x11')][_0x29ec('0x14')]);return _0x140c2b(_0x5ea113[_0x29ec('0x11')][_0x29ec('0x14')]);}logger[_0x29ec('0x11')](_0x29ec('0x13'),_0x126d99,_0x5ea113[_0x29ec('0x11')][_0x29ec('0x14')]);return _0x121dd3(_0x5ea113['error'][_0x29ec('0x14')]);}else{logger[_0x29ec('0xd')](_0x29ec('0x13'),_0x126d99,_0x29ec('0xf'));_0x121dd3(_0x5ea113[_0x29ec('0x15')][_0x29ec('0x14')]);}})[_0x29ec('0x16')](function(_0x5e2177){logger[_0x29ec('0x11')](_0x29ec('0x13'),_0x126d99,_0x5e2177);_0x140c2b(_0x5e2177);});});}