Built motion from commit e6806ed6.|2.6.0
[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 _0x781a=['moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x22b32c,_0xfd4dac){var _0x25b08a=function(_0x5c0939){while(--_0x5c0939){_0x22b32c['push'](_0x22b32c['shift']());}};_0x25b08a(++_0xfd4dac);}(_0x781a,0x1b8));var _0xa781=function(_0x394f21,_0xf4a9e7){_0x394f21=_0x394f21-0x0;var _0x455536=_0x781a[_0x394f21];return _0x455536;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa781('0x0'));var BPromise=require(_0xa781('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa781('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa781('0x3'))(_0xa781('0x4'));var config=require(_0xa781('0x5'));var jayson=require(_0xa781('0x6'));var client=jayson[_0xa781('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4cbe18,_0x253a14,_0x5e6395){return new BPromise(function(_0x2d58de,_0xe1daa5){return client[_0xa781('0x8')](_0x4cbe18,_0x5e6395)[_0xa781('0x9')](function(_0x48a025){logger[_0xa781('0xa')](_0xa781('0xb'),_0x253a14,_0xa781('0xc'));logger[_0xa781('0xd')](_0xa781('0xe'),_0x253a14,_0xa781('0xc'),JSON[_0xa781('0xf')](_0x48a025));if(_0x48a025[_0xa781('0x10')]){if(_0x48a025[_0xa781('0x10')][_0xa781('0x11')]===0x1f4){logger[_0xa781('0x10')](_0xa781('0xb'),_0x253a14,_0x48a025[_0xa781('0x10')]['message']);return _0xe1daa5(_0x48a025['error'][_0xa781('0x12')]);}logger['error'](_0xa781('0xb'),_0x253a14,_0x48a025[_0xa781('0x10')][_0xa781('0x12')]);return _0x2d58de(_0x48a025['error'][_0xa781('0x12')]);}else{logger[_0xa781('0xa')](_0xa781('0xb'),_0x253a14,'request\x20sent');_0x2d58de(_0x48a025[_0xa781('0x13')][_0xa781('0x12')]);}})['catch'](function(_0x3be0d2){logger[_0xa781('0x10')]('VtigerField,\x20%s,\x20%s',_0x253a14,_0x3be0d2);_0xe1daa5(_0x3be0d2);});});}