提交 a6697c5d 编写于 作者: J johnniang

Translate some tips

上级 90d81b78
......@@ -62,7 +62,7 @@ public class CacheLockInterceptor {
}
if (!cacheResult) {
throw new FrequentAccessException("Frequent access").setErrorData(cacheLockKey);
throw new FrequentAccessException("访问过于频繁,请稍后再试!").setErrorData(cacheLockKey);
}
// Proceed the method
......
......@@ -59,7 +59,7 @@ public class ControllerExceptionHandler {
public BaseResponse handleConstraintViolationException(ConstraintViolationException e) {
BaseResponse<Map<String, String>> baseResponse = handleBaseException(e);
baseResponse.setStatus(HttpStatus.BAD_REQUEST.value());
baseResponse.setMessage("Field validation error");
baseResponse.setMessage("字段验证错误,请完善后重试!");
baseResponse.setData(ValidationUtils.mapWithValidError(e.getConstraintViolations()));
return baseResponse;
}
......@@ -69,7 +69,7 @@ public class ControllerExceptionHandler {
public BaseResponse handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
BaseResponse<Map<String, String>> baseResponse = handleBaseException(e);
baseResponse.setStatus(HttpStatus.BAD_REQUEST.value());
baseResponse.setMessage("Field validation error");
baseResponse.setMessage("字段验证错误,请完善后重试!");
Map<String, String> errMap = ValidationUtils.mapWithFieldError(e.getBindingResult().getFieldErrors());
baseResponse.setData(errMap);
return baseResponse;
......
......@@ -6,6 +6,7 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.SortDefault;
import org.springframework.web.bind.annotation.*;
import run.halo.app.cache.lock.CacheLock;
import run.halo.app.model.dto.BaseCommentDTO;
import run.halo.app.model.params.JournalCommentParam;
import run.halo.app.model.vo.BaseCommentVO;
......@@ -56,6 +57,7 @@ public class JournalController {
@PostMapping("comments")
@ApiOperation("Comments a post")
@CacheLock(autoDelete = false, traceRequest = true)
public BaseCommentDTO comment(@RequestBody JournalCommentParam journalCommentParam) {
return journalCommentService.convertTo(journalCommentService.createBy(journalCommentParam));
}
......
......@@ -8,6 +8,7 @@ import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
import org.springframework.data.web.SortDefault;
import org.springframework.web.bind.annotation.*;
import run.halo.app.cache.lock.CacheLock;
import run.halo.app.model.dto.BaseCommentDTO;
import run.halo.app.model.dto.post.BasePostDetailDTO;
import run.halo.app.model.dto.post.BasePostSimpleDTO;
......@@ -91,6 +92,7 @@ public class PostController {
@PostMapping("comments")
@ApiOperation("Comments a post")
@CacheLock(autoDelete = false, traceRequest = true)
public BaseCommentDTO comment(@RequestBody PostCommentParam postCommentParam) {
return postCommentService.convertTo(postCommentService.createBy(postCommentParam));
}
......
......@@ -6,6 +6,7 @@ import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.SortDefault;
import org.springframework.web.bind.annotation.*;
import run.halo.app.cache.lock.CacheLock;
import run.halo.app.model.dto.BaseCommentDTO;
import run.halo.app.model.params.SheetCommentParam;
import run.halo.app.model.vo.BaseCommentVO;
......@@ -57,6 +58,7 @@ public class SheetController {
@PostMapping("comments")
@ApiOperation("Comments a post")
@CacheLock(autoDelete = false, traceRequest = true)
public BaseCommentDTO comment(@RequestBody SheetCommentParam sheetCommentParam) {
return sheetCommentService.convertTo(sheetCommentService.createBy(sheetCommentParam));
}
......
......@@ -19,20 +19,20 @@ import java.lang.reflect.ParameterizedType;
@Data
public abstract class BaseCommentParam<COMMENT> implements InputConverter<COMMENT> {
@NotBlank(message = "PostComment author name must not be blank")
@NotBlank(message = "评论者名称不能为空")
@Size(max = 50, message = "Length of comment author name must not be more than {max}")
private String author;
@NotBlank(message = "PostComment email must not be blank")
@Email(message = "PostComment email's format is incorrect")
@Size(max = 255, message = "Length of comment email must not be more than {max}")
@NotBlank(message = "邮箱不能为空")
@Email(message = "邮箱格式不正确")
@Size(max = 255, message = "邮箱的长度不能超过 {max}")
private String email;
@Size(max = 127, message = "Length of comment author url must not be more than {max}")
@Size(max = 127, message = "评论者博客链接不能超过 {max}")
private String authorUrl;
@NotBlank(message = "PostComment content must not be blank")
@Size(max = 1023, message = "Length of comment content must not be more than {max}")
@NotBlank(message = "评论内容不能为空")
@Size(max = 1023, message = "评论内容的长额不能超过 {max}")
private String content;
@Min(value = 1, message = "Post id must not be less than {value}")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册