Przeglądaj źródła

MOD:素材库渠道修改

cxyu 3 lat temu
rodzic
commit
8129db8ed5
1 zmienionych plików z 15 dodań i 17 usunięć
  1. 15 17
      data_manage/public_analysis.py

+ 15 - 17
data_manage/public_analysis.py

@@ -566,7 +566,6 @@ def advertisement_rank(user_id, start, end, type, page, page_size, order, order_
 
     db = MysqlUtils().dm
 
-
     sql = f"""
     select 
     campaign_id,
@@ -664,12 +663,11 @@ def idea_rank(user_id, start, end, page, page_size, order, order_by, book, chann
         else:
             op1 = f" and pitcher in {str(user)}"
 
-    if channel == '朋友圈信息流':
-        channel = 'MP'
-    if channel == '广点通':
-        channel = 'GDT'
-
-    op4 = f" and type='{channel}'" if channel else ''
+    channel = channel.replace('朋友圈信息流', 'MP')
+    channel = channel.replace('广点通', 'GDT')
+    channel = "','".join(channel.split(','))
+    channel = "'{}'".format(channel)
+    op4 = f" and type in ({channel}) " if channel else ''
 
     op10 = f" and book='{book}'" if book else ''
     op11 = f" and image_id like '%,%' " if not is_singleimg else ''
@@ -790,11 +788,11 @@ def media_rank(user_id, start, end, page, page_size, order, order_by, book, chan
         else:
             op1 = f" and pitcher in {str(user)}"
 
-    if channel == '朋友圈信息流':
-        channel = 'MP'
-    if channel == '广点通':
-        channel = 'GDT'
-    op4 = f" and type='{channel}'" if channel else ''
+    channel = channel.replace('朋友圈信息流', 'MP')
+    channel = channel.replace('广点通', 'GDT')
+    channel = "','".join(channel.split(','))
+    channel = "'{}'".format(channel)
+    op4 = f" and type in ({channel}) " if channel else ''
 
     op10 = f" and book='{book}'" if book else ''
 
@@ -916,11 +914,11 @@ def content_rank(user_id, start, end, page, page_size, order, order_by, book, ch
         else:
             op1 = f" and pitcher in {str(user)}"
 
-    if channel == '朋友圈信息流':
-        channel = 'MP'
-    if channel == '广点通':
-        channel = 'GDT'
-    op4 = f" and type='{channel}'" if channel else ''
+    channel = channel.replace('朋友圈信息流', 'MP')
+    channel = channel.replace('广点通', 'GDT')
+    channel = "','".join(channel.split(','))
+    channel = "'{}'".format(channel)
+    op4 = f" and type in ({channel}) " if channel else ''
     op10 = f" and book='{book}'" if book else ''
 
     if campaign_ids: