6ce7480acef17d61a3d6c404e6a0a8ca0aa68971
[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 _0x86f4=['stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x86f4,0xf5));var _0x486f=function(_0x2185a1,_0x10c70f){_0x2185a1=_0x2185a1-0x0;var _0x522b04=_0x86f4[_0x2185a1];return _0x522b04;};'use strict';var _=require('lodash');var util=require(_0x486f('0x0'));var moment=require(_0x486f('0x1'));var BPromise=require(_0x486f('0x2'));var rs=require(_0x486f('0x3'));var fs=require('fs');var Redis=require(_0x486f('0x4'));var db=require(_0x486f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x486f('0x6'))(_0x486f('0x7'));var config=require(_0x486f('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x486f('0x9')]=_[_0x486f('0xa')](config[_0x486f('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x486f('0xb'))(new Redis(config[_0x486f('0x9')]));require(_0x486f('0xc'))[_0x486f('0xd')](socket);function respondWithRpcPromise(_0x1660b8,_0x2d505a,_0x197830){return new BPromise(function(_0x28d7d3,_0x52e3f2){return client['request'](_0x1660b8,_0x197830)[_0x486f('0xe')](function(_0x19e222){logger[_0x486f('0xf')](_0x486f('0x10'),_0x2d505a,_0x486f('0x11'));logger[_0x486f('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x2d505a,_0x486f('0x11'),JSON[_0x486f('0x13')](_0x19e222));if(_0x19e222[_0x486f('0x14')]){if(_0x19e222[_0x486f('0x14')][_0x486f('0x15')]===0x1f4){logger[_0x486f('0x14')](_0x486f('0x10'),_0x2d505a,_0x19e222[_0x486f('0x14')][_0x486f('0x16')]);return _0x52e3f2(_0x19e222[_0x486f('0x14')][_0x486f('0x16')]);}logger[_0x486f('0x14')](_0x486f('0x10'),_0x2d505a,_0x19e222[_0x486f('0x14')]['message']);return _0x28d7d3(_0x19e222[_0x486f('0x14')][_0x486f('0x16')]);}else{logger[_0x486f('0xf')](_0x486f('0x10'),_0x2d505a,_0x486f('0x11'));_0x28d7d3(_0x19e222['result'][_0x486f('0x16')]);}})[_0x486f('0x17')](function(_0x191574){logger[_0x486f('0x14')](_0x486f('0x10'),_0x2d505a,_0x191574);_0x52e3f2(_0x191574);});});}