Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sun
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
1
Merge Requests
1
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
sun
Commits
167077c8
Commit
167077c8
authored
Jan 19, 2019
by
王浩
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'haow/dev' into 'dev'
tag search add page count See merge request
!50
parents
992cf45c
5085d20d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
search.py
api/search.py
+3
-2
base.py
utils/base.py
+16
-0
No files found.
api/search.py
View file @
167077c8
...
...
@@ -3,7 +3,7 @@
# __author__ = "chenwei"
# Date: 2018/11/17
from
utils.base
import
APIView
from
utils.base
import
APIView
,
get_offset_count
class
GroupSearchView
(
APIView
):
...
...
@@ -45,10 +45,11 @@ class UserSearchView(APIView):
class
TagSearchView
(
APIView
):
def
get
(
self
,
request
):
offset
,
count
=
get_offset_count
(
request
)
name
=
request
.
GET
.
get
(
'name'
)
platform
=
request
.
GET
.
get
(
'platform'
)
try
:
data
=
self
.
rpc
[
'venus/sun/tag/search'
](
name
=
name
,
platform
=
platform
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/tag/search'
](
offset
=
offset
,
count
=
count
,
name
=
name
,
platform
=
platform
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
...
...
utils/base.py
View file @
167077c8
...
...
@@ -348,3 +348,19 @@ class ClientDefaultArgs(LazyAttrDict):
def
get_device_id
(
self
):
device_id
=
self
.
device_id
or
self
.
idfv
or
self
.
idfa
return
device_id
def
get_offset_count
(
request
):
try
:
page
=
int
(
request
.
GET
.
get
(
'page'
,
1
))
except
:
page
=
1
try
:
count
=
int
(
request
.
GET
.
get
(
'count'
,
10
))
except
:
count
=
10
offset
=
count
*
(
page
-
1
)
return
offset
,
count
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