4fccbe36a7e520331a8a2eb43bf8fc4123bcffab
[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 _0x226d=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x226d,0xab));var _0xd226=function(_0xcf36a9,_0xce6c4e){_0xcf36a9=_0xcf36a9-0x0;var _0x309776=_0x226d[_0xcf36a9];return _0x309776;};'use strict';var _=require(_0xd226('0x0'));var util=require(_0xd226('0x1'));var moment=require(_0xd226('0x2'));var BPromise=require(_0xd226('0x3'));var rs=require(_0xd226('0x4'));var fs=require('fs');var Redis=require(_0xd226('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd226('0x6'));var logger=require('../../config/logger')(_0xd226('0x7'));var config=require(_0xd226('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1905f3,_0x586b53,_0x116875){return new BPromise(function(_0x2d9d02,_0x42b137){return client[_0xd226('0x9')](_0x1905f3,_0x116875)[_0xd226('0xa')](function(_0x266a37){logger[_0xd226('0xb')](_0xd226('0xc'),_0x586b53,_0xd226('0xd'));logger[_0xd226('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x586b53,_0xd226('0xd'),JSON[_0xd226('0xf')](_0x266a37));if(_0x266a37[_0xd226('0x10')]){if(_0x266a37[_0xd226('0x10')][_0xd226('0x11')]===0x1f4){logger[_0xd226('0x10')](_0xd226('0xc'),_0x586b53,_0x266a37[_0xd226('0x10')][_0xd226('0x12')]);return _0x42b137(_0x266a37[_0xd226('0x10')]['message']);}logger['error'](_0xd226('0xc'),_0x586b53,_0x266a37[_0xd226('0x10')]['message']);return _0x2d9d02(_0x266a37['error'][_0xd226('0x12')]);}else{logger[_0xd226('0xb')](_0xd226('0xc'),_0x586b53,_0xd226('0xd'));_0x2d9d02(_0x266a37[_0xd226('0x13')][_0xd226('0x12')]);}})[_0xd226('0x14')](function(_0x208ce6){logger[_0xd226('0x10')]('DeskField,\x20%s,\x20%s',_0x586b53,_0x208ce6);_0x42b137(_0x208ce6);});});}