6e8db518dd113fa5d93a50b789e9716e3ff98078
[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 _0x57d2=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x2dcd28,_0x401951){var _0x17650c=function(_0x20b968){while(--_0x20b968){_0x2dcd28['push'](_0x2dcd28['shift']());}};_0x17650c(++_0x401951);}(_0x57d2,0x15c));var _0x257d=function(_0x5709d1,_0xd522c3){_0x5709d1=_0x5709d1-0x0;var _0x58354d=_0x57d2[_0x5709d1];return _0x58354d;};'use strict';var _=require(_0x257d('0x0'));var util=require(_0x257d('0x1'));var moment=require('moment');var BPromise=require(_0x257d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x257d('0x3'));var db=require(_0x257d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x257d('0x5'))(_0x257d('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x257d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cf28f,_0x57a365,_0x44fc6d){return new BPromise(function(_0x41be14,_0x3fa349){return client[_0x257d('0x8')](_0x5cf28f,_0x44fc6d)[_0x257d('0x9')](function(_0x27bb17){logger[_0x257d('0xa')](_0x257d('0xb'),_0x57a365,'request\x20sent');logger[_0x257d('0xc')](_0x257d('0xd'),_0x57a365,_0x257d('0xe'),JSON[_0x257d('0xf')](_0x27bb17));if(_0x27bb17['error']){if(_0x27bb17[_0x257d('0x10')][_0x257d('0x11')]===0x1f4){logger[_0x257d('0x10')](_0x257d('0xb'),_0x57a365,_0x27bb17['error'][_0x257d('0x12')]);return _0x3fa349(_0x27bb17[_0x257d('0x10')]['message']);}logger[_0x257d('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x57a365,_0x27bb17[_0x257d('0x10')]['message']);return _0x41be14(_0x27bb17[_0x257d('0x10')][_0x257d('0x12')]);}else{logger[_0x257d('0xa')](_0x257d('0xb'),_0x57a365,_0x257d('0xe'));_0x41be14(_0x27bb17['result'][_0x257d('0x12')]);}})[_0x257d('0x13')](function(_0x3da799){logger[_0x257d('0x10')](_0x257d('0xb'),_0x57a365,_0x3da799);_0x3fa349(_0x3da799);});});}