Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Письменов Дмитрий Иванович
/
yourroomads
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b6074aac
authored
Jul 07, 2021
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#20434 Загрузка и синхронизация sitelinks
1 parent
afbd8523
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
app/Service/Requests/Direct/AddSitelinks.php
app/Service/Requests/Direct/GetSitelinks.php
app/Service/Requests/Direct/AddSitelinks.php
View file @
b6074aa
...
...
@@ -29,12 +29,12 @@ class AddSitelinks extends DirectRequest
public
function
getObjectsCount
()
{
return
count
(
$this
->
getParams
()[
'
AdExtension
s'
]);
return
count
(
$this
->
getParams
()[
'
SitelinksSet
s'
]);
}
public
function
slice
(
$maxObjects
)
:
?
APIRequest
{
$splinter
=
$this
->
sliceByKey
(
$maxObjects
,
'
AdExtension
s'
);
$splinter
=
$this
->
sliceByKey
(
$maxObjects
,
'
SitelinksSet
s'
);
$splinter
->
putParams
([
'goalSitelinks'
=>
$this
->
goalSitelinks
->
slice
(
$maxObjects
)
->
values
(),
...
...
@@ -59,9 +59,9 @@ class AddSitelinks extends DirectRequest
$goalSitelink
=
$this
->
goalSitelinks
->
get
(
$key
);
if
(
!
isset
(
$add_result
[
'Id'
]))
{
Log
::
debug
(
"Add
AdExtension
, empty Id"
);
Log
::
debug
(
"Add
Sitelink
, empty Id"
);
Log
::
debug
(
$add_result
);
Log
::
debug
(
$this
->
getParams
()[
'
AdExtension
s'
][
$key
]);
Log
::
debug
(
$this
->
getParams
()[
'
SitelinksSet
s'
][
$key
]);
$goalSitelink
->
update
([
'reserve_create_at'
=>
null
,
...
...
@@ -100,7 +100,7 @@ class AddSitelinks extends DirectRequest
private
function
requestPrepare
(
$params
)
{
$this
->
setService
(
'
AdExtension
s'
);
$this
->
setService
(
'
Sitelink
s'
);
$this
->
setMethod
(
'add'
);
$this
->
putParams
(
$params
);
...
...
@@ -121,7 +121,9 @@ class AddSitelinks extends DirectRequest
return
[
'Sitelinks'
=>
array_map
(
function
(
$link
)
use
(
$list
)
{
return
StrReplaceByVariables
::
getInstance
(
$link
,
$list
)
->
get
();
return
array_map
(
function
(
$value
)
use
(
$list
)
{
return
StrReplaceByVariables
::
getInstance
(
$value
,
$list
)
->
get
();
},
array_filter
(
$link
));
},
$goalSitelink
->
sitelink
->
links
),
];
...
...
app/Service/Requests/Direct/GetSitelinks.php
View file @
b6074aa
...
...
@@ -88,7 +88,7 @@ class GetSitelinks extends DirectRequest
$this
->
setMethod
(
'get'
);
$params
=
[
"FieldNames"
=>
[
"Id"
,
"Sitelinks"
,
"Id"
,
],
"SitelinkFieldNames"
=>
[
"Title"
,
"Href"
,
"Description"
,
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment