|
@@ -12,6 +12,7 @@ from Object.RedisObject import RedisObject
|
|
|
from Object.ResponseObject import ResponseObject
|
|
|
from Object.TokenObject import TokenObject
|
|
|
from Object.utils import LocalDateTimeUtil
|
|
|
+from Service.CommonService import CommonService
|
|
|
from Service.ModelService import ModelService
|
|
|
|
|
|
LOGGER = logging.getLogger('info')
|
|
@@ -21,14 +22,14 @@ class AppSetView(View):
|
|
|
def get(self, request, *args, **kwargs):
|
|
|
request.encoding = 'utf-8'
|
|
|
operation = kwargs.get('operation', None)
|
|
|
- return self.validation(request.GET, operation)
|
|
|
+ return self.validation(request.GET, request, operation)
|
|
|
|
|
|
def post(self, request, *args, **kwargs):
|
|
|
request.encoding = 'utf-8'
|
|
|
operation = kwargs.get('operation', None)
|
|
|
- return self.validation(request.POST, operation)
|
|
|
+ return self.validation(request.POST, request, operation)
|
|
|
|
|
|
- def validation(self, request_dict, operation):
|
|
|
+ def validation(self, request_dict, request, operation):
|
|
|
response = ResponseObject()
|
|
|
if operation == 'query':
|
|
|
return self.do_query(request_dict, response)
|
|
@@ -45,6 +46,8 @@ class AppSetView(View):
|
|
|
return self.do_admin_query(user_id, request_dict, response)
|
|
|
elif operation == 'admin_update':
|
|
|
return self.do_admin_update(user_id, request_dict, response)
|
|
|
+ elif operation == 'statusByIp':
|
|
|
+ return self.status_by_ip(request_dict, request, response)
|
|
|
else:
|
|
|
return response.json(414)
|
|
|
|
|
@@ -273,3 +276,19 @@ class AppSetView(View):
|
|
|
LOGGER.info('异常详情,errLine:{}, errMsg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
return response.json(500)
|
|
|
return response.json(0)
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def status_by_ip(self, request, response):
|
|
|
+ """
|
|
|
+ 根据ip 解析地址返回状态
|
|
|
+ """
|
|
|
+ try:
|
|
|
+ # 这里加status过滤条件条件
|
|
|
+ ip = CommonService.get_ip_address(request)
|
|
|
+ LOGGER.info(f"请求ip地址为 {ip}")
|
|
|
+ status = 1
|
|
|
+ response_data = {"status": status}
|
|
|
+ return response.json(0, response_data)
|
|
|
+ except Exception as e:
|
|
|
+ LOGGER.info('根据ip解析地址返回状态异常,errLine:{}, errMsg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
+ return response.json(500)
|