style: 错误信息英文返回-framework模块
This commit is contained in:
@@ -22,7 +22,7 @@ func WriterCSVFile(data [][]string, filePath string) error {
|
||||
// 确保文件夹路径存在
|
||||
err := os.MkdirAll(dirPath, os.ModePerm)
|
||||
if err != nil {
|
||||
logger.Errorf("创建文件夹失败 CreateFile %v", err)
|
||||
logger.Errorf("MkdirAll dir %v", err)
|
||||
}
|
||||
|
||||
// 创建或打开文件
|
||||
@@ -51,7 +51,7 @@ func ReadCSVFile(filePath string) []map[string]string {
|
||||
// 打开 CSV 文件
|
||||
file, err := os.Open(filePath)
|
||||
if err != nil {
|
||||
logger.Errorf("无法打开 CSV 文件:%v", err)
|
||||
logger.Errorf("Open CSV file: %v", err)
|
||||
return arr
|
||||
}
|
||||
defer file.Close()
|
||||
@@ -62,7 +62,7 @@ func ReadCSVFile(filePath string) []map[string]string {
|
||||
// 读取 CSV 头部行
|
||||
header, err := reader.Read()
|
||||
if err != nil {
|
||||
logger.Errorf("无法读取 CSV 头部行:%v", err)
|
||||
logger.Errorf("Read CSV header rows: %v", err)
|
||||
return arr
|
||||
}
|
||||
|
||||
|
||||
@@ -73,13 +73,13 @@ func generateFileName(fileName string) string {
|
||||
func isAllowWrite(fileName string, allowExts []string, fileSize int64) error {
|
||||
// 判断上传文件名称长度
|
||||
if len(fileName) > DEFAULT_FILE_NAME_LENGTH {
|
||||
return fmt.Errorf("The maximum length limit for uploading file names is %d", DEFAULT_FILE_NAME_LENGTH)
|
||||
return fmt.Errorf("the maximum length limit for uploading file names is %d", DEFAULT_FILE_NAME_LENGTH)
|
||||
}
|
||||
|
||||
// 最大上传文件大小
|
||||
maxFileSize := uploadFileSize()
|
||||
if fileSize > maxFileSize {
|
||||
return fmt.Errorf("Maximum upload file size %s", parse.Bit(float64(maxFileSize)))
|
||||
return fmt.Errorf("maximum upload file size %s", parse.Bit(float64(maxFileSize)))
|
||||
}
|
||||
|
||||
// 判断文件拓展是否为允许的拓展类型
|
||||
@@ -95,7 +95,7 @@ func isAllowWrite(fileName string, allowExts []string, fileSize int64) error {
|
||||
}
|
||||
}
|
||||
if !hasExt {
|
||||
return fmt.Errorf("The upload file type is not supported, only the following types are supported:%s", strings.Join(allowExts, ","))
|
||||
return fmt.Errorf("the upload file type is not supported, only the following types are supported: %s", strings.Join(allowExts, ","))
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -107,7 +107,7 @@ func isAllowWrite(fileName string, allowExts []string, fileSize int64) error {
|
||||
func isAllowRead(filePath string) error {
|
||||
// 禁止目录上跳级别
|
||||
if strings.Contains(filePath, "..") {
|
||||
return fmt.Errorf("Prohibit jumping levels on the directory")
|
||||
return fmt.Errorf("prohibit jumping levels on the directory")
|
||||
}
|
||||
|
||||
// 检查允许下载的文件规则
|
||||
@@ -120,7 +120,7 @@ func isAllowRead(filePath string) error {
|
||||
}
|
||||
}
|
||||
if !hasExt {
|
||||
return fmt.Errorf("Rules for illegally downloaded files: %s", fileExt)
|
||||
return fmt.Errorf("rules for illegally downloaded files: %s", fileExt)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user