23044f4cee8a0bd3f26ffeecdd2854012bca5ff3
[motion2.git] / server / api / analyticExtractedReport / analyticExtractedReport.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 _0xff83=['then','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http'];(function(_0x3e24c9,_0x4d9e09){var _0x4237cf=function(_0x79297b){while(--_0x79297b){_0x3e24c9['push'](_0x3e24c9['shift']());}};_0x4237cf(++_0x4d9e09);}(_0xff83,0xee));var _0x3ff8=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xff83[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x3ff8('0x0'));var moment=require(_0x3ff8('0x1'));var BPromise=require('bluebird');var rs=require(_0x3ff8('0x2'));var fs=require('fs');var Redis=require(_0x3ff8('0x3'));var db=require(_0x3ff8('0x4'))['db'];var utils=require(_0x3ff8('0x5'));var logger=require('../../config/logger')(_0x3ff8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3ff8('0x7')][_0x3ff8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fa008,_0x3eb04c,_0x380507){return new BPromise(function(_0x1027ca,_0x20973c){return client['request'](_0x3fa008,_0x380507)[_0x3ff8('0x9')](function(_0x33e0fd){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x3eb04c,_0x3ff8('0xa'));logger[_0x3ff8('0xb')](_0x3ff8('0xc'),_0x3eb04c,_0x3ff8('0xa'),JSON[_0x3ff8('0xd')](_0x33e0fd));if(_0x33e0fd[_0x3ff8('0xe')]){if(_0x33e0fd['error'][_0x3ff8('0xf')]===0x1f4){logger['error'](_0x3ff8('0x10'),_0x3eb04c,_0x33e0fd[_0x3ff8('0xe')][_0x3ff8('0x11')]);return _0x20973c(_0x33e0fd['error'][_0x3ff8('0x11')]);}logger['error'](_0x3ff8('0x10'),_0x3eb04c,_0x33e0fd[_0x3ff8('0xe')][_0x3ff8('0x11')]);return _0x1027ca(_0x33e0fd[_0x3ff8('0xe')]['message']);}else{logger['info'](_0x3ff8('0x10'),_0x3eb04c,_0x3ff8('0xa'));_0x1027ca(_0x33e0fd[_0x3ff8('0x12')]['message']);}})['catch'](function(_0x1e0a08){logger[_0x3ff8('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x3eb04c,_0x1e0a08);_0x20973c(_0x1e0a08);});});}