|
@@ -1,5 +1,6 @@
|
|
|
import time
|
|
|
|
|
|
+from django.http import HttpResponse
|
|
|
from django.utils.decorators import method_decorator
|
|
|
from django.views import View
|
|
|
|
|
@@ -259,11 +260,9 @@ def confirm_region_with_ip(request):
|
|
|
@param request:
|
|
|
@return:
|
|
|
"""
|
|
|
- response = ResponseObject()
|
|
|
try:
|
|
|
request.encoding = 'utf-8'
|
|
|
ip = CommonService.get_ip_address(request)
|
|
|
- device_domain_qs = DeviceDomainModel.objects.filter(ip=ip)
|
|
|
|
|
|
# 获取地区和国家信息
|
|
|
ip_addr_qs = IPAddr.objects.filter(ip=ip, is_geoip2=False).values('region', 'country_code')
|
|
@@ -277,10 +276,10 @@ def confirm_region_with_ip(request):
|
|
|
|
|
|
area = 'mainland'
|
|
|
if country_code != 'CN':
|
|
|
- area = 'overseas'
|
|
|
+ return HttpResponse(status=110)
|
|
|
elif region in ['香港', '澳门', '台湾']:
|
|
|
- area = 'overseas'
|
|
|
- res = {'region': area}
|
|
|
- return response.json(0, res)
|
|
|
+ return HttpResponse(status=110)
|
|
|
+ return HttpResponse(status=111)
|
|
|
except Exception as e:
|
|
|
- return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
+ return HttpResponse(status=500,
|
|
|
+ content='error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|