Commit 4dda251f by Vladislav

fix KeywordsDelete

1 parent 9753f212
Showing with 4 additions and 9 deletions
...@@ -41,15 +41,6 @@ class KeywordsDelete extends Command ...@@ -41,15 +41,6 @@ class KeywordsDelete extends Command
*/ */
public function handle() public function handle()
{ {
$tokens = Tokens::whereHas('dictionaryCampaignsForExternalWithTrashed.goalKeywordsDelete')
->with([
'dictionaryCampaignsForExternalWithTrashed.goalKeywordsDelete',
])
->where('type', '!=', Tokens::MAIN)
->get();
foreach (Tokens::where('type', '!=', Tokens::MAIN)->get() as $token) { foreach (Tokens::where('type', '!=', Tokens::MAIN)->get() as $token) {
$sql = "SELECT gk.external_id $sql = "SELECT gk.external_id
FROM goal_keywords gk FROM goal_keywords gk
...@@ -63,6 +54,10 @@ class KeywordsDelete extends Command ...@@ -63,6 +54,10 @@ class KeywordsDelete extends Command
$ids[] = $item->external_id; $ids[] = $item->external_id;
} }
if (!count($ids)) {
continue;
}
$factory = APIRequest::getInstance(API::YANDEX); $factory = APIRequest::getInstance(API::YANDEX);
$factory->setToken($token); $factory->setToken($token);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!