a378e9a30a84a2ad7015c4d1b35f0d1e4926333a
[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 _0x2bef=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','VtigerField,\x20%s,\x20%s','message','lodash','util'];(function(_0xa0032b,_0x5bd969){var _0x22457b=function(_0x4efb95){while(--_0x4efb95){_0xa0032b['push'](_0xa0032b['shift']());}};_0x22457b(++_0x5bd969);}(_0x2bef,0x11b));var _0xf2be=function(_0xb82940,_0x530318){_0xb82940=_0xb82940-0x0;var _0x2e152a=_0x2bef[_0xb82940];return _0x2e152a;};'use strict';var _=require(_0xf2be('0x0'));var util=require(_0xf2be('0x1'));var moment=require(_0xf2be('0x2'));var BPromise=require(_0xf2be('0x3'));var rs=require(_0xf2be('0x4'));var fs=require('fs');var Redis=require(_0xf2be('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf2be('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf2be('0x7'));var jayson=require(_0xf2be('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd96d5c,_0x4335ac,_0x12670e){return new BPromise(function(_0x4eeb00,_0x56bfec){return client[_0xf2be('0x9')](_0xd96d5c,_0x12670e)[_0xf2be('0xa')](function(_0x1f2d37){logger[_0xf2be('0xb')]('VtigerField,\x20%s,\x20%s',_0x4335ac,_0xf2be('0xc'));logger[_0xf2be('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x4335ac,_0xf2be('0xc'),JSON[_0xf2be('0xe')](_0x1f2d37));if(_0x1f2d37[_0xf2be('0xf')]){if(_0x1f2d37[_0xf2be('0xf')][_0xf2be('0x10')]===0x1f4){logger[_0xf2be('0xf')](_0xf2be('0x11'),_0x4335ac,_0x1f2d37[_0xf2be('0xf')][_0xf2be('0x12')]);return _0x56bfec(_0x1f2d37[_0xf2be('0xf')][_0xf2be('0x12')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x4335ac,_0x1f2d37['error'][_0xf2be('0x12')]);return _0x4eeb00(_0x1f2d37['error']['message']);}else{logger[_0xf2be('0xb')](_0xf2be('0x11'),_0x4335ac,_0xf2be('0xc'));_0x4eeb00(_0x1f2d37['result'][_0xf2be('0x12')]);}})['catch'](function(_0x5eded8){logger[_0xf2be('0xf')]('VtigerField,\x20%s,\x20%s',_0x4335ac,_0x5eded8);_0x56bfec(_0x5eded8);});});}