Commit 5325dac4 by Vladislav

#22080 Физически удалены РК с целевых токенах

1 parent b863e82a
......@@ -377,6 +377,26 @@ class DictionaryCampaignsSyncByCampaign extends Command
$this->info('update goal_advertisements.dictionary_campaign_external_id successful!');
DB::update("
UPDATE goal_advertisements ga
INNER JOIN goal_sitelinks gs on ga.goal_sitelink_id = gs.id AND gs.external_id is not null AND gs.updated_need is null AND gs.deleted_at is null
SET ga.goal_sitelink_external_id = gs.external_id,
ga.updated_at = CURRENT_TIMESTAMP
WHERE ga.deleted_at IS NULL
AND ga.goal_sitelink_external_id IS NULL
");
$this->info('update goal_advertisements.goal_sitelink_external_id successful!');
DB::update("
UPDATE goal_advertisements ga
LEFT JOIN goal_v_cards gvc on ga.goal_v_card_id = gvc.id AND gvc.external_id is not null AND gvc.deleted_at is null
SET ga.goal_v_card_external_id = gvc.external_id,
ga.updated_at = CURRENT_TIMESTAMP
WHERE ga.deleted_at IS NULL
AND ga.goal_v_card_external_id IS NULL
");
$this->info('update goal_advertisements.goal_v_card_external_id successful!');
DB::update("
UPDATE goal_bid_modifiers gbm
INNER JOIN dictionary_campaigns dc ON dc.id = gbm.dictionary_campaign_id AND dc.external_id IS NOT NULL AND dc.deleted_at IS NULL
SET gbm.dictionary_campaign_external_id = dc.external_id,
......
......@@ -78,7 +78,15 @@ class ArchiveAds extends DirectRequest
* ),
* )
*/
if (isset($archive_result['Errors'][0]['Code']) == 8300) {
if (
isset($archive_result['Errors'][0]['Code'])
&&
$archive_result['Errors'][0]['Code'] == 8300
&&
isset($add_result['Errors'][0]['Details'])
&&
$archive_result['Errors'][0]['Details'] === 'Ad is a draft and cannot be archived'
) {
if ($this->getToken()->isMain()) {
Advertisement::whereExternalId($external_id)
->update([
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!