Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
dailylimit.php
1
<?php
9
namespace
Bitrix\Sender\Integration\Bitrix24\Limitation
;
10
11
use
Bitrix\Main\Config
;
12
13
use
Bitrix\Sender\Internals\Model
;
14
use Bitrix\Bitrix24;
15
20
class
DailyLimit
21
{
23
protected
static
$instance
;
24
30
public
static
function
instance
()
31
{
32
if
(!static::$instance)
33
{
34
static::$instance =
new
static
();
35
}
36
37
return
static::$instance;
38
}
39
43
public
function
__construct
()
44
{
45
static
$isRatingCalculated =
false
;
46
if
(!$isRatingCalculated)
47
{
48
$isRatingCalculated =
true
;
49
Rating::calculate
();
50
}
51
}
52
58
public
function
getCurrent
()
59
{
60
return
Model\DailyCounterTable::getCurrentFieldValue(
'SENT_CNT'
);
61
}
62
68
public
function
getLimit
()
69
{
70
$senderLimit = (int)
Config
\Option::get(
"sender"
,
"~mail_counter_limit_daily"
, 1000);
71
72
$b24MailCounter =
new
Bitrix24\MailCounter
();
73
$b24Limit = $b24MailCounter->getDailyLimit();
74
if
(!$b24Limit)
75
{
76
return
$senderLimit;
77
}
78
79
return
min($senderLimit, $b24Limit);
80
81
}
82
89
public
function
setLimit
($limit)
90
{
91
Config\Option::set(
"sender"
,
"~mail_counter_limit_daily"
, intval($limit));
92
}
93
99
public
static
function
increment
()
100
{
101
Model\DailyCounterTable::incrementFieldValue(
'SENT_CNT'
);
102
}
103
109
public
static
function
incrementError
()
110
{
111
Model\DailyCounterTable::incrementFieldValue(
'ERROR_CNT'
);
112
}
113
}
Bitrix\Main\DB\Connection\$host
$host
Definition
connection.php:29
Bitrix\Sender\Integration\Bitrix24\Limitation\DailyLimit
Definition
dailylimit.php:21
Bitrix\Sender\Integration\Bitrix24\Limitation\DailyLimit\__construct
__construct()
Definition
dailylimit.php:43
Bitrix\Sender\Integration\Bitrix24\Limitation\DailyLimit\instance
static instance()
Definition
dailylimit.php:30
Bitrix\Sender\Integration\Bitrix24\Limitation\DailyLimit\incrementError
static incrementError()
Definition
dailylimit.php:109
Bitrix\Sender\Integration\Bitrix24\Limitation\DailyLimit\increment
static increment()
Definition
dailylimit.php:99
Bitrix\Sender\Integration\Bitrix24\Limitation\DailyLimit\getCurrent
getCurrent()
Definition
dailylimit.php:58
Bitrix\Sender\Integration\Bitrix24\Limitation\DailyLimit\$instance
static $instance
Definition
dailylimit.php:23
Bitrix\Sender\Integration\Bitrix24\Limitation\DailyLimit\getLimit
getLimit()
Definition
dailylimit.php:68
Bitrix\Sender\Integration\Bitrix24\Limitation\DailyLimit\setLimit
setLimit($limit)
Definition
dailylimit.php:89
Bitrix\Sender\Integration\Bitrix24\Limitation\Rating\calculate
static calculate()
Definition
rating.php:51
Bitrix\Main\Config
Definition
configuration.php:2
Bitrix\Sender\Integration\Bitrix24\Limitation
Definition
dailylimit.php:9
Bitrix\Sender\Internals\Model
Definition
abuse.php:3
modules
sender
lib
integration
bitrix24
limitation
dailylimit.php
Создано системой
1.10.0