Built motion from commit (unavailable).|2.5.14
[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 _0x17ac=['body','options','raw','update','where','attributes','limit','UpdateSmsQueueReport','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create'];(function(_0x471c7e,_0x3b98a9){var _0x2ff35b=function(_0x1c450a){while(--_0x1c450a){_0x471c7e['push'](_0x471c7e['shift']());}};_0x2ff35b(++_0x3b98a9);}(_0x17ac,0x13a));var _0xc17a=function(_0x14bd48,_0x394393){_0x14bd48=_0x14bd48-0x0;var _0x253fa9=_0x17ac[_0x14bd48];return _0x253fa9;};'use strict';var _=require(_0xc17a('0x0'));var util=require(_0xc17a('0x1'));var moment=require(_0xc17a('0x2'));var BPromise=require('bluebird');var rs=require(_0xc17a('0x3'));var fs=require('fs');var Redis=require(_0xc17a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc17a('0x5'))(_0xc17a('0x6'));var config=require(_0xc17a('0x7'));var jayson=require(_0xc17a('0x8'));var client=jayson['client'][_0xc17a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c60e1,_0x7288ff,_0xe27d69){return new BPromise(function(_0x3a6678,_0x278227){return client[_0xc17a('0xa')](_0x1c60e1,_0xe27d69)[_0xc17a('0xb')](function(_0x1a9588){logger[_0xc17a('0xc')](_0xc17a('0xd'),_0x7288ff,_0xc17a('0xe'));logger[_0xc17a('0xf')](_0xc17a('0x10'),_0x7288ff,_0xc17a('0xe'),JSON[_0xc17a('0x11')](_0x1a9588));if(_0x1a9588[_0xc17a('0x12')]){if(_0x1a9588[_0xc17a('0x12')][_0xc17a('0x13')]===0x1f4){logger['error'](_0xc17a('0xd'),_0x7288ff,_0x1a9588['error'][_0xc17a('0x14')]);return _0x278227(_0x1a9588['error'][_0xc17a('0x14')]);}logger[_0xc17a('0x12')](_0xc17a('0xd'),_0x7288ff,_0x1a9588[_0xc17a('0x12')][_0xc17a('0x14')]);return _0x3a6678(_0x1a9588['error']['message']);}else{logger[_0xc17a('0xc')](_0xc17a('0xd'),_0x7288ff,'request\x20sent');_0x3a6678(_0x1a9588[_0xc17a('0x15')]['message']);}})[_0xc17a('0x16')](function(_0x42af85){logger[_0xc17a('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x7288ff,_0x42af85);_0x278227(_0x42af85);});});}exports[_0xc17a('0x17')]=function(_0x3bc711){var _0x4eecc9=this;return new Promise(function(_0xe3d05d,_0x357036){return db[_0xc17a('0x18')][_0xc17a('0x19')](_0x3bc711[_0xc17a('0x1a')],{'raw':_0x3bc711[_0xc17a('0x1b')]?_0x3bc711[_0xc17a('0x1b')][_0xc17a('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x53df99){logger[_0xc17a('0xc')](_0xc17a('0x17'),_0x3bc711);logger[_0xc17a('0xf')](_0xc17a('0x17'),_0x3bc711,JSON[_0xc17a('0x11')](_0x53df99));_0xe3d05d(_0x53df99);})[_0xc17a('0x16')](function(_0x1a2b38){logger[_0xc17a('0x12')](_0xc17a('0x17'),_0x1a2b38[_0xc17a('0x14')],_0x3bc711);_0x357036(_0x4eecc9[_0xc17a('0x12')](0x1f4,_0x1a2b38[_0xc17a('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0x35fb04){var _0x33811d=this;return new Promise(function(_0x5a0710,_0x10b8b3){return db[_0xc17a('0x18')][_0xc17a('0x1d')](_0x35fb04[_0xc17a('0x1a')],{'raw':_0x35fb04[_0xc17a('0x1b')]?_0x35fb04[_0xc17a('0x1b')][_0xc17a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35fb04[_0xc17a('0x1b')]?_0x35fb04[_0xc17a('0x1b')][_0xc17a('0x1e')]||null:null,'attributes':_0x35fb04['options']?_0x35fb04['options'][_0xc17a('0x1f')]||null:null,'limit':_0x35fb04[_0xc17a('0x1b')]?_0x35fb04['options'][_0xc17a('0x20')]||null:null})[_0xc17a('0xb')](function(_0x44636d){logger[_0xc17a('0xc')](_0xc17a('0x21'),_0x35fb04);logger['debug']('UpdateSmsQueueReport',_0x35fb04,JSON['stringify'](_0x44636d));_0x5a0710(_0x44636d);})[_0xc17a('0x16')](function(_0x37081f){logger[_0xc17a('0x12')](_0xc17a('0x21'),_0x37081f[_0xc17a('0x14')],_0x35fb04);_0x10b8b3(_0x33811d['error'](0x1f4,_0x37081f['message']));});});};