123456789101112131415161718192021222324252627282930 |
- # @Author : Rocky
- # @File : InitController.py
- # @Time : 2023/4/11 17:26
- from django.http import HttpResponse
- import logging
- from django.views import View
- from Object.ResponseObject import ResponseObject
- class InitView(View):
- def get(self, request, *args, **kwargs):
- request.encoding = 'utf-8'
- operation = kwargs.get('operation')
- return self.validation(request.GET, operation)
- def post(self, request, *args, **kwargs):
- request.encoding = 'utf-8'
- operation = kwargs.get('operation')
- return self.validation(request.POST, operation)
- def validation(self, request_dict, operation):
- if operation == 'health-check': # 负载均衡器健康检测接口
- return self.health_check(request_dict)
- @staticmethod
- def health_check(request_dict):
- response = ResponseObject()
- return response.json(0)
|