7ca59c23d7699829d3998692734a23395e21a7d4
[motion2.git] / server / api / intDeskField / intDeskField.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 _0x1330=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1330,0x68));var _0x0133=function(_0x28c939,_0x110e29){_0x28c939=_0x28c939-0x0;var _0x527fe9=_0x1330[_0x28c939];return _0x527fe9;};'use strict';var _=require(_0x0133('0x0'));var util=require(_0x0133('0x1'));var moment=require(_0x0133('0x2'));var BPromise=require('bluebird');var rs=require(_0x0133('0x3'));var fs=require('fs');var Redis=require(_0x0133('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0133('0x5'));var logger=require(_0x0133('0x6'))(_0x0133('0x7'));var config=require(_0x0133('0x8'));var jayson=require(_0x0133('0x9'));var client=jayson[_0x0133('0xa')][_0x0133('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38d396,_0x31b69f,_0x4ee29b){return new BPromise(function(_0x5043f6,_0x5dc149){return client[_0x0133('0xc')](_0x38d396,_0x4ee29b)[_0x0133('0xd')](function(_0x1ab9b1){logger['info'](_0x0133('0xe'),_0x31b69f,_0x0133('0xf'));logger[_0x0133('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x31b69f,_0x0133('0xf'),JSON[_0x0133('0x11')](_0x1ab9b1));if(_0x1ab9b1[_0x0133('0x12')]){if(_0x1ab9b1[_0x0133('0x12')]['code']===0x1f4){logger['error'](_0x0133('0xe'),_0x31b69f,_0x1ab9b1[_0x0133('0x12')][_0x0133('0x13')]);return _0x5dc149(_0x1ab9b1[_0x0133('0x12')]['message']);}logger[_0x0133('0x12')](_0x0133('0xe'),_0x31b69f,_0x1ab9b1['error'][_0x0133('0x13')]);return _0x5043f6(_0x1ab9b1[_0x0133('0x12')]['message']);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x31b69f,_0x0133('0xf'));_0x5043f6(_0x1ab9b1['result']['message']);}})[_0x0133('0x14')](function(_0x28ade9){logger[_0x0133('0x12')](_0x0133('0xe'),_0x31b69f,_0x28ade9);_0x5dc149(_0x28ade9);});});}