This commit is contained in:
2025-06-25 11:17:57 +08:00
parent ce55353d30
commit 7b517cdc48
3 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ class TranslationJob
}
$languages = ['cn' => 'cn', 'en' => 'en', 'ru' => 'ru', 'ar' => 'ar'];
$languages = array_merge(['to'=>$toLang],$languages);
// $languages = array_merge(['to'=>$toLang],$languages);
unset($languages[$sourceLang]);
log::info('languages', [$languages]);
foreach ($languages as $lang => $xflang) {
+2
View File
@@ -23,6 +23,8 @@ class TranslatorService
$rst_dst = $this->xunfei->fanyi($var, $fromLang, $targetLang);
if ($rst_dst) {
$vehicle[$k] = $rst_dst["trans_result"]["dst"];
}else{
unset($vehicle[$k]);
}
}
}
+2 -2
View File
@@ -53,8 +53,8 @@ class Xunfei
//在控制台-我的应用-机器翻译获取
$api_key = "b6d805f240176ecaea85130cb5f2bca1";
// 机器翻译接口地址
// $url = "https://ntrans.xfyun.cn/v2/ots";
$url = "http://ntrans.example.cn";
$url = "https://ntrans.xfyun.cn/v2/ots";
// $url = "http://ntrans.example.cn";
//body组装
// $text = "中华人民共和国于1949年成立";//待翻译文本
$body = json_encode($this->getBody($app_id, $from, $to, $text));