ck %!s(int64=4) %!d(string=hai) anos
pai
achega
696496d638

+ 2 - 2
app/api_data/get_order.py

@@ -236,5 +236,5 @@ if __name__ == '__main__':
     # zhangdu('2020-11-01', '2020-12-20')
 
     # zhangzhongyun('2021-04-01', '2021-04-21')
-    # youshuge()
-    yueweng()
+    youshuge()
+    # yueweng()

+ 0 - 1
app/etl/data_stat_run.py

@@ -33,7 +33,6 @@ def main(st,et):
         do_cost(st,et)
         src_book_info()  # 书籍卡点信息
         # book_annual_expect_profit.run() # 年预期收益
-        dw_daily_channel()
         dw_channel()
         dw_pitcher_trend()
         book_trend()

+ 4 - 4
app/etl/dm/dm_pitcher_daily_overview.py

@@ -60,22 +60,22 @@ from (select pitcher,
     select b.pitcher, sum(amount) last_month_far_amount
     from order a
              left outer join dw_daily_channel_cost b on a.channel = b.channel and a.date = b.dt
-    where reg_time >= '{du.get_n_pre_month_first_day(1)} 00:00:00' and reg_time<'{du.get_n_pre_month_first_day(0)} 00:00:00'
+    where reg_time >= '{du.get_n_pre_month_first_day(1)} 00:00:00' and reg_time<'{du.get_n_pre_month_first_day(0)} 00:00:00' and status=2 
     group by pitcher
     ) y on q.pitcher = y.pitcher
 left outer join (
     select b.pitcher, sum(amount) last_month_amount
     from order a
              left outer join dw_daily_channel_cost b on a.channel = b.channel and a.date = b.dt
-    where reg_time >= '{du.get_n_pre_month_first_day(1)} 00:00:00' and reg_time<'{du.get_n_pre_month_first_day(0)} 00:00:00' 
+    where reg_time >= '{du.get_n_pre_month_first_day(1)} 00:00:00' and reg_time<'{du.get_n_pre_month_first_day(0)} 00:00:00' and status=2 
  and dt<'{du.get_n_pre_month_first_day(0)}'
     group by pitcher
 ) p on q.pitcher=p.pitcher
 left outer join (
     select b.pitcher, sum(amount) this_month_amount
-    from order a
+    from order  a
              left outer join dw_daily_channel_cost b on a.channel = b.channel and a.date = b.dt
-    where reg_time >= '{du.get_n_pre_month_first_day(0)} 00:00:00' 
+    where reg_time >= '{du.get_n_pre_month_first_day(0)} 00:00:00' and status=2 
     group by pitcher
 ) g on q.pitcher=g.pitcher
 """

+ 7 - 7
app/etl/dw/dw_channel_daily.py

@@ -34,13 +34,13 @@ from
 left outer join
      (select date as dt3,channel as channel3,count(1) as first_order_count,          ---新用户首日充值
      count(distinct user_id) as first_order_user,sum(amount) as first_order_amount
-    from order where toDate(reg_time)=date  group by date,channel) c
+    from order where status=2 and toDate(reg_time)=date  group by date,channel) c
     on dt=dt3 and channel=channel3
 
 left outer join
         (select date as dt4,channel as channel4,count(1) as order_count,   ---账面充值
         count(distinct user_id) as order_user,sum(amount) as order_amount
-        from order  group by date,channel) d
+        from order where status=2    group by date,channel) d
         on dt=dt4 and channel=channel4
 
 left outer join (
@@ -50,7 +50,7 @@ left outer join (
            sum(if(user_order_count>=5,1,0)) reg_order_user_again5,
            sum(if(user_order_count>=6,1,0)) reg_order_user_again6
     from (select formatDateTime(reg_time,'%Y-%m-%d') reg_date,channel,count(1) user_order_count
-    from order group by formatDateTime(reg_time,'%Y-%m-%d') ,user_id,channel) x group by reg_date,channel
+    from order where status=2  group by formatDateTime(reg_time,'%Y-%m-%d') ,user_id,channel) x group by reg_date,channel
     ) f on dt=dt6 and channel=channel6
 
 left outer join
@@ -60,7 +60,7 @@ left outer join
    sum(amount) as reg_order_amount,
    count(distinct user_id) as reg_order_user,
    count(1) as reg_order_count
-   from order where reg_time>'2019-03-18 00:00:00' group by toDate(formatDateTime(reg_time,'%Y-%m-%d')),channel) b
+   from order where status=2 and reg_time>'2019-03-18 00:00:00' group by toDate(formatDateTime(reg_time,'%Y-%m-%d')),channel) b
     on dt=dt2 and channel=channel2
     having order_amount+cost+reg_order_amount>0"""
 
@@ -104,7 +104,7 @@ select toDate(formatDateTime(reg_time,'%Y-%m-%d')) as dt,
            count(distinct if(subtractDays(date, 28)>=toDate(reg_time),null,user_id)) dc28,
            count(distinct if(subtractDays(date, 29)>=toDate(reg_time),null,user_id)) dc29,
            count(distinct if(subtractDays(date, 30)>=toDate(reg_time),null,user_id)) dc30
-from order where reg_time>'2019-03-18 00:00:00' group by toDate(formatDateTime(reg_time,'%Y-%m-%d')),channel"""
+from order where status=2 and reg_time>'2019-03-18 00:00:00' group by toDate(formatDateTime(reg_time,'%Y-%m-%d')),channel"""
 
     data =ck.execute(sql)
     isql="insert into dw_channel_user_daily values " \
@@ -182,7 +182,7 @@ def dw_channel_amount_daily():
            if(dt<subtractDays(today(), 88),sum(if(subtractDays(date, 90)>=toDate(reg_time),0,amount)),null) as dm3,
            if(dt<subtractDays(today(), 118),sum(if(subtractDays(date, 120)>=toDate(reg_time),0,amount)),null) as dm4,
            if(dt<subtractDays(today(), 148),sum(if(subtractDays(date, 150)>=toDate(reg_time),0,amount)),null) as dm5
- from order where reg_time>'2019-03-18 00:00:00' group by toDate(formatDateTime(reg_time,'%Y-%m-%d')),channel  """
+ from order where status=2 and reg_time>'2019-03-18 00:00:00' group by toDate(formatDateTime(reg_time,'%Y-%m-%d')),channel  """
     data=ck.execute(sql)
     isql="insert into dw_channel_amount_daily values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s," \
          "%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"
@@ -201,7 +201,7 @@ def dw_channel_amount_daily_reverse():
                 sum(if(addDays(date,4)=today(),amount,0)) ba5,
                 sum(if(addDays(date,6)=today(),amount,0)) ba6,
                 sum(if(addDays(date,7)=today(),amount,0)) ba7
-     from order where reg_time>'2019-03-18 00:00:00' and date>=subtractDays(today(),7) group by toDate(formatDateTime(reg_time,'%Y-%m-%d')),channel"""
+     from order where status=2 and reg_time>'2019-03-18 00:00:00' and date>=subtractDays(today(),7) group by toDate(formatDateTime(reg_time,'%Y-%m-%d')),channel"""
     data = ck.execute(sql)
     isql = "replace into dw_channel_amount_daily_reverse values (%s,%s,%s,%s,%s,%s,%s,%s,%s)"
     db.dm.execute("truncate table dw_channel_amount_daily_reverse")