Commit 7f8375b2 authored by gaoming's avatar gaoming

guangdiantong

parent cd4e3597
from .server_settings import *
#from .local_settings import *
\ No newline at end of file
from .local_settings import *
\ No newline at end of file
......@@ -28,7 +28,8 @@ class Statistic(View):
data = request.GET.dict()
# 迈可思, 趣米, 广点通, 爱思助手激活回调(增加点入)
self.async_active_callback.delay(**data)
#self.async_active_callback.delay(**data)
self.async_active_callback(**data)
return JsonResponse({
"code":0,#0为成功,其他为失败
"failMsg":"",#错误信息
......@@ -39,9 +40,9 @@ class Statistic(View):
data=request.POST.dict()
# 迈可思, 趣米, 广点通, 爱思助手激活回调(增加点入)
self.async_active_callback.delay(**data)
#self.async_active_callback.delay(**data)
#self.async_active_callback(**data)
self.async_active_callback(**data)
return JsonResponse({
"code":0,#0为成功,其他为失败
"failMsg":"",#错误信息
......@@ -53,8 +54,8 @@ class Statistic(View):
@shared_task
def async_active_callback(**kwargs):
#@shared_task
def async_active_callback(self,**kwargs):
'''
异步激活和回调
'''
......@@ -67,15 +68,17 @@ class Statistic(View):
client_type=kwargs.get("client_type",CLIENT_TYPE.USER.value[0])
#获取查询子串
sub_query=["{0}='{1}'".format(key,value) for key,value in kwargs.items() if key in ["device_id","idfa","idfv","imei","mac"]]
#对device_id,idfv,imei进行md5加密后再做一次查询
def md5(string):
if string:
md5=hashlib.md5()
md5.update(string.encode(encoding='utf-8'))
return md5.hexdigest()
return string
#对device_id进行md5加密后再做一次查询
if device_id:
md5=hashlib.md5()
md5.update(device_id.encode(encoding='utf-8'))
md5_device_id=md5.hexdigest()
sub_query.append("device_id='{0}'".format(md5_device_id))
#获取查询子串并对每一个关联字段做一次md5加密查询
sub_query=[item for key,value in kwargs.items() if key in ["device_id","idfa","idfv","imei","mac"] for item in ("{0}='{1}'".format(key,value),"{0}='{1}'".format(key,md5(value)))]
sql="select * from like_promotion_channel where {0}".format(" or ".join(sub_query))
print(sql)
......@@ -164,6 +167,8 @@ class DoubleCheck(View):
class Channel(View):
'''
处理请求
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment