Commit c1ebf045 by Vladislav

#20364 Загрузка и синхронизация расширений

1 parent 3bf1442d
......@@ -142,13 +142,21 @@ class GetAdGroups extends DirectRequest
'external_id' => $external_id,
], $data);
$ad_group->negativeKeywordSharedSets()->sync($negative_keyword_shared_sets->pluck('id'));
$negativeKeywordSharedSets_sync = $ad_group->negativeKeywordSharedSets()->sync($negative_keyword_shared_sets->pluck('id'));
if ($ad_group->wasRecentlyCreated) {
$campaign_ids_synced_need[$ad_group->campaign_id] = true;
} elseif ($ad_group->wasChanged(['campaign_id'])) {
$campaign_ids_synced_need[$ad_group->campaign_id] = true;
} elseif ($ad_group->wasChanged($ad_group::getPropertiesWatch()->toArray())) {
} elseif (
$ad_group->wasChanged($ad_group::getPropertiesWatch()->toArray())
||
!empty($negativeKeywordSharedSets_sync['attached'])
||
!empty($negativeKeywordSharedSets_sync['detached'])
||
!empty($negativeKeywordSharedSets_sync['updated'])
) {
$ad_group->goalGroups()->has('dictionaryCampaign')->forExternal()->update([
'updated_need' => Carbon::now(),
]);
......
......@@ -161,18 +161,27 @@ class GetAds extends DirectRequest
'external_id' => $external_id
], $data);
$advertisement->adExtensions()->sync($ad_extensions->pluck('id'));
$adExtensions_sync = $advertisement->adExtensions()->sync($ad_extensions->pluck('id'));
if ($advertisement->wasRecentlyCreated) {
$campaign_ids_synced_need[$advertisement->campaign_id] = true;
} elseif ($advertisement->wasChanged(['campaign_id'])) {
$campaign_ids_synced_need[$advertisement->campaign_id] = true;
} elseif ($advertisement->wasChanged($advertisement::getPropertiesWatch()->toArray())) {
} elseif (
$advertisement->wasChanged($advertisement::getPropertiesWatch()->toArray())
||
!empty($adExtensions_sync['attached'])
||
!empty($adExtensions_sync['detached'])
||
!empty($adExtensions_sync['updated'])
) {
$advertisement->goalAdvertisements()->has('dictionaryCampaign')->forExternal()->update([
'updated_need' => Carbon::now(),
]);
}
} else {
//
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!