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 a564d7b1
authored
Aug 31, 2021
by
Vladislav
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#20794 Сделать чтобы в целевых РК оставалась одна карточка
1 parent
f09c1351
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
24 deletions
app/Service/Requests/Direct/GetAdGroups.php
app/Service/Requests/Direct/GetAdGroups.php
View file @
a564d7b
...
@@ -80,7 +80,6 @@ class GetAdGroups extends DirectRequest
...
@@ -80,7 +80,6 @@ class GetAdGroups extends DirectRequest
}
}
$campaign_ids_synced_need
=
[];
$campaign_ids_synced_need
=
[];
$now
=
Carbon
::
now
();
foreach
(
$response
[
'result'
][
'AdGroups'
]
as
$ad_group
)
{
foreach
(
$response
[
'result'
][
'AdGroups'
]
as
$ad_group
)
{
...
@@ -118,7 +117,7 @@ class GetAdGroups extends DirectRequest
...
@@ -118,7 +117,7 @@ class GetAdGroups extends DirectRequest
'serving_status'
=>
$ad_group
[
'ServingStatus'
],
'serving_status'
=>
$ad_group
[
'ServingStatus'
],
'restricted_region_ids'
=>
$ad_group
[
'RestrictedRegionIds'
],
'restricted_region_ids'
=>
$ad_group
[
'RestrictedRegionIds'
],
'updated_self'
=>
null
,
'updated_self'
=>
null
,
'updated_at'
=>
$now
,
'updated_at'
=>
Carbon
::
now
()
,
'deleted_at'
=>
null
,
'deleted_at'
=>
null
,
];
];
...
@@ -169,35 +168,28 @@ class GetAdGroups extends DirectRequest
...
@@ -169,35 +168,28 @@ class GetAdGroups extends DirectRequest
$negativeKeywordSharedSets_sync
=
$ad_group
->
negativeKeywordSharedSets
()
->
sync
(
$negative_keyword_shared_sets
->
pluck
(
'id'
));
$negativeKeywordSharedSets_sync
=
$ad_group
->
negativeKeywordSharedSets
()
->
sync
(
$negative_keyword_shared_sets
->
pluck
(
'id'
));
if
(
}
!
empty
(
$this
->
getParams
()[
'SelectionCriteria'
][
'CampaignIds'
])
&&
}
!
isset
(
$response
[
'result'
][
'LimitedBy'
])
)
{
if
(
$this
->
getToken
()
->
isMain
())
{
$campaign_ids
=
$this
->
getParams
()[
'SelectionCriteria'
][
'CampaignIds'
];
if
(
!
empty
(
$this
->
getParams
()[
'SelectionCriteria'
][
'CampaignIds'
])
&&
!
isset
(
$response
[
'result'
][
'LimitedBy'
])
)
{
$campaign_ids
=
$this
->
getParams
()[
'SelectionCriteria'
][
'CampaignIds'
];
DB
::
update
(
"UPDATE ad_groups ag
DB
::
update
(
"UPDATE ad_groups ag
INNER JOIN campaigns ca ON ag.campaign_id = ca.id
INNER JOIN campaigns ca ON ag.campaign_id = ca.id
SET ag.deleted_at =
CURRENT_TIMESTAMP
SET ag.deleted_at =
now()
WHERE ca.groups_loaded_at IS NOT NULL
WHERE ca.groups_loaded_at IS NOT NULL
AND ag.updated_at <= ca.groups_loaded_at
AND ag.updated_at <= ca.groups_loaded_at
AND ag.deleted_at is null
AND ag.deleted_at is null
AND ca.external_id in ("
.
implode
(
", "
,
$campaign_ids
)
.
")"
);
AND ca.external_id in ("
.
implode
(
", "
,
$campaign_ids
)
.
")"
);
Campaigns
::
whereIn
(
'external_id'
,
$campaign_ids
)
Campaigns
::
whereIn
(
'external_id'
,
$campaign_ids
)
->
update
([
'groups_loaded_at'
=>
Carbon
::
now
(),
]);
}
}
}
if
(
$this
->
getToken
()
->
isMain
())
{
if
(
isset
(
$this
->
getParams
()[
'SelectionCriteria'
][
'CampaignIds'
]))
{
Campaigns
::
whereIn
(
'external_id'
,
$this
->
getParams
()[
'SelectionCriteria'
][
'CampaignIds'
])
->
update
([
->
update
([
'groups_loaded_at'
=>
Carbon
::
now
(),
'groups_loaded_at'
=>
Carbon
::
now
(),
]);
]);
...
...
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