mirror of
https://github.com/dromara/RuoYi-Vue-Plus.git
synced 2026-04-27 21:44:26 +08:00
update 日常校验 统一重构到 StringUtils 便于维护扩展
This commit is contained in:
@@ -107,9 +107,9 @@ public class CaptchaController {
|
||||
|
||||
private String getCodeResult(String capStr) {
|
||||
int numberLength = captchaProperties.getNumberLength();
|
||||
int a = Convert.toInt(StringUtils.sub(capStr, 0, numberLength).trim());
|
||||
int a = Convert.toInt(StringUtils.substring(capStr, 0, numberLength).trim());
|
||||
char operator = capStr.charAt(numberLength);
|
||||
int b = Convert.toInt(StringUtils.sub(capStr, numberLength + 1, numberLength + 1 + numberLength).trim());
|
||||
int b = Convert.toInt(StringUtils.substring(capStr, numberLength + 1, numberLength + 1 + numberLength).trim());
|
||||
switch (operator) {
|
||||
case '*':
|
||||
return a * b + "";
|
||||
|
||||
@@ -72,9 +72,9 @@ public class CommonController
|
||||
// 本地资源路径
|
||||
String localPath = RuoYiConfig.getProfile();
|
||||
// 数据库资源地址
|
||||
String downloadPath = localPath + StringUtils.subAfter(resource, Constants.RESOURCE_PREFIX,false);
|
||||
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
|
||||
// 下载名称
|
||||
String downloadName = StringUtils.subAfter(downloadPath, "/",true);
|
||||
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
||||
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
|
||||
File file = new File(downloadPath);
|
||||
FileUtils.setAttachmentResponseHeader(response, downloadName);
|
||||
|
||||
Reference in New Issue
Block a user