Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
sendersendcounter.php
1
<?php
9
namespace
Bitrix\Main\Mail
;
10
11
use
Bitrix\Main\Type
;
12
13
class
SenderSendCounter
14
{
15
public
const
DEFAULT_LIMIT
= 250;
22
public
function
get
($email)
23
{
24
$counter = 0;
25
$date =
new
Type\Date
();
26
27
$res = Internal\SenderSendCounterTable::getList(array(
28
"filter"
=> array(
29
"=DATE_STAT"
=> $date,
30
"=EMAIL"
=> $email,
31
)
32
));
33
34
if
($cnt = $res->fetch())
35
{
36
$counter = $cnt[
"CNT"
];
37
}
38
39
return
$counter;
40
}
41
48
public
function
getMonthly
($email)
49
{
50
$counter = 0;
51
$date =
new
Type\Date
(date(
"01.m.Y"
),
"d.m.Y"
);
52
53
$res = Internals\SenderSendCounterTable::getList(array(
54
"select"
=> array(
55
new
\
Bitrix
\Main\
Entity
\
ExpressionField
(
'CNT'
,
'SUM(CNT)'
),
56
),
57
"filter"
=> array(
58
">=DATE_STAT"
=> $date,
59
"=EMAIL"
=> $email,
60
)
61
));
62
63
if
($cnt = $res->fetch())
64
{
65
$counter = $cnt[
"CNT"
];
66
}
67
68
return
$counter;
69
}
70
75
public
function
increment
($email, $increment = 1)
76
{
77
$insert = array(
78
"DATE_STAT"
=>
new
Type
\
Date
(),
79
"EMAIL"
=> $email,
80
"CNT"
=> $increment,
81
);
82
$update = array(
83
"CNT"
=>
new
\
Bitrix
\Main\DB\
SqlExpression
(
"?# + ?i"
,
"CNT"
, $increment),
84
);
85
86
Internal\SenderSendCounterTable::mergeData($insert, $update);
87
}
88
}
Bitrix\Main\DB\SqlExpression
Definition
sqlexpression.php:19
Bitrix\Main\Mail\SenderSendCounter
Definition
sendersendcounter.php:14
Bitrix\Main\Mail\SenderSendCounter\increment
increment($email, $increment=1)
Definition
sendersendcounter.php:75
Bitrix\Main\Mail\SenderSendCounter\getMonthly
getMonthly($email)
Definition
sendersendcounter.php:48
Bitrix\Main\Mail\SenderSendCounter\DEFAULT_LIMIT
const DEFAULT_LIMIT
Definition
sendersendcounter.php:15
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Main\ORM\Fields\ExpressionField
Definition
expressionfield.php:25
Bitrix\Main\Type\Date
Definition
date.php:9
Bitrix\Main\Mail
Definition
address.php:8
Bitrix\Main\Type
Definition
collection.php:2
Bitrix
modules
main
lib
mail
sendersendcounter.php
Создано системой
1.10.0