Commit 29956596 by Vladislav

#20794 Сделать чтобы в целевых РК оставалась одна карточка

1 parent 2e2195e1
...@@ -63,6 +63,7 @@ class DictionaryCampaignsSyncByCampaign extends Command ...@@ -63,6 +63,7 @@ class DictionaryCampaignsSyncByCampaign extends Command
INNER JOIN tokens t on t.type != '" . Tokens::MAIN . "' INNER JOIN tokens t on t.type != '" . Tokens::MAIN . "'
LEFT JOIN goal_ad_images gai on ai.id = gai.ad_image_id and t.id = gai.token_id LEFT JOIN goal_ad_images gai on ai.id = gai.ad_image_id and t.id = gai.token_id
WHERE gai.id is null and gai.deleted_at is null WHERE gai.id is null and gai.deleted_at is null
AND ai.hash != 'IJUw9SYfLo1BvIqO_xnP5A'
"); ");
$this->info('goal_ad_images successful!'); $this->info('goal_ad_images successful!');
......
...@@ -64,7 +64,7 @@ class AddAdImages extends DirectRequest ...@@ -64,7 +64,7 @@ class AddAdImages extends DirectRequest
'token_id' => $this->getToken()->getKey(), 'token_id' => $this->getToken()->getKey(),
'service' => $this->getService(), 'service' => $this->getService(),
'method' => $this->getMethod(), 'method' => $this->getMethod(),
'params' => $data, 'params' => ['Name' => $data['Name']],
'errors' => $add_result['Errors'], 'errors' => $add_result['Errors'],
]); ]);
......
...@@ -83,17 +83,21 @@ class AddKeywords extends DirectRequest ...@@ -83,17 +83,21 @@ class AddKeywords extends DirectRequest
continue; continue;
} elseif (isset($add_result['Errors']) && count($add_result['Errors'])) { } elseif (isset($add_result['Errors']) && count($add_result['Errors'])) {
$goalKeyword->errors()->create([ $model = GoalKeyword::whereId($goalKeyword->id)->first();
'token_id' => $this->getToken()->getKey(),
'service' => $this->getService(), if ($model) {
'method' => $this->getMethod(), $model->errors()->create([
'params' => $data, 'token_id' => $this->getToken()->getKey(),
'errors' => $add_result['Errors'], 'service' => $this->getService(),
]); 'method' => $this->getMethod(),
$goalKeyword->update([ 'params' => $data,
'reserve_create_at' => null, 'errors' => $add_result['Errors'],
]); ]);
continue; $model->update([
'reserve_create_at' => null,
]);
continue;
}
} }
Log::debug("AddKeywords, empty Id"); Log::debug("AddKeywords, empty Id");
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!