cb1c143ec00513602576f12ee8752a6f2353150b
[motion2.git] / server / api / setting / setting.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 _0x2322=['error','Setting,\x20%s,\x20%s','message','info','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0x2322,0x1ea));var _0x2232=function(_0x13a4b5,_0x4173b2){_0x13a4b5=_0x13a4b5-0x0;var _0x2fd940=_0x2322[_0x13a4b5];return _0x2fd940;};'use strict';var _=require(_0x2232('0x0'));var util=require(_0x2232('0x1'));var moment=require(_0x2232('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2232('0x3'));var db=require(_0x2232('0x4'))['db'];var utils=require(_0x2232('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2232('0x6'));var jayson=require(_0x2232('0x7'));var client=jayson[_0x2232('0x8')][_0x2232('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16e930,_0x2f03a6,_0x3aaa1f){return new BPromise(function(_0x5409a5,_0x17eaac){return client[_0x2232('0xa')](_0x16e930,_0x3aaa1f)[_0x2232('0xb')](function(_0x6d0bb2){logger['info']('Setting,\x20%s,\x20%s',_0x2f03a6,_0x2232('0xc'));logger['debug'](_0x2232('0xd'),_0x2f03a6,_0x2232('0xc'),JSON['stringify'](_0x6d0bb2));if(_0x6d0bb2[_0x2232('0xe')]){if(_0x6d0bb2[_0x2232('0xe')]['code']===0x1f4){logger[_0x2232('0xe')](_0x2232('0xf'),_0x2f03a6,_0x6d0bb2['error'][_0x2232('0x10')]);return _0x17eaac(_0x6d0bb2['error']['message']);}logger['error'](_0x2232('0xf'),_0x2f03a6,_0x6d0bb2[_0x2232('0xe')]['message']);return _0x5409a5(_0x6d0bb2[_0x2232('0xe')][_0x2232('0x10')]);}else{logger[_0x2232('0x11')](_0x2232('0xf'),_0x2f03a6,_0x2232('0xc'));_0x5409a5(_0x6d0bb2['result'][_0x2232('0x10')]);}})['catch'](function(_0x1dc9a4){logger['error']('Setting,\x20%s,\x20%s',_0x2f03a6,_0x1dc9a4);_0x17eaac(_0x1dc9a4);});});}