Built motion from commit (unavailable).|2.4.18
[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 _0xc46c=['http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','update','where','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0xfbca2e,_0x2d0cb0){var _0x2a14cc=function(_0x28eef1){while(--_0x28eef1){_0xfbca2e['push'](_0xfbca2e['shift']());}};_0x2a14cc(++_0x2d0cb0);}(_0xc46c,0xfe));var _0xcc46=function(_0x431ff8,_0x4085dd){_0x431ff8=_0x431ff8-0x0;var _0x84ccd4=_0xc46c[_0x431ff8];return _0x84ccd4;};'use strict';var _=require(_0xcc46('0x0'));var util=require(_0xcc46('0x1'));var moment=require(_0xcc46('0x2'));var BPromise=require(_0xcc46('0x3'));var rs=require(_0xcc46('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcc46('0x5'));var logger=require(_0xcc46('0x6'))(_0xcc46('0x7'));var config=require('../../config/environment');var jayson=require(_0xcc46('0x8'));var client=jayson[_0xcc46('0x9')][_0xcc46('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10d143,_0x249118,_0x298956){return new BPromise(function(_0xc36f56,_0x236cd6){return client[_0xcc46('0xb')](_0x10d143,_0x298956)[_0xcc46('0xc')](function(_0x22d8b3){logger[_0xcc46('0xd')](_0xcc46('0xe'),_0x249118,_0xcc46('0xf'));logger[_0xcc46('0x10')](_0xcc46('0x11'),_0x249118,'request\x20sent',JSON[_0xcc46('0x12')](_0x22d8b3));if(_0x22d8b3[_0xcc46('0x13')]){if(_0x22d8b3[_0xcc46('0x13')][_0xcc46('0x14')]===0x1f4){logger[_0xcc46('0x13')](_0xcc46('0xe'),_0x249118,_0x22d8b3[_0xcc46('0x13')]['message']);return _0x236cd6(_0x22d8b3['error'][_0xcc46('0x15')]);}logger['error'](_0xcc46('0xe'),_0x249118,_0x22d8b3[_0xcc46('0x13')][_0xcc46('0x15')]);return _0xc36f56(_0x22d8b3[_0xcc46('0x13')][_0xcc46('0x15')]);}else{logger[_0xcc46('0xd')](_0xcc46('0xe'),_0x249118,_0xcc46('0xf'));_0xc36f56(_0x22d8b3['result']['message']);}})[_0xcc46('0x16')](function(_0x32a30c){logger[_0xcc46('0x13')](_0xcc46('0xe'),_0x249118,_0x32a30c);_0x236cd6(_0x32a30c);});});}exports[_0xcc46('0x17')]=function(_0x2114a4){var _0x37b13f=this;return new Promise(function(_0x37396e,_0x544d3d){return db[_0xcc46('0x18')][_0xcc46('0x19')](_0x2114a4[_0xcc46('0x1a')],{'raw':_0x2114a4[_0xcc46('0x1b')]?_0x2114a4['options'][_0xcc46('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x26c10d){logger['info']('CreateSmsQueueReport',_0x2114a4);logger[_0xcc46('0x10')](_0xcc46('0x17'),_0x2114a4,JSON[_0xcc46('0x12')](_0x26c10d));_0x37396e(_0x26c10d);})[_0xcc46('0x16')](function(_0xfdad55){logger[_0xcc46('0x13')]('CreateSmsQueueReport',_0xfdad55[_0xcc46('0x15')],_0x2114a4);_0x544d3d(_0x37b13f[_0xcc46('0x13')](0x1f4,_0xfdad55[_0xcc46('0x15')]));});});};exports['UpdateSmsQueueReport']=function(_0x55ae07){var _0xe3786c=this;return new Promise(function(_0x58378d,_0x267c14){return db[_0xcc46('0x18')][_0xcc46('0x1d')](_0x55ae07[_0xcc46('0x1a')],{'raw':_0x55ae07[_0xcc46('0x1b')]?_0x55ae07[_0xcc46('0x1b')][_0xcc46('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55ae07[_0xcc46('0x1b')]?_0x55ae07[_0xcc46('0x1b')][_0xcc46('0x1e')]||null:null,'attributes':_0x55ae07[_0xcc46('0x1b')]?_0x55ae07['options']['attributes']||null:null,'limit':_0x55ae07[_0xcc46('0x1b')]?_0x55ae07['options'][_0xcc46('0x1f')]||null:null})[_0xcc46('0xc')](function(_0x5e3ab4){logger[_0xcc46('0xd')](_0xcc46('0x20'),_0x55ae07);logger[_0xcc46('0x10')](_0xcc46('0x20'),_0x55ae07,JSON[_0xcc46('0x12')](_0x5e3ab4));_0x58378d(_0x5e3ab4);})['catch'](function(_0x2629cd){logger[_0xcc46('0x13')]('UpdateSmsQueueReport',_0x2629cd[_0xcc46('0x15')],_0x55ae07);_0x267c14(_0xe3786c['error'](0x1f4,_0x2629cd[_0xcc46('0x15')]));});});};