73f415221f85c1a69727444e3b117a693637bf8e
[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 _0x82b6=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1360a8,_0x126918){var _0x50ed88=function(_0x1f6154){while(--_0x1f6154){_0x1360a8['push'](_0x1360a8['shift']());}};_0x50ed88(++_0x126918);}(_0x82b6,0x17d));var _0x682b=function(_0x389213,_0x14a50d){_0x389213=_0x389213-0x0;var _0x4ad6ca=_0x82b6[_0x389213];return _0x4ad6ca;};'use strict';var _=require('lodash');var util=require(_0x682b('0x0'));var moment=require(_0x682b('0x1'));var BPromise=require('bluebird');var rs=require(_0x682b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x682b('0x3'))['db'];var utils=require(_0x682b('0x4'));var logger=require('../../config/logger')(_0x682b('0x5'));var config=require(_0x682b('0x6'));var jayson=require(_0x682b('0x7'));var client=jayson[_0x682b('0x8')][_0x682b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23c765,_0x2cfee5,_0x2b0188){return new BPromise(function(_0xefc299,_0x37247b){return client[_0x682b('0xa')](_0x23c765,_0x2b0188)[_0x682b('0xb')](function(_0x3d1329){logger['info'](_0x682b('0xc'),_0x2cfee5,_0x682b('0xd'));logger[_0x682b('0xe')](_0x682b('0xf'),_0x2cfee5,_0x682b('0xd'),JSON[_0x682b('0x10')](_0x3d1329));if(_0x3d1329[_0x682b('0x11')]){if(_0x3d1329[_0x682b('0x11')][_0x682b('0x12')]===0x1f4){logger[_0x682b('0x11')]('CmCustomField,\x20%s,\x20%s',_0x2cfee5,_0x3d1329[_0x682b('0x11')][_0x682b('0x13')]);return _0x37247b(_0x3d1329['error'][_0x682b('0x13')]);}logger[_0x682b('0x11')]('CmCustomField,\x20%s,\x20%s',_0x2cfee5,_0x3d1329[_0x682b('0x11')]['message']);return _0xefc299(_0x3d1329[_0x682b('0x11')][_0x682b('0x13')]);}else{logger['info'](_0x682b('0xc'),_0x2cfee5,_0x682b('0xd'));_0xefc299(_0x3d1329[_0x682b('0x14')]['message']);}})[_0x682b('0x15')](function(_0x1de215){logger['error'](_0x682b('0xc'),_0x2cfee5,_0x1de215);_0x37247b(_0x1de215);});});}