4d06af38b0cc3a93d8ae5f76d4dbc199d7d3d3cd
[motion2.git] / server / api / intVtigerField / intVtigerField.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 _0x6215=['debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','then','info','VtigerField,\x20%s,\x20%s'];(function(_0xceeb3c,_0x2cd4cd){var _0x50b99d=function(_0x539816){while(--_0x539816){_0xceeb3c['push'](_0xceeb3c['shift']());}};_0x50b99d(++_0x2cd4cd);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5621('0x0'));var util=require(_0x5621('0x1'));var moment=require(_0x5621('0x2'));var BPromise=require('bluebird');var rs=require(_0x5621('0x3'));var fs=require('fs');var Redis=require(_0x5621('0x4'));var db=require(_0x5621('0x5'))['db'];var utils=require(_0x5621('0x6'));var logger=require(_0x5621('0x7'))(_0x5621('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x431e77,_0x13ed74,_0x2b7275){return new BPromise(function(_0x253c0b,_0x19427d){return client['request'](_0x431e77,_0x2b7275)[_0x5621('0x9')](function(_0x39b1c0){logger[_0x5621('0xa')](_0x5621('0xb'),_0x13ed74,'request\x20sent');logger[_0x5621('0xc')](_0x5621('0xd'),_0x13ed74,_0x5621('0xe'),JSON['stringify'](_0x39b1c0));if(_0x39b1c0[_0x5621('0xf')]){if(_0x39b1c0[_0x5621('0xf')][_0x5621('0x10')]===0x1f4){logger[_0x5621('0xf')](_0x5621('0xb'),_0x13ed74,_0x39b1c0[_0x5621('0xf')][_0x5621('0x11')]);return _0x19427d(_0x39b1c0[_0x5621('0xf')][_0x5621('0x11')]);}logger[_0x5621('0xf')]('VtigerField,\x20%s,\x20%s',_0x13ed74,_0x39b1c0[_0x5621('0xf')][_0x5621('0x11')]);return _0x253c0b(_0x39b1c0[_0x5621('0xf')]['message']);}else{logger[_0x5621('0xa')](_0x5621('0xb'),_0x13ed74,'request\x20sent');_0x253c0b(_0x39b1c0[_0x5621('0x12')][_0x5621('0x11')]);}})[_0x5621('0x13')](function(_0x180926){logger[_0x5621('0xf')](_0x5621('0xb'),_0x13ed74,_0x180926);_0x19427d(_0x180926);});});}