Commit 3c86a56a authored by daniel's avatar daniel

feat(markNoSelect): 自助选号处理+预约发枪保留1位小数

parent 415faf80
......@@ -154,6 +154,38 @@ public class CommonController {
return Result.fail().setMsg("文件上传失败");
}
@PostMapping("uploadSelectMarkNoBg")
@ApiOperation(value = "选号背景上传")
public Result<?> uploadGunRuleBg(@RequestPart @RequestParam("file") MultipartFile file,@RequestParam(value = "gCmptId") Integer gCmptId) {
try {
// 检查文件大小是否超过1MB
long maxFileSize = 5 * 1024 * 1024; // 1MB
if (file.getSize() > maxFileSize) {
return Result.fail().setMsg("上传文件大小不能超过5MB");
}
String originalFilename = file.getOriginalFilename();
if (originalFilename == null || originalFilename.isEmpty()) {
return Result.fail().setMsg("文件名不能为空");
}
assert originalFilename != null;
// 检查文件名中是否包含点号
int lastIndex = originalFilename.lastIndexOf(".");
if (lastIndex == -1) {
// 如果没有后缀名,直接返回报错信息
return Result.fail().setMsg("上传的文件没有后缀名,请检查文件");
}
String objectName = "micro/" +gCmptId+ "_cmptId/mark_no_bg.png";
String filePath = aliOssUtil.upload(file.getBytes(), objectName);
log.info("文件上传名: {} 保存的文件名:{}", originalFilename,filePath);
return Result.success().setContent(filePath);
} catch (IOException e) {
log.error("文件上传失败:{}", e);
}
return Result.fail().setMsg("文件上传失败");
}
/**
* 检查文件的魔数是否与扩展名匹配
......
......@@ -241,7 +241,8 @@
</n-form-item>
<n-form-item label="关门时间" path="cutOffTime">
<n-input-number :min="1"
:max="200" v-model:value="gunRuleValue.cutOffTime" placeholder="请输入关门时间">
:precision="1"
:max="500" v-model:value="gunRuleValue.cutOffTime" placeholder="请输入关门时间">
<template #suffix>
小时
</template>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment