Built motion from commit ffdca78c.|2.6.24
[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 _0x58a7=['ioredis','../../config/logger','../../config/environment','client','request','then','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','info','lodash','util','bluebird','randomstring'];(function(_0x269b63,_0x17d6fc){var _0x54a157=function(_0x40ccac){while(--_0x40ccac){_0x269b63['push'](_0x269b63['shift']());}};_0x54a157(++_0x17d6fc);}(_0x58a7,0x7a));var _0x758a=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x58a7[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x758a('0x0'));var util=require(_0x758a('0x1'));var moment=require('moment');var BPromise=require(_0x758a('0x2'));var rs=require(_0x758a('0x3'));var fs=require('fs');var Redis=require(_0x758a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x758a('0x5'))('rpc');var config=require(_0x758a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x758a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2876cc,_0x516c39,_0x5d91dd){return new BPromise(function(_0x5dc4d9,_0x3f02e5){return client[_0x758a('0x8')](_0x2876cc,_0x5d91dd)[_0x758a('0x9')](function(_0x30f291){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x516c39,_0x758a('0xa'));logger['debug'](_0x758a('0xb'),_0x516c39,_0x758a('0xa'),JSON[_0x758a('0xc')](_0x30f291));if(_0x30f291[_0x758a('0xd')]){if(_0x30f291[_0x758a('0xd')][_0x758a('0xe')]===0x1f4){logger[_0x758a('0xd')](_0x758a('0xf'),_0x516c39,_0x30f291[_0x758a('0xd')]['message']);return _0x3f02e5(_0x30f291['error']['message']);}logger[_0x758a('0xd')](_0x758a('0xf'),_0x516c39,_0x30f291[_0x758a('0xd')][_0x758a('0x10')]);return _0x5dc4d9(_0x30f291[_0x758a('0xd')]['message']);}else{logger[_0x758a('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x516c39,_0x758a('0xa'));_0x5dc4d9(_0x30f291['result'][_0x758a('0x10')]);}})['catch'](function(_0x4facc8){logger['error'](_0x758a('0xf'),_0x516c39,_0x4facc8);_0x3f02e5(_0x4facc8);});});}