Exemplo n.º 1
0
    def get(self, request, *args, **kwargs):
        """
        查询某个证书详情
        ---
        parameters:
            - name: tenantName
              description: 租户名
              required: true
              type: string
              paramType: path
            - name: certificate_id
              description: 证书ID
              required: true
              type: string
              paramType: path

        """
        try:
            certificate_id = kwargs.get("certificate_id", None)
            code, msg, certificate = domain_service.get_certificate_by_pk(
                certificate_id)
            if code != 200:
                return Response(general_message(code, "delete error", msg),
                                status=code)

            result = general_message(200,
                                     "success",
                                     "查询成功",
                                     bean=certificate.to_dict())
        except Exception as e:
            logger.exception(e)
            result = error_message(e.message)
        return Response(result, status=result["code"])
Exemplo n.º 2
0
 def get(self, request, team_id, certificate_id, *args, **kwargs):
     code, msg, certificate = domain_service.get_certificate_by_pk(certificate_id)
     if code != 200:
         raise ServiceHandleException(msg=None, status_code=code, msg_show=msg)
     serializer = TeamCertificatesRSerializer(data=certificate)
     serializer.is_valid(raise_exception=True)
     return Response(serializer.data, status.HTTP_200_OK)