1a164416fc32f7cc618bd176c12d3875b17075b8
[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 _0x7145=['then','info','Schedule,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request'];(function(_0x356932,_0xdc04ba){var _0x3f8ea9=function(_0x572ea9){while(--_0x572ea9){_0x356932['push'](_0x356932['shift']());}};_0x3f8ea9(++_0xdc04ba);}(_0x7145,0x1d0));var _0x5714=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7145[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x5714('0x0'));var util=require(_0x5714('0x1'));var moment=require(_0x5714('0x2'));var BPromise=require(_0x5714('0x3'));var rs=require(_0x5714('0x4'));var fs=require('fs');var Redis=require(_0x5714('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5714('0x6'));var logger=require(_0x5714('0x7'))('rpc');var config=require(_0x5714('0x8'));var jayson=require(_0x5714('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d2a1d,_0x73ee73,_0x130bb9){return new BPromise(function(_0x5ef9b9,_0x45f810){return client[_0x5714('0xa')](_0x1d2a1d,_0x130bb9)[_0x5714('0xb')](function(_0x5cfdd6){logger[_0x5714('0xc')](_0x5714('0xd'),_0x73ee73,'request\x20sent');logger[_0x5714('0xe')]('Schedule,\x20%s,\x20%s,\x20%s',_0x73ee73,_0x5714('0xf'),JSON[_0x5714('0x10')](_0x5cfdd6));if(_0x5cfdd6[_0x5714('0x11')]){if(_0x5cfdd6[_0x5714('0x11')]['code']===0x1f4){logger[_0x5714('0x11')](_0x5714('0xd'),_0x73ee73,_0x5cfdd6[_0x5714('0x11')]['message']);return _0x45f810(_0x5cfdd6[_0x5714('0x11')][_0x5714('0x12')]);}logger[_0x5714('0x11')]('Schedule,\x20%s,\x20%s',_0x73ee73,_0x5cfdd6[_0x5714('0x11')][_0x5714('0x12')]);return _0x5ef9b9(_0x5cfdd6[_0x5714('0x11')]['message']);}else{logger[_0x5714('0xc')](_0x5714('0xd'),_0x73ee73,_0x5714('0xf'));_0x5ef9b9(_0x5cfdd6['result'][_0x5714('0x12')]);}})['catch'](function(_0x40e118){logger['error']('Schedule,\x20%s,\x20%s',_0x73ee73,_0x40e118);_0x45f810(_0x40e118);});});}