1
This commit is contained in:
+4
-3
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace app\queue\translation\jobs;
|
namespace app\common\utils\translation\jobs;
|
||||||
|
|
||||||
use support\Log;
|
use support\Log;
|
||||||
use app\queue\translation\service\TranslatorClient;
|
use app\common\utils\translation\service\TranslatorClient;
|
||||||
|
|
||||||
class TranslationJob
|
class TranslationJob
|
||||||
{
|
{
|
||||||
@@ -11,7 +11,8 @@ class TranslationJob
|
|||||||
|
|
||||||
public function __construct(array $payload)
|
public function __construct(array $payload)
|
||||||
{
|
{
|
||||||
$this->config = getConfig('/queue/translation/config/trans.php');
|
$this->config = getConfig('/common/utils/translation/config/trans.php');
|
||||||
|
// $this->config = getConfig('/queue/translation/config/trans.php');
|
||||||
$this->payload = $payload;
|
$this->payload = $payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
+2
-2
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace app\queue\translation\queue;
|
namespace app\common\utils\translation\queue;
|
||||||
|
|
||||||
use support\Log;
|
use support\Log;
|
||||||
use Webman\RedisQueue\Consumer;
|
use Webman\RedisQueue\Consumer;
|
||||||
use app\queue\translation\jobs\TranslationJob;
|
use app\common\utils\translation\jobs\TranslationJob;
|
||||||
|
|
||||||
class Translation implements Consumer
|
class Translation implements Consumer
|
||||||
{
|
{
|
||||||
+5
-3
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace app\queue\translation\service;
|
namespace app\common\utils\translation\service;
|
||||||
|
|
||||||
// use Webman\RedisQueue\Client;
|
// use Webman\RedisQueue\Client;
|
||||||
use Webman\RedisQueue\Redis;
|
use Webman\RedisQueue\Redis;
|
||||||
@@ -12,7 +12,8 @@ class TranslationService
|
|||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->config = getConfig('/queue/translation/config/trans.php');
|
$this->config = getConfig('/common/utils/translation/config/trans.php');
|
||||||
|
// $this->config = getConfig('/queue/translation/config/trans.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,8 +24,9 @@ class TranslationService
|
|||||||
* @param string $sourceLocale 源语种,如 'zh'
|
* @param string $sourceLocale 源语种,如 'zh'
|
||||||
* @param array $sourceFields 源语种字段 ['name'=>…,'condition_desc'=>…]
|
* @param array $sourceFields 源语种字段 ['name'=>…,'condition_desc'=>…]
|
||||||
* @param array $clientFields 前端已传翻译 ['en'=>[...], …]
|
* @param array $clientFields 前端已传翻译 ['en'=>[...], …]
|
||||||
|
* @param array $intactFields 不需要翻译的字段
|
||||||
*/
|
*/
|
||||||
public function queueTranslations(string $entityType, int $entityId, string $sourceLocale, array $sourceFields, array $clientFields = []): void
|
public function queueTranslations(string $entityType, int $entityId, string $sourceLocale, array $sourceFields, array $clientFields = [], array $intactFields = []): void
|
||||||
{
|
{
|
||||||
foreach ($this->config['locales'] as $locale) {
|
foreach ($this->config['locales'] as $locale) {
|
||||||
$payload = [
|
$payload = [
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace app\queue\translation\service;
|
namespace app\common\utils\translation\service;
|
||||||
|
|
||||||
use app\queue\utils\XunfeiFanyi;
|
use app\queue\utils\XunfeiFanyi;
|
||||||
use support\Log;
|
use support\Log;
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace app\ticket\service;
|
namespace app\ticket\service;
|
||||||
|
|
||||||
use app\queue\translation\service\TranslationService;
|
use app\common\utils\translation\service\TranslationService;
|
||||||
use app\queue\utils\Translat;
|
use app\queue\utils\Translat;
|
||||||
use app\ticket\logic\CategorieLogic;
|
use app\ticket\logic\CategorieLogic;
|
||||||
use app\ticket\model\CategorieTranslation;
|
use app\ticket\model\CategorieTranslation;
|
||||||
|
|||||||
Reference in New Issue
Block a user