Built motion from commit 85328c08.|2.5.50
[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 _0x38a1=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskField,\x20%s,\x20%s','result','catch','bluebird'];(function(_0x25c638,_0x18e767){var _0x528849=function(_0x2330d7){while(--_0x2330d7){_0x25c638['push'](_0x25c638['shift']());}};_0x528849(++_0x18e767);}(_0x38a1,0x149));var _0x138a=function(_0xfdbb7c,_0x17cb51){_0xfdbb7c=_0xfdbb7c-0x0;var _0x402b3a=_0x38a1[_0xfdbb7c];return _0x402b3a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x138a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x138a('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x138a('0x2'));var logger=require(_0x138a('0x3'))(_0x138a('0x4'));var config=require(_0x138a('0x5'));var jayson=require(_0x138a('0x6'));var client=jayson[_0x138a('0x7')][_0x138a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x239c08,_0x2e88ae,_0x202a64){return new BPromise(function(_0x116f92,_0x511e9f){return client[_0x138a('0x9')](_0x239c08,_0x202a64)[_0x138a('0xa')](function(_0x3c2805){logger[_0x138a('0xb')]('DeskField,\x20%s,\x20%s',_0x2e88ae,_0x138a('0xc'));logger[_0x138a('0xd')](_0x138a('0xe'),_0x2e88ae,_0x138a('0xc'),JSON[_0x138a('0xf')](_0x3c2805));if(_0x3c2805['error']){if(_0x3c2805[_0x138a('0x10')][_0x138a('0x11')]===0x1f4){logger[_0x138a('0x10')]('DeskField,\x20%s,\x20%s',_0x2e88ae,_0x3c2805[_0x138a('0x10')][_0x138a('0x12')]);return _0x511e9f(_0x3c2805[_0x138a('0x10')][_0x138a('0x12')]);}logger[_0x138a('0x10')](_0x138a('0x13'),_0x2e88ae,_0x3c2805[_0x138a('0x10')][_0x138a('0x12')]);return _0x116f92(_0x3c2805[_0x138a('0x10')]['message']);}else{logger['info'](_0x138a('0x13'),_0x2e88ae,'request\x20sent');_0x116f92(_0x3c2805[_0x138a('0x14')][_0x138a('0x12')]);}})[_0x138a('0x15')](function(_0x51db02){logger[_0x138a('0x10')](_0x138a('0x13'),_0x2e88ae,_0x51db02);_0x511e9f(_0x51db02);});});}