Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
physical
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alpha
physical
Commits
9d693cfb
Commit
9d693cfb
authored
Dec 01, 2018
by
段英荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
ce68c272
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
group.py
search/utils/group.py
+9
-3
group.py
search/views/group.py
+2
-2
No files found.
search/utils/group.py
View file @
9d693cfb
...
...
@@ -48,7 +48,7 @@ class GroupUtils(object):
return
{
"total_count"
:
0
,
"hits"
:[]}
@classmethod
def
get_hot_group_recommend_result
s
(
cls
,
offset
,
size
):
def
get_hot_group_recommend_result
_list
(
cls
,
offset
,
size
):
try
:
q
=
dict
()
q
[
"query"
]
=
{
...
...
@@ -67,10 +67,16 @@ class GroupUtils(object):
"include"
:[
"id"
]
}
return
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
"group"
,
q
,
offset
,
size
)
result_dict
=
ESPerform
.
get_search_results
(
ESPerform
.
get_cli
(),
"group"
,
q
,
offset
,
size
)
group_ids_list
=
[]
if
len
(
result_dict
[
"hits"
])
>
0
:
group_ids_list
=
[
item
[
"_source"
][
"id"
]
for
item
in
result_dict
[
"hits"
]]
return
group_ids_list
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
{
"total_count"
:
0
,
"hits"
:[]}
return
[]
@classmethod
def
get_user_attention_group_list
(
cls
,
user_id
,
offset
,
size
):
...
...
search/views/group.py
View file @
9d693cfb
...
...
@@ -44,10 +44,10 @@ def group_sort(user_id=-1,sort_type=GroupSortTypes.HOT_RECOMMEND,offset=0,size=1
"""
try
:
if
sort_type
==
GroupSortTypes
.
HOT_RECOMMEND
:
result_dict
=
GroupUtils
.
get_hot_group_recommend_results
(
offset
,
size
)
group_ids_list
=
[
item
.
id
for
item
in
result_dict
[
"hits"
]]
group_ids_list
=
GroupUtils
.
get_hot_group_recommend_result_list
(
offset
,
size
)
return
{
"group_recommend_ids"
:
group_ids_list
}
elif
sort_type
==
GroupSortTypes
.
ATTENTION_RECOMMEND
:
attention_group_list
=
GroupUtils
.
get_user_attention_group_list
(
user_id
,
offset
,
size
)
if
len
(
attention_group_list
)
==
0
:
...
...
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