b28da8e8bb2f301774ebc309fe8840c5c2fc3d87
[motion2.git] / server / api / chatOfflineMessage / chatOfflineMessage.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 _0xed20=['bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash'];(function(_0x262f36,_0x54bd2d){var _0x355624=function(_0x1b84f5){while(--_0x1b84f5){_0x262f36['push'](_0x262f36['shift']());}};_0x355624(++_0x54bd2d);}(_0xed20,0x1b9));var _0x0ed2=function(_0x34b50f,_0x3713fa){_0x34b50f=_0x34b50f-0x0;var _0x324183=_0xed20[_0x34b50f];return _0x324183;};'use strict';var _=require(_0x0ed2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0ed2('0x1'));var rs=require(_0x0ed2('0x2'));var fs=require('fs');var Redis=require(_0x0ed2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0ed2('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0ed2('0x5'));var client=jayson[_0x0ed2('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35f80f,_0x1847c6,_0x17c085){return new BPromise(function(_0x2fbb7d,_0x15a400){return client[_0x0ed2('0x7')](_0x35f80f,_0x17c085)[_0x0ed2('0x8')](function(_0x101f28){logger[_0x0ed2('0x9')](_0x0ed2('0xa'),_0x1847c6,'request\x20sent');logger['debug'](_0x0ed2('0xb'),_0x1847c6,_0x0ed2('0xc'),JSON['stringify'](_0x101f28));if(_0x101f28['error']){if(_0x101f28[_0x0ed2('0xd')][_0x0ed2('0xe')]===0x1f4){logger[_0x0ed2('0xd')](_0x0ed2('0xa'),_0x1847c6,_0x101f28[_0x0ed2('0xd')][_0x0ed2('0xf')]);return _0x15a400(_0x101f28[_0x0ed2('0xd')][_0x0ed2('0xf')]);}logger[_0x0ed2('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1847c6,_0x101f28[_0x0ed2('0xd')][_0x0ed2('0xf')]);return _0x2fbb7d(_0x101f28[_0x0ed2('0xd')][_0x0ed2('0xf')]);}else{logger[_0x0ed2('0x9')](_0x0ed2('0xa'),_0x1847c6,_0x0ed2('0xc'));_0x2fbb7d(_0x101f28['result'][_0x0ed2('0xf')]);}})[_0x0ed2('0x10')](function(_0x1c5079){logger[_0x0ed2('0xd')](_0x0ed2('0xa'),_0x1847c6,_0x1c5079);_0x15a400(_0x1c5079);});});}