1bbd28f08e27363b284918cf6262664aa999f76f
[motion2.git] / server / api / schedule / schedule.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 _0xc39e=['../../config/environment','http','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xc39e,0x172));var _0xec39=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xc39e[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require(_0xec39('0x0'));var util=require(_0xec39('0x1'));var moment=require(_0xec39('0x2'));var BPromise=require(_0xec39('0x3'));var rs=require(_0xec39('0x4'));var fs=require('fs');var Redis=require(_0xec39('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xec39('0x6'))(_0xec39('0x7'));var config=require(_0xec39('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xec39('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4280b0,_0x1aca72,_0x30ccf3){return new BPromise(function(_0x4b92bc,_0x38371){return client[_0xec39('0xa')](_0x4280b0,_0x30ccf3)[_0xec39('0xb')](function(_0x235254){logger[_0xec39('0xc')](_0xec39('0xd'),_0x1aca72,'request\x20sent');logger[_0xec39('0xe')](_0xec39('0xf'),_0x1aca72,_0xec39('0x10'),JSON[_0xec39('0x11')](_0x235254));if(_0x235254[_0xec39('0x12')]){if(_0x235254[_0xec39('0x12')]['code']===0x1f4){logger[_0xec39('0x12')](_0xec39('0xd'),_0x1aca72,_0x235254['error'][_0xec39('0x13')]);return _0x38371(_0x235254[_0xec39('0x12')][_0xec39('0x13')]);}logger[_0xec39('0x12')]('Schedule,\x20%s,\x20%s',_0x1aca72,_0x235254[_0xec39('0x12')]['message']);return _0x4b92bc(_0x235254[_0xec39('0x12')]['message']);}else{logger[_0xec39('0xc')](_0xec39('0xd'),_0x1aca72,_0xec39('0x10'));_0x4b92bc(_0x235254['result']['message']);}})[_0xec39('0x14')](function(_0x32004e){logger[_0xec39('0x12')]('Schedule,\x20%s,\x20%s',_0x1aca72,_0x32004e);_0x38371(_0x32004e);});});}