Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
街头小贩
Jforum2
提交
c0ec4075
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 搜索 >>
提交
c0ec4075
编写于
12月 13, 2020
作者:
街头小贩
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修正喜好记录的增加bug
上级
2395240b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
9 deletion
+24
-9
core/src/main/java/com/apobates/forum/core/service/PostsMoodRecordsService.java
.../apobates/forum/core/service/PostsMoodRecordsService.java
+2
-2
thrones/src/main/java/com/apobates/forum/thrones/controller/PostsMoodController.java
...pobates/forum/thrones/controller/PostsMoodController.java
+9
-2
thrones/src/main/webapp/static/lib/forum/jForum.xhr.defer.js
thrones/src/main/webapp/static/lib/forum/jForum.xhr.defer.js
+11
-3
thrones/src/main/webapp/static/lib/forum/jForum.xhr.js
thrones/src/main/webapp/static/lib/forum/jForum.xhr.js
+2
-2
未找到文件。
core/src/main/java/com/apobates/forum/core/service/PostsMoodRecordsService.java
浏览文件 @
c0ec4075
...
...
@@ -59,7 +59,7 @@ public interface PostsMoodRecordsService {
* @param topicId 话题ID
* @param like 是否为赞,true,false为讨厌
* @param culpritor 操作的肇事信息
* @return -1表示
点过赞了,大于0表示点赞成功,0点赞
失败
* @return -1表示
删除喜好,大于0表示喜好增加成功,0喜好增加
失败
*/
long
toggleMoodRecord
(
long
id
,
long
topicId
,
boolean
like
,
ActionEventCulpritor
culpritor
);
}
\ No newline at end of file
}
thrones/src/main/java/com/apobates/forum/thrones/controller/PostsMoodController.java
浏览文件 @
c0ec4075
...
...
@@ -69,7 +69,14 @@ public class PostsMoodController {
// 移至StrategyInterceptorAdapter
//----------------------------------
boolean
liked
=
(
moodStatus
==
1
);
return
TipMessage
.
Builder
.
of
(()->
postsMoodRecordsService
.
toggleMoodRecord
(
postsId
,
tpObj
.
getId
(),
liked
,
aec
)>
0
).
success
(
"回复点赞成功"
).
error
(
"点赞失败"
);
long
retVal
=
postsMoodRecordsService
.
toggleMoodRecord
(
postsId
,
tpObj
.
getId
(),
liked
,
aec
);
if
(-
1
==
retVal
){
return
TipMessage
.
ofSuccess
(
"操作成功"
,
"DEL"
);
}
if
(
retVal
>
0
){
return
TipMessage
.
ofSuccess
(
"操作成功"
,
"ADD"
);
}
return
TipMessage
.
ofError
(
"操作失败"
);
}
//查看点赞的计数
...
...
@@ -97,4 +104,4 @@ public class PostsMoodController {
Map
<
String
,
Object
>
result
=
Map
.
ofEntries
(
Map
.
entry
(
"topic"
,
tpObj
.
getId
()),
Map
.
entry
(
"result"
,
data
));
return
callBackFun
+
"("
+
new
Gson
().
toJson
(
result
)
+
");"
;
}
}
\ No newline at end of file
}
thrones/src/main/webapp/static/lib/forum/jForum.xhr.defer.js
浏览文件 @
c0ec4075
...
...
@@ -26,11 +26,19 @@ define('jForumXhrDefer', ['require','jquery'], function (require, $) {
});
};
//回复点赞计数更新
da
.
updateMoodCounter
=
function
(
jqEle
){
da
.
updateMoodCounter
=
function
(
jqEle
,
inputVal
){
var
cc
=
jqEle
.
find
(
'
span
'
);
var
upC
=
1
;
if
(
cc
.
length
==
1
){
upC
+=
parseInt
(
cc
.
html
());
//是+是-
var
curVal
=
parseInt
(
cc
.
html
());
if
(
'
ADD
'
===
inputVal
){
curVal
+=
1
;
}
if
(
'
DEL
'
===
inputVal
){
curVal
-=
1
;
}
upC
=
curVal
;
}
else
{
cc
=
$
(
'
<span></span>
'
).
appendTo
(
jqEle
);
}
...
...
@@ -107,4 +115,4 @@ define('jForumXhrDefer', ['require','jquery'], function (require, $) {
return
da
;
})();
return
jForumXhrDefer
;
});
\ No newline at end of file
});
thrones/src/main/webapp/static/lib/forum/jForum.xhr.js
浏览文件 @
c0ec4075
...
...
@@ -81,7 +81,7 @@ define('jForumXhr', ['require','jquery','jForumUtils','jForumTemplate','jForumXh
//成功:有回调的执行回调,没有回调的提示
if
(
response
.
level
===
'
acc
'
)
{
try
{
xhrDefer
[
callFun
](
jqEle
);
xhrDefer
[
callFun
](
jqEle
,
response
.
input
);
}
catch
(
e
)
{
console
.
error
(
e
.
message
);
}
}
else
{
//失败:都提示
showTipMessage
=
true
;
...
...
@@ -159,4 +159,4 @@ define('jForumXhr', ['require','jquery','jForumUtils','jForumTemplate','jForumXh
return
jqXhr
;
})();
return
jForumXhr
;
});
\ No newline at end of file
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录