2namespace Bitrix\MessageService\Sender;
4use Bitrix\Main\Config\Option;
5use Bitrix\MessageService\Internal\Entity\MessageTable;
9 private static $options;
10 private static $optionName =
'sender.limitation.daily';
11 private static $defaultLimit = 0;
16 $counts = MessageTable::getAllDailyCount();
20 $sid = $sender->getId();
21 foreach ($sender->getFromList() as $from)
23 $key = $sid.
':'.$from[
'id'];
26 'fromId' => $from[
'id'],
27 'limit' => static::getDailyLimit($sid, $from[
'id']),
28 'current' => isset($counts[
$key]) ? $counts[
$key] : 0
40 foreach ($sender->getFromList() as $from)
42 $limit = static::getDailyLimit($sender->getId(), $from[
'id']);
43 if (isset($limit) && $limit > 0)
55 $key = $senderId .
':' . $fromId;
56 return static::getOption(
$key, static::$defaultLimit);
61 $key = $senderId .
':' . $fromId;
62 static::setOption(
$key, (
int)$limit);
63 MessageTable::returnDeferredToQueue($senderId, $fromId);
69 $limit = static::getDailyLimit($senderId, $fromId);
72 $current = MessageTable::getDailyCount($senderId, $fromId);
74 return ($current < $limit);
81 $time = static::getOption(
'retryTime', [
96 'auto' => (bool)
$params[
'auto'],
100 static::setOption(
'retryTime',
$result);
112 Option::set(
'messageservice', static::$optionName, serialize(
$options));
121 private static function getOptions()
123 if (static::$options ===
null)
125 $optionsString = Option::get(
'messageservice', static::$optionName);
128 static::$options = unserialize($optionsString, [
'allowed_classes' =>
false]);
131 if (!is_array(static::$options))
133 static::$options =
array();
136 return static::$options;
147 private static function setOption($optionName,
$optionValue)
149 $options = static::getOptions();
150 if (!isset($options[$optionName]) || $options[$optionName] !==
$optionValue)
153 static::setOptions($options);
165 private static function getOption($optionName,
$defaultValue =
null)
167 $options = static::getOptions();
168 return isset($options[$optionName]) ? $options[$optionName] :
$defaultValue;
177 static::$options =
array();
178 Option::delete(
'messageservice',
array(
'name' => static::$optionName));
if($_SERVER $defaultValue['REQUEST_METHOD']==="GET" &&!empty($RestoreDefaults) && $bizprocPerms==="W" &&check_bitrix_sessid())
static getDailyLimit($senderId, $fromId)
static setDailyLimit($senderId, $fromId, $limit)
static checkDailyLimit($senderId, $fromId)
static setRetryTime(array $params)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
CheckSerializedData($str, $max_depth=200)
if(empty($signedUserToken)) $key
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']