Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
IEQEFCR
halo
提交
a6697c5d
H
halo
项目概览
IEQEFCR
/
halo
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
halo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a6697c5d
编写于
5月 03, 2019
作者:
J
johnniang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Translate some tips
上级
90d81b78
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
16 addition
and
10 deletion
+16
-10
src/main/java/run/halo/app/cache/lock/CacheLockInterceptor.java
...in/java/run/halo/app/cache/lock/CacheLockInterceptor.java
+1
-1
src/main/java/run/halo/app/controller/base/ControllerExceptionHandler.java
.../halo/app/controller/base/ControllerExceptionHandler.java
+2
-2
src/main/java/run/halo/app/controller/content/api/JournalController.java
...un/halo/app/controller/content/api/JournalController.java
+2
-0
src/main/java/run/halo/app/controller/content/api/PostController.java
...a/run/halo/app/controller/content/api/PostController.java
+2
-0
src/main/java/run/halo/app/controller/content/api/SheetController.java
.../run/halo/app/controller/content/api/SheetController.java
+2
-0
src/main/java/run/halo/app/model/params/BaseCommentParam.java
...main/java/run/halo/app/model/params/BaseCommentParam.java
+7
-7
未找到文件。
src/main/java/run/halo/app/cache/lock/CacheLockInterceptor.java
浏览文件 @
a6697c5d
...
...
@@ -62,7 +62,7 @@ public class CacheLockInterceptor {
}
if
(!
cacheResult
)
{
throw
new
FrequentAccessException
(
"
Frequent access
"
).
setErrorData
(
cacheLockKey
);
throw
new
FrequentAccessException
(
"
访问过于频繁,请稍后再试!
"
).
setErrorData
(
cacheLockKey
);
}
// Proceed the method
...
...
src/main/java/run/halo/app/controller/base/ControllerExceptionHandler.java
浏览文件 @
a6697c5d
...
...
@@ -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
;
...
...
src/main/java/run/halo/app/controller/content/api/JournalController.java
浏览文件 @
a6697c5d
...
...
@@ -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
));
}
...
...
src/main/java/run/halo/app/controller/content/api/PostController.java
浏览文件 @
a6697c5d
...
...
@@ -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
));
}
...
...
src/main/java/run/halo/app/controller/content/api/SheetController.java
浏览文件 @
a6697c5d
...
...
@@ -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
));
}
...
...
src/main/java/run/halo/app/model/params/BaseCommentParam.java
浏览文件 @
a6697c5d
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录