views.py 文件源码

python
阅读 45 收藏 0 点赞 0 评论 0

项目:jupiter-app 作者: jupiter-group 项目源码 文件源码
def leave_close_claim(self, request, *args, **kwargs):
        """
        :param request:
        {
            "target_account_id": account_id
        }
        """
        deposit = self.get_object()
        if deposit.status in deposit.INOPERABLE_STATUSES:
            raise ValidationError('???????? ? ????????? ??????????')
        if deposit.status == deposit.STATUS_REQUESTED_CLOSING:
            raise ValidationError('?????? ?? ???????? ???????? ??? ??????.')

        target_account_id = request.data['target_account_id']
        if not fin_models.Account.objects.filter(pk=target_account_id):
            raise ValidationError('?????????? ????? ?? ??????????.')
        account = fin_models.Account.objects.get(pk=target_account_id)
        if account.status in fin_models.Account.INOPERABLE_STATUSES:
            raise ValidationError('???????? ? ????????? ?????? ??????????.')
        res, info = deposit.leave_close_claim(target_account_id)
        return Response(info, status=status.HTTP_200_OK if res else status.HTTP_400_BAD_REQUEST)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号