Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
e76f61b4
Commit
e76f61b4
authored
3 years ago
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
话题下线返回message
parent
a08ee369
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
9 deletions
+12
-9
TopicController.java
.../java/com/tanpu/community/controller/TopicController.java
+1
-1
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+6
-3
TopicManager.java
...c/main/java/com/tanpu/community/manager/TopicManager.java
+4
-4
RankUtils.java
...ice/src/main/java/com/tanpu/community/util/RankUtils.java
+1
-1
No files found.
community-service/src/main/java/com/tanpu/community/controller/TopicController.java
View file @
e76f61b4
...
...
@@ -40,7 +40,7 @@ public class TopicController {
@ApiOperation
(
"话题详情页顶部"
)
@ResponseBody
public
CommonResp
<
TopicRankQo
>
getDetail
(
@RequestParam
String
topicId
){
return
CommonResp
.
success
(
topicManager
.
getDetail
(
topicId
)
);
return
topicManager
.
getDetail
(
topicId
);
}
...
...
This diff is collapsed.
Click to expand it.
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
e76f61b4
...
...
@@ -255,7 +255,8 @@ public class ThemeManager {
/**
* 推荐:由最热,最新和python推荐三个部分组成,比例为6,3,1
* 查询主题列表:推荐/关注/热门/最新
*
*/
// 查询主题列表:推荐/关注/热门/最新
public
ThemeListResp
queryList
(
ThemeListReq
req
,
String
userId
)
{
...
...
@@ -272,15 +273,17 @@ public class ThemeManager {
Integer
pageSize
=
req
.
page
.
pageSize
;
List
<
ThemeEntity
>
themes
=
new
ArrayList
<>();
// 推荐:由最新,最热和python推荐三个部分组成,默认比例为6,3,1,可在配置文件中配置
if
(
ThemeListTypeEnum
.
RECOMMEND
.
getCode
().
equals
(
req
.
getType
()))
{
// 推荐
// 需要筛掉用户访问过详情的 & 最近出现在列表页过的.
List
<
String
>
visitedIds
=
visitLogService
.
queryUserRecentVisited
(
userId
);
List
<
String
>
excludes
=
ListUtils
.
union
(
excludeIds
,
visitedIds
);
List
<
String
>
recmdIds
=
recommendService
.
getRecommendThemes
(
pageStart
,
pageSize
,
userId
,
excludes
);
themes
=
themeService
.
queryByThemeIds
(
recmdIds
);
//排序并去重
themes
=
RankUtils
.
sortThemeEntityByIds
(
themes
,
recmdIds
).
stream
().
limit
(
pageSize
).
collect
(
Collectors
.
toList
());
...
...
This diff is collapsed.
Click to expand it.
community-service/src/main/java/com/tanpu/community/manager/TopicManager.java
View file @
e76f61b4
package
com
.
tanpu
.
community
.
manager
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.constant.ErrorCodeConstant
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.community.api.beans.qo.TopicRankQo
;
import
com.tanpu.community.api.beans.req.page.Page
;
import
com.tanpu.community.api.beans.req.topic.TopicSearchReq
;
...
...
@@ -39,12 +39,12 @@ public class TopicManager {
}
// 话题详情页
public
TopicRankQo
getDetail
(
String
topicId
)
{
public
CommonResp
<
TopicRankQo
>
getDetail
(
String
topicId
)
{
TopicEntity
topicEntity
=
topicService
.
queryById
(
topicId
);
if
(
topicEntity
==
null
){
throw
new
BizException
(
ErrorCodeConstant
.
TOPIC_NOT_FOUND
);
return
CommonResp
.
error
(
ErrorCodeConstant
.
TOPIC_NOT_FOUND
.
getCode
(),
"抱歉!该话题已下线。"
);
}
return
rankService
.
getTopicDetail
(
topicId
);
return
CommonResp
.
success
(
rankService
.
getTopicDetail
(
topicId
)
);
}
...
...
This diff is collapsed.
Click to expand it.
community-service/src/main/java/com/tanpu/community/util/RankUtils.java
View file @
e76f61b4
...
...
@@ -11,7 +11,7 @@ public class RankUtils {
/**
* 根据id排序主题对象
* 根据id排序主题对象
(同时去重)
* @param list 主题
* @param ids 主题Id,list中可重复
* @return
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment