|
@@ -29,22 +29,28 @@ from Object.TokenObject import TokenObject
|
|
|
from Object.UidTokenObject import UidTokenObject
|
|
|
from django.http import JsonResponse
|
|
|
from Object.RedisObject import RedisObject
|
|
|
+from Service.CommonService import CommonService
|
|
|
|
|
|
|
|
|
-# http://192.168.136.40:8077/detect/changeStatus?uid=JW3684H8BSHG9TTM111A&token_val=18071adc03536302f34&appBundleId=com.ansjer.zccloud_ab&push_type=2&token=local&status=1&app_type=1
|
|
|
+# http://192.168.136.40:8077/detect/changeStatus?uid=JW3684H8BSHG9TTM111A&token_val=18071adc03536302f34&appBundleId=com.ansjer.zccloud_ab&push_type=2&token=local&status=1&app_type=1&m_code=12
|
|
|
class DetectControllerView(View):
|
|
|
@method_decorator(csrf_exempt)
|
|
|
def dispatch(self, *args, **kwargs):
|
|
|
return super(DetectControllerView, self).dispatch(*args, **kwargs)
|
|
|
|
|
|
+ def __init__(self):
|
|
|
+ self.ip = ''
|
|
|
+
|
|
|
def get(self, request, *args, **kwargs):
|
|
|
request.encoding = 'utf-8'
|
|
|
operation = kwargs.get('operation')
|
|
|
+ self.ip = CommonService.get_ip_address(request)
|
|
|
return self.validation(request.GET, operation)
|
|
|
|
|
|
def post(self, request, *args, **kwargs):
|
|
|
request.encoding = 'utf-8'
|
|
|
operation = kwargs.get('operation')
|
|
|
+ self.ip = CommonService.get_ip_address(request)
|
|
|
return self.validation(request.POST, operation)
|
|
|
|
|
|
def validation(self, request_dict, operation):
|
|
@@ -150,6 +156,14 @@ class DetectControllerView(View):
|
|
|
dvqs = Device_Info.objects.filter(userID_id=userID, UID=uid)
|
|
|
status = int(status)
|
|
|
if dvqs.exists():
|
|
|
+ # 获取用户区域
|
|
|
+ ip = self.ip
|
|
|
+ ipInfo = CommonService.getIpIpInfo(ip=ip, lang='EN')
|
|
|
+ area = ipInfo['country_name']
|
|
|
+ # if area == 'China':
|
|
|
+ # DETECT_PUSH_DOMAIN = 'cn.push.dvema.com'
|
|
|
+ # else:
|
|
|
+ # DETECT_PUSH_DOMAIN = 'en.push.dvema.com'
|
|
|
nowTime = int(time.time())
|
|
|
uid_set_qs = UidSetModel.objects. \
|
|
|
filter(uid=uid, uidpushmodel__userID_id=userID, uidpushmodel__m_code=m_code)
|