Commit f479c136 by Vladislav

fix both in app/Console/Commands/CampaignsAdd.php

2 parents e93b717c 2a6e24be
......@@ -63,11 +63,12 @@ class CampaignsResume extends Command
*/
$tokens = Tokens::whereHas('dictionaryCampaignsEnabledForExternalDisabled')
->with([
'dictionaryCampaignsEnabledForExternalDisabled' => function (HasManyThrough $query) {
return $query->limit(1000);
},
])->where('type', '!=', Tokens::MAIN)
// ->with([
// 'dictionaryCampaignsEnabledForExternalDisabled' => function (HasManyThrough $query) {
// return $query->limit(1000);
// },
// ])
->where('type', '!=', Tokens::MAIN)
->get();
foreach ($tokens as $token) {
......
......@@ -62,11 +62,12 @@ class CampaignsSuspend extends Command
*/
$tokens = Tokens::whereHas('dictionaryCampaignsNotEnabledForExternalNotDisabled')
->with([
'dictionaryCampaignsNotEnabledForExternalNotDisabled' => function (HasManyThrough $query) {
return $query->limit(1000);
},
])->where('type', '!=', Tokens::MAIN)
// ->with([
// 'dictionaryCampaignsNotEnabledForExternalNotDisabled' => function (HasManyThrough $query) {
// return $query->limit(1000);
// },
// ])
->where('type', '!=', Tokens::MAIN)
->get();
foreach ($tokens as $token) {
......
......@@ -43,12 +43,13 @@ class CampaignsUpdate extends Command
public function handle()
{
$tokens = Tokens::whereHas('dictionaryCampaignsEnabledForExternalNeedUpdated')
->with([
'dictionaryCampaignsEnabledForExternalNeedUpdated' => function (HasManyThrough $query) {
return $query->limit(10);
},
'dictionaryCampaignsEnabledForExternalNeedUpdated.campaign'
])->where('type', '!=', Tokens::MAIN)
// ->with([
// 'dictionaryCampaignsEnabledForExternalNeedUpdated' => function (HasManyThrough $query) {
// return $query->limit(10);
// },
// 'dictionaryCampaignsEnabledForExternalNeedUpdated.campaign'
// ])
->where('type', '!=', Tokens::MAIN)
->get();
foreach ($tokens as $token) {
......
......@@ -12,6 +12,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
class ProcessCallAPI implements ShouldQueue
{
......@@ -57,7 +58,13 @@ class ProcessCallAPI implements ShouldQueue
}
}
$response = $api->execute();
$limits->acceptRezerv($this->limitId, new HeaderLimits($response->headers()));
try{
$limits->acceptRezerv($this->limitId, new HeaderLimits($response->headers()));
}catch(\Exception $e){
Log::debug($e);
Log::debug($response->headers());
}
//TODO: обработать результат.
// если не хватило баллов на все что хотели запросить, то в очередь отправляем новый запрос на получение новых данных
AdsHandler::getInstance($this->api)->handle($response);
......
......@@ -68,7 +68,7 @@ class DirectRequest extends APIRequest
$request->setToken($this->getToken());
return $request;
}
throw new Exception('Unknown Service or Method');
throw new \Exception('Unknown Service or Method');
return $this;
}
......
......@@ -19,8 +19,8 @@ class CreateDictionaryCampaignsTable extends Migration
$table->bigInteger('campaign_id')->unsigned();
$table->bigInteger('dictionary_id')->unsigned();
$table->string('name', 255)->nullable();
$table->text('negative_keywords')->nullable();
$table->text('excluded_sites')->nullable();
$table->json('negative_keywords')->nullable();
$table->json('excluded_sites')->nullable();
$table->boolean('synced')->default(1);
$table->boolean('updated')->default(1);
$table->boolean('enabled')->default(1);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!