Browse Source

MOD:素材库渠道修改

cxyu 3 years ago
parent
commit
8129db8ed5
1 changed files with 15 additions and 17 deletions
  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
     db = MysqlUtils().dm
 
 
-
     sql = f"""
     sql = f"""
     select 
     select 
     campaign_id,
     campaign_id,
@@ -664,12 +663,11 @@ def idea_rank(user_id, start, end, page, page_size, order, order_by, book, chann
         else:
         else:
             op1 = f" and pitcher in {str(user)}"
             op1 = f" and pitcher in {str(user)}"
 
 
-    if channel == '朋友圈信息流':
+    channel = channel.replace('朋友圈信息流', 'MP')
-        channel = 'MP'
+    channel = channel.replace('广点通', 'GDT')
-    if channel == '广点通':
+    channel = "','".join(channel.split(','))
-        channel = 'GDT'
+    channel = "'{}'".format(channel)
-
+    op4 = f" and type in ({channel}) " if channel else ''
-    op4 = f" and type='{channel}'" if channel else ''
 
 
     op10 = f" and book='{book}'" if book else ''
     op10 = f" and book='{book}'" if book else ''
     op11 = f" and image_id like '%,%' " if not is_singleimg 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:
         else:
             op1 = f" and pitcher in {str(user)}"
             op1 = f" and pitcher in {str(user)}"
 
 
-    if channel == '朋友圈信息流':
+    channel = channel.replace('朋友圈信息流', 'MP')
-        channel = 'MP'
+    channel = channel.replace('广点通', 'GDT')
-    if channel == '广点通':
+    channel = "','".join(channel.split(','))
-        channel = 'GDT'
+    channel = "'{}'".format(channel)
-    op4 = f" and type='{channel}'" if channel else ''
+    op4 = f" and type in ({channel}) " if channel else ''
 
 
     op10 = f" and book='{book}'" if book 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:
         else:
             op1 = f" and pitcher in {str(user)}"
             op1 = f" and pitcher in {str(user)}"
 
 
-    if channel == '朋友圈信息流':
+    channel = channel.replace('朋友圈信息流', 'MP')
-        channel = 'MP'
+    channel = channel.replace('广点通', 'GDT')
-    if channel == '广点通':
+    channel = "','".join(channel.split(','))
-        channel = 'GDT'
+    channel = "'{}'".format(channel)
-    op4 = f" and type='{channel}'" if channel else ''
+    op4 = f" and type in ({channel}) " if channel else ''
     op10 = f" and book='{book}'" if book else ''
     op10 = f" and book='{book}'" if book else ''
 
 
     if campaign_ids:
     if campaign_ids: