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 88186ddc
authored
Jun 09, 2021
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#19472 Синхронизация групп с целевыми
1 parent
422f5e7d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
11 deletions
app/Jobs/ProcessCallAPI.php
app/Service/Requests/Direct/CheckChanges.php
app/Service/Requests/Direct/GetAdGroups.php
app/Service/Requests/Direct/GetCampaigns.php
app/Jobs/ProcessCallAPI.php
View file @
88186dd
...
@@ -58,22 +58,17 @@ class ProcessCallAPI implements ShouldQueue
...
@@ -58,22 +58,17 @@ class ProcessCallAPI implements ShouldQueue
}
}
}
}
$response
=
$api
->
execute
();
$response
=
$api
->
execute
();
try
{
$limits
->
acceptRezerv
(
$this
->
limitId
,
new
HeaderLimits
(
$response
->
headers
()));
$limits
->
acceptRezerv
(
$this
->
limitId
,
new
HeaderLimits
(
$response
->
headers
()));
}
catch
(
\Exception
$e
){
Log
::
debug
(
$e
);
Log
::
debug
(
$response
->
headers
());
}
//TODO: обработать результат.
//TODO: обработать результат.
// если не хватило баллов на все что хотели запросить, то в очередь отправляем новый запрос на получение новых данных
// если не хватило баллов на все что хотели запросить, то в очередь отправляем новый запрос на получение новых данных
AdsHandler
::
getInstance
(
$this
->
api
)
->
handle
(
$response
);
AdsHandler
::
getInstance
(
$this
->
api
)
->
handle
(
$response
);
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
\Log
::
debug
(
$e
);
//TODO: надо отдельно выделить ошибки вызовов, за которые списываются баллы
//TODO: надо отдельно выделить ошибки вызовов, за которые списываются баллы
//https://yandex.ru/dev/direct/doc/dg/concepts/errors.html
//https://yandex.ru/dev/direct/doc/dg/concepts/errors.html
Log
::
debug
(
$e
);
Log
::
debug
(
$e
);
$limits
->
removeRezerv
(
$this
->
limitId
);
$limits
->
removeRezerv
(
$this
->
limitId
);
throw
$e
;
}
}
}
}
}
}
app/Service/Requests/Direct/CheckChanges.php
View file @
88186dd
...
@@ -16,6 +16,9 @@ use Illuminate\Support\Facades\Log;
...
@@ -16,6 +16,9 @@ use Illuminate\Support\Facades\Log;
class
CheckChanges
extends
DirectRequest
class
CheckChanges
extends
DirectRequest
{
{
protected
$max_count
=
-
1
;
protected
$max_count
=
-
1
;
protected
$max_count_CampaignIds
=
3000
;
protected
$max_count_AdGroupIds
=
10000
;
protected
$max_count_AdIds
=
50000
;
public
function
call
(
$params
=
null
)
public
function
call
(
$params
=
null
)
{
{
...
@@ -124,15 +127,15 @@ class CheckChanges extends DirectRequest
...
@@ -124,15 +127,15 @@ class CheckChanges extends DirectRequest
$this
->
setMethod
(
'check'
);
$this
->
setMethod
(
'check'
);
if
(
isset
(
$params
[
'CampaignIds'
])){
if
(
isset
(
$params
[
'CampaignIds'
])){
$this
->
max_count
=
3000
;
$this
->
max_count
=
$this
->
max_count_CampaignIds
;
}
}
if
(
isset
(
$params
[
'AdGroupIds'
])){
if
(
isset
(
$params
[
'AdGroupIds'
])){
$this
->
max_count
=
10000
;
$this
->
max_count
=
$this
->
max_count_AdGroupIds
;
}
}
if
(
isset
(
$params
[
'AdIds'
])){
if
(
isset
(
$params
[
'AdIds'
])){
$this
->
max_count
=
50000
;
$this
->
max_count
=
$this
->
max_count_AdIds
;
}
}
$this
->
setParams
(
$params
);
$this
->
setParams
(
$params
);
...
...
app/Service/Requests/Direct/GetAdGroups.php
View file @
88186dd
...
@@ -16,6 +16,7 @@ use Illuminate\Support\Facades\Log;
...
@@ -16,6 +16,7 @@ use Illuminate\Support\Facades\Log;
class
GetAdGroups
extends
DirectRequest
class
GetAdGroups
extends
DirectRequest
{
{
protected
$max_count
=
10000
;
protected
$max_count
=
10000
;
protected
$max_count_CampaignIds
=
10
;
function
call
(
$params
=
null
)
function
call
(
$params
=
null
)
{
{
...
@@ -156,6 +157,9 @@ class GetAdGroups extends DirectRequest
...
@@ -156,6 +157,9 @@ class GetAdGroups extends DirectRequest
],
],
];
];
if
(
isset
(
$filter
[
'CampaignIds'
]))
{
if
(
isset
(
$filter
[
'CampaignIds'
]))
{
$this
->
max_count
=
$this
->
max_count_CampaignIds
;
$params
[
'SelectionCriteria'
]
=
[
$params
[
'SelectionCriteria'
]
=
[
'CampaignIds'
=>
$filter
[
'CampaignIds'
],
'CampaignIds'
=>
$filter
[
'CampaignIds'
],
];
];
...
...
app/Service/Requests/Direct/GetCampaigns.php
View file @
88186dd
...
@@ -11,7 +11,7 @@ use Illuminate\Support\Facades\Log;
...
@@ -11,7 +11,7 @@ use Illuminate\Support\Facades\Log;
class
GetCampaigns
extends
DirectRequest
class
GetCampaigns
extends
DirectRequest
{
{
protected
$max_count
=
1000
0
;
protected
$max_count
=
1000
;
protected
$timestamp
;
protected
$timestamp
;
public
function
call
(
$params
=
null
)
public
function
call
(
$params
=
null
)
...
...
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