From 1b38f977ec483f938bbc79bea5ecb9ce3c9ee3ae Mon Sep 17 00:00:00 2001 From: hgc Date: Wed, 26 Feb 2025 22:14:32 +0800 Subject: [PATCH] update --- app/command/SyncGoogleAdsAsset.php | 59 ------------------------------ composer.json | 3 +- composer.lock | 55 +++++++++++++++++++++++++++- 3 files changed, 56 insertions(+), 61 deletions(-) delete mode 100644 app/command/SyncGoogleAdsAsset.php diff --git a/app/command/SyncGoogleAdsAsset.php b/app/command/SyncGoogleAdsAsset.php deleted file mode 100644 index a941dd3..0000000 --- a/app/command/SyncGoogleAdsAsset.php +++ /dev/null @@ -1,59 +0,0 @@ -setName('sync:google_ads_asset') - ->setDescription('Synchronize Google Ads Asset relations'); - } - - protected function execute(Input $input, Output $output) - { - // 获取所有素材 - $assets = GoogleAdsAsset::where('status', 1)->select(); - - foreach ($assets as $asset) { - // 获取广告表中的所有广告 - $ads = GoogleAdsAd::where('status', 1)->select(); - - foreach ($ads as $ad) { - // 检查广告的 metadata 是否包含素材的 resource_name - if (isset($ad->metadata) && strpos($ad->metadata, $asset->resource_name) !== false) { - // 插入关联记录 - $existingRelation = GoogleAdsAssetRelations::where('asset_id', $asset->asset_id) - ->where('ad_id', $ad->ad_id) - ->where('date', date('Y-m-d')) - ->find(); - - if (!$existingRelation) { - // 如果没有现有记录,则插入新的关联 - GoogleAdsAssetRelations::create([ - 'asset_id' => $asset->asset_id, - 'ad_id' => $ad->ad_id, - 'ad_group_id' => $ad->ad_group_id, - 'campaign_id' => $ad->campaign_id, - 'date' => date('Y-m-d') - ]); - - $output->writeln("Inserted relation for Asset ID: {$asset->asset_id} and Ad ID: {$ad->ad_id}"); - } else { - $output->writeln("Relation already exists for Asset ID: {$asset->asset_id} and Ad ID: {$ad->ad_id}"); - } - } - } - } - - $output->writeln('Google Ads Asset synchronization completed.'); - } -} diff --git a/composer.json b/composer.json index 99bd6f6..a3c396b 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,8 @@ "firebase/php-jwt": "^6.10", "spiral/roadrunner-cli": "^2.6", "spiral/roadrunner-grpc": "^3.4", - "webman/redis-queue": "^1.3" + "webman/redis-queue": "^1.3", + "webman/console": "^v1.2.35" }, "suggest": { "ext-event": "For better performance. " diff --git a/composer.lock b/composer.lock index 97d39de..3f5bc07 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c99bb5201649417c649c7a5fb8b36d3a", + "content-hash": "cd3b1caf96f62b54bf6f76861680b014", "packages": [ { "name": "brick/math", @@ -5623,6 +5623,59 @@ }, "time": "2022-08-18T12:14:59+00:00" }, + { + "name": "webman/console", + "version": "v1.3.15", + "source": { + "type": "git", + "url": "https://github.com/webman-php/console.git", + "reference": "edadb1906e55c050fa8b5cadd20ee8a95599e13f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webman-php/console/zipball/edadb1906e55c050fa8b5cadd20ee8a95599e13f", + "reference": "edadb1906e55c050fa8b5cadd20ee8a95599e13f", + "shasum": "" + }, + "require": { + "doctrine/inflector": "^2.0", + "symfony/console": ">=5.0" + }, + "require-dev": { + "workerman/webman": "^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Webman\\Console\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "walkor", + "email": "walkor@workerman.net", + "homepage": "http://www.workerman.net", + "role": "Developer" + } + ], + "description": "Webman console", + "homepage": "http://www.workerman.net", + "keywords": [ + "webman console" + ], + "support": { + "email": "walkor@workerman.net", + "forum": "http://www.workerman.net/questions", + "issues": "https://github.com/webman-php/console/issues", + "source": "https://github.com/webman-php/console", + "wiki": "http://www.workerman.net/doc/webman" + }, + "time": "2025-01-07T06:44:45+00:00" + }, { "name": "webman/event", "version": "v1.0.5",