Browse Source

MOD:素材库投放时间展示修改

cxyu 3 years ago
parent
commit
0483a7651b
1 changed files with 24 additions and 15 deletions
  1. 24 15
      data_manage/public_analysis.py

+ 24 - 15
data_manage/public_analysis.py

@@ -663,11 +663,14 @@ def idea_rank(user_id, start, end, page, page_size, order, order_by, book, chann
         else:
             op1 = f" and pitcher in {str(user)}"
 
-    channel = channel.replace('朋友圈信息流', 'MP')
-    channel = channel.replace('广点通', 'GDT')
-    channel = "','".join(channel.split(','))
-    channel = "'{}'".format(channel)
-    op4 = f" and type in ({channel}) " if channel else ''
+    if channel:
+        channel = channel.replace('朋友圈信息流', 'MP')
+        channel = channel.replace('广点通', 'GDT')
+        channel = "','".join(channel.split(','))
+        channel = "'{}'".format(channel)
+        op4 = f" and type in ({channel}) "
+    else:
+        op4 = ''
 
     op10 = f" and book='{book}'" if book else ''
     op11 = f" and image_id like '%,%' " if not is_singleimg else ''
@@ -789,11 +792,14 @@ def media_rank(user_id, start, end, page, page_size, order, order_by, book, chan
         else:
             op1 = f" and pitcher in {str(user)}"
 
-    channel = channel.replace('朋友圈信息流', 'MP')
-    channel = channel.replace('广点通', 'GDT')
-    channel = "','".join(channel.split(','))
-    channel = "'{}'".format(channel)
-    op4 = f" and type in ({channel}) " if channel else ''
+    if channel:
+        channel = channel.replace('朋友圈信息流', 'MP')
+        channel = channel.replace('广点通', 'GDT')
+        channel = "','".join(channel.split(','))
+        channel = "'{}'".format(channel)
+        op4 = f" and type in ({channel}) "
+    else:
+        op4 = ''
 
     op10 = f" and book='{book}'" if book else ''
 
@@ -916,11 +922,14 @@ def content_rank(user_id, start, end, page, page_size, order, order_by, book, ch
         else:
             op1 = f" and pitcher in {str(user)}"
 
-    channel = channel.replace('朋友圈信息流', 'MP')
-    channel = channel.replace('广点通', 'GDT')
-    channel = "','".join(channel.split(','))
-    channel = "'{}'".format(channel)
-    op4 = f" and type in ({channel}) " if channel else ''
+    if channel:
+        channel = channel.replace('朋友圈信息流', 'MP')
+        channel = channel.replace('广点通', 'GDT')
+        channel = "','".join(channel.split(','))
+        channel = "'{}'".format(channel)
+        op4 = f" and type in ({channel}) "
+    else:
+        op4 = ''
     op10 = f" and book='{book}'" if book else ''
 
     if campaign_ids: