修改头像增加sql报错处理

This commit is contained in:
wcy 2024-10-08 09:43:03 +08:00
parent d63830f40f
commit f0ffb844dc
1 changed files with 4 additions and 0 deletions

View File

@ -120,6 +120,7 @@ public class SysProfileController extends BaseController {
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
@PostMapping("/avatar")
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file,String fileType) throws Exception {
try {
FileInfo fileInfo = sysFileService.uploadHeadPic(file, fileType);
if (!file.isEmpty()) {
LoginUser loginUser = SecurityUtils.getLoginUser();
@ -140,6 +141,9 @@ public class SysProfileController extends BaseController {
return ajax;
}
}
} catch (Exception e) {
throw new RuntimeException("系统异常,请联系管理员!");
}
return error("上传图片异常,请联系管理员");
}
}