Built motion from commit d5e4af8c.|2.6.23
[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 _0xe200=['error','code','message','result','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4b280d,_0x4097f8){var _0x2e51f7=function(_0x4f87a2){while(--_0x4f87a2){_0x4b280d['push'](_0x4b280d['shift']());}};_0x2e51f7(++_0x4097f8);}(_0xe200,0x18b));var _0x0e20=function(_0x598ac0,_0x43cb83){_0x598ac0=_0x598ac0-0x0;var _0x557323=_0xe200[_0x598ac0];return _0x557323;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0e20('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e20('0x1'));var db=require(_0x0e20('0x2'))['db'];var utils=require(_0x0e20('0x3'));var logger=require('../../config/logger')(_0x0e20('0x4'));var config=require(_0x0e20('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0e20('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x9fb423,_0x5a6d1c,_0x194a65){return new BPromise(function(_0x2bd8d1,_0x59a18c){return client['request'](_0x9fb423,_0x194a65)[_0x0e20('0x7')](function(_0x188b46){logger[_0x0e20('0x8')](_0x0e20('0x9'),_0x5a6d1c,_0x0e20('0xa'));logger['debug'](_0x0e20('0xb'),_0x5a6d1c,_0x0e20('0xa'),JSON[_0x0e20('0xc')](_0x188b46));if(_0x188b46['error']){if(_0x188b46[_0x0e20('0xd')][_0x0e20('0xe')]===0x1f4){logger[_0x0e20('0xd')](_0x0e20('0x9'),_0x5a6d1c,_0x188b46[_0x0e20('0xd')][_0x0e20('0xf')]);return _0x59a18c(_0x188b46[_0x0e20('0xd')][_0x0e20('0xf')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x5a6d1c,_0x188b46[_0x0e20('0xd')][_0x0e20('0xf')]);return _0x2bd8d1(_0x188b46[_0x0e20('0xd')][_0x0e20('0xf')]);}else{logger[_0x0e20('0x8')](_0x0e20('0x9'),_0x5a6d1c,'request\x20sent');_0x2bd8d1(_0x188b46[_0x0e20('0x10')][_0x0e20('0xf')]);}})['catch'](function(_0x4a83d4){logger[_0x0e20('0xd')](_0x0e20('0x9'),_0x5a6d1c,_0x4a83d4);_0x59a18c(_0x4a83d4);});});}