|
@@ -51,4 +51,27 @@ def dw_daily_channel(dt):
|
|
|
db.quchen_text.execute(insert_sql)
|
|
|
|
|
|
|
|
|
+def clean_order(dt):
|
|
|
+ sql=""" replace into ods_order
|
|
|
+ select
|
|
|
+ case platform when '掌中云' then DATE_FORMAT(STR_TO_DATE(order_time,'%Y-%m-%dT%H:%i:%s'),'%Y-%m-%d')
|
|
|
+ when '掌读' then from_unixtime(order_time, '%Y-%m-%d')
|
|
|
+ ELSE left(order_time,10) end date,
|
|
|
+ stage,platform,channel,channel_id,user_id,
|
|
|
+ case when platform='掌中云' then DATE_FORMAT(STR_TO_DATE(order_time,'%Y-%m-%dT%H:%i:%s'),'%Y-%m-%d %H:%i:%s')
|
|
|
+ when platform='掌读' then from_unixtime(order_time, '%Y-%m-%d %H:%i:%s')
|
|
|
+ ELSE order_time end order_time,
|
|
|
+ case when platform='掌中云' then DATE_FORMAT(STR_TO_DATE(reg_time,'%Y-%m-%dT%H:%i:%s'),'%Y-%m-%d %H:%i:%s')
|
|
|
+ when platform='掌读' then from_unixtime(reg_time, '%Y-%m-%d %H:%i:%s')
|
|
|
+ ELSE reg_time end reg_time,
|
|
|
+ amount,from_novel,order_id from `order` where date=UNIX_TIMESTAMP('{}')
|
|
|
+ """.format(dt)
|
|
|
+ db.quchen_text.execute(sql)
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+
|
|
|
+ li=dt.getDateLists('2019-03-01','2020-01-01')
|
|
|
+ for i in li:
|
|
|
+ print(i)
|
|
|
+ clean_order(i)
|
|
|
|