Commit 8b8d77fc by Евгений

Улучшение #20443

Загрузка и синхронизация изображений
1 parent 5d378d10
......@@ -53,6 +53,11 @@ class AdvertisementsAdd extends Command
->join('advertisements', 'goal_advertisements.advertisement_id', '=', 'advertisements.id')
->leftJoin('goal_advertisement_goal_ad_extensions', 'goal_advertisements.id', '=', 'goal_advertisement_goal_ad_extensions.goal_advertisement_id')
->leftJoin('goal_ad_extensions', 'goal_advertisement_goal_ad_extensions.goal_ad_extension_id', '=', 'goal_ad_extensions.id')
->leftJoin('ad_images', 'advertisements.ad_image_hash', '=', 'ad_images.hash')
->leftJoin('goal_ad_images', function($join) use ($token) {
$join->on('goal_ad_images.ad_image_id', '=', 'ad_images.id');
$join->on('goal_ad_images.token_id', '=', $token->id);
})
->whereNotExists(function (Builder $query) {
$query->select(DB::raw(1))
->from('goal_advertisement_goal_ad_extensions')
......@@ -91,7 +96,7 @@ class AdvertisementsAdd extends Command
'advertisements.href as href',
'advertisements.display_url_path as display_url_path',
'goal_advertisements.goal_v_card_external_id as goal_v_card_external_id',
'advertisements.ad_image_hash as ad_image_hash',
'goal_ad_images.hash as ad_image_hash',
'goal_advertisements.goal_sitelink_external_id as goal_sitelink_external_id',
DB::raw('JSON_ARRAYAGG(goal_ad_extensions.external_id) as ad_extension_ids'),
'advertisements.ad_extensions as ad_extensions',
......
......@@ -52,6 +52,11 @@ class AdvertisementsUpdate extends Command
->join('advertisements', 'goal_advertisements.advertisement_id', '=', 'advertisements.id')
->leftJoin('goal_advertisement_goal_ad_extensions', 'goal_advertisements.id', '=', 'goal_advertisement_goal_ad_extensions.goal_advertisement_id')
->leftJoin('goal_ad_extensions', 'goal_advertisement_goal_ad_extensions.goal_ad_extension_id', '=', 'goal_ad_extensions.id')
->leftJoin('ad_images', 'advertisements.ad_image_hash', '=', 'ad_images.hash')
->leftJoin('goal_ad_images', function($join) use ($token) {
$join->on('goal_ad_images.ad_image_id', '=', 'ad_images.id');
$join->on('goal_ad_images.token_id', '=', DB::raw($token->id) );
})
->whereNotExists(function (Builder $query) {
$query->select(DB::raw(1))
->from('goal_advertisement_goal_ad_extensions')
......@@ -89,7 +94,7 @@ class AdvertisementsUpdate extends Command
'advertisements.href as href',
'advertisements.display_url_path as display_url_path',
'goal_advertisements.goal_v_card_external_id as goal_v_card_external_id',
'advertisements.ad_image_hash as ad_image_hash',
'goal_ad_images.hash as ad_image_hash',
'goal_advertisements.goal_sitelink_external_id as goal_sitelink_external_id',
DB::raw("JSON_ARRAYAGG(JSON_OBJECT('AdExtensionId', goal_ad_extensions.external_id, 'Operation', 'SET')) as ad_extensions"),
'advertisements.video_extension as video_extension',
......
......@@ -7,6 +7,7 @@ use App\Console\Commands\AdExtensionsLoad;
use App\Console\Commands\AdGroupsAdd;
use App\Console\Commands\AdGroupsLoadUpdated;
use App\Console\Commands\AdGroupsUpdate;
use App\Console\Commands\AdImagesAdd;
use App\Console\Commands\AdImagesLoad;
use App\Console\Commands\AdvertisementsAdd;
use App\Console\Commands\AdvertisementsLoadUpdated;
......@@ -92,6 +93,7 @@ class Kernel extends ConsoleKernel
$schedule->command(VCardsLoad::class)->hourlyAt(25);
$schedule->command(VCardsAdd::class)->hourlyAt(35);
$schedule->command(AdImagesAdd::class)->hourlyAt(35);
$schedule->command(AdExtensionsAdd::class)->hourlyAt(35);
$schedule->command(SitelinksAdd::class)->hourlyAt(35);
$schedule->command(NegativeKeywordSharedSetsAdd::class)->hourlyAt(35);
......
......@@ -56,7 +56,7 @@ return [
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'strict' => false,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!