Forráskód Böngészése

MOD:素材库-文本模块,添加文本筛选

cxyu 3 éve
szülő
commit
64502d4511
2 módosított fájl, 20 hozzáadás és 39 törlés
  1. 7 2
      data_manage/public_analysis.py
  2. 13 37
      handlers/PublicAnalysisHandler.py

+ 7 - 2
data_manage/public_analysis.py

@@ -907,7 +907,8 @@ def media_rank(user_id, start, end, page, page_size, order, order_by, book, chan
     return data
 
 
-def content_rank(user_id, start, end, page, page_size, order, order_by, book, channel, data_type, campaign_ids):
+def content_rank(user_id, start, end, page, page_size, order, order_by, book, channel, data_type, content, type,
+                 campaign_ids):
     # TODO:修改为clickhouse来进行数据访问
 
     # 时间的归因-----获取到所有这段时间内的记录,并进行聚合(聚合周末再做,先把数据拿出来)
@@ -932,6 +933,10 @@ def content_rank(user_id, start, end, page, page_size, order, order_by, book, ch
         op4 = ''
     op10 = f" and book='{book}'" if book else ''
 
+    op_content = ''
+    if content:
+        op_content = f" and title like '%{content}%'  " if type == 1 else f" and description like '%{content}%' "
+
     if campaign_ids:
         campaign_ids = campaign_ids.split(',')
         campaign_ids = "','".join([str(i) for i in campaign_ids])
@@ -1010,7 +1015,7 @@ def content_rank(user_id, start, end, page, page_size, order, order_by, book, ch
     where (REPLACE(REPLACE(description, CHAR(10), ''), CHAR(13), '') is not null 
     or REPLACE(REPLACE(title, CHAR(10), ''), CHAR(13), '') is not null )
     and (1=1 {op1}  {op_or1})
-    {op4} {op10} {op_campaign_id}
+    {op4} {op10} {op_content} {op_campaign_id} 
     {op_time_bigger} {op_time_small} 
     group by campaign_id ) as foo
      {op_order}

+ 13 - 37
handlers/PublicAnalysisHandler.py

@@ -188,7 +188,8 @@ class AdvertisementIdea(BaseHandler):
 
             du = DateUtils()
             arg = self.get_args()
-            data_type = arg.get('dataType', 'all') if arg.get('dataType', 'all') is not None else 'all'  # 数据是否是个人,个人是private,共有是all
+            data_type = arg.get('dataType', 'all') if arg.get('dataType',
+                                                              'all') is not None else 'all'  # 数据是否是个人,个人是private,共有是all
             channel = arg.get('channel')  # 渠道-----朋友圈信息流,抖音,广点通等等,,,,,,选项朋友圈信息流,公众平台流量,先#TODO:先暂时放置
             page = arg.get('pageNum', 1) if arg.get('pageNUm', 1) is not None else 1
             page_size = arg.get('pageSize', 20) if arg.get('pageSize', 20) is not None else 20
@@ -198,7 +199,8 @@ class AdvertisementIdea(BaseHandler):
             end = arg.get('endDate')
             book = arg.get('novels')
             is_video = arg.get('type')
-            is_singleimg = arg.get('singleImg', True) if arg.get('singleImg', True) is not None else True  # 是否是组图-----默认是没有
+            is_singleimg = arg.get('singleImg', True) if arg.get('singleImg',
+                                                                 True) is not None else True  # 是否是组图-----默认是没有
             user_id = arg.get('userId')
             campaign_ids = arg.get('campaignIds')
 
@@ -215,7 +217,8 @@ class AdvertisementMedia(BaseHandler):
 
             du = DateUtils()
             arg = self.get_args()
-            data_type = arg.get('dataType', 'all') if arg.get('dataType', 'all') is not None else 'all'  # 数据是否是个人,个人是private,共有是all
+            data_type = arg.get('dataType', 'all') if arg.get('dataType',
+                                                              'all') is not None else 'all'  # 数据是否是个人,个人是private,共有是all
             channel = arg.get('channel')  # 渠道-----朋友圈信息流,抖音,广点通等等,,,,,,选项朋友圈信息流,公众平台流量,先#TODO:先暂时放置
             page = arg.get('pageNum', 1) if arg.get('pageNUm', 1) is not None else 1
             page_size = arg.get('pageSize', 20) if arg.get('pageSize', 20) is not None else 20
@@ -225,7 +228,8 @@ class AdvertisementMedia(BaseHandler):
             end = arg.get('endDate')
             book = arg.get('novels')
             is_video = arg.get('type')
-            is_singleimg = arg.get('singleImg', True) if arg.get('singleImg', True) is not None else True  # 是否是组图-----默认是没有
+            is_singleimg = arg.get('singleImg', True) if arg.get('singleImg',
+                                                                 True) is not None else True  # 是否是组图-----默认是没有
             user_id = arg.get('userId')
             campaign_ids = arg.get('campaignIds')
 
@@ -242,7 +246,8 @@ class AdvertisementContent(BaseHandler):
 
             du = DateUtils()
             arg = self.get_args()
-            data_type = arg.get('dataType', 'all') if arg.get('dataType', 'all') is not None else 'all'  # 数据是否是个人,个人是private,共有是all
+            data_type = arg.get('dataType', 'all') if arg.get('dataType',
+                                                              'all') is not None else 'all'  # 数据是否是个人,个人是private,共有是all
             channel = arg.get('channel')  # 渠道-----朋友圈信息流,抖音,广点通等等,,,,,,选项朋友圈信息流,公众平台流量,先#TODO:先暂时放置
             page = arg.get('pageNum', 1) if arg.get('pageNUm', 1) is not None else 1
             page_size = arg.get('pageSize', 20) if arg.get('pageSize', 20) is not None else 20
@@ -252,39 +257,10 @@ class AdvertisementContent(BaseHandler):
             end = arg.get('endDate')
             book = arg.get('novels')
             user_id = arg.get('userId')
+            content = arg.get('content')
+            type = arg.get('type')
             campaign_ids = arg.get('campaignIds')
 
             data = content_rank(user_id, start, end, page, page_size, order, order_by,
-                                book, channel, data_type, campaign_ids)
+                                book, channel, data_type, content, type, campaign_ids)
             self.write_json_tmp_java(data=data)
-
-
-class LabelList(BaseHandler):
-    def get(self):
-        page = 1
-        page_size = 1000
-        data = label_list(page, page_size)
-        self.write_json_tmp_java(data=data)
-
-
-class LabelAdd(BaseHandler):
-    def post(self):
-        arg = self.get_args()
-        label = arg.get('label')
-        user_id = arg.get('userId')
-        data = label_add(label, user_id)
-        self.write_json_tmp_java(data=data)
-
-
-class LabelUpdate(BaseHandler):
-    def post(self):
-        pass
-
-
-class LabelDel(BaseHandler):
-    def post(self):
-        arg = self.get_args()
-        label_id = arg.get('id')
-        user_id = arg.get('userId')
-        data = label_del(label_id, user_id)
-        self.write_json_tmp_java(data=data)