翻译修改为队列
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user