Built motion from commit 67e5df37.|2.0.66
[motion2.git] / server / api / analyticTreeReport / analyticTreeReport.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 _0x9337=['../../config/utils','../../config/logger','jayson/promise','client','AnalyticTreeReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x9337,0x13f));var _0x7933=function(_0x23a763,_0x8f65a9){_0x23a763=_0x23a763-0x0;var _0x166423=_0x9337[_0x23a763];return _0x166423;};'use strict';var _=require(_0x7933('0x0'));var util=require(_0x7933('0x1'));var moment=require(_0x7933('0x2'));var BPromise=require(_0x7933('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x7933('0x4'));var logger=require(_0x7933('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7933('0x6'));var client=jayson[_0x7933('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1db697,_0x3a511d,_0x5c1ec){return new BPromise(function(_0x241ecb,_0x3e5b51){return client['request'](_0x1db697,_0x5c1ec)['then'](function(_0x277204){logger['info'](_0x7933('0x8'),_0x3a511d,'request\x20sent');logger[_0x7933('0x9')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3a511d,_0x7933('0xa'),JSON[_0x7933('0xb')](_0x277204));if(_0x277204[_0x7933('0xc')]){if(_0x277204['error'][_0x7933('0xd')]===0x1f4){logger[_0x7933('0xc')](_0x7933('0x8'),_0x3a511d,_0x277204[_0x7933('0xc')]['message']);return _0x3e5b51(_0x277204[_0x7933('0xc')][_0x7933('0xe')]);}logger[_0x7933('0xc')](_0x7933('0x8'),_0x3a511d,_0x277204[_0x7933('0xc')][_0x7933('0xe')]);return _0x241ecb(_0x277204['error']['message']);}else{logger['info'](_0x7933('0x8'),_0x3a511d,_0x7933('0xa'));_0x241ecb(_0x277204[_0x7933('0xf')][_0x7933('0xe')]);}})[_0x7933('0x10')](function(_0x4f7078){logger[_0x7933('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x3a511d,_0x4f7078);_0x3e5b51(_0x4f7078);});});}