Built motion from commit b5413ace.|2.6.9
[motion2.git] / server / api / analyticFieldReport / analyticFieldReport.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 _0x3317=['catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3317,0x1d5));var _0x7331=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x3317[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0x7331('0x0'));var moment=require('moment');var BPromise=require(_0x7331('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7331('0x2'));var db=require(_0x7331('0x3'))['db'];var utils=require(_0x7331('0x4'));var logger=require('../../config/logger')(_0x7331('0x5'));var config=require('../../config/environment');var jayson=require(_0x7331('0x6'));var client=jayson[_0x7331('0x7')][_0x7331('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8e961a,_0x8b965a,_0x379793){return new BPromise(function(_0x3ffa60,_0x2b9b51){return client[_0x7331('0x9')](_0x8e961a,_0x379793)['then'](function(_0x1f3171){logger[_0x7331('0xa')](_0x7331('0xb'),_0x8b965a,_0x7331('0xc'));logger[_0x7331('0xd')](_0x7331('0xe'),_0x8b965a,_0x7331('0xc'),JSON['stringify'](_0x1f3171));if(_0x1f3171[_0x7331('0xf')]){if(_0x1f3171[_0x7331('0xf')]['code']===0x1f4){logger[_0x7331('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x8b965a,_0x1f3171[_0x7331('0xf')][_0x7331('0x10')]);return _0x2b9b51(_0x1f3171[_0x7331('0xf')]['message']);}logger['error'](_0x7331('0xb'),_0x8b965a,_0x1f3171[_0x7331('0xf')][_0x7331('0x10')]);return _0x3ffa60(_0x1f3171['error'][_0x7331('0x10')]);}else{logger['info'](_0x7331('0xb'),_0x8b965a,_0x7331('0xc'));_0x3ffa60(_0x1f3171['result'][_0x7331('0x10')]);}})[_0x7331('0x11')](function(_0x11abf4){logger['error'](_0x7331('0xb'),_0x8b965a,_0x11abf4);_0x2b9b51(_0x11abf4);});});}