|
...
|
...
|
@@ -17,7 +17,14 @@ class Translate |
|
|
|
{
|
|
|
|
//接口地址
|
|
|
|
// public static $url = 'https://translate.hbb618.cn/translates';
|
|
|
|
public static $url = 'https://api.cmer.com/translates';
|
|
|
|
public static $url = 'https://api.cmer.com/';
|
|
|
|
|
|
|
|
public static $header = array(
|
|
|
|
'accept: application/json',
|
|
|
|
'Content-Type: application/json',
|
|
|
|
'apikey: UkzZljFv83Z2qBi5YR1o3f2otAVWtug6',
|
|
|
|
'X-CmerApi-Host:ai_translate.p.cmer.com'
|
|
|
|
);
|
|
|
|
|
|
|
|
public static $tls_list = [
|
|
|
|
'en' => [
|
|
...
|
...
|
@@ -734,7 +741,7 @@ class Translate |
|
|
|
'sl' => 'auto',
|
|
|
|
'tls' => $tls,
|
|
|
|
];
|
|
|
|
return Http::post(self::$url.$action, $data);
|
|
|
|
return http_post(self::$url.$action, json_encode($data),self::$header);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -749,11 +756,8 @@ class Translate |
|
|
|
if (!$texts) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
$retsult = self::translate($texts, $tls)->json();
|
|
|
|
|
|
|
|
return $retsult[0]['texts'] ?? '';
|
|
|
|
|
|
|
|
$result = self::translate($texts, $tls);
|
|
|
|
return $result[0]['texts'] ?? '';
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* 翻译带源语种
|
|
...
|
...
|
@@ -772,7 +776,7 @@ class Translate |
|
|
|
'sl' => 'auto',
|
|
|
|
'tl' => $tl,
|
|
|
|
];
|
|
|
|
return Http::post(self::$url . $action, $data);
|
|
|
|
return http_post(self::$url.$action, json_encode($data),self::$header);
|
|
|
|
}
|
|
|
|
|
|
|
|
} |
...
|
...
|
|