02c835a68e5725371e69e69f526a699312bac198
[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 _0x70a9=['DashboardItem,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then'];(function(_0x55434c,_0x59d490){var _0x57cb63=function(_0x405a15){while(--_0x405a15){_0x55434c['push'](_0x55434c['shift']());}};_0x57cb63(++_0x59d490);}(_0x70a9,0x1cb));var _0x970a=function(_0x6cde5d,_0x10877b){_0x6cde5d=_0x6cde5d-0x0;var _0x9b2f68=_0x70a9[_0x6cde5d];return _0x9b2f68;};'use strict';var _=require(_0x970a('0x0'));var util=require(_0x970a('0x1'));var moment=require(_0x970a('0x2'));var BPromise=require(_0x970a('0x3'));var rs=require(_0x970a('0x4'));var fs=require('fs');var Redis=require(_0x970a('0x5'));var db=require(_0x970a('0x6'))['db'];var utils=require(_0x970a('0x7'));var logger=require('../../config/logger')(_0x970a('0x8'));var config=require(_0x970a('0x9'));var jayson=require(_0x970a('0xa'));var client=jayson[_0x970a('0xb')][_0x970a('0xc')]({'port':0x232a});config['redis']=_[_0x970a('0xd')](config[_0x970a('0xe')],{'host':_0x970a('0xf'),'port':0x18eb});var socket=require(_0x970a('0x10'))(new Redis(config['redis']));require(_0x970a('0x11'))[_0x970a('0x12')](socket);function respondWithRpcPromise(_0x450c6f,_0x40755d,_0x2526e1){return new BPromise(function(_0x2c5a41,_0x452308){return client[_0x970a('0x13')](_0x450c6f,_0x2526e1)[_0x970a('0x14')](function(_0x5d54b2){logger['info'](_0x970a('0x15'),_0x40755d,'request\x20sent');logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x40755d,_0x970a('0x16'),JSON[_0x970a('0x17')](_0x5d54b2));if(_0x5d54b2[_0x970a('0x18')]){if(_0x5d54b2[_0x970a('0x18')][_0x970a('0x19')]===0x1f4){logger[_0x970a('0x18')](_0x970a('0x15'),_0x40755d,_0x5d54b2[_0x970a('0x18')][_0x970a('0x1a')]);return _0x452308(_0x5d54b2[_0x970a('0x18')][_0x970a('0x1a')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x40755d,_0x5d54b2[_0x970a('0x18')]['message']);return _0x2c5a41(_0x5d54b2[_0x970a('0x18')]['message']);}else{logger[_0x970a('0x1b')](_0x970a('0x15'),_0x40755d,'request\x20sent');_0x2c5a41(_0x5d54b2[_0x970a('0x1c')]['message']);}})[_0x970a('0x1d')](function(_0x4a5ebf){logger[_0x970a('0x18')]('DashboardItem,\x20%s,\x20%s',_0x40755d,_0x4a5ebf);_0x452308(_0x4a5ebf);});});}