【新增】 上传.c文件,返回文件内容
This commit is contained in:
@@ -32,6 +32,7 @@ import pc.exam.pp.module.exam.service.question.IExamQuestionService;
|
||||
import pc.exam.pp.module.system.enums.common.SexEnum;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -285,5 +286,16 @@ public class ExamQuestionController {
|
||||
return CommonResult.success(examQuestionService.auditQuestion(audioQuestionVo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 试题预览
|
||||
*/
|
||||
@PostMapping("/previewQuestion")
|
||||
public CommonResult<String> previewQuestion(@RequestPart("file") MultipartFile file) throws IOException {
|
||||
// 先判断是否为.c的文件
|
||||
if (!file.getOriginalFilename().endsWith(".c")) {
|
||||
return CommonResult.error(100810, "请上传.c文件");
|
||||
}
|
||||
return CommonResult.success(new String(file.getBytes(), StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user