Commit 29956596 by Vladislav

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

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