|
@@ -222,10 +222,11 @@ class UserBrandInfo(View):
|
|
|
if check_perm is True:
|
|
|
if username is None or username is '':
|
|
|
# 按照用户去重复查询
|
|
|
- user_brand_queryset = User_Brand.objects.all().order_by('userID').values_list('userID', flat=True).distinct()
|
|
|
+ # 分页
|
|
|
+ user_brand_queryset = User_Brand.objects.all().order_by('userID').values_list('userID', flat=True).distinct()[(page - 1) * line:page * line]
|
|
|
else:
|
|
|
- user_brand_queryset = User_Brand.objects.filter(userID__username=username).order_by('userID').values_list( 'userID',flat=True).distinct()
|
|
|
- print (user_brand_queryset)
|
|
|
+ # 分页
|
|
|
+ user_brand_queryset = User_Brand.objects.filter(userID__username=username).order_by('userID').values_list( 'userID',flat=True).distinct()[(page - 1) * line:page * line]
|
|
|
send_jsons=[]
|
|
|
counts=0
|
|
|
for i in user_brand_queryset:
|
|
@@ -237,10 +238,7 @@ class UserBrandInfo(View):
|
|
|
send_jsons.append(user_brand_querysetlast["datas"][0])
|
|
|
# 按照加入的日期排序
|
|
|
send_jsons = sorted(send_jsons, key=lambda x:x['fields']['addTime'], reverse=True)
|
|
|
- # 分页
|
|
|
- send_jsons = send_jsons[(page - 1) * line:page * line]
|
|
|
return response.json(0, {'datas': send_jsons, 'count': counts})
|
|
|
-
|
|
|
else:
|
|
|
return response.json(404)
|
|
|
else:
|
|
@@ -252,7 +250,6 @@ class UserBrandInfo(View):
|
|
|
if check_perm is True:
|
|
|
# 按照用户去重复查询
|
|
|
user_brand_queryset = User_Brand.objects.all().order_by('userID').values_list('userID', flat=True).distinct()
|
|
|
- print (user_brand_queryset)
|
|
|
send_jsons=[]
|
|
|
counts=0
|
|
|
for i in user_brand_queryset:
|
|
@@ -266,9 +263,7 @@ class UserBrandInfo(View):
|
|
|
for k, v in enumerate(send_jsons):
|
|
|
deviceSupplier.append(v['fields']['deviceSupplier'])
|
|
|
deviceSupplier = Counter(deviceSupplier)
|
|
|
- print (deviceSupplier)
|
|
|
return response.json(0, {'datas': deviceSupplier,'counts':counts})
|
|
|
-
|
|
|
else:
|
|
|
return response.json(404)
|
|
|
# 区域统计的接口
|
|
@@ -278,7 +273,6 @@ class UserBrandInfo(View):
|
|
|
if check_perm is True:
|
|
|
# 按照用户去重复查询
|
|
|
user_brand_queryset = User_Brand.objects.all().order_by('userID').values_list('userID', flat=True).distinct()
|
|
|
- print (user_brand_queryset)
|
|
|
send_jsons=[]
|
|
|
counts=0
|
|
|
for i in user_brand_queryset:
|
|
@@ -292,8 +286,6 @@ class UserBrandInfo(View):
|
|
|
for k, v in enumerate(send_jsons):
|
|
|
deviceSupplier.append(v['fields'][district])
|
|
|
deviceSupplier = Counter(deviceSupplier)
|
|
|
- deviceSupplier = deviceSupplier
|
|
|
-
|
|
|
return response.json(0, {'datas': deviceSupplier,'counts':counts})
|
|
|
|
|
|
else:
|