first commit
This commit is contained in:
38
app/adminapi/logic/translation/TranslationLogic.php
Normal file
38
app/adminapi/logic/translation/TranslationLogic.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
namespace app\adminapi\logic\translation;
|
||||
|
||||
use app\common\service\{ConfigService,UtilsService};
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* 翻译逻辑
|
||||
* Class TranslationLogic
|
||||
* @package app\adminapi\logic\translation
|
||||
*/
|
||||
class TranslationLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 翻译
|
||||
* @param array $params
|
||||
* @return array
|
||||
* @author BD
|
||||
* @date 2024/04/25 01:30
|
||||
*/
|
||||
public static function translation(array $params)
|
||||
{
|
||||
// 输入
|
||||
$qArray = $params['qArray'];
|
||||
|
||||
$ret = UtilsService::do_translate($qArray,$params['from'],$params['to']);
|
||||
$ret = json_decode($ret, true);
|
||||
if($ret['errorCode'] != 0){
|
||||
throw new \Exception('错误代码:'.$ret['errorCode'].',请核对错误代码列表');
|
||||
}
|
||||
|
||||
return ['result' => $ret['translateResults']];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user