Procházet zdrojové kódy

MOD:素材库文本修复

cxyu před 3 roky
rodič
revize
da1047e970
1 změnil soubory, kde provedl 14 přidání a 5 odebrání
  1. 14 5
      data_manage/public_analysis.py

+ 14 - 5
data_manage/public_analysis.py

@@ -846,9 +846,18 @@ def content_rank(user_id, start, end, page, page_size, order, order_by, book, ch
     op_time_small = f" and dt<='{end}' " if end else ''
 
     db = MysqlUtils().dm
-    total = db.getData(f"select sum(if(title,1,0))+sum(if(description,1,0)) from dw_image_cost_day dicd ")[0][0]
-    title_totle = db.getData(f"select sum(if(title,1,0)) from dw_image_cost_day dicd ")[0][0]
-    des_totle = db.getData(f"select sum(if(description,1,0)) from dw_image_cost_day dicd ")[0][0]
+
+    title_totle = db.getData(f'''select count(*) from dw_image_cost_day dicd
+where   REPLACE(REPLACE(title , CHAR(10), ''), CHAR(13), '')  is not null
+    and (1=1 {op1}  {op4}   {op10} {op11}  {op12}  {op_or1}) 
+    {op_time_bigger} {op_time_small} 
+''')[0][0]
+    des_totle = db.getData(f'''select count(*) from dw_image_cost_day dicd
+ where   REPLACE(REPLACE(description , CHAR(10), ''), CHAR(13), '')  is not null
+    and (1=1 {op1}  {op4}   {op10} {op11}  {op12}  {op_or1}) 
+    {op_time_bigger} {op_time_small} 
+''')[0][0]
+    total = des_totle + title_totle
     end_title = int((page * page_size) / total * title_totle) + 1
     start_title = int(((page - 1) * page_size) / total * title_totle)
     end_des = int((page * page_size) / total * des_totle) + 1
@@ -878,7 +887,7 @@ def content_rank(user_id, start, end, page, page_size, order, order_by, book, ch
     null as updateBy,
     use_times as userTimes
     from dw_image_cost_day
-    where replace (preview_url,' ,','') !='' 
+    where     REPLACE(REPLACE(title, CHAR(10), ''), CHAR(13), '') is not null
     and (1=1 {op1}  {op4}   {op10} {op11}  {op12}  {op_or1}) 
     {op_time_bigger} {op_time_small} 
     limit {start_title} , {end_title}) as a
@@ -906,7 +915,7 @@ select * from (select
     null as updateBy,
     use_times as userTimes
     from dw_image_cost_day
-    where replace (preview_url,' ,','') !=''
+    where  REPLACE(REPLACE(title, CHAR(10), ''), CHAR(13), '') is not null
     and (1=1 {op1}  {op4}   {op10} {op11}  {op12}  {op_or1}) 
     {op_time_bigger} {op_time_small}  
     limit {start_des} , {end_des}