93bd8812595d5610978094ae5ac2d09fb715c870
[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 _0x5265=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','error','code','message','catch','bluebird','randomstring','ioredis'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0x5265,0x18c));var _0x5526=function(_0x5d28a2,_0x347284){_0x5d28a2=_0x5d28a2-0x0;var _0x1b36e2=_0x5265[_0x5d28a2];return _0x1b36e2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5526('0x0'));var rs=require(_0x5526('0x1'));var fs=require('fs');var Redis=require(_0x5526('0x2'));var db=require(_0x5526('0x3'))['db'];var utils=require(_0x5526('0x4'));var logger=require(_0x5526('0x5'))(_0x5526('0x6'));var config=require('../../config/environment');var jayson=require(_0x5526('0x7'));var client=jayson[_0x5526('0x8')][_0x5526('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x915ff6,_0x516862,_0x2948dd){return new BPromise(function(_0x135f04,_0x5b63f6){return client[_0x5526('0xa')](_0x915ff6,_0x2948dd)[_0x5526('0xb')](function(_0x164ec3){logger[_0x5526('0xc')](_0x5526('0xd'),_0x516862,_0x5526('0xe'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x516862,_0x5526('0xe'),JSON['stringify'](_0x164ec3));if(_0x164ec3['error']){if(_0x164ec3[_0x5526('0xf')][_0x5526('0x10')]===0x1f4){logger[_0x5526('0xf')]('Setting,\x20%s,\x20%s',_0x516862,_0x164ec3[_0x5526('0xf')][_0x5526('0x11')]);return _0x5b63f6(_0x164ec3[_0x5526('0xf')][_0x5526('0x11')]);}logger[_0x5526('0xf')](_0x5526('0xd'),_0x516862,_0x164ec3[_0x5526('0xf')][_0x5526('0x11')]);return _0x135f04(_0x164ec3[_0x5526('0xf')][_0x5526('0x11')]);}else{logger[_0x5526('0xc')](_0x5526('0xd'),_0x516862,_0x5526('0xe'));_0x135f04(_0x164ec3['result']['message']);}})[_0x5526('0x12')](function(_0x542855){logger[_0x5526('0xf')](_0x5526('0xd'),_0x516862,_0x542855);_0x5b63f6(_0x542855);});});}