Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
街头小贩
Jforum2
提交
b4a27392
J
Jforum2
项目概览
街头小贩
/
Jforum2
通知
2
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
1
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
Jforum2
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b4a27392
编写于
9月 22, 2020
作者:
街头小贩
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修正thrones.admin 中CTL的TipMessage输出API
上级
77df6529
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
142 addition
and
64 deletion
+142
-64
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminAlbumController.java
.../forum/thrones/admin/controller/AdminAlbumController.java
+3
-1
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminBoardCategoryController.java
...hrones/admin/controller/AdminBoardCategoryController.java
+3
-1
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminBoardController.java
.../forum/thrones/admin/controller/AdminBoardController.java
+12
-9
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminBoardModeratorController.java
...rones/admin/controller/AdminBoardModeratorController.java
+3
-1
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminForumMessageController.java
...thrones/admin/controller/AdminForumMessageController.java
+8
-6
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminMemberNamesProtectController.java
...s/admin/controller/AdminMemberNamesProtectController.java
+4
-3
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminMemberPenalizeRecordsController.java
...dmin/controller/AdminMemberPenalizeRecordsController.java
+3
-1
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminMemberVipExchangeRecordsController.java
...n/controller/AdminMemberVipExchangeRecordsController.java
+3
-1
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminPostsController.java
.../forum/thrones/admin/controller/AdminPostsController.java
+4
-3
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminRegisteInviteCodeController.java
...es/admin/controller/AdminRegisteInviteCodeController.java
+5
-5
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminSectionArticleController.java
...rones/admin/controller/AdminSectionArticleController.java
+4
-3
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminTopicCarouselController.java
...hrones/admin/controller/AdminTopicCarouselController.java
+12
-9
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminTopicCategoryController.java
...hrones/admin/controller/AdminTopicCategoryController.java
+4
-3
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminTopicController.java
.../forum/thrones/admin/controller/AdminTopicController.java
+16
-13
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminTopicTagController.java
...rum/thrones/admin/controller/AdminTopicTagController.java
+5
-5
utils/src/main/java/com/apobates/forum/utils/TipMessage.java
utils/src/main/java/com/apobates/forum/utils/TipMessage.java
+53
-0
未找到文件。
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminAlbumController.java
浏览文件 @
b4a27392
...
...
@@ -138,10 +138,12 @@ public class AdminAlbumController {
@RequestParam
(
"cover"
)
long
coverPictureId
,
HttpServletRequest
request
,
Model
model
)
{
/*
Optional<Boolean> data = albumService.editCover(topicAlbumId, coverPictureId);
if (data.isPresent()) {
return TipMessage.ofSuccess("封面图片设置成功");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
condition
(()->
albumService
.
editCover
(
topicAlbumId
,
coverPictureId
)).
success
(
"封面图片设置成功"
).
error
(
"操作失败"
);
}
}
\ No newline at end of file
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminBoardCategoryController.java
浏览文件 @
b4a27392
...
...
@@ -117,11 +117,13 @@ public class AdminBoardCategoryController {
@RequestParam
(
"category"
)
int
topicCategoryId
,
HttpServletRequest
request
,
Model
model
)
{
/*
int records = boardTopicCategoryIndexService.deleteForTopic(boardId, Arrays.asList(topicCategoryId));
if (records == 1) {
return TipMessage.ofSuccess("版块与话题类型的关联删除成功");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
or
(()->
boardTopicCategoryIndexService
.
deleteForTopic
(
boardId
,
Arrays
.
asList
(
topicCategoryId
))
==
1
).
success
(
"版块与话题类型的关联删除成功"
).
error
(
"操作失败"
);
}
//检查举报和反馈模块是否关联到了某版块
...
...
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminBoardController.java
浏览文件 @
b4a27392
...
...
@@ -261,11 +261,12 @@ public class AdminBoardController {
HttpServletRequest
request
,
Model
model
)
{
ActionEventCulpritor
aec
=
AdminHomeController
.
getActionCulpritor
(
mbean
.
getMid
(),
mbean
.
getNickname
(),
request
,
""
);
boolean
symbol
=
boardService
.
lock
(
boardId
,
boardGroupId
,
aec
).
orElse
(
false
);
if
(
symbol
)
{
/*
if (
boardService.lock(boardId, boardGroupId, aec).orElse(false)
) {
return TipMessage.ofSuccess("成功锁定版块");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
condition
(()->
boardService
.
lock
(
boardId
,
boardGroupId
,
aec
)).
success
(
"成功锁定版块"
).
error
(
"操作失败"
);
}
//解锁
@PostMapping
(
path
=
"/lock/remove"
,
produces
=
"application/json;charset=UTF-8"
)
...
...
@@ -277,11 +278,12 @@ public class AdminBoardController {
HttpServletRequest
request
,
Model
model
)
{
ActionEventCulpritor
aec
=
AdminHomeController
.
getActionCulpritor
(
mbean
.
getMid
(),
mbean
.
getNickname
(),
request
,
""
);
boolean
symbol
=
boardService
.
releaseLock
(
boardId
,
boardGroupId
,
aec
).
orElse
(
false
);
if
(
symbol
)
{
/*
if (
boardService.releaseLock(boardId, boardGroupId, aec).orElse(false)
) {
return TipMessage.ofSuccess("成功解锁版块");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
condition
(()->
boardService
.
releaseLock
(
boardId
,
boardGroupId
,
aec
)).
success
(
"成功解锁版块"
).
error
(
"操作失败"
);
}
//删除
@PostMapping
(
path
=
"/remove"
,
produces
=
"application/json;charset=UTF-8"
)
...
...
@@ -293,11 +295,12 @@ public class AdminBoardController {
HttpServletRequest
request
,
Model
model
)
{
ActionEventCulpritor
aec
=
AdminHomeController
.
getActionCulpritor
(
mbean
.
getMid
(),
mbean
.
getNickname
(),
request
,
""
);
boolean
symbol
=
boardService
.
remove
(
boardId
,
boardGroupId
,
aec
).
orElse
(
false
);
if
(
symbol
)
{
/*
if (
boardService.remove(boardId, boardGroupId, aec).orElse(false)
) {
return TipMessage.ofSuccess("版块删除成功");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
condition
(()->
boardService
.
remove
(
boardId
,
boardGroupId
,
aec
)).
success
(
"版块删除成功"
).
error
(
"操作失败"
);
}
//查看指定的版块的名称
@GetMapping
(
path
=
"/list.json"
,
produces
=
"application/json;charset=UTF-8"
)
...
...
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminBoardModeratorController.java
浏览文件 @
b4a27392
...
...
@@ -224,9 +224,11 @@ public class AdminBoardModeratorController {
}
else
{
symbol
=
boardModeratorService
.
remove
(
volumesId
,
boardId
,
memberId
);
}
/*
if (symbol.isPresent()) {
return TipMessage.ofSuccess("版主卸任成功");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
or
(()->
symbol
.
orElse
(
false
)).
success
(
"版主卸任成功"
).
error
(
"操作失败"
);
}
}
\ No newline at end of file
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminForumMessageController.java
浏览文件 @
b4a27392
...
...
@@ -161,11 +161,12 @@ public class AdminForumMessageController {
MemberSessionBean
mbean
,
HttpServletRequest
request
,
Model
model
)
{
int
affect
=
inboxService
.
remove
(
mbean
.
getMid
(),
Arrays
.
asList
(
id
));
if
(
affect
==
1
)
{
/*
if (
inboxService.remove(mbean.getMid(), Arrays.asList(id))
== 1) {
return TipMessage.ofSuccess("消息删除成功");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
or
(()->
inboxService
.
remove
(
mbean
.
getMid
(),
Arrays
.
asList
(
id
))
==
1
).
success
(
"消息删除成功"
).
error
(
"操作失败"
);
}
//阅读消息(发件人不可以操作)
...
...
@@ -176,11 +177,12 @@ public class AdminForumMessageController {
MemberSessionBean
mbean
,
HttpServletRequest
request
,
Model
model
)
{
int
affect
=
inboxService
.
readed
(
mbean
.
getMid
(),
Arrays
.
asList
(
id
));
if
(
affect
==
1
)
{
/*
if (
inboxService.readed(mbean.getMid(), Arrays.asList(id))
== 1) {
return TipMessage.ofSuccess("消息标记成功");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
or
(()->
inboxService
.
readed
(
mbean
.
getMid
(),
Arrays
.
asList
(
id
))
==
1
).
success
(
"消息标记成功"
).
error
(
"操作失败"
);
}
@GetMapping
(
path
=
"/label/json"
,
produces
=
"application/json;charset=UTF-8"
)
...
...
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminMemberNamesProtectController.java
浏览文件 @
b4a27392
...
...
@@ -102,10 +102,11 @@ public class AdminMemberNamesProtectController {
MemberSessionBean
mbean
,
HttpServletRequest
request
,
Model
model
)
{
boolean
symbol
=
memberNamesProtectService
.
editStatus
(
id
,
false
).
orElse
(
false
);
if
(
symbol
)
{
/*
if (
memberNamesProtectService.editStatus(id, false).orElse(false)
) {
return TipMessage.ofSuccess("会员帐户保护删除成功");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
condition
(()->
memberNamesProtectService
.
editStatus
(
id
,
false
)).
success
(
"会员帐户保护删除成功"
).
error
(
"操作失败"
);
}
}
\ No newline at end of file
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminMemberPenalizeRecordsController.java
浏览文件 @
b4a27392
...
...
@@ -120,6 +120,7 @@ public class AdminMemberPenalizeRecordsController {
@RequestParam
(
"id"
)
long
id
,
HttpServletRequest
request
,
Model
model
)
{
/*
try{
if (memberPenalizeRecordsService.expired(id).orElse(false)) {
return TipMessage.ofSuccess("惩罚记录成功结束");
...
...
@@ -127,7 +128,8 @@ public class AdminMemberPenalizeRecordsController {
}catch(IllegalArgumentException | IllegalStateException e){
return TipMessage.ofError(e.getMessage());
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
condition
(()->
memberPenalizeRecordsService
.
expired
(
id
)).
success
(
"惩罚记录成功结束"
).
error
(
"操作失败"
);
}
//会员的惩罚状态
...
...
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminMemberVipExchangeRecordsController.java
浏览文件 @
b4a27392
...
...
@@ -147,6 +147,7 @@ public class AdminMemberVipExchangeRecordsController {
MemberSessionBean
mbean
,
HttpServletRequest
request
,
Model
model
)
{
/*
try{
if (memberVipExchangeRecordsService.expired(id).orElse(false)) {
return TipMessage.ofSuccess("交易记录成功作废");
...
...
@@ -154,6 +155,7 @@ public class AdminMemberVipExchangeRecordsController {
}catch(IllegalArgumentException | IllegalStateException e){
return TipMessage.ofError(e.getMessage());
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
condition
(()->
memberVipExchangeRecordsService
.
expired
(
id
)).
success
(
"交易记录成功作废"
).
error
(
"操作失败"
);
}
}
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminPostsController.java
浏览文件 @
b4a27392
...
...
@@ -76,11 +76,12 @@ public class AdminPostsController {
HttpServletRequest
request
,
Model
model
)
{
ActionEventCulpritor
aec
=
AdminHomeController
.
getActionCulpritor
(
mbean
.
getMid
(),
mbean
.
getNickname
(),
request
,
""
);
boolean
symbol
=
postsService
.
remove
(
postsId
,
aec
).
orElse
(
false
);
if
(
symbol
)
{
/*
if (
postsService.remove(postsId, aec).orElse(false)
) {
return TipMessage.ofSuccess("回复删除成功");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
condition
(()->
postsService
.
remove
(
postsId
,
aec
)).
success
(
"回复删除成功"
).
error
(
"操作失败"
);
}
//指定回复的喜好记录
...
...
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminRegisteInviteCodeController.java
浏览文件 @
b4a27392
...
...
@@ -73,8 +73,7 @@ public class AdminRegisteInviteCodeController {
model
.
addAttribute
(
"form"
,
form
);
return
"admin/member_invitecode/create"
;
}
long
primaryKey
=
registeInviteCodeService
.
create
(
mbean
.
getNickname
(),
form
.
getCode
());
if
(
primaryKey
>
0
)
{
if
(
registeInviteCodeService
.
create
(
mbean
.
getNickname
(),
form
.
getCode
())
>
0
)
{
return
"redirect:/member/invitecode/"
;
}
model
.
addAttribute
(
"form"
,
form
);
...
...
@@ -88,10 +87,11 @@ public class AdminRegisteInviteCodeController {
MemberSessionBean
mbean
,
HttpServletRequest
request
,
Model
model
)
{
boolean
symbol
=
registeInviteCodeService
.
remove
(
id
).
orElse
(
false
);
if
(
symbol
)
{
/*
if (
registeInviteCodeService.remove(id).orElse(false)
) {
return TipMessage.ofSuccess("邀请码删除成功");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
condition
(()->
registeInviteCodeService
.
remove
(
id
)).
success
(
"邀请码删除成功"
).
error
(
"操作失败"
);
}
}
\ No newline at end of file
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminSectionArticleController.java
浏览文件 @
b4a27392
...
...
@@ -382,10 +382,11 @@ public class AdminSectionArticleController {
HttpServletRequest
request
,
Model
model
)
{
ActionEventCulpritor
aec
=
AdminHomeController
.
getActionCulpritor
(
mbean
.
getMid
(),
mbean
.
getNickname
(),
request
,
""
);
boolean
symbol
=
topicService
.
removeTermArticle
(
articleId
,
termId
,
aec
).
orElse
(
false
);
if
(
symbol
)
{
/*
if (
topicService.removeTermArticle(articleId, termId, aec).orElse(false)
) {
return TipMessage.ofSuccess("文章删除成功");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
condition
(()->
topicService
.
removeTermArticle
(
articleId
,
termId
,
aec
)).
success
(
"文章删除成功"
).
error
(
"操作失败"
);
}
}
\ No newline at end of file
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminTopicCarouselController.java
浏览文件 @
b4a27392
...
...
@@ -110,11 +110,12 @@ public class AdminTopicCarouselController {
MemberSessionBean
mbean
,
HttpServletRequest
request
,
Model
model
)
{
boolean
symbol
=
topicCarouselService
.
remove
(
topicCarouselId
).
orElse
(
false
);
if
(
symbol
)
{
/*
if (
topicCarouselService.remove(topicCarouselId).orElse(false)
) {
return TipMessage.ofSuccess("轮播图删除成功");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
condition
(()->
topicCarouselService
.
remove
(
topicCarouselId
)).
success
(
"轮播图删除成功"
).
error
(
"操作失败"
);
}
//轮播图下所有幻灯片,忽略状态
@GetMapping
(
path
=
"/slide"
)
...
...
@@ -182,11 +183,12 @@ public class AdminTopicCarouselController {
MemberSessionBean
mbean
,
HttpServletRequest
request
,
Model
model
)
{
boolean
symbol
=
topicCarouselSlideService
.
remove
(
topicCarouselSlideId
,
topicCarouselId
).
orElse
(
false
);
if
(
symbol
)
{
/*
if (
topicCarouselSlideService.remove(topicCarouselSlideId, topicCarouselId).orElse(false)
) {
return TipMessage.ofSuccess("幻灯片删除成功");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
condition
(()->
topicCarouselSlideService
.
remove
(
topicCarouselSlideId
,
topicCarouselId
)).
success
(
"幻灯片删除成功"
).
error
(
"操作失败"
);
}
//版块绑定轮播图
@GetMapping
(
path
=
"/bind"
)
...
...
@@ -228,11 +230,12 @@ public class AdminTopicCarouselController {
@RequestParam
(
"volumes"
)
int
volumesId
,
HttpServletRequest
request
,
Model
model
)
{
boolean
symbol
=
topicCarouselService
.
remove
(
topicCarouselId
,
volumesId
,
boardId
).
orElse
(
false
);
if
(
symbol
)
{
/*
if (
topicCarouselService.remove(topicCarouselId, volumesId, boardId).orElse(false)
) {
return TipMessage.ofSuccess("版块轮播图关联删除成功");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
condition
(()->
topicCarouselService
.
remove
(
topicCarouselId
,
volumesId
,
boardId
)).
success
(
"版块轮播图关联删除成功"
).
error
(
"操作失败"
);
}
//版块绑定轮播图记录
...
...
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminTopicCategoryController.java
浏览文件 @
b4a27392
...
...
@@ -106,11 +106,12 @@ public class AdminTopicCategoryController {
@RequestParam
(
"id"
)
int
categoryId
,
HttpServletRequest
request
,
Model
model
)
{
boolean
symbol
=
topicCategoryService
.
remove
(
categoryId
).
orElse
(
false
);
if
(
symbol
)
{
/*
if (
topicCategoryService.remove(categoryId).orElse(false)
) {
return TipMessage.ofSuccess("话题类型删除成功");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
condition
(()->
topicCategoryService
.
remove
(
categoryId
)).
success
(
"话题类型删除成功"
).
error
(
"操作失败"
);
}
//所有可用的
...
...
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminTopicController.java
浏览文件 @
b4a27392
...
...
@@ -239,7 +239,6 @@ public class AdminTopicController {
MemberRoleEnum
wmr
=
EnumArchitecture
.
getInstance
(
form
.
getIntegerWriteLowMemberRole
(),
MemberRoleEnum
.
class
).
orElse
(
MemberRoleEnum
.
NO
);
config
.
setWriteLowMemberRole
(
wmr
);
config
.
setWriteLowMemberLevel
(
form
.
getIntegerWriteLowMemberLevel
());
//editTopicConfig(long id, TopicConfig updateConfig, long configId, ActionEventCulpritor culpritor) {
ActionEventCulpritor
aec
=
AdminHomeController
.
getActionCulpritor
(
mbean
.
getMid
(),
mbean
.
getNickname
(),
request
,
form
.
getToken
());
Optional
<
Boolean
>
symbol
=
topicService
.
editTopicConfig
(
form
.
getLongTopicId
(),
...
...
@@ -294,11 +293,12 @@ public class AdminTopicController {
HttpServletRequest
request
,
Model
model
)
{
ActionEventCulpritor
aec
=
AdminHomeController
.
getActionCulpritor
(
mbean
.
getMid
(),
mbean
.
getNickname
(),
request
,
""
);
boolean
symbol
=
topicService
.
lock
(
topicId
,
aec
).
orElse
(
false
);
if
(
symbol
)
{
/*
if (
topicService.lock(topicId, aec).orElse(false)
) {
return TipMessage.ofSuccess("成功锁定话题");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
condition
(()->
topicService
.
lock
(
topicId
,
aec
)).
success
(
"成功锁定话题"
).
error
(
"操作失败"
);
}
//锁定话题
@PostMapping
(
path
=
"/lock/remove"
,
produces
=
"application/json;charset=UTF-8"
)
...
...
@@ -309,11 +309,12 @@ public class AdminTopicController {
HttpServletRequest
request
,
Model
model
)
{
ActionEventCulpritor
aec
=
AdminHomeController
.
getActionCulpritor
(
mbean
.
getMid
(),
mbean
.
getNickname
(),
request
,
""
);
boolean
symbol
=
topicService
.
releaseLock
(
topicId
,
aec
).
orElse
(
false
);
if
(
symbol
)
{
/*
if (
topicService.releaseLock(topicId, aec).orElse(false)
) {
return TipMessage.ofSuccess("成功解锁话题");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
condition
(()->
topicService
.
releaseLock
(
topicId
,
aec
)).
success
(
"成功解锁话题"
).
error
(
"操作失败"
);
}
//删除话题
@PostMapping
(
path
=
"/remove"
,
produces
=
"application/json;charset=UTF-8"
)
...
...
@@ -324,11 +325,12 @@ public class AdminTopicController {
HttpServletRequest
request
,
Model
model
)
{
ActionEventCulpritor
aec
=
AdminHomeController
.
getActionCulpritor
(
mbean
.
getMid
(),
mbean
.
getNickname
(),
request
,
""
);
boolean
symbol
=
topicService
.
remove
(
topicId
,
aec
).
orElse
(
false
);
if
(
symbol
)
{
/*
if (
topicService.remove(topicId, aec).orElse(false)
) {
return TipMessage.ofSuccess("话题删除成功");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
condition
(()->
topicService
.
remove
(
topicId
,
aec
)).
success
(
"话题删除成功"
).
error
(
"操作失败"
);
}
//置顶话题
@PostMapping
(
path
=
"/top"
,
produces
=
"application/json;charset=UTF-8"
)
...
...
@@ -339,11 +341,12 @@ public class AdminTopicController {
HttpServletRequest
request
,
Model
model
)
{
ActionEventCulpritor
aec
=
AdminHomeController
.
getActionCulpritor
(
mbean
.
getMid
(),
mbean
.
getNickname
(),
request
,
""
);
boolean
symbol
=
topicService
.
editTop
(
topicId
,
aec
).
orElse
(
false
);
if
(
symbol
)
{
/*
if (
topicService.editTop(topicId, aec).orElse(false)
) {
return TipMessage.ofSuccess("话题置顶成功");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
condition
(()->
topicService
.
editTop
(
topicId
,
aec
)).
success
(
"话题置顶成功"
).
error
(
"操作失败"
);
}
@GetMapping
(
path
=
"/{id}.xhtml"
)
...
...
thrones.admin/src/main/java/com/apobates/forum/thrones/admin/controller/AdminTopicTagController.java
浏览文件 @
b4a27392
...
...
@@ -69,11 +69,12 @@ public class AdminTopicTagController {
HttpServletRequest
request
,
Model
model
)
{
ActionEventCulpritor
aec
=
AdminHomeController
.
getActionCulpritor
(
mbean
.
getMid
(),
mbean
.
getNickname
(),
request
,
token
);
boolean
symbol
=
topicTagService
.
deleteForTopic
(
topicId
,
tagId
,
aec
).
orElse
(
false
);
if
(
symbol
)
{
/*
if (
topicTagService.deleteForTopic(topicId, tagId, aec).orElse(false)
) {
return TipMessage.ofSuccess("成功删除标签");
}
return
TipMessage
.
ofError
(
"操作失败"
);
return TipMessage.ofError("操作失败");*/
return
TipMessage
.
Builder
.
condition
(()->
topicTagService
.
deleteForTopic
(
topicId
,
tagId
,
aec
)).
success
(
"成功删除标签"
).
error
(
"操作失败"
);
}
@GetMapping
(
path
=
"/collection"
)
...
...
@@ -118,8 +119,7 @@ public class AdminTopicTagController {
int
rates
=
StringSeekUtils
.
queryWordCountByBM
(
topic
.
getTitle
()
+
" "
+
topic
.
getContent
().
getContent
(),
newTagNames
);
//
ActionEventCulpritor
aec
=
AdminHomeController
.
getActionCulpritor
(
mbean
.
getMid
(),
mbean
.
getNickname
(),
request
,
form
.
getToken
());
long
id
=
topicTagService
.
create
(
topic
.
getId
(),
newTagNames
,
rates
,
aec
);
if
(
id
>
0
)
{
if
(
topicTagService
.
create
(
topic
.
getId
(),
newTagNames
,
rates
,
aec
)
>
0
)
{
return
"redirect:/topic/tag/collection?topic="
+
form
.
getTopic
();
}
model
.
addAttribute
(
"form"
,
form
);
...
...
utils/src/main/java/com/apobates/forum/utils/TipMessage.java
浏览文件 @
b4a27392
package
com.apobates.forum.utils
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.util.function.Supplier
;
/**
* 提示消息
...
...
@@ -93,4 +95,55 @@ public final class TipMessage {
public
static
TipMessage
ofSuccess
(
String
message
,
String
url
)
{
return
new
TipMessage
(
message
,
TipMessageLevelEnum
.
ACC
,
url
);
}
public
static
class
Builder
{
private
final
boolean
condition
;
private
final
String
message
;
private
Builder
(
boolean
condition
)
{
this
.
condition
=
condition
;
this
.
message
=
null
;
}
private
Builder
(
boolean
condition
,
String
message
)
{
this
.
condition
=
condition
;
this
.
message
=
message
;
}
public
static
Builder
condition
(
Supplier
<
Optional
<
Boolean
>>
condition
){
try
{
return
new
Builder
(
condition
.
get
().
orElse
(
false
));
}
catch
(
Exception
e
){
return
new
Builder
(
false
,
e
.
getMessage
());
}
}
public
static
Builder
or
(
Supplier
<
Boolean
>
condition
){
try
{
return
new
Builder
(
condition
.
get
());
}
catch
(
Exception
e
){
return
new
Builder
(
false
,
e
.
getMessage
());
}
}
/**
* 若不调用默认为:操作成功
*
* @param successMessage 操作成功的内容
* @return
*/
public
Builder
success
(
String
successMessage
){
if
(!
this
.
condition
){
return
this
;
}
return
new
Builder
(
this
.
condition
,
successMessage
);
}
/**
* 生成TipMessage
*
* @param errorMessage 操作失败的内容
* @return
*/
public
TipMessage
error
(
String
errorMessage
){
return
this
.
condition
?
TipMessage
.
ofSuccess
(
Optional
.
ofNullable
(
message
).
orElse
(
"操作成功"
)):
TipMessage
.
ofError
(
Optional
.
ofNullable
(
message
).
orElse
(
errorMessage
));
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录