コード例 #1
0
 def get(self, request):
     serializer = UserSerializer(data=request.query_params)
     serializer.is_valid(raise_exception=True)
     query_criteria = serializer.data
     delete_null(query_criteria)
     # query_criteria = None
     query_set = UserService.getUserList(query_criteria=query_criteria)
     serializer = UserSerializer(query_set, many=True)
     return Response(serializer.data)
コード例 #2
0
 def patch(self, request):
     serializer = RefundApplicationSerializer(data=request.data)
     serializer.is_valid(raise_exception=True)
     validate_data = delete_null(serializer.data)
     RefundApplicationService.processRefund(
         serializer.data.get('refund_id'), validate_data)
     return Response(serializer.data)
コード例 #3
0
 def put(self, request):
     serializer = UserSerializer(data=request.data)
     serializer.is_valid(raise_exception=True)
     validated_data = delete_null(serializer.data)
     UserService.updateUserDetail(serializer.data.get('user_id'),
                                  validated_data)
     return Response(serializer.data)
コード例 #4
0
ファイル: views.py プロジェクト: liyang1384/SUFEShopServer
 def get(self, request):
     qurey_params = request.query_params.copy()
     min_amount = qurey_params.get('min_amount')
     max_amount = qurey_params.get('max_amount')
     qurey_params.pop('min_amount')
     qurey_params.pop('max_amount')
     serializer = OrderSerializer(data=qurey_params)
     serializer.is_valid(raise_exception=True)
     query_criteria = serializer.data
     delete_null(query_criteria)
     query_criteria.update({
         'amount__gte': min_amount,
         'amount__lte': max_amount
     })
     if query_criteria.order_type == 0:
         query_set = OrderService.listBoughtOrder(
             query_criteria.get('user_id'))
     else:
         query_set = OrderService.listSoldOrder(
             query_criteria.get('user_id'))
     serializer = OrderSerializer(query_set, many=True)
     return Response(serializer.data)
コード例 #5
0
ファイル: views.py プロジェクト: liyang1384/SUFEShopServer
 def get(self, request):
     qurey_params = request.query_params.copy()
     min_price = qurey_params.get('min_price')
     max_price = qurey_params.get('max_price')
     qurey_params.pop('min_price')
     qurey_params.pop('max_price')
     serializer = CommoditySerializer(data=qurey_params)
     serializer.is_valid(raise_exception=True)
     query_criteria = serializer.data
     query_criteria.update({'price__gte': min_price,'price__lte': max_price})
     query_criteria = delete_null(query_criteria)
     query_set = CommodityService.listCommodities(query_criteria)
     serializer = CommoditySerializer(query_set,many=True)
     return Response(serializer.data)
コード例 #6
0
 def post(self, request):
     serializer = RefundApplicationSerializer(request.data)
     serializer.is_valid(raise_exception=True)
     validate_data = delete_null(serializer.data)
     RefundApplicationService.insertRefundDetail(validate_data)
     return Response(serializer.data)
コード例 #7
0
 def post(self, request):
     serializer = UserSerializer(data=request.data)
     serializer.is_valid(raise_exception=True)
     validated_data = delete_null(serializer.data)
     UserService.insertUserInfo(validated_data=validated_data)
     return Response(serializer.data)