Commit 580527a4 authored by 王浩's avatar 王浩

add get shadow user list api

parent 8dd114a0
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -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'),
]
......@@ -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
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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment