eff0402408892f05bc0efdf27c787253e9c43016
[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 _0x42b9=['request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','rpc','jayson/promise','client','http'];(function(_0x5751e6,_0x125e5e){var _0x4199e4=function(_0x559843){while(--_0x559843){_0x5751e6['push'](_0x5751e6['shift']());}};_0x4199e4(++_0x125e5e);}(_0x42b9,0x132));var _0x942b=function(_0x136628,_0xdd3206){_0x136628=_0x136628-0x0;var _0x35aad7=_0x42b9[_0x136628];return _0x35aad7;};'use strict';var _=require(_0x942b('0x0'));var util=require(_0x942b('0x1'));var moment=require(_0x942b('0x2'));var BPromise=require('bluebird');var rs=require(_0x942b('0x3'));var fs=require('fs');var Redis=require(_0x942b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x942b('0x5'));var config=require('../../config/environment');var jayson=require(_0x942b('0x6'));var client=jayson[_0x942b('0x7')][_0x942b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53c255,_0x2a28bb,_0x366fb5){return new BPromise(function(_0x463101,_0x19d1bf){return client[_0x942b('0x9')](_0x53c255,_0x366fb5)[_0x942b('0xa')](function(_0xa88cc4){logger[_0x942b('0xb')](_0x942b('0xc'),_0x2a28bb,_0x942b('0xd'));logger[_0x942b('0xe')](_0x942b('0xf'),_0x2a28bb,'request\x20sent',JSON['stringify'](_0xa88cc4));if(_0xa88cc4[_0x942b('0x10')]){if(_0xa88cc4[_0x942b('0x10')][_0x942b('0x11')]===0x1f4){logger[_0x942b('0x10')]('Schedule,\x20%s,\x20%s',_0x2a28bb,_0xa88cc4[_0x942b('0x10')][_0x942b('0x12')]);return _0x19d1bf(_0xa88cc4['error'][_0x942b('0x12')]);}logger[_0x942b('0x10')]('Schedule,\x20%s,\x20%s',_0x2a28bb,_0xa88cc4[_0x942b('0x10')][_0x942b('0x12')]);return _0x463101(_0xa88cc4['error'][_0x942b('0x12')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x2a28bb,_0x942b('0xd'));_0x463101(_0xa88cc4[_0x942b('0x13')][_0x942b('0x12')]);}})[_0x942b('0x14')](function(_0xeab74d){logger['error'](_0x942b('0xc'),_0x2a28bb,_0xeab74d);_0x19d1bf(_0xeab74d);});});}