5e4d011c93cf97769ae7b06dafbb9347ae3f0566
[motion2.git] / server / api / userProfileSection / userProfileSection.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 _0x119d=['http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','util','moment','../../config/utils','rpc','../../config/environment','client'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x119d,0x181));var _0xd119=function(_0x26550f,_0x4109c7){_0x26550f=_0x26550f-0x0;var _0x79e1d=_0x119d[_0x26550f];return _0x79e1d;};'use strict';var _=require('lodash');var util=require(_0xd119('0x0'));var moment=require(_0xd119('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd119('0x2'));var logger=require('../../config/logger')(_0xd119('0x3'));var config=require(_0xd119('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xd119('0x5')][_0xd119('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x72c210,_0x2fa420,_0x97ba2d){return new BPromise(function(_0x16e1d0,_0x3ea317){return client[_0xd119('0x7')](_0x72c210,_0x97ba2d)[_0xd119('0x8')](function(_0x2ec892){logger[_0xd119('0x9')](_0xd119('0xa'),_0x2fa420,_0xd119('0xb'));logger[_0xd119('0xc')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2fa420,_0xd119('0xb'),JSON[_0xd119('0xd')](_0x2ec892));if(_0x2ec892[_0xd119('0xe')]){if(_0x2ec892[_0xd119('0xe')]['code']===0x1f4){logger[_0xd119('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x2fa420,_0x2ec892[_0xd119('0xe')][_0xd119('0xf')]);return _0x3ea317(_0x2ec892['error'][_0xd119('0xf')]);}logger[_0xd119('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x2fa420,_0x2ec892[_0xd119('0xe')][_0xd119('0xf')]);return _0x16e1d0(_0x2ec892[_0xd119('0xe')][_0xd119('0xf')]);}else{logger[_0xd119('0x9')](_0xd119('0xa'),_0x2fa420,_0xd119('0xb'));_0x16e1d0(_0x2ec892['result'][_0xd119('0xf')]);}})[_0xd119('0x10')](function(_0x10028e){logger['error'](_0xd119('0xa'),_0x2fa420,_0x10028e);_0x3ea317(_0x10028e);});});}