9b2ed9a7f9e602854a149465ce230463f00f5979
[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 _0x6820=['request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','CmCustomField,\x20%s,\x20%s'];(function(_0x46210c,_0x148f24){var _0x8f7d9a=function(_0x250fb9){while(--_0x250fb9){_0x46210c['push'](_0x46210c['shift']());}};_0x8f7d9a(++_0x148f24);}(_0x6820,0x184));var _0x0682=function(_0x52c100,_0x5853dc){_0x52c100=_0x52c100-0x0;var _0x8f3c80=_0x6820[_0x52c100];return _0x8f3c80;};'use strict';var _=require('lodash');var util=require(_0x0682('0x0'));var moment=require(_0x0682('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0682('0x2'));var db=require(_0x0682('0x3'))['db'];var utils=require(_0x0682('0x4'));var logger=require('../../config/logger')(_0x0682('0x5'));var config=require(_0x0682('0x6'));var jayson=require(_0x0682('0x7'));var client=jayson['client'][_0x0682('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20558d,_0x46b564,_0x470b32){return new BPromise(function(_0x588aa4,_0xa7a705){return client['request'](_0x20558d,_0x470b32)[_0x0682('0x9')](function(_0x5980bb){logger['info'](_0x0682('0xa'),_0x46b564,_0x0682('0xb'));logger['debug'](_0x0682('0xc'),_0x46b564,'request\x20sent',JSON['stringify'](_0x5980bb));if(_0x5980bb[_0x0682('0xd')]){if(_0x5980bb['error'][_0x0682('0xe')]===0x1f4){logger['error'](_0x0682('0xa'),_0x46b564,_0x5980bb[_0x0682('0xd')][_0x0682('0xf')]);return _0xa7a705(_0x5980bb[_0x0682('0xd')][_0x0682('0xf')]);}logger[_0x0682('0xd')](_0x0682('0xa'),_0x46b564,_0x5980bb[_0x0682('0xd')][_0x0682('0xf')]);return _0x588aa4(_0x5980bb[_0x0682('0xd')][_0x0682('0xf')]);}else{logger[_0x0682('0x10')](_0x0682('0xa'),_0x46b564,'request\x20sent');_0x588aa4(_0x5980bb[_0x0682('0x11')][_0x0682('0xf')]);}})[_0x0682('0x12')](function(_0x2feb74){logger[_0x0682('0xd')]('CmCustomField,\x20%s,\x20%s',_0x46b564,_0x2feb74);_0xa7a705(_0x2feb74);});});}