Commit 8d7f473c authored by gaoming's avatar gaoming

update

parent fa4911df
......@@ -9,5 +9,7 @@ urlpatterns =[
re_path(r'^[a-z0-9]+/doublecheck$', views.DoubleCheck.as_view()),
re_path('ping',views.ping),
re_path('list',channelsinfo_views.list),
re_path('add',channelsinfo_views.add)
re_path('add',channelsinfo_views.add),
#接数据
#re_path('receive',views.GetData)
]
\ No newline at end of file
......@@ -216,13 +216,16 @@ class Channel(View):
url_logger.info(request.path)
#获得渠道数据
#获得处理渠道
try:
data,success,fail=Channel.__dict__.get(platform)(self)
channel_handler=Channel.__dict__.get(platform)
except Exception as e:
channel_logger.info(e)
return JsonResponse({'code':1,'failMsg':"not exists method to handle it!"})
#处理渠道
data,success,fail=channel_handler(self)
result,msg=PromotionChannel.record(request,sub_name,**data)
......@@ -277,8 +280,15 @@ class Channel(View):
data=self.request.GET.dict()
channel_logger.info(data)
callback_url=data.get("callback_url")
callback_url=unquote(callback_url)
try:
callback_url=unquote(callback_url)
except Exception as e:
channel_logger.info(e)
callback_url=callback_url.replace("{{ATYPE}}","activate").replace("{{AVALUE}}","0")
#从百度拿到的akey
......@@ -295,10 +305,12 @@ class Channel(View):
sign=get_sign()
callback_url=callback_url+"&sign="+sign
data.update({"imei":data.pop("imei_MD5","")})
data.update({"imei":data.pop("imei_md5","")})
data.update({"callback":callback_url})
data.update({"appid":"baidu"})
channel_logger.info("百度end---")
success =lambda msg:{"ret":0,"failMsg":msg}
fail =lambda msg:{"ret":1,'failMsg':msg}
......
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