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
Merge Requests
0
Merge Requests
0
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
backend
channels
Commits
7f8375b2
Commit
7f8375b2
authored
Jun 19, 2019
by
gaoming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
guangdiantong
parent
cd4e3597
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
15 deletions
+20
-15
settings.py
channels/settings.py
+2
-2
views.py
like/views.py
+18
-13
No files found.
channels/settings.py
View file @
7f8375b2
from
.server_settings
import
*
#from .local_settings import *
\ No newline at end of file
from
.local_settings
import
*
\ No newline at end of file
like/views.py
View file @
7f8375b2
...
...
@@ -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
):
'''
处理请求
...
...
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