Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
marketingservice.php
1
<?php
9
namespace
Bitrix\Sender\Integration\Seo\Ads
;
10
11
use
Bitrix\Main\Loader
;
12
use
Bitrix\Sender\Integration
;
13
use
Bitrix\Seo\Marketing
;
14
19
class
MarketingService
20
{
26
public
static
function
canUse
()
27
{
28
if
(!Loader::includeModule(
'seo'
))
29
{
30
return
false
;
31
}
32
33
return
Marketing\Configurator::canUse();
34
}
35
41
public
static
function
isAvailable
()
42
{
43
return
self::canUse
() && Integration\Bitrix24\Service::isAdAvailable();
44
}
45
51
public
static
function
getTypeMap
()
52
{
53
return
[
54
MessageMarketingFb::CODE
=> Marketing\Service::TYPE_FACEBOOK
55
];
56
}
57
64
public
static
function
getAdsProvider
($adsType, $clientId =
null
)
65
{
66
$service = Marketing\Configurator::getService();
67
$service->setClientId($clientId);
68
$providers = Marketing\Configurator::getProviders([$adsType]);
69
$isFound =
false
;
70
$provider = array();
71
foreach
($providers as $type => $provider)
72
{
73
if
($type == $adsType)
74
{
75
$isFound =
true
;
76
break
;
77
}
78
}
79
80
if
(!$isFound)
81
{
82
return
null
;
83
}
84
85
return
$provider;
86
}
87
95
public
static
function
send
(\stdClass $config, array $contacts)
96
{
97
if
(!static::canUse())
98
{
99
return
false
;
100
}
101
//
102
// $audience = Marketing\Service::getAudience($config->type);
103
// $audience->setAccountId($config->accountId);
104
// $audience->enableQueueMode();
105
106
// if ($config->autoRemoveDayNumber)
107
// {
108
// $audience->enableQueueAutoRemove($config->autoRemoveDayNumber);
109
// }
110
// else
111
// {
112
// $audience->disableQueueAutoRemove();
113
// }
114
//
115
// $audienceImportResult = $audience->addContacts(
116
// $config->audienceId,
117
// $contacts,
118
// array(
119
// 'type' => $config->contactType
120
// )
121
// );
122
//
123
// return $audienceImportResult->isSuccess();
124
return
true
;
125
}
126
}
Bitrix\Main\Loader
Definition
loader.php:12
Bitrix\Sender\Integration\Seo\Ads\MarketingService
Definition
marketingservice.php:20
Bitrix\Sender\Integration\Seo\Ads\MarketingService\getTypeMap
static getTypeMap()
Definition
marketingservice.php:51
Bitrix\Sender\Integration\Seo\Ads\MarketingService\canUse
static canUse()
Definition
marketingservice.php:26
Bitrix\Sender\Integration\Seo\Ads\MarketingService\send
static send(\stdClass $config, array $contacts)
Definition
marketingservice.php:95
Bitrix\Sender\Integration\Seo\Ads\MarketingService\isAvailable
static isAvailable()
Definition
marketingservice.php:41
Bitrix\Sender\Integration\Seo\Ads\MarketingService\getAdsProvider
static getAdsProvider($adsType, $clientId=null)
Definition
marketingservice.php:64
Bitrix\Sender\Integration\Seo\Ads\MessageMarketingFb\CODE
const CODE
Definition
messagemarketingfb.php:28
Bitrix\Sender\Integration\Seo\Ads
Definition
marketingservice.php:9
Bitrix\Sender\Integration
Bitrix\Seo\Marketing
Definition
account.php:3
modules
sender
lib
integration
seo
ads
marketingservice.php
Создано системой
1.10.0