From d809b9f666a8f0a25524d01c93f49f3e7c18da9a Mon Sep 17 00:00:00 2001 From: "HESU\\HESU" <1696136552@qq.com> Date: Wed, 28 May 2025 09:30:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E4=BF=AE=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E9=98=9F=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 18 +- app/service/TranslatorService.php | 12 + composer.json | 5 +- composer.lock | 615 +++++++++++++++--- .../app/controller/LocationController.php | 24 +- .../app/controller/VehicleController.php | 30 +- 6 files changed, 556 insertions(+), 148 deletions(-) diff --git a/.env.example b/.env.example index 8ade683..131c9fe 100644 --- a/.env.example +++ b/.env.example @@ -11,4 +11,20 @@ WEBMAN_COUNT = 2 OSS_ACCESS_KEY_ID=LTAI5tAGiH7bkVkmrniXnfkA OSS_ACCESS_KEY_SECRET=nqklJBft6t3S0A4ZvxF4ci9ni91kmm OSS_BUCKET=vehicle-album -OSS_ENDPOINT=https://oss-cn-beijing.aliyuncs.com \ No newline at end of file +OSS_ENDPOINT=https://oss-cn-beijing.aliyuncs.com + +# redis +REDIS_HOST = 1Panel-redis-1jWE +REDIS_PASSWORD = redis_h6xWCT +REDIS_PORT = 6379 +REDIS_DATABASE = 0 + +# redis-queue +REDIS_QUEUE_HOST = redis://1Panel-redis-q527:6379 +REDIS_QUEUE_AUTH = redis_d2tGfw +REDIS_QUEUE_DB = 15 +REDIS_QUEUE_PREFIX = +REDIS_QUEUE_MAX_ATTEMPTS = 5 +REDIS_QUEUE_RETRY_SECONDS = 5 +REDIS_QUEUE_PROCESS_COUNT = 2 +REDIS_QUEUE_CONSUMER_DIR = /mzl/modules/translation/queue \ No newline at end of file diff --git a/app/service/TranslatorService.php b/app/service/TranslatorService.php index 282e91d..052a253 100644 --- a/app/service/TranslatorService.php +++ b/app/service/TranslatorService.php @@ -3,6 +3,8 @@ namespace app\service; use app\util\Xunfei; +use support\Log; +use Webman\RedisQueue\Redis; class TranslatorService { @@ -39,4 +41,14 @@ class TranslatorService } return $location; } + + public function queue($field,$sourceLang,$type,$id) { + // 队列名 + $queue = 'translator'; + // 数据,可以直接传数组,无需序列化 + $data = ['entityType' => $type, 'sourceFields' => $field, 'sourceLang' => $sourceLang, 'locale' => 'hello', 'id' => $id]; + // 投递消息 + Redis::send($queue, $data); + return true; + } } \ No newline at end of file diff --git a/composer.json b/composer.json index cb56d2b..300a1f6 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,10 @@ "shopwwi/filesystem-oss": "^1.0", "webman/console": "^2.1", "webman/cache": "^2.1", - "workerman/crontab": "^1.0" + "workerman/crontab": "^1.0", + "webman/redis": "dev-main", + "illuminate/events": "^12.14", + "webman/redis-queue": "^1.3" }, "suggest": { "ext-event": "For better performance. " diff --git a/composer.lock b/composer.lock index 3db0971..9489f02 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": "2dc28180e70f613eb100a93e80076a5e", + "content-hash": "5890526c12c278e535143c406c9f1b88", "packages": [ { "name": "aliyuncs/oss-sdk-php", @@ -123,7 +123,13 @@ "type": "zip", "url": "https://api.github.com/repos/CarbonPHP/carbon-doctrine-types/zipball/18ba5ddfec8976260ead6e866180bd5d2f71aa1d", "reference": "18ba5ddfec8976260ead6e866180bd5d2f71aa1d", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^8.1" @@ -192,7 +198,13 @@ "type": "zip", "url": "https://api.github.com/repos/doctrine/inflector/zipball/5817d0659c5b50c9b950feb9af7b9668e2c436bc", "reference": "5817d0659c5b50c9b950feb9af7b9668e2c436bc", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.2 || ^8.0" @@ -817,17 +829,23 @@ }, { "name": "illuminate/bus", - "version": "v12.12.0", + "version": "v12.14.1", "source": { "type": "git", "url": "https://github.com/illuminate/bus.git", - "reference": "2814b6d6ec18737a852055d44302bcac3221a95b" + "reference": "60da78ea881c539ce56c5b66321be73755c5918c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/bus/zipball/2814b6d6ec18737a852055d44302bcac3221a95b", - "reference": "2814b6d6ec18737a852055d44302bcac3221a95b", - "shasum": "" + "url": "https://api.github.com/repos/illuminate/bus/zipball/60da78ea881c539ce56c5b66321be73755c5918c", + "reference": "60da78ea881c539ce56c5b66321be73755c5918c", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "illuminate/collections": "^12.0", @@ -866,21 +884,27 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2025-04-24T19:45:06+00:00" + "time": "2025-05-13T15:08:45+00:00" }, { "name": "illuminate/collections", - "version": "v12.12.0", + "version": "v12.14.1", "source": { "type": "git", "url": "https://github.com/illuminate/collections.git", - "reference": "abccbba3aef0fb9460105496e18c36b28dfe10b2" + "reference": "954b7154723f51ef105fbfa6999eb424febbdb5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/collections/zipball/abccbba3aef0fb9460105496e18c36b28dfe10b2", - "reference": "abccbba3aef0fb9460105496e18c36b28dfe10b2", - "shasum": "" + "url": "https://api.github.com/repos/illuminate/collections/zipball/954b7154723f51ef105fbfa6999eb424febbdb5c", + "reference": "954b7154723f51ef105fbfa6999eb424febbdb5c", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "illuminate/conditionable": "^12.0", @@ -923,7 +947,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2025-04-29T20:14:54+00:00" + "time": "2025-05-13T15:08:45+00:00" }, { "name": "illuminate/conditionable", @@ -937,7 +961,13 @@ "type": "zip", "url": "https://api.github.com/repos/illuminate/conditionable/zipball/455a28c08f849db93078c9a60d765b88011affd2", "reference": "455a28c08f849db93078c9a60d765b88011affd2", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^8.2" @@ -973,17 +1003,23 @@ }, { "name": "illuminate/container", - "version": "v12.12.0", + "version": "v12.14.1", "source": { "type": "git", "url": "https://github.com/illuminate/container.git", - "reference": "cdd99204b29acf795a02f778542df5a5244361fd" + "reference": "f93a0e410eaf0839d0b6da23454abc37a28968f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/container/zipball/cdd99204b29acf795a02f778542df5a5244361fd", - "reference": "cdd99204b29acf795a02f778542df5a5244361fd", - "shasum": "" + "url": "https://api.github.com/repos/illuminate/container/zipball/f93a0e410eaf0839d0b6da23454abc37a28968f2", + "reference": "f93a0e410eaf0839d0b6da23454abc37a28968f2", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "illuminate/contracts": "^12.0", @@ -1020,7 +1056,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2025-03-22T17:41:27+00:00" + "time": "2025-05-13T15:08:45+00:00" }, { "name": "illuminate/contracts", @@ -1034,7 +1070,13 @@ "type": "zip", "url": "https://api.github.com/repos/illuminate/contracts/zipball/bbaec083da240396f2186f4c3a9952da207f28a0", "reference": "bbaec083da240396f2186f4c3a9952da207f28a0", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^8.2", @@ -1142,17 +1184,23 @@ }, { "name": "illuminate/events", - "version": "v12.12.0", + "version": "v12.14.1", "source": { "type": "git", "url": "https://github.com/illuminate/events.git", - "reference": "80fc4cdfef9c33a59c998d2eb361eb6ae7c124bf" + "reference": "bf1f121ea51e077e893d32e2848e102513d4b1b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/events/zipball/80fc4cdfef9c33a59c998d2eb361eb6ae7c124bf", - "reference": "80fc4cdfef9c33a59c998d2eb361eb6ae7c124bf", - "shasum": "" + "url": "https://api.github.com/repos/illuminate/events/zipball/bf1f121ea51e077e893d32e2848e102513d4b1b5", + "reference": "bf1f121ea51e077e893d32e2848e102513d4b1b5", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "illuminate/bus": "^12.0", @@ -1193,7 +1241,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2025-03-19T20:10:05+00:00" + "time": "2025-05-13T15:08:45+00:00" }, { "name": "illuminate/filesystem", @@ -1325,7 +1373,7 @@ }, { "name": "illuminate/macroable", - "version": "v12.12.0", + "version": "v12.14.1", "source": { "type": "git", "url": "https://github.com/illuminate/macroable.git", @@ -1335,7 +1383,13 @@ "type": "zip", "url": "https://api.github.com/repos/illuminate/macroable/zipball/e862e5648ee34004fa56046b746f490dfa86c613", "reference": "e862e5648ee34004fa56046b746f490dfa86c613", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^8.2" @@ -1431,7 +1485,13 @@ "type": "zip", "url": "https://api.github.com/repos/illuminate/pipeline/zipball/3c6df979e7e8ef09183a610cc0383179c1aba309", "reference": "3c6df979e7e8ef09183a610cc0383179c1aba309", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "illuminate/contracts": "^12.0", @@ -1467,6 +1527,66 @@ }, "time": "2025-03-19T20:10:05+00:00" }, + { + "name": "illuminate/redis", + "version": "v12.12.0", + "source": { + "type": "git", + "url": "https://github.com/illuminate/redis.git", + "reference": "5b2c93074b0f6af40cb0ee72f4fbd50c473f10fb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/illuminate/redis/zipball/5b2c93074b0f6af40cb0ee72f4fbd50c473f10fb", + "reference": "5b2c93074b0f6af40cb0ee72f4fbd50c473f10fb", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "illuminate/collections": "^12.0", + "illuminate/contracts": "^12.0", + "illuminate/macroable": "^12.0", + "illuminate/support": "^12.0", + "php": "^8.2" + }, + "suggest": { + "ext-redis": "Required to use the phpredis connector (^4.0|^5.0|^6.0).", + "predis/predis": "Required to use the predis connector (^2.3)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "12.x-dev" + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Redis\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Illuminate Redis package.", + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2025-04-11T14:29:19+00:00" + }, { "name": "illuminate/session", "version": "v12.12.0", @@ -1526,17 +1646,23 @@ }, { "name": "illuminate/support", - "version": "v12.12.0", + "version": "v12.14.1", "source": { "type": "git", "url": "https://github.com/illuminate/support.git", - "reference": "586b1ccf141724d7cd87ee759e6e8baae9c6d507" + "reference": "e7789d3fd90493d076318df934a92d687e4bc340" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/support/zipball/586b1ccf141724d7cd87ee759e6e8baae9c6d507", - "reference": "586b1ccf141724d7cd87ee759e6e8baae9c6d507", - "shasum": "" + "url": "https://api.github.com/repos/illuminate/support/zipball/e7789d3fd90493d076318df934a92d687e4bc340", + "reference": "e7789d3fd90493d076318df934a92d687e4bc340", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "doctrine/inflector": "^2.0", @@ -1560,7 +1686,7 @@ "suggest": { "illuminate/filesystem": "Required to use the Composer class (^12.0).", "laravel/serializable-closure": "Required to use the once function (^1.3|^2.0).", - "league/commonmark": "Required to use Str::markdown() and Stringable::markdown() (^2.6).", + "league/commonmark": "Required to use Str::markdown() and Stringable::markdown() (^2.7).", "league/uri": "Required to use the Uri class (^7.5.1).", "ramsey/uuid": "Required to use Str::uuid() (^4.7).", "symfony/process": "Required to use the Composer class (^7.2).", @@ -1599,7 +1725,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2025-04-30T14:33:58+00:00" + "time": "2025-05-13T15:08:45+00:00" }, { "name": "intervention/image", @@ -2048,7 +2174,13 @@ "type": "zip", "url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/ced71f79398ece168e24f7f7710462f462310d4d", "reference": "ced71f79398ece168e24f7f7710462f462310d4d", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "carbonphp/carbon-doctrine-types": "<100.0", @@ -2154,7 +2286,13 @@ "type": "zip", "url": "https://api.github.com/repos/nikic/FastRoute/zipball/181d480e08d9476e61381e04a71b34dc0432e812", "reference": "181d480e08d9476e61381e04a71b34dc0432e812", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=5.4.0" @@ -2279,7 +2417,13 @@ "type": "zip", "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=8.0.0" @@ -2328,7 +2472,13 @@ "type": "zip", "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": "^7.0 || ^8.0" @@ -2376,7 +2526,13 @@ "type": "zip", "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=7.4.0" @@ -2429,7 +2585,13 @@ "type": "zip", "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=7.2.0" @@ -2629,17 +2791,23 @@ }, { "name": "psr/log", - "version": "3.0.2", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" + "reference": "79dff0b268932c640297f5208d6298f71855c03e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", - "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", - "shasum": "" + "url": "https://api.github.com/repos/php-fig/log/zipball/79dff0b268932c640297f5208d6298f71855c03e", + "reference": "79dff0b268932c640297f5208d6298f71855c03e", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=8.0.0" @@ -2673,9 +2841,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/3.0.2" + "source": "https://github.com/php-fig/log/tree/3.0.1" }, - "time": "2024-09-11T13:17:53+00:00" + "time": "2024-08-21T13:31:24+00:00" }, { "name": "psr/simple-cache", @@ -2689,7 +2857,13 @@ "type": "zip", "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/764e0b3939f5ca87cb904f570ef9be2d78a07865", "reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=8.0.0" @@ -2988,7 +3162,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/15a4f8e5cd3bce9aeafc882b1acab39ec8de2c1b", "reference": "15a4f8e5cd3bce9aeafc882b1acab39ec8de2c1b", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=8.1", @@ -3064,7 +3244,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/clock/zipball/b81435fbd6648ea425d1ee96a2d8e68f4ceacd24", "reference": "b81435fbd6648ea425d1ee96a2d8e68f4ceacd24", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=8.2", @@ -3231,7 +3417,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", "reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=8.1" @@ -3453,7 +3645,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7642f5e970b672283b7823222ae8ef8bbc160b9f", "reference": "7642f5e970b672283b7823222ae8ef8bbc160b9f", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=8.1", @@ -4246,20 +4444,25 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.32.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493" + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493", - "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493", - "shasum": "" + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { - "ext-iconv": "*", "php": ">=7.2" }, "provide": { @@ -4271,8 +4474,8 @@ "type": "library", "extra": { "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -4307,7 +4510,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.32.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" }, "funding": [ { @@ -4323,21 +4526,27 @@ "type": "tidelift" } ], - "time": "2024-12-23T08:48:59+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.32.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608" + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608", - "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608", - "shasum": "" + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=7.2" @@ -4387,7 +4596,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.32.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0" }, "funding": [ { @@ -4403,11 +4612,11 @@ "type": "tidelift" } ], - "time": "2025-01-02T08:10:11+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php83", - "version": "v1.32.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php83.git", @@ -4417,7 +4626,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/2fb86d65e2d424369ad2905e83b236a8805ba491", "reference": "2fb86d65e2d424369ad2905e83b236a8805ba491", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=7.2" @@ -4463,7 +4678,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php83/tree/v1.32.0" + "source": "https://github.com/symfony/polyfill-php83/tree/v1.31.0" }, "funding": [ { @@ -4493,7 +4708,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/service-contracts/zipball/e53260aabf78fb3d63f8d79d69ece59f80d5eda0", "reference": "e53260aabf78fb3d63f8d79d69ece59f80d5eda0", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=8.1", @@ -4663,7 +4884,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/translation/zipball/e7fd8e2a4239b79a0fd9fb1fef3e0e7f969c6dc6", "reference": "e7fd8e2a4239b79a0fd9fb1fef3e0e7f969c6dc6", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=8.2", @@ -4758,7 +4985,13 @@ "type": "zip", "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/4667ff3bd513750603a09c8dedbea942487fb07c", "reference": "4667ff3bd513750603a09c8dedbea942487fb07c", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=8.1" @@ -5069,17 +5302,23 @@ }, { "name": "voku/portable-ascii", - "version": "2.0.3", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/voku/portable-ascii.git", - "reference": "b1d923f88091c6bf09699efcd7c8a1b1bfd7351d" + "reference": "16c17671a804bb92602822113dd91fbc8a35d2af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/voku/portable-ascii/zipball/b1d923f88091c6bf09699efcd7c8a1b1bfd7351d", - "reference": "b1d923f88091c6bf09699efcd7c8a1b1bfd7351d", - "shasum": "" + "url": "https://api.github.com/repos/voku/portable-ascii/zipball/16c17671a804bb92602822113dd91fbc8a35d2af", + "reference": "16c17671a804bb92602822113dd91fbc8a35d2af", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=7.0.0" @@ -5115,7 +5354,7 @@ ], "support": { "issues": "https://github.com/voku/portable-ascii/issues", - "source": "https://github.com/voku/portable-ascii/tree/2.0.3" + "source": "https://github.com/voku/portable-ascii/tree/2.0.2" }, "funding": [ { @@ -5139,7 +5378,7 @@ "type": "tidelift" } ], - "time": "2024-11-21T01:49:47+00:00" + "time": "2024-11-21T00:49:12+00:00" }, { "name": "webman/admin", @@ -5402,6 +5641,86 @@ }, "time": "2023-12-04T09:22:12+00:00" }, + { + "name": "webman/redis", + "version": "dev-main", + "source": { + "type": "git", + "url": "https://github.com/webman-php/redis.git", + "reference": "559eb1692d39c6fef5cf526223fff728be6c0fb9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webman-php/redis/zipball/559eb1692d39c6fef5cf526223fff728be6c0fb9", + "reference": "559eb1692d39c6fef5cf526223fff728be6c0fb9", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "illuminate/redis": "^10.0 || ^11.0 || ^12.0", + "workerman/webman-framework": "^2.1 || dev-master" + }, + "default-branch": true, + "type": "library", + "autoload": { + "psr-4": { + "support\\": "src/support", + "Webman\\Redis\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Webman redis", + "support": { + "issues": "https://github.com/webman-php/redis/issues", + "source": "https://github.com/webman-php/redis/tree/v2.1.3" + }, + "time": "2025-03-14T03:52:14+00:00" + }, + { + "name": "webman/redis-queue", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/webman-php/redis-queue.git", + "reference": "6fd491b19acb006d60931724aa2577a046ccb612" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webman-php/redis-queue/zipball/6fd491b19acb006d60931724aa2577a046ccb612", + "reference": "6fd491b19acb006d60931724aa2577a046ccb612", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "workerman/redis-queue": "^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Webman\\RedisQueue\\": "./src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "description": "Redis message queue plugin for webman.", + "support": { + "issues": "https://github.com/webman-php/redis-queue/issues", + "source": "https://github.com/webman-php/redis-queue/tree/v1.3.1" + }, + "time": "2024-02-28T07:21:52+00:00" + }, { "name": "workerman/coroutine", "version": "v1.1.3", @@ -5414,7 +5733,13 @@ "type": "zip", "url": "https://api.github.com/repos/workerman-php/coroutine/zipball/df8fc428967d512a74a8a7d80355c1d40228c9fa", "reference": "df8fc428967d512a74a8a7d80355c1d40228c9fa", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "php": ">=8.1" @@ -5497,6 +5822,90 @@ }, "time": "2025-01-15T07:20:50+00:00" }, + { + "name": "workerman/redis", + "version": "v2.0.4", + "source": { + "type": "git", + "url": "https://github.com/walkor/redis.git", + "reference": "82b398c5bdd5d683a3458aaf645b159b7b39b84e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/walkor/redis/zipball/82b398c5bdd5d683a3458aaf645b159b7b39b84e", + "reference": "82b398c5bdd5d683a3458aaf645b159b7b39b84e", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=7", + "workerman/workerman": "^4.1.0||^5.0.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Workerman\\Redis\\": "./src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "homepage": "http://www.workerman.net", + "support": { + "issues": "https://github.com/walkor/redis/issues", + "source": "https://github.com/walkor/redis/tree/v2.0.4" + }, + "time": "2025-04-05T07:45:12+00:00" + }, + { + "name": "workerman/redis-queue", + "version": "v1.2.1", + "source": { + "type": "git", + "url": "https://github.com/walkor/redis-queue.git", + "reference": "75dbf7ed2ea228c45dc0df82c0fea35879b715d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/walkor/redis-queue/zipball/75dbf7ed2ea228c45dc0df82c0fea35879b715d0", + "reference": "75dbf7ed2ea228c45dc0df82c0fea35879b715d0", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] + }, + "require": { + "php": ">=7.0", + "workerman/redis": "^1.0||^2.0", + "workerman/workerman": ">=4.0.20" + }, + "type": "library", + "autoload": { + "psr-4": { + "Workerman\\RedisQueue\\": "./src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Message queue system written in PHP based on workerman and backed by Redis.", + "homepage": "http://www.workerman.net", + "support": { + "issues": "https://github.com/walkor/redis-queue/issues", + "source": "https://github.com/walkor/redis-queue/tree/v1.2.1" + }, + "time": "2025-01-02T09:21:45+00:00" + }, { "name": "workerman/webman-framework", "version": "v2.1.2", @@ -5509,7 +5918,13 @@ "type": "zip", "url": "https://api.github.com/repos/walkor/webman-framework/zipball/f803bd867f07bb0929faef060b59a19a44186bfc", "reference": "f803bd867f07bb0929faef060b59a19a44186bfc", - "shasum": "" + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "ext-json": "*", @@ -5565,17 +5980,23 @@ }, { "name": "workerman/workerman", - "version": "v5.1.1", + "version": "v5.1.0", "source": { "type": "git", "url": "https://github.com/walkor/workerman.git", - "reference": "72cafa19e488896abd2576ea67b3b1af1abf71c0" + "reference": "5ce17bc71dfdad0e9eba8cd658342da793d2f581" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/walkor/workerman/zipball/72cafa19e488896abd2576ea67b3b1af1abf71c0", - "reference": "72cafa19e488896abd2576ea67b3b1af1abf71c0", - "shasum": "" + "url": "https://api.github.com/repos/walkor/workerman/zipball/5ce17bc71dfdad0e9eba8cd658342da793d2f581", + "reference": "5ce17bc71dfdad0e9eba8cd658342da793d2f581", + "shasum": "", + "mirrors": [ + { + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", + "preferred": true + } + ] }, "require": { "ext-json": "*", @@ -5637,13 +6058,15 @@ "type": "patreon" } ], - "time": "2025-04-02T14:01:24+00:00" + "time": "2025-02-05T14:25:44+00:00" } ], "packages-dev": [], "aliases": [], "minimum-stability": "dev", - "stability-flags": {}, + "stability-flags": { + "webman/redis": 20 + }, "prefer-stable": true, "prefer-lowest": false, "platform": { diff --git a/plugin/admin/app/controller/LocationController.php b/plugin/admin/app/controller/LocationController.php index fe463aa..82560e5 100644 --- a/plugin/admin/app/controller/LocationController.php +++ b/plugin/admin/app/controller/LocationController.php @@ -191,32 +191,12 @@ class LocationController extends Crud ]; //删除已保存的模型 unset($translationModels[$lang]); - unset($languages[$lang]); +// unset($languages[$lang]); // 创建翻译服务实例 $translatorService = new \app\service\TranslatorService(); - foreach ($languages as $language) { - $translationModel = $translationModels[$language]; - if(!empty($data['id'])){ - $translation = $translationModel::find($data['id']); - }else{ - $translation = new $translationModel(); - } - - // 复制主表数据 - $translation->fill($data); - $translation->id = $location->id; - - // 使用翻译服务处理需要翻译的字段 - $translatedData = $translatorService->location($data, $language,$lang); - log::info('$lang',[$language,$lang,$translatedData]); - - // 更新翻译后的字段 - $translation->name = $translatedData['name'] ?? $data['name']; - - $translation->save(); - } + $translatorService->queue($data,$languages[$lang],'location',$data['id']?:null); } /** diff --git a/plugin/admin/app/controller/VehicleController.php b/plugin/admin/app/controller/VehicleController.php index a627bca..498fd9f 100644 --- a/plugin/admin/app/controller/VehicleController.php +++ b/plugin/admin/app/controller/VehicleController.php @@ -276,38 +276,12 @@ class VehicleController extends Crud ]; //删除已保存的模型 unset($translationModels[$lang]); - unset($languages[$lang]); +// unset($languages[$lang]); // 创建翻译服务实例 $translatorService = new \app\service\TranslatorService(); - foreach ($languages as $language) { - $translationModel = $translationModels[$language]; - if(!empty($data['id'])){ -// $vehicle = Vehicle::find($data['id']); - $translation = $translationModel::find($data['id']); - }else{ - $translation = new $translationModel(); - } - - // 复制主表数据 - $translation->fill($data); - $translation->id = $vehicle->id; - - // 使用翻译服务处理需要翻译的字段 - log::info('lang:',[$language,$lang]); - $translatedData = $translatorService->vehicle($data, $language,$lang); - - // 更新翻译后的字段 - $translation->brand = $translatedData['brand'] ?? $data['brand']; - $translation->model = $translatedData['model'] ?? $data['model']; -// $translation->status = $translatedData['status'] ?? $data['status']; - $translation->purchase_location = $translatedData['purchase_location'] ?? $data['purchase_location']; - $translation->procedure_location = $translatedData['procedure_location'] ?? $data['procedure_location']; -// $translation->fbo_destination = $translatedData['fbo_destination'] ?? $data['fbo_destination']; - - $translation->save(); - } + $translatorService->queue($data,$languages[$lang],'vehicle',$data['id']?:null); }