Beispiel #1
0
 def get(self, request, **kwargs):
     if 'kw' in request.GET and request.GET['kw']:
         keywords = request.GET['kw'].strip()
         #分页
         pagesize, pageindex = getPageSizeAndIndex(request)
         args = {}
         datalist, counts = Searcher().Search(keywords, pagesize, pageindex)
         data = UrlResultSerializer(datalist).data
         return GetResponseData(True, 0, data, counts)
     return GetResponseData(False, -3)
Beispiel #2
0
 def get(self, request, **kwargs):
     if 'url' in request.GET and request.GET['url']:
         url = request.GET['url'].strip()
     #分页
     pagesize, pageindex = getPageSizeAndIndex(request)
     args = {}
     datalist = UrlInfo.objects.filter(**args).order_by("-createtime")[(pageindex - 1) * pagesize:pagesize * pageindex]
     counts = UrlInfo.objects.filter(**args).count()
     data=UrlSerializer(datalist).data
     return GetResponseData(True,0,data,counts)
Beispiel #3
0
 def get(self, request, **kwargs):
     if "kw" in request.GET and request.GET["kw"]:
         keywords = request.GET["kw"].strip()
         # 分页
         pagesize, pageindex = getPageSizeAndIndex(request)
         args = {}
         datalist, counts = Searcher().Search(keywords, pagesize, pageindex)
         data = UrlResultSerializer(datalist).data
         return GetResponseData(True, 0, data, counts)
     return GetResponseData(False, -3)
Beispiel #4
0
 def get(self, request, **kwargs):
     if 'url' in request.GET and request.GET['url']:
         url = request.GET['url'].strip()
     #分页
     pagesize, pageindex = getPageSizeAndIndex(request)
     args = {}
     datalist = UrlInfo.objects.filter(
         **args).order_by("-createtime")[(pageindex - 1) *
                                         pagesize:pagesize * pageindex]
     counts = UrlInfo.objects.filter(**args).count()
     data = UrlSerializer(datalist).data
     return GetResponseData(True, 0, data, counts)