Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
channels
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gaoming
channels
Commits
8d7f473c
Commit
8d7f473c
authored
Aug 08, 2019
by
gaoming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
fa4911df
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
urls.py
like/urls.py
+4
-1
views.py
like/views.py
+15
-3
No files found.
like/urls.py
View file @
8d7f473c
...
@@ -9,5 +9,7 @@ urlpatterns =[
...
@@ -9,5 +9,7 @@ urlpatterns =[
re_path
(
r'^[a-z0-9]+/doublecheck$'
,
views
.
DoubleCheck
.
as_view
()),
re_path
(
r'^[a-z0-9]+/doublecheck$'
,
views
.
DoubleCheck
.
as_view
()),
re_path
(
'ping'
,
views
.
ping
),
re_path
(
'ping'
,
views
.
ping
),
re_path
(
'list'
,
channelsinfo_views
.
list
),
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
like/views.py
View file @
8d7f473c
...
@@ -216,13 +216,16 @@ class Channel(View):
...
@@ -216,13 +216,16 @@ class Channel(View):
url_logger
.
info
(
request
.
path
)
url_logger
.
info
(
request
.
path
)
#获得
渠道数据
#获得
处理渠道
try
:
try
:
data
,
success
,
fail
=
Channel
.
__dict__
.
get
(
platform
)(
self
)
channel_handler
=
Channel
.
__dict__
.
get
(
platform
)
except
Exception
as
e
:
except
Exception
as
e
:
channel_logger
.
info
(
e
)
channel_logger
.
info
(
e
)
return
JsonResponse
({
'code'
:
1
,
'failMsg'
:
"not exists method to handle it!"
})
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
)
result
,
msg
=
PromotionChannel
.
record
(
request
,
sub_name
,
**
data
)
...
@@ -277,8 +280,15 @@ class Channel(View):
...
@@ -277,8 +280,15 @@ class Channel(View):
data
=
self
.
request
.
GET
.
dict
()
data
=
self
.
request
.
GET
.
dict
()
channel_logger
.
info
(
data
)
callback_url
=
data
.
get
(
"callback_url"
)
callback_url
=
data
.
get
(
"callback_url"
)
try
:
callback_url
=
unquote
(
callback_url
)
callback_url
=
unquote
(
callback_url
)
except
Exception
as
e
:
channel_logger
.
info
(
e
)
callback_url
=
callback_url
.
replace
(
"{{ATYPE}}"
,
"activate"
)
.
replace
(
"{{AVALUE}}"
,
"0"
)
callback_url
=
callback_url
.
replace
(
"{{ATYPE}}"
,
"activate"
)
.
replace
(
"{{AVALUE}}"
,
"0"
)
#从百度拿到的akey
#从百度拿到的akey
...
@@ -295,10 +305,12 @@ class Channel(View):
...
@@ -295,10 +305,12 @@ class Channel(View):
sign
=
get_sign
()
sign
=
get_sign
()
callback_url
=
callback_url
+
"&sign="
+
sign
callback_url
=
callback_url
+
"&sign="
+
sign
data
.
update
({
"imei"
:
data
.
pop
(
"imei_
MD
5"
,
""
)})
data
.
update
({
"imei"
:
data
.
pop
(
"imei_
md
5"
,
""
)})
data
.
update
({
"callback"
:
callback_url
})
data
.
update
({
"callback"
:
callback_url
})
data
.
update
({
"appid"
:
"baidu"
})
data
.
update
({
"appid"
:
"baidu"
})
channel_logger
.
info
(
"百度end---"
)
success
=
lambda
msg
:{
"ret"
:
0
,
"failMsg"
:
msg
}
success
=
lambda
msg
:{
"ret"
:
0
,
"failMsg"
:
msg
}
fail
=
lambda
msg
:{
"ret"
:
1
,
'failMsg'
:
msg
}
fail
=
lambda
msg
:{
"ret"
:
1
,
'failMsg'
:
msg
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment