InitController.py 860 B

12345678910111213141516171819202122232425262728
  1. # @Author : guanhailong
  2. # @File : InitController.py
  3. # @Time : 2023/4/17 17:26
  4. from django.views import View
  5. from Object.ResponseObject import ResponseObject
  6. class InitView(View):
  7. def get(self, request, *args, **kwargs):
  8. request.encoding = 'utf-8'
  9. operation = kwargs.get('operation')
  10. return self.validation(request.GET, operation)
  11. def post(self, request, *args, **kwargs):
  12. request.encoding = 'utf-8'
  13. operation = kwargs.get('operation')
  14. return self.validation(request.POST, operation)
  15. def validation(self, request_dict, operation):
  16. if operation == 'health-check': # 负载均衡器健康检测接口
  17. return self.health_check(request_dict)
  18. @staticmethod
  19. def health_check(request_dict):
  20. response = ResponseObject()
  21. return response.json(0)