|
@@ -175,11 +175,16 @@ class UserBrandInfo(View):
|
|
|
def query_info(self, request_dict, userID,response):
|
|
|
page = int(request_dict.get('page', None))
|
|
|
line = int(request_dict.get('line', None))
|
|
|
+ username = request_dict.get('username',None)
|
|
|
+
|
|
|
param_flag = CommonService.get_param_flag(data=[page, line])
|
|
|
if param_flag is True:
|
|
|
check_perm = ModelService.check_perm(userID=userID,permID=30)
|
|
|
if check_perm is True:
|
|
|
- user_brand_queryset = User_Brand.objects.all().order_by('-id')
|
|
|
+ if username is None or username is '':
|
|
|
+ user_brand_queryset = User_Brand.objects.all().order_by( '-id')
|
|
|
+ else:
|
|
|
+ user_brand_queryset = User_Brand.objects.filter(userID__username=username).order_by('-id')
|
|
|
if user_brand_queryset.exists():
|
|
|
count = user_brand_queryset.count()
|
|
|
res = user_brand_queryset[(page - 1) * line:page * line]
|
|
@@ -210,12 +215,16 @@ class UserBrandInfo(View):
|
|
|
def query_all_info(self, request_dict, userID,response):
|
|
|
page = int(request_dict.get('page', None))
|
|
|
line = int(request_dict.get('line', None))
|
|
|
+ username = request_dict.get('username', None)
|
|
|
param_flag = CommonService.get_param_flag(data=[page, line])
|
|
|
if param_flag is True:
|
|
|
check_perm = ModelService.check_perm(userID=userID,permID=30)
|
|
|
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()
|
|
|
+ else:
|
|
|
+ user_brand_queryset = User_Brand.objects.filter(userID__username=username).order_by('userID').values_list( 'userID',flat=True).distinct()
|
|
|
print (user_brand_queryset)
|
|
|
send_jsons=[]
|
|
|
counts=0
|