63304eccb5ba147cf7fe879a6393073e6d3b9694
[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 _0x73a1=['catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result'];(function(_0xe25fae,_0x54e211){var _0x4b197e=function(_0x2428e9){while(--_0x2428e9){_0xe25fae['push'](_0xe25fae['shift']());}};_0x4b197e(++_0x54e211);}(_0x73a1,0x161));var _0x173a=function(_0x224f65,_0x4750bf){_0x224f65=_0x224f65-0x0;var _0x3f921c=_0x73a1[_0x224f65];return _0x3f921c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x173a('0x0'));var BPromise=require(_0x173a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x173a('0x2'));var db=require(_0x173a('0x3'))['db'];var utils=require(_0x173a('0x4'));var logger=require(_0x173a('0x5'))(_0x173a('0x6'));var config=require('../../config/environment');var jayson=require(_0x173a('0x7'));var client=jayson[_0x173a('0x8')][_0x173a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbd8757,_0x12bb11,_0x550e2b){return new BPromise(function(_0x2b545e,_0x2c7090){return client[_0x173a('0xa')](_0xbd8757,_0x550e2b)[_0x173a('0xb')](function(_0x30ffef){logger[_0x173a('0xc')]('VtigerField,\x20%s,\x20%s',_0x12bb11,_0x173a('0xd'));logger['debug'](_0x173a('0xe'),_0x12bb11,_0x173a('0xd'),JSON[_0x173a('0xf')](_0x30ffef));if(_0x30ffef[_0x173a('0x10')]){if(_0x30ffef['error'][_0x173a('0x11')]===0x1f4){logger['error'](_0x173a('0x12'),_0x12bb11,_0x30ffef['error'][_0x173a('0x13')]);return _0x2c7090(_0x30ffef[_0x173a('0x10')]['message']);}logger[_0x173a('0x10')](_0x173a('0x12'),_0x12bb11,_0x30ffef[_0x173a('0x10')][_0x173a('0x13')]);return _0x2b545e(_0x30ffef[_0x173a('0x10')][_0x173a('0x13')]);}else{logger[_0x173a('0xc')](_0x173a('0x12'),_0x12bb11,'request\x20sent');_0x2b545e(_0x30ffef[_0x173a('0x14')][_0x173a('0x13')]);}})[_0x173a('0x15')](function(_0x4b323c){logger['error']('VtigerField,\x20%s,\x20%s',_0x12bb11,_0x4b323c);_0x2c7090(_0x4b323c);});});}