Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
accountvkontakte.php
1
<?
2
3
namespace
Bitrix\Seo\Retargeting\Services
;
4
5
use
Bitrix\Main\Context
;
6
use
Bitrix\Main\Web\Json
;
7
use
Bitrix\Main\Web\Uri
;
8
use \Bitrix\Seo\Retargeting\Account;
9
use
Bitrix\Main\Result
;
10
use
Bitrix\Main\Type\Date
;
11
12
class
AccountVkontakte
extends
Account
13
{
14
const
TYPE_CODE
=
'vkontakte'
;
15
16
protected
static
$listRowMap
= array(
17
'ID'
=>
'ACCOUNT_ID'
,
18
'NAME'
=>
'NAME'
,
19
);
20
21
public
function
getList
()
22
{
23
$result = $this->
getRequest
()->send([
24
'methodName'
=>
'retargeting.account.list'
,
25
]);
26
27
if
($result->isSuccess())
28
{
29
$list = [];
30
while
($item = $result->fetch())
31
{
32
if
(
33
(
34
isset($item[
'CLIENT_NAME'
])
35
|| isset($item[
'NAME'
])
36
)
37
&& isset($item[
'ID'
])
38
)
39
{
40
$list[] = [
41
'NAME'
=> !empty(trim($item[
'CLIENT_NAME'
])) ? $item[
'CLIENT_NAME'
] : $item[
'NAME'
],
42
'ACCOUNT_ID'
=> $item[
'ID'
],
43
];
44
}
45
}
46
$result->setData($list);
47
}
48
49
return
$result;
50
}
51
52
public
function
getProfile
()
53
{
54
$response = $this->
getRequest
()->send(array(
55
'methodName'
=>
'retargeting.profile'
,
56
'parameters'
=> array()
57
));
58
59
if
($response->isSuccess())
60
{
61
$data = $response->fetch();
62
return
array(
63
'ID'
=> $data[
'ID'
],
64
'NAME'
=> $data[
'FIRST_NAME'
] .
' '
. $data[
'LAST_NAME'
],
65
'LINK'
=>
'https://vk.com/'
. $data[
'SCREEN_NAME'
],
66
'PICTURE'
=> (
Context::getCurrent
()->
getRequest
()->isHttps() ?
'https'
:
'http'
)
67
.
'://'
68
.
Context::getCurrent
()->getServer()->getHttpHost() .
'/bitrix/images/seo/integration/vklogo.svg'
,
69
);
70
}
71
72
return
null
;
73
}
74
}
Bitrix\Main\Context\getCurrent
static getCurrent()
Definition
context.php:241
Bitrix\Main\ORM\Data\Result
Definition
result.php:16
Bitrix\Main\Type\Date
Definition
date.php:9
Bitrix\Main\Web\Json
Definition
json.php:11
Bitrix\Main\Web\Uri
Definition
uri.php:17
Bitrix\Seo\Retargeting\Account
Definition
account.php:8
Bitrix\Seo\Retargeting\BaseApiObject\getRequest
getRequest()
Definition
baseapiobject.php:44
Bitrix\Seo\Retargeting\Services\AccountVkontakte
Definition
accountvkontakte.php:13
Bitrix\Seo\Retargeting\Services\AccountVkontakte\$listRowMap
static $listRowMap
Definition
accountvkontakte.php:16
Bitrix\Seo\Retargeting\Services\AccountVkontakte\TYPE_CODE
const TYPE_CODE
Definition
accountvkontakte.php:14
Bitrix\Seo\Retargeting\Services\AccountVkontakte\getList
getList()
Definition
accountvkontakte.php:21
Bitrix\Seo\Retargeting\Services\AccountVkontakte\getProfile
getProfile()
Definition
accountvkontakte.php:52
Bitrix\Main\Context
Definition
culture.php:9
Bitrix\Seo\Retargeting\Services
Definition
accountfacebook.php:3
modules
seo
lib
retargeting
services
accountvkontakte.php
Создано системой
1.10.0