Built motion from commit e02f907f.|2.6.14
[motion2.git] / server / api / jscriptyQuestionReport / jscriptyQuestionReport.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 _0x9973=['result','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5d7419,_0x272f46){var _0x3518af=function(_0x3d2d1b){while(--_0x3d2d1b){_0x5d7419['push'](_0x5d7419['shift']());}};_0x3518af(++_0x272f46);}(_0x9973,0x8d));var _0x3997=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9973[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3997('0x0'));var BPromise=require(_0x3997('0x1'));var rs=require(_0x3997('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3997('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3997('0x4'));var config=require('../../config/environment');var jayson=require(_0x3997('0x5'));var client=jayson[_0x3997('0x6')][_0x3997('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4472c8,_0x13f871,_0x476d75){return new BPromise(function(_0x457e5b,_0x49b1d1){return client[_0x3997('0x8')](_0x4472c8,_0x476d75)[_0x3997('0x9')](function(_0xf2e8b3){logger[_0x3997('0xa')](_0x3997('0xb'),_0x13f871,_0x3997('0xc'));logger[_0x3997('0xd')](_0x3997('0xe'),_0x13f871,_0x3997('0xc'),JSON[_0x3997('0xf')](_0xf2e8b3));if(_0xf2e8b3['error']){if(_0xf2e8b3[_0x3997('0x10')][_0x3997('0x11')]===0x1f4){logger['error'](_0x3997('0xb'),_0x13f871,_0xf2e8b3[_0x3997('0x10')][_0x3997('0x12')]);return _0x49b1d1(_0xf2e8b3[_0x3997('0x10')][_0x3997('0x12')]);}logger[_0x3997('0x10')](_0x3997('0xb'),_0x13f871,_0xf2e8b3[_0x3997('0x10')][_0x3997('0x12')]);return _0x457e5b(_0xf2e8b3['error'][_0x3997('0x12')]);}else{logger[_0x3997('0xa')](_0x3997('0xb'),_0x13f871,'request\x20sent');_0x457e5b(_0xf2e8b3[_0x3997('0x13')]['message']);}})['catch'](function(_0xf8ffd8){logger[_0x3997('0x10')](_0x3997('0xb'),_0x13f871,_0xf8ffd8);_0x49b1d1(_0xf8ffd8);});});}