Commit c6b0c864 authored by gaoming's avatar gaoming

device_id logic

parent c5276e56
......@@ -139,3 +139,4 @@ USE_TZ = False
# https://docs.djangoproject.com/en/2.2/howto/static-files/
STATIC_URL = '/static/'
......@@ -65,15 +65,18 @@ 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进行md5加密后再做一次查询
if device_id:
md5=hashlib.md5()
md5.update(device_id.encode(encoding='utf-8'))
kwargs.update({"device_id":md5.hexdigest()})
#获取查询子串
sub_query=["{0}='{1}'".format(key,value) for key,value in kwargs.items() if key in ["device_id","idfa","idfv","imei","mac"]]
md5_device_id=md5.hexdigest()
sub_query.append("device_id='{0}'".format(md5_device_id))
sql="select * from like_promotion_channel where {0}".format(" or ".join(sub_query))
print(sql)
record = PromotionChannel.objects.raw(sql)
......@@ -105,7 +108,6 @@ class Statistic(View):
url = unquote(record.callback)
#根据平台不同,调整参数类型
try:
import requests
#GET回调
......
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