修改原有框架中英文映射

This commit is contained in:
2026-03-17 18:09:10 +08:00
parent e7b8f4cae9
commit bdf50e61f5
81 changed files with 1956 additions and 735 deletions

View File

@@ -26,7 +26,7 @@ class EmailService
$logic = new SystemConfigLogic();
$config = $logic->getGroup('email_config');
if (!$config) {
throw new ApiException('未设置邮件配置');
throw new ApiException('Mail config not set');
}
return $config;
}
@@ -38,7 +38,7 @@ class EmailService
public static function getMailer(): PHPMailer
{
if (!class_exists(PHPMailer::class)) {
throw new ApiException('请执行 composer require phpmailer/phpmailer 并重启');
throw new ApiException('Please run composer require phpmailer/phpmailer and restart');
}
$config = static::getConfig();
$mailer = new PHPMailer();

View File

@@ -54,7 +54,7 @@ class ChunkUploadService
{
$allow_file = Arr::getConfigValue($this->config, 'upload_allow_file');
if (!in_array($data['ext'], explode(',', $allow_file))) {
throw new ApiException('不支持该格式的文件上传');
throw new ApiException('File format not supported for upload');
}
// 检查已经上传的分片文件
for ($i = 0; $i < $data['total']; ++$i) {
@@ -80,11 +80,11 @@ class ChunkUploadService
{
$allow_file = Arr::getConfigValue($this->config, 'upload_allow_file');
if (!in_array($data['ext'], explode(',', $allow_file))) {
throw new ApiException('不支持该格式的文件上传');
throw new ApiException('File format not supported for upload');
}
$request = request();
if (!$request) {
throw new ApiException('切片上传服务必须在 HTTP 请求环境下调用');
throw new ApiException('Chunk upload must be called in HTTP request context');
}
$uploadFile = current($request->file());
$chunkName = $this->path . "{$data['hash']}_{$data['total']}_{$data['index']}.chunk";
@@ -107,7 +107,7 @@ class ChunkUploadService
for ($i = 0; $i < $data['total']; ++$i) {
$chunkFile = $this->path . "{$data['hash']}_{$data['total']}_{$i}.chunk";
if (!file_exists($chunkFile)) {
throw new ApiException('切片文件查找失败,请重新上传');
throw new ApiException('Chunk file not found, please upload again');
}
fwrite($fileHandle, file_get_contents($chunkFile));
unlink($chunkFile);

View File

@@ -34,17 +34,17 @@ class UploadService
$ext = $file->getUploadExtension() ?: null;
$file_size = $file->getSize();
if ($file_size > Arr::getConfigValue($uploadConfig, 'upload_size')) {
throw new ApiException('文件大小超过限制');
throw new ApiException('File size exceeds limit');
}
$allow_file = Arr::getConfigValue($uploadConfig, 'upload_allow_file');
$allow_image = Arr::getConfigValue($uploadConfig, 'upload_allow_image');
if ($upload == 'image') {
if (!in_array($ext, explode(',', $allow_image))) {
throw new ApiException('不支持该格式的文件上传');
throw new ApiException('File format not supported for upload');
}
} else {
if (!in_array($ext, explode(',', $allow_file))) {
throw new ApiException('不支持该格式的文件上传');
throw new ApiException('File format not supported for upload');
}
}
switch ($type) {
@@ -115,7 +115,7 @@ class UploadService
];
break;
default:
throw new ApiException('该上传模式不存在');
throw new ApiException('Upload mode not found');
}
return new $config['adapter'](array_merge(
$config,