Commit c7d4f915 by Vladislav

#20695 Отключение объявлений

1 parent 0cd0b7c0
Showing with 30 additions and 3 deletions
......@@ -44,15 +44,42 @@ class ArchiveAds extends DirectRequest
if (!isset($archive_result['Id'])) {
Log::debug("ArchiveAds, empty Id");
Log::debug($archive_result);
Log::debug($this->getParams()['SelectionCriteria']['Ids'][$key]);
$external_id = $this->getParams()['SelectionCriteria']['Ids'][$key];
Log::debug($external_id);
/*
* array (
* 0 =>
* array (
* 'Code' => 8300,
* 'Message' => 'Invalid object status',
* 'Details' => 'Ad is a draft and cannot be archived',
* ),
* )
*/
if (isset($archive_result['Errors'][0]['Code']) == 8300) {
if ($this->getToken()->isMain()) {
Advertisement::whereExternalId($external_id)
->update([
'archived_need' => null,
'reserve_archive_at' => null,
]);
} else {
GoalAdvertisement::whereExternalId($external_id)
->update([
'archived_need' => null,
'reserve_archive_at' => null,
]);
}
}
if ($this->getToken()->isMain()) {
Advertisement::whereExternalId($this->getParams()['SelectionCriteria']['Ids'][$key])
Advertisement::whereExternalId($external_id)
->update([
'reserve_archive_at' => null,
]);
} else {
GoalAdvertisement::whereExternalId($this->getParams()['SelectionCriteria']['Ids'][$key])
GoalAdvertisement::whereExternalId($external_id)
->update([
'reserve_archive_at' => null,
]);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!