6770a5268739e06807134191b029c88504cecafb
[motion2.git] / server / api / dashboardItem / dashboardItem.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 _0x2d32=['../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x26a8ec,_0x2b8eba){var _0x25724a=function(_0x358e0a){while(--_0x358e0a){_0x26a8ec['push'](_0x26a8ec['shift']());}};_0x25724a(++_0x2b8eba);}(_0x2d32,0x1b4));var _0x22d3=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2d32[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var util=require(_0x22d3('0x0'));var moment=require(_0x22d3('0x1'));var BPromise=require(_0x22d3('0x2'));var rs=require(_0x22d3('0x3'));var fs=require('fs');var Redis=require(_0x22d3('0x4'));var db=require(_0x22d3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22d3('0x6'))(_0x22d3('0x7'));var config=require(_0x22d3('0x8'));var jayson=require(_0x22d3('0x9'));var client=jayson['client'][_0x22d3('0xa')]({'port':0x232a});config[_0x22d3('0xb')]=_['defaults'](config[_0x22d3('0xb')],{'host':_0x22d3('0xc'),'port':0x18eb});var socket=require(_0x22d3('0xd'))(new Redis(config[_0x22d3('0xb')]));require(_0x22d3('0xe'))[_0x22d3('0xf')](socket);function respondWithRpcPromise(_0x17ff74,_0x40f9b6,_0x4bfe65){return new BPromise(function(_0x8e5b99,_0x3c4e80){return client[_0x22d3('0x10')](_0x17ff74,_0x4bfe65)[_0x22d3('0x11')](function(_0x150d25){logger[_0x22d3('0x12')](_0x22d3('0x13'),_0x40f9b6,'request\x20sent');logger[_0x22d3('0x14')](_0x22d3('0x15'),_0x40f9b6,_0x22d3('0x16'),JSON['stringify'](_0x150d25));if(_0x150d25[_0x22d3('0x17')]){if(_0x150d25[_0x22d3('0x17')]['code']===0x1f4){logger[_0x22d3('0x17')](_0x22d3('0x13'),_0x40f9b6,_0x150d25['error']['message']);return _0x3c4e80(_0x150d25[_0x22d3('0x17')]['message']);}logger[_0x22d3('0x17')](_0x22d3('0x13'),_0x40f9b6,_0x150d25[_0x22d3('0x17')][_0x22d3('0x18')]);return _0x8e5b99(_0x150d25['error']['message']);}else{logger[_0x22d3('0x12')](_0x22d3('0x13'),_0x40f9b6,_0x22d3('0x16'));_0x8e5b99(_0x150d25['result'][_0x22d3('0x18')]);}})[_0x22d3('0x19')](function(_0x15c512){logger['error']('DashboardItem,\x20%s,\x20%s',_0x40f9b6,_0x15c512);_0x3c4e80(_0x15c512);});});}