59e93f0cd2e3bc92b42731acebc879db60d45faa
[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 _0xffdd=['message','info','CmCustomField,\x20%s,\x20%s','request\x20sent','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','debug','stringify','error','code'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0xffdd,0x193));var _0xdffd=function(_0x57fc31,_0x5de793){_0x57fc31=_0x57fc31-0x0;var _0x3102d0=_0xffdd[_0x57fc31];return _0x3102d0;};'use strict';var _=require(_0xdffd('0x0'));var util=require(_0xdffd('0x1'));var moment=require(_0xdffd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdffd('0x3'));var db=require(_0xdffd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdffd('0x5'))(_0xdffd('0x6'));var config=require(_0xdffd('0x7'));var jayson=require(_0xdffd('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4835f6,_0x372e34,_0x25cd14){return new BPromise(function(_0x1c39c6,_0x2e9eb0){return client[_0xdffd('0x9')](_0x4835f6,_0x25cd14)[_0xdffd('0xa')](function(_0x19137c){logger['info']('CmCustomField,\x20%s,\x20%s',_0x372e34,'request\x20sent');logger[_0xdffd('0xb')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x372e34,'request\x20sent',JSON[_0xdffd('0xc')](_0x19137c));if(_0x19137c[_0xdffd('0xd')]){if(_0x19137c[_0xdffd('0xd')][_0xdffd('0xe')]===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x372e34,_0x19137c[_0xdffd('0xd')]['message']);return _0x2e9eb0(_0x19137c[_0xdffd('0xd')][_0xdffd('0xf')]);}logger[_0xdffd('0xd')]('CmCustomField,\x20%s,\x20%s',_0x372e34,_0x19137c[_0xdffd('0xd')][_0xdffd('0xf')]);return _0x1c39c6(_0x19137c[_0xdffd('0xd')][_0xdffd('0xf')]);}else{logger[_0xdffd('0x10')](_0xdffd('0x11'),_0x372e34,_0xdffd('0x12'));_0x1c39c6(_0x19137c['result'][_0xdffd('0xf')]);}})['catch'](function(_0xa5dd99){logger[_0xdffd('0xd')](_0xdffd('0x11'),_0x372e34,_0xa5dd99);_0x2e9eb0(_0xa5dd99);});});}