7b711a6337e1ba4a82b9a49e21f7454a8a0a1a12
[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 _0x9af9=['message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x121b65,_0x1ef814){var _0x3086e9=function(_0x2ca681){while(--_0x2ca681){_0x121b65['push'](_0x121b65['shift']());}};_0x3086e9(++_0x1ef814);}(_0x9af9,0xb6));var _0x99af=function(_0x16dc88,_0x5d7a40){_0x16dc88=_0x16dc88-0x0;var _0x25ada2=_0x9af9[_0x16dc88];return _0x25ada2;};'use strict';var _=require(_0x99af('0x0'));var util=require(_0x99af('0x1'));var moment=require('moment');var BPromise=require(_0x99af('0x2'));var rs=require(_0x99af('0x3'));var fs=require('fs');var Redis=require(_0x99af('0x4'));var db=require(_0x99af('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x99af('0x6'));var jayson=require(_0x99af('0x7'));var client=jayson[_0x99af('0x8')][_0x99af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5712c6,_0xf1d640,_0x4cb61d){return new BPromise(function(_0x36444d,_0x3872d1){return client['request'](_0x5712c6,_0x4cb61d)[_0x99af('0xa')](function(_0x154289){logger[_0x99af('0xb')](_0x99af('0xc'),_0xf1d640,_0x99af('0xd'));logger[_0x99af('0xe')](_0x99af('0xf'),_0xf1d640,_0x99af('0xd'),JSON['stringify'](_0x154289));if(_0x154289[_0x99af('0x10')]){if(_0x154289[_0x99af('0x10')][_0x99af('0x11')]===0x1f4){logger[_0x99af('0x10')](_0x99af('0xc'),_0xf1d640,_0x154289[_0x99af('0x10')]['message']);return _0x3872d1(_0x154289[_0x99af('0x10')][_0x99af('0x12')]);}logger[_0x99af('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0xf1d640,_0x154289['error']['message']);return _0x36444d(_0x154289[_0x99af('0x10')][_0x99af('0x12')]);}else{logger[_0x99af('0xb')](_0x99af('0xc'),_0xf1d640,_0x99af('0xd'));_0x36444d(_0x154289[_0x99af('0x13')][_0x99af('0x12')]);}})['catch'](function(_0x133067){logger[_0x99af('0x10')](_0x99af('0xc'),_0xf1d640,_0x133067);_0x3872d1(_0x133067);});});}