Built motion from commit (unavailable).|2.5.11
[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 _0xc8c6=['../../config/logger','../../config/environment','jayson/promise','request','then','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueueReport,\x20%s,\x20%s','info','result','catch','CreateSmsQueueReport','create','body','options','debug','UpdateSmsQueueReport','SmsQueueReport','raw','where','attributes','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc8c6,0x95));var _0x6c8c=function(_0x2dac5e,_0x50d131){_0x2dac5e=_0x2dac5e-0x0;var _0x2b27a3=_0xc8c6[_0x2dac5e];return _0x2b27a3;};'use strict';var _=require(_0x6c8c('0x0'));var util=require(_0x6c8c('0x1'));var moment=require(_0x6c8c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c8c('0x3'));var fs=require('fs');var Redis=require(_0x6c8c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c8c('0x5'));var logger=require(_0x6c8c('0x6'))('rpc');var config=require(_0x6c8c('0x7'));var jayson=require(_0x6c8c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52de03,_0x2b713b,_0x216e10){return new BPromise(function(_0x106e51,_0x1c0650){return client[_0x6c8c('0x9')](_0x52de03,_0x216e10)[_0x6c8c('0xa')](function(_0x53ca70){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x2b713b,_0x6c8c('0xb'));logger['debug'](_0x6c8c('0xc'),_0x2b713b,'request\x20sent',JSON[_0x6c8c('0xd')](_0x53ca70));if(_0x53ca70[_0x6c8c('0xe')]){if(_0x53ca70['error'][_0x6c8c('0xf')]===0x1f4){logger[_0x6c8c('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x2b713b,_0x53ca70[_0x6c8c('0xe')][_0x6c8c('0x10')]);return _0x1c0650(_0x53ca70[_0x6c8c('0xe')]['message']);}logger[_0x6c8c('0xe')](_0x6c8c('0x11'),_0x2b713b,_0x53ca70[_0x6c8c('0xe')]['message']);return _0x106e51(_0x53ca70[_0x6c8c('0xe')][_0x6c8c('0x10')]);}else{logger[_0x6c8c('0x12')](_0x6c8c('0x11'),_0x2b713b,_0x6c8c('0xb'));_0x106e51(_0x53ca70[_0x6c8c('0x13')][_0x6c8c('0x10')]);}})[_0x6c8c('0x14')](function(_0x4e974f){logger[_0x6c8c('0xe')](_0x6c8c('0x11'),_0x2b713b,_0x4e974f);_0x1c0650(_0x4e974f);});});}exports[_0x6c8c('0x15')]=function(_0x590f0f){var _0x31872b=this;return new Promise(function(_0xae2401,_0x3dda12){return db['SmsQueueReport'][_0x6c8c('0x16')](_0x590f0f[_0x6c8c('0x17')],{'raw':_0x590f0f[_0x6c8c('0x18')]?_0x590f0f[_0x6c8c('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2e7cb2){logger['info']('CreateSmsQueueReport',_0x590f0f);logger[_0x6c8c('0x19')](_0x6c8c('0x15'),_0x590f0f,JSON[_0x6c8c('0xd')](_0x2e7cb2));_0xae2401(_0x2e7cb2);})[_0x6c8c('0x14')](function(_0x57c23d){logger[_0x6c8c('0xe')](_0x6c8c('0x15'),_0x57c23d[_0x6c8c('0x10')],_0x590f0f);_0x3dda12(_0x31872b[_0x6c8c('0xe')](0x1f4,_0x57c23d['message']));});});};exports[_0x6c8c('0x1a')]=function(_0xf2de36){var _0x50650b=this;return new Promise(function(_0x129ce1,_0x312d64){return db[_0x6c8c('0x1b')]['update'](_0xf2de36[_0x6c8c('0x17')],{'raw':_0xf2de36['options']?_0xf2de36[_0x6c8c('0x18')][_0x6c8c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf2de36['options']?_0xf2de36[_0x6c8c('0x18')][_0x6c8c('0x1d')]||null:null,'attributes':_0xf2de36[_0x6c8c('0x18')]?_0xf2de36['options'][_0x6c8c('0x1e')]||null:null,'limit':_0xf2de36[_0x6c8c('0x18')]?_0xf2de36[_0x6c8c('0x18')]['limit']||null:null})[_0x6c8c('0xa')](function(_0x6691c){logger[_0x6c8c('0x12')]('UpdateSmsQueueReport',_0xf2de36);logger[_0x6c8c('0x19')](_0x6c8c('0x1a'),_0xf2de36,JSON[_0x6c8c('0xd')](_0x6691c));_0x129ce1(_0x6691c);})[_0x6c8c('0x14')](function(_0x303758){logger['error'](_0x6c8c('0x1a'),_0x303758['message'],_0xf2de36);_0x312d64(_0x50650b['error'](0x1f4,_0x303758[_0x6c8c('0x10')]));});});};