38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
import threading
|
|||
|
|
|
||
|
|
from rest_framework.decorators import action
|
||
|
|
from rest_framework.pagination import PageNumberPagination
|
||
|
|
from rest_framework.request import Request
|
||
|
|
from rest_framework.viewsets import ViewSet
|
||
|
|
|
||
|
|
from sixGuoDjango import BaseResponse, ResData
|
||
|
|
from wechat_数据库.企业微信数据库.企微用户表 import wecom企微用户
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
class 企微用户分页( PageNumberPagination ):
|
||
|
|
page_size = 10
|
||
|
|
page_size_query_param = "page_size"
|
||
|
|
max_page_size = 100
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
class 企业微信接口ViewSets( ViewSet ):
|
||
|
|
lock = threading.Lock( )
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
@action( detail=False, methods=[ "post" ], url_path="查询添加的企微用户" )
|
||
|
|
def 查询添加的企微用户( self, request: Request ):
|
||
|
|
""""""
|
||
|
|
wecom_data = wecom企微用户.objects.all( ).values( )
|
||
|
|
paginator = 企微用户分页( )
|
||
|
|
page_queryset = paginator.paginate_queryset( wecom_data, request )
|
||
|
|
print( "🍎🍎🍎🍎🍎🍎🍎🍎🍎🍎🍎🍎🍎🍎🍎" )
|
||
|
|
httpResData = BaseResponse( resData=ResData( listData=wecom_data, dictData={ } ), ).model_dump( )
|
||
|
|
return paginator.get_paginated_response( page_queryset )
|