12345678910111213141516171819202122232425262728 |
- # @Author : guanhailong
- # @File : InitController.py
- # @Time : 2023/4/17 17:26
- 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)
|