Built motion from commit d301b742.|2.6.29
[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 _0xdf19=['stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','rpc','jayson/promise','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xdf19,0xa5));var _0x9df1=function(_0x19a490,_0x4627d9){_0x19a490=_0x19a490-0x0;var _0x52081c=_0xdf19[_0x19a490];return _0x52081c;};'use strict';var _=require(_0x9df1('0x0'));var util=require(_0x9df1('0x1'));var moment=require(_0x9df1('0x2'));var BPromise=require(_0x9df1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9df1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9df1('0x5'));var config=require('../../config/environment');var jayson=require(_0x9df1('0x6'));var client=jayson['client'][_0x9df1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x26e5bb,_0x4c27c7,_0x448a28){return new BPromise(function(_0x55caf7,_0x2ad28c){return client[_0x9df1('0x8')](_0x26e5bb,_0x448a28)[_0x9df1('0x9')](function(_0x1af1a3){logger[_0x9df1('0xa')](_0x9df1('0xb'),_0x4c27c7,_0x9df1('0xc'));logger[_0x9df1('0xd')](_0x9df1('0xe'),_0x4c27c7,_0x9df1('0xc'),JSON[_0x9df1('0xf')](_0x1af1a3));if(_0x1af1a3[_0x9df1('0x10')]){if(_0x1af1a3[_0x9df1('0x10')]['code']===0x1f4){logger['error'](_0x9df1('0xb'),_0x4c27c7,_0x1af1a3[_0x9df1('0x10')]['message']);return _0x2ad28c(_0x1af1a3[_0x9df1('0x10')][_0x9df1('0x11')]);}logger[_0x9df1('0x10')](_0x9df1('0xb'),_0x4c27c7,_0x1af1a3[_0x9df1('0x10')][_0x9df1('0x11')]);return _0x55caf7(_0x1af1a3[_0x9df1('0x10')]['message']);}else{logger['info'](_0x9df1('0xb'),_0x4c27c7,_0x9df1('0xc'));_0x55caf7(_0x1af1a3[_0x9df1('0x12')][_0x9df1('0x11')]);}})[_0x9df1('0x13')](function(_0x4c53ba){logger[_0x9df1('0x10')]('CmCustomField,\x20%s,\x20%s',_0x4c27c7,_0x4c53ba);_0x2ad28c(_0x4c53ba);});});}