Browse Source

MOD:修复订单数据

cxyu 3 years ago
parent
commit
d69da93c48

+ 7 - 1
app/api_data/platform_order/order_data_change.py

@@ -23,7 +23,13 @@ def insert_order_data(ymd):
     DATE_FORMAT(FROM_UNIXTIME(f.create_time), '%Y-%m-%d %H:%i:%s') as reg_time,
     a.amount ,ifnull(d.name,''),a.order_id ,a.status 
     from db_mp.h_pay a 
-    left join db_mp.mp_conf_agent b on a.app_id =b.app_id and a.agent_id =b.agent_id 
+    left join 
+    (select b.agent_id,b.advertiser_conf_id  from 
+        (select agent_id,max(update_time) as update_time  
+        from db_mp.mp_conf_agent mmc 
+        group by agent_id ) a
+        left join db_mp.mp_conf_agent b on  a.agent_id=b.agent_id 
+        and a.update_time = b.update_time ) b on  a.agent_id =b.agent_id 
     left join db_mp.mp_mp_conf c on b.advertiser_conf_id = c.id 
     left join db_mp.h_game d on a.app_id =d.id 
     left join db_mp.h_member f on a.mem_id = f.id

+ 5 - 10
app/etl/data_stat_run.py

@@ -57,12 +57,11 @@ def main(st, et):
 
 def hourly():
     thedate = du.getTodayOrYestoday()
-    main(thedate, thedate)
-    #TODO:特殊---因为创建角色数量一直在变,故需要每次都跑所有数据------之后引进flink-cdc后则不需要
-    #TODO:暂时让近30天的创建角色正确
-    for i in du.getDateLists(du.get_n_days(-30), du.get_n_days(-1)):
+    #默认做三天的留存数据
+    for i in du.getDateLists(du.get_n_days(-3), du.getNow()):
         dw_daily_channel_cost(i)
-        platform_data_sum(i)
+    main(thedate, thedate)
+
 
 
 def daily():
@@ -72,11 +71,7 @@ def daily():
     do_order(st, et)
     do_cost(st, et)
 
-    #TODO:特殊---因为创建角色数量一直在变,故需要每次都跑所有数据------之后引进flink-cdc后则不需要
-    #TODO:暂时让近30天的创建角色正确
-    for i in du.getDateLists(du.get_n_days(-30), et):
-        dw_daily_channel_cost(i)
-        platform_data_sum(i)
+
 
 
 if __name__ == '__main__':

+ 1 - 1
app/etl/data_stat_task.py

@@ -323,7 +323,7 @@ if __name__ == '__main__':
     # channel_by_account_daily('2021-02-05')
     # dw_daily_channel_cost('2021-10-18')
 
-    for i in dt.getDateLists('2021-09-08', '2021-11-28'):
+    for i in dt.getDateLists('2021-09-08', '2021-11-02'):
         print(i)
         channel_info_daily(i)
 

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

@@ -249,9 +249,9 @@ def dw_channel_daily():
 
 
 if __name__ == '__main__':
-    # dw_channel_daily()
+    dw_channel_daily()
     # dw_daily_channel()
-    dw_channel()
+    # dw_channel()
     # dw_channel_amount_daily()
     # dw_channel_user_daily()
     # dw_channel_amount_daily_reverse()

+ 2 - 1
app/etl/sync_to_ck_task.py

@@ -72,9 +72,10 @@ def campaign_vx():
 
 
 if __name__ == '__main__':
+    du = DateUtils()
     # order_sync_ck('2021-06-03')
     # dw_order_channel_cost_sync_ck(dt.get_n_days(-2))
-    for i in dt.getDateLists('2021-03-19','2021-10-28'):
+    for i in dt.getDateLists('2021-03-19',du.getNow()):
     # #     order(i)
     #     dw_order_channel_sync_ck(i)
         print(i)