Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
saturn
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
赵磊
saturn
Commits
c92d4e19
Commit
c92d4e19
authored
Jan 14, 2019
by
王浩
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'haow/dev' into 'test'
Haow/dev See merge request
alpha/saturn!9
parents
12f7dae4
580527a4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
7 deletions
+47
-7
urls.py
api/urls.py
+8
-0
read_excel.py
api/utils/read_excel.py
+2
-6
base_view.py
api/views/base_view.py
+16
-0
user.py
api/views/user.py
+21
-1
No files found.
api/urls.py
View file @
c92d4e19
...
...
@@ -6,7 +6,15 @@ from .views import topic
from
.views
import
tag
urlpatterns
=
[
# grasp
url
(
r'^v1/update_grasp_status$'
,
user
.
UpdateGraspStatus
.
as_view
(),
name
=
'update_grasp_status$'
),
# topic
url
(
r'^v1/create_topic_for_batch$'
,
topic
.
CreateTopicForBatch
.
as_view
(),
name
=
'create_topic_for_batch'
),
# tag
url
(
r'^v1/create_tag_for_batch$'
,
tag
.
CreateTagForBatch
.
as_view
(),
name
=
'create_tag_for_batch'
),
# user
url
(
r'^v1/user/shadow/list$'
,
user
.
ShadowUserList
.
as_view
(),
name
=
'create_tag_for_batch'
),
]
api/utils/read_excel.py
View file @
c92d4e19
...
...
@@ -11,7 +11,7 @@ PAGE_SIZE = 100
def
read_excel
():
wb
=
open_workbook
(
filename
=
'/Users/
apple
/Desktop/nice_tag20181225.xlsx'
)
wb
=
open_workbook
(
filename
=
'/Users/
haowei
/Desktop/nice_tag20181225.xlsx'
)
sheet1
=
wb
.
sheet_by_index
(
0
)
...
...
@@ -27,7 +27,7 @@ def read_excel():
def
create_tags
(
tags
):
url
=
'http://
127.0.0.1:809
0/api/v1/create_tag_for_batch'
url
=
'http://
39.107.208.122:8
0/api/v1/create_tag_for_batch'
post_data
=
json
.
dumps
(
tags
)
textmod
=
{
"tags"
:
post_data
}
...
...
@@ -44,10 +44,6 @@ def process():
count
=
math
.
ceil
(
len
(
tags
)
/
PAGE_SIZE
)
print
(
count
)
for
i
in
range
(
0
,
count
):
if
i
==
5
:
break
if
i
<
4
:
continue
print
(
i
)
item
=
tags
[
PAGE_SIZE
*
i
:
PAGE_SIZE
*
i
+
PAGE_SIZE
]
# print(item, len(item))
...
...
api/views/base_view.py
View file @
c92d4e19
...
...
@@ -380,3 +380,19 @@ class BaseViewLoginRequired(LoginRequiredMixin, BaseView):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
BaseViewLoginRequired
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
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
api/views/user.py
View file @
c92d4e19
from
api.views.base_view
import
BaseView
from
api.views.base_view
import
BaseView
,
get_offset_count
class
UpdateGraspStatus
(
BaseView
):
...
...
@@ -18,3 +18,23 @@ class UpdateGraspStatus(BaseView):
return
self
.
error
(
error
)
return
self
.
ok
(
data
=
_data
)
class
ShadowUserList
(
BaseView
):
'''
列表获取马甲用户
'''
def
get
(
self
,
request
):
offset
,
count
=
get_offset_count
(
request
)
error
,
_data
=
self
.
call_rpc
(
"venus/community/user/shadow/list"
,
offset
=
offset
,
count
=
count
)
if
error
:
return
self
.
error
(
error
)
users
=
_data
.
get
(
'users'
)
result
=
{
'users'
:
[{
'user_id'
:
item
.
get
(
'user_id'
)}
for
item
in
users
if
item
],
'total'
:
_data
.
get
(
'total'
)
}
return
self
.
ok
(
data
=
result
)
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