Built motion from commit a61a4a20.|2.5.46
[motion2.git] / server / api / smsQueueReport / smsQueueReport.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 _0x4224=['where','attributes','limit','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','UpdateSmsQueueReport','update','body'];(function(_0x1b0f71,_0x8e3d31){var _0x435ffb=function(_0x46a772){while(--_0x46a772){_0x1b0f71['push'](_0x1b0f71['shift']());}};_0x435ffb(++_0x8e3d31);}(_0x4224,0x157));var _0x4422=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x4224[_0x4bd06e];return _0x85ebb;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4422('0x0'));var rs=require(_0x4422('0x1'));var fs=require('fs');var Redis=require(_0x4422('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4422('0x3'));var logger=require(_0x4422('0x4'))(_0x4422('0x5'));var config=require(_0x4422('0x6'));var jayson=require(_0x4422('0x7'));var client=jayson[_0x4422('0x8')][_0x4422('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd8859a,_0x497db5,_0x31eec9){return new BPromise(function(_0x4a1a33,_0x48ab54){return client[_0x4422('0xa')](_0xd8859a,_0x31eec9)[_0x4422('0xb')](function(_0x521f40){logger['info'](_0x4422('0xc'),_0x497db5,_0x4422('0xd'));logger[_0x4422('0xe')](_0x4422('0xf'),_0x497db5,_0x4422('0xd'),JSON[_0x4422('0x10')](_0x521f40));if(_0x521f40[_0x4422('0x11')]){if(_0x521f40[_0x4422('0x11')][_0x4422('0x12')]===0x1f4){logger['error'](_0x4422('0xc'),_0x497db5,_0x521f40[_0x4422('0x11')][_0x4422('0x13')]);return _0x48ab54(_0x521f40[_0x4422('0x11')]['message']);}logger[_0x4422('0x11')](_0x4422('0xc'),_0x497db5,_0x521f40[_0x4422('0x11')][_0x4422('0x13')]);return _0x4a1a33(_0x521f40[_0x4422('0x11')][_0x4422('0x13')]);}else{logger[_0x4422('0x14')](_0x4422('0xc'),_0x497db5,'request\x20sent');_0x4a1a33(_0x521f40[_0x4422('0x15')][_0x4422('0x13')]);}})[_0x4422('0x16')](function(_0x1dcec5){logger[_0x4422('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x497db5,_0x1dcec5);_0x48ab54(_0x1dcec5);});});}exports[_0x4422('0x17')]=function(_0x1c4aec){var _0x1b19cd=this;return new Promise(function(_0x1e11bd,_0x544c78){return db[_0x4422('0x18')][_0x4422('0x19')](_0x1c4aec['body'],{'raw':_0x1c4aec[_0x4422('0x1a')]?_0x1c4aec[_0x4422('0x1a')][_0x4422('0x1b')]===undefined?!![]:![]:!![]})[_0x4422('0xb')](function(_0x21a4a8){logger[_0x4422('0x14')]('CreateSmsQueueReport',_0x1c4aec);logger[_0x4422('0xe')](_0x4422('0x17'),_0x1c4aec,JSON[_0x4422('0x10')](_0x21a4a8));_0x1e11bd(_0x21a4a8);})[_0x4422('0x16')](function(_0x3ff4c7){logger[_0x4422('0x11')](_0x4422('0x17'),_0x3ff4c7[_0x4422('0x13')],_0x1c4aec);_0x544c78(_0x1b19cd['error'](0x1f4,_0x3ff4c7['message']));});});};exports[_0x4422('0x1c')]=function(_0x412adb){var _0x42640c=this;return new Promise(function(_0x3fe96b,_0x24e1d8){return db[_0x4422('0x18')][_0x4422('0x1d')](_0x412adb[_0x4422('0x1e')],{'raw':_0x412adb['options']?_0x412adb['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x412adb[_0x4422('0x1a')]?_0x412adb[_0x4422('0x1a')][_0x4422('0x1f')]||null:null,'attributes':_0x412adb['options']?_0x412adb[_0x4422('0x1a')][_0x4422('0x20')]||null:null,'limit':_0x412adb[_0x4422('0x1a')]?_0x412adb[_0x4422('0x1a')][_0x4422('0x21')]||null:null})[_0x4422('0xb')](function(_0x326b78){logger[_0x4422('0x14')](_0x4422('0x1c'),_0x412adb);logger[_0x4422('0xe')](_0x4422('0x1c'),_0x412adb,JSON[_0x4422('0x10')](_0x326b78));_0x3fe96b(_0x326b78);})['catch'](function(_0x1c3706){logger[_0x4422('0x11')]('UpdateSmsQueueReport',_0x1c3706[_0x4422('0x13')],_0x412adb);_0x24e1d8(_0x42640c[_0x4422('0x11')](0x1f4,_0x1c3706[_0x4422('0x13')]));});});};