557091667e1f227d9f466759966eba4a02003f63
[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 _0xc94a=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','catch'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0xc94a,0x14a));var _0xac94=function(_0x14e730,_0x46b6ff){_0x14e730=_0x14e730-0x0;var _0x3fae2d=_0xc94a[_0x14e730];return _0x3fae2d;};'use strict';var _=require(_0xac94('0x0'));var util=require(_0xac94('0x1'));var moment=require('moment');var BPromise=require(_0xac94('0x2'));var rs=require(_0xac94('0x3'));var fs=require('fs');var Redis=require(_0xac94('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xac94('0x5'));var logger=require(_0xac94('0x6'))(_0xac94('0x7'));var config=require(_0xac94('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xac94('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e07ec,_0x4ccb6c,_0x22b647){return new BPromise(function(_0x313002,_0x38c4d7){return client[_0xac94('0xa')](_0x4e07ec,_0x22b647)[_0xac94('0xb')](function(_0x177dd5){logger[_0xac94('0xc')]('VtigerField,\x20%s,\x20%s',_0x4ccb6c,_0xac94('0xd'));logger['debug'](_0xac94('0xe'),_0x4ccb6c,_0xac94('0xd'),JSON[_0xac94('0xf')](_0x177dd5));if(_0x177dd5['error']){if(_0x177dd5[_0xac94('0x10')][_0xac94('0x11')]===0x1f4){logger[_0xac94('0x10')](_0xac94('0x12'),_0x4ccb6c,_0x177dd5[_0xac94('0x10')][_0xac94('0x13')]);return _0x38c4d7(_0x177dd5[_0xac94('0x10')]['message']);}logger[_0xac94('0x10')](_0xac94('0x12'),_0x4ccb6c,_0x177dd5[_0xac94('0x10')]['message']);return _0x313002(_0x177dd5[_0xac94('0x10')][_0xac94('0x13')]);}else{logger[_0xac94('0xc')](_0xac94('0x12'),_0x4ccb6c,_0xac94('0xd'));_0x313002(_0x177dd5[_0xac94('0x14')][_0xac94('0x13')]);}})[_0xac94('0x15')](function(_0x241dad){logger[_0xac94('0x10')](_0xac94('0x12'),_0x4ccb6c,_0x241dad);_0x38c4d7(_0x241dad);});});}