Browse Source

Merge branch 'dev'

ck 4 năm trước cách đây
mục cha
commit
9399285c99
2 tập tin đã thay đổi với 4 bổ sung4 xóa
  1. 3 3
      data_manage/analysis_select.py
  2. 1 1
      data_manage/public_analysis.py

+ 3 - 3
data_manage/analysis_select.py

@@ -37,7 +37,7 @@ def channel_analysis_select(arg):
             (select channel,round(sum(cost),2) cost  from dw_daily_channel_cost
                 where  dt>='{start}' and dt<='{end}' {op} {op1} group by channel) a
                 left join
-            (select channel,round(sum(amount),2) amount from `order` where date>='{st}' and date<='{et}'  and
+            (select channel,round(sum(amount),2) amount from `order` where  date>='{st}' and date<='{et}' and status=2  and
             formatDateTime(reg_time,'%Y-%m-%d')>='{start}' and formatDateTime(reg_time,'%Y-%m-%d')<='{end}' {op} {op1}
             group by channel) b
             using (channel) {op2} {op3}"""
@@ -63,8 +63,8 @@ def channel_analysis_select_daily(arg):
 
 
     sql = f"""select formatDateTime(date,'%Y-%m-%d'),round(sum(amount),2) from `order` where formatDateTime(reg_time,'%Y-%m-%d')>='{start}' and formatDateTime(reg_time,'%Y-%m-%d')<='{end}'
-            and date>='{st}' and date<='{et}' and channel = '{channel}'
-            group by date order by date desc limit 10"""
+            and date>='{st}' and date<='{et}' and channel = '{channel}' and status=2 
+            group by date order by date desc limit 30"""
 
     data = get_dict_list(['dt','amount'],ck.getDataList(sql))
     # print(data)

+ 1 - 1
data_manage/public_analysis.py

@@ -406,7 +406,7 @@ def boss_panel_summary(user_id,start,end,channel,pitcher, type, stage, page, pag
 
     dm = MysqlUtils().dm
 
-    sql=f"""select sum(order_amount) order_amount,sum(cost) cost,dt from dw_channel                                                                                                                                                                                                                                                                                                                                             
+    sql=f"""select sum(order_amount) order_amount,sum(cost) cost,round(sum(reg_order_amount)/sum(cost),4) roi,dt from dw_channel                                                                                                                                                                                                                                                                                                                                             
     where 1=1 {op} {op1} {op2} {op3} {op4} {op5} {op6}
     GROUP BY dt HAVING order_amount+cost>0 {op7} """
     # print(sql)