Built motion from commit 0900f080.|2.5.45
[motion2.git] / server / api / cmCustomField / cmCustomField.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 _0x553a=['message','result','util','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','then','info','debug','request\x20sent','stringify','error','code','CmCustomField,\x20%s,\x20%s'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x553a,0x192));var _0xa553=function(_0x11fbaa,_0x52dc16){_0x11fbaa=_0x11fbaa-0x0;var _0x1831fd=_0x553a[_0x11fbaa];return _0x1831fd;};'use strict';var _=require('lodash');var util=require(_0xa553('0x0'));var moment=require('moment');var BPromise=require(_0xa553('0x1'));var rs=require(_0xa553('0x2'));var fs=require('fs');var Redis=require(_0xa553('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa553('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa553('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18da5d,_0x3da5c7,_0xaae97){return new BPromise(function(_0x48f7d2,_0x25bbb7){return client['request'](_0x18da5d,_0xaae97)[_0xa553('0x6')](function(_0xf6e0db){logger[_0xa553('0x7')]('CmCustomField,\x20%s,\x20%s',_0x3da5c7,'request\x20sent');logger[_0xa553('0x8')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x3da5c7,_0xa553('0x9'),JSON[_0xa553('0xa')](_0xf6e0db));if(_0xf6e0db[_0xa553('0xb')]){if(_0xf6e0db['error'][_0xa553('0xc')]===0x1f4){logger[_0xa553('0xb')](_0xa553('0xd'),_0x3da5c7,_0xf6e0db['error'][_0xa553('0xe')]);return _0x25bbb7(_0xf6e0db[_0xa553('0xb')][_0xa553('0xe')]);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x3da5c7,_0xf6e0db[_0xa553('0xb')][_0xa553('0xe')]);return _0x48f7d2(_0xf6e0db[_0xa553('0xb')][_0xa553('0xe')]);}else{logger['info'](_0xa553('0xd'),_0x3da5c7,'request\x20sent');_0x48f7d2(_0xf6e0db[_0xa553('0xf')]['message']);}})['catch'](function(_0x1d0f4e){logger['error'](_0xa553('0xd'),_0x3da5c7,_0x1d0f4e);_0x25bbb7(_0x1d0f4e);});});}