Commit 08466974 authored by 高雅喆's avatar 高雅喆

fix bug

parent 05f2d736
......@@ -31,10 +31,10 @@ def get_click_zero_uid_count(platform):
cursor = db.cursor()
sql = "select '0-7' as label,count(distinct(device_id)) from data_feed_exposure2 \
where device_type{0} \
and stat_date = get_yesterday_date() \
and stat_date = '{7}' \
and device_id not in \
(select distinct(device_id) from data_feed_click2 \
where stat_date = get_yesterday_date() \
where stat_date = '{7}' \
and device_type{1}) \
and device_id in \
(select distinct(device_id) \
......@@ -45,10 +45,10 @@ def get_click_zero_uid_count(platform):
union all \
select '7-14' as label,count(distinct(device_id)) from data_feed_exposure2 \
where device_type{0} \
and stat_date = get_yesterday_date() \
and stat_date = '{7}' \
and device_id not in \
(select distinct(device_id) from data_feed_click2 \
where stat_date = get_yesterday_date() \
where stat_date = '{7}' \
and device_type{1}) \
and device_id in \
(select distinct(device_id) \
......@@ -62,10 +62,10 @@ def get_click_zero_uid_count(platform):
union all \
select '14-30' as label,count(distinct(device_id)) from data_feed_exposure2 \
where device_type{0} \
and stat_date = get_yesterday_date() \
and stat_date = '{7}' \
and device_id not in \
(select distinct(device_id) from data_feed_click2 \
where stat_date = get_yesterday_date() \
where stat_date = '{7}' \
and device_type{1}) \
and device_id in \
(select distinct(device_id) \
......@@ -79,10 +79,10 @@ def get_click_zero_uid_count(platform):
union all \
select '30-60' as label,count(distinct(device_id)) from data_feed_exposure2 \
where device_type{0} \
and stat_date = get_yesterday_date() \
and stat_date = '{7}' \
and device_id not in \
(select distinct(device_id) from data_feed_click2 \
where stat_date = get_yesterday_date() \
where stat_date = '{7}' \
and device_type{1}) \
and device_id in \
(select distinct(device_id) \
......@@ -96,10 +96,10 @@ def get_click_zero_uid_count(platform):
union all \
select '60-90' as label,count(distinct(device_id)) from data_feed_exposure2 \
where device_type{0} \
and stat_date = get_yesterday_date() \
and stat_date = '{7}' \
and device_id not in \
(select distinct(device_id) from data_feed_click2 \
where stat_date = get_yesterday_date() \
where stat_date = '{7}' \
and device_type{1}) \
and device_id in \
(select distinct(device_id) \
......@@ -113,17 +113,17 @@ def get_click_zero_uid_count(platform):
union all \
select '90+' as label,count(distinct(device_id)) from data_feed_exposure2 \
where device_type{0} \
and stat_date = get_yesterday_date() \
and stat_date = '{7}' \
and device_id not in \
(select distinct(device_id) from data_feed_click2 \
where stat_date = get_yesterday_date() \
where stat_date = '{7}' \
and device_type{1}) \
and device_id in \
(select distinct(device_id) \
from data_feed_exposure2 \
where device_id in \
(select distinct(device_id) from data_feed_exposure2 \
where stat_date < {6}))".format(platform,platform.replace(' ','') if platform[-2]=='e' else platform,my_date1,my_date2,my_date3,my_date4,my_date5)
where stat_date < {6}))".format(platform,platform.replace(' ','') if platform[-2]=='e' else platform,my_date1,my_date2,my_date3,my_date4,my_date5,get_yesterday_date())
cursor.execute(sql)
result = cursor.fetchall()
db.close()
......
import datetime
import pymysql
from utils import get_yesterday_date
#一周之前的date(7)
my_date1 = (datetime.date.today() - datetime.timedelta(days=7)).strftime("%Y-%m-%d")
......
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