1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
dailycounter.php
См. документацию.
1
<?php
8
namespace
Bitrix\Sender\Internals\Model;
9
10
use Bitrix\Main\Entity;
11
use Bitrix\Main\Type;
12
use Bitrix\Main\DB;
13
31
class
DailyCounterTable
extends
Entity\DataManager
32
{
38
public
static
function
getTableName
()
39
{
40
return
'b_sender_counter_daily'
;
41
}
42
48
public
static
function
getMap
()
49
{
50
return
array
(
51
'DATE_STAT'
=>
array
(
52
'data_type'
=>
'date'
,
53
'primary'
=>
true
,
54
),
55
'SENT_CNT'
=>
array
(
56
'data_type'
=>
'integer'
,
57
'default_value'
=> 0,
58
),
59
'TEST_SENT_CNT'
=>
array
(
60
'data_type'
=>
'integer'
,
61
'default_value'
=> 0,
62
),
63
'ERROR_CNT'
=>
array
(
64
'data_type'
=>
'integer'
,
65
'default_value'
=> 0,
66
),
67
'ABUSE_CNT'
=>
array
(
68
'data_type'
=>
'integer'
,
69
'default_value'
=> 0,
70
),
71
);
72
}
73
81
public
static
function
mergeData
(
array
$insert,
array
$update)
82
{
83
$entity
= static::getEntity();
84
$connection
=
$entity
->getConnection();
85
$helper =
$connection
->getSqlHelper();
86
87
$sql = $helper->prepareMerge(
$entity
->getDBTableName(),
$entity
->getPrimaryArray(), $insert, $update);
88
89
$sql = current($sql);
90
if
($sql <>
''
)
91
{
92
$connection
->queryExecute($sql);
93
$entity
->cleanCache();
94
}
95
}
96
104
public
static
function
incrementFieldValue
($fieldName, $increment = 1)
105
{
106
if
(!array_key_exists($fieldName, static::getMap()))
107
{
108
return
;
109
}
110
111
$insert =
array
(
112
"DATE_STAT"
=>
new
Type
\
Date
(),
113
$fieldName => $increment,
114
);
115
116
117
$update =
array
(
118
$fieldName =>
new
DB
\
SqlExpression
(
"?# + ?i"
, $fieldName, $increment),
119
);
120
121
static::mergeData($insert, $update);
122
}
123
130
public
static
function
getCurrentFieldValue
($fieldName)
131
{
132
if
(!array_key_exists($fieldName, static::getMap()))
133
{
134
return
0;
135
}
136
137
$result
= static::getRowByDate();
138
return
(
$result
&& isset(
$result
[$fieldName])) ? (int)
$result
[$fieldName] : 0;
139
}
140
147
public
static
function
getRowByDate
($daysLeft = 0)
148
{
149
$date =
new
Type\Date
;
150
if
($daysLeft)
151
{
152
$date->add(
"-$daysLeft day"
);
153
}
154
155
return
static::getRow(
array
(
156
"filter"
=>
array
(
"=DATE_STAT"
=> $date),
157
"cache"
=>
array
(
"ttl"
=> 60)
158
));
159
}
160
}
$connection
$connection
Определения
actionsdefinitions.php:38
Bitrix\Main\Access\Entity\DataManager
Определения
datamanager.php:15
Bitrix\Main\DB\SqlExpression
Определения
sqlexpression.php:21
Bitrix\Main\Type\Date
Определения
date.php:9
Bitrix\Sender\Internals\Model\DailyCounterTable
Определения
dailycounter.php:32
Bitrix\Sender\Internals\Model\DailyCounterTable\getMap
static getMap()
Определения
dailycounter.php:48
Bitrix\Sender\Internals\Model\DailyCounterTable\incrementFieldValue
static incrementFieldValue($fieldName, $increment=1)
Определения
dailycounter.php:104
Bitrix\Sender\Internals\Model\DailyCounterTable\getRowByDate
static getRowByDate($daysLeft=0)
Определения
dailycounter.php:147
Bitrix\Sender\Internals\Model\DailyCounterTable\getCurrentFieldValue
static getCurrentFieldValue($fieldName)
Определения
dailycounter.php:130
Bitrix\Sender\Internals\Model\DailyCounterTable\mergeData
static mergeData(array $insert, array $update)
Определения
dailycounter.php:81
Bitrix\Sender\Internals\Model\DailyCounterTable\getTableName
static getTableName()
Определения
dailycounter.php:38
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
$entity
$entity
Определения
group_bizproc_workflow_delete.php:17
Bitrix\Main\DB
Определения
arrayresult.php:2
Bitrix\Main\Type
Определения
collection.php:2
bitrix
modules
sender
lib
internals
model
dailycounter.php
Создано системой
1.14.0