|
@@ -184,17 +184,21 @@ class UserBrandInfo(View):
|
|
line = int(request_dict.get('line', None))
|
|
line = int(request_dict.get('line', None))
|
|
param_flag = CommonService.get_param_flag(data=[page, line])
|
|
param_flag = CommonService.get_param_flag(data=[page, line])
|
|
if param_flag is True:
|
|
if param_flag is True:
|
|
- user_brand_queryset = User_Brand.objects.all().order_by('-id')
|
|
|
|
- if user_brand_queryset.exists():
|
|
|
|
- count = user_brand_queryset.count()
|
|
|
|
- res = user_brand_queryset[(page - 1) * line:page * line]
|
|
|
|
- send_json = CommonService.qs_to_dict(res)
|
|
|
|
- for k, v in enumerate(send_json["datas"]):
|
|
|
|
- username = ModelService.get_user_name(userID=send_json["datas"][k]['fields']['userID'])
|
|
|
|
- send_json["datas"][k]['fields']['username']=username
|
|
|
|
- send_json['count'] = count
|
|
|
|
- return response.json(0, send_json)
|
|
|
|
- return response.json(0, {'datas': [], 'count': 0})
|
|
|
|
|
|
+ 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 user_brand_queryset.exists():
|
|
|
|
+ count = user_brand_queryset.count()
|
|
|
|
+ res = user_brand_queryset[(page - 1) * line:page * line]
|
|
|
|
+ send_json = CommonService.qs_to_dict(res)
|
|
|
|
+ for k, v in enumerate(send_json["datas"]):
|
|
|
|
+ username = ModelService.get_user_name(userID=send_json["datas"][k]['fields']['userID'])
|
|
|
|
+ send_json["datas"][k]['fields']['username']=username
|
|
|
|
+ send_json['count'] = count
|
|
|
|
+ return response.json(0, send_json)
|
|
|
|
+ return response.json(0, {'datas': [], 'count': 0})
|
|
|
|
+ else:
|
|
|
|
+ return response.json(404)
|
|
else:
|
|
else:
|
|
return response.json(444)
|
|
return response.json(444)
|
|
def delete_by_admin(self, request_dict, userID,response):
|
|
def delete_by_admin(self, request_dict, userID,response):
|