Built motion from commit (unavailable).|2.3.93
[motion2.git] / server / api / tag / tag.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 _0xd280=['jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x53273a,_0x5ed978){var _0x3c41db=function(_0x491a57){while(--_0x491a57){_0x53273a['push'](_0x53273a['shift']());}};_0x3c41db(++_0x5ed978);}(_0xd280,0x1e9));var _0x0d28=function(_0x296bcd,_0x115fbd){_0x296bcd=_0x296bcd-0x0;var _0x13523e=_0xd280[_0x296bcd];return _0x13523e;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0d28('0x0'));var fs=require('fs');var Redis=require(_0x0d28('0x1'));var db=require(_0x0d28('0x2'))['db'];var utils=require(_0x0d28('0x3'));var logger=require('../../config/logger')(_0x0d28('0x4'));var config=require('../../config/environment');var jayson=require(_0x0d28('0x5'));var client=jayson[_0x0d28('0x6')][_0x0d28('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e37b3,_0x366cd5,_0x5ad156){return new BPromise(function(_0x565c37,_0x21b8b6){return client[_0x0d28('0x8')](_0x4e37b3,_0x5ad156)['then'](function(_0x1117bd){logger[_0x0d28('0x9')](_0x0d28('0xa'),_0x366cd5,_0x0d28('0xb'));logger[_0x0d28('0xc')](_0x0d28('0xd'),_0x366cd5,'request\x20sent',JSON[_0x0d28('0xe')](_0x1117bd));if(_0x1117bd[_0x0d28('0xf')]){if(_0x1117bd[_0x0d28('0xf')]['code']===0x1f4){logger[_0x0d28('0xf')]('Tag,\x20%s,\x20%s',_0x366cd5,_0x1117bd['error'][_0x0d28('0x10')]);return _0x21b8b6(_0x1117bd[_0x0d28('0xf')][_0x0d28('0x10')]);}logger['error'](_0x0d28('0xa'),_0x366cd5,_0x1117bd[_0x0d28('0xf')]['message']);return _0x565c37(_0x1117bd[_0x0d28('0xf')][_0x0d28('0x10')]);}else{logger['info'](_0x0d28('0xa'),_0x366cd5,_0x0d28('0xb'));_0x565c37(_0x1117bd[_0x0d28('0x11')][_0x0d28('0x10')]);}})[_0x0d28('0x12')](function(_0x3134ae){logger['error'](_0x0d28('0xa'),_0x366cd5,_0x3134ae);_0x21b8b6(_0x3134ae);});});}