Browse Source

支持多应用APP_IDS

liyuyi@c-top.com.cn 4 years ago
parent
commit
d6986d7cca

+ 4 - 4
ai_strategy_request_func.py

@@ -209,7 +209,7 @@ class ParseAddCampaignOrAddGroupRequest(object):
                      'click_track_url', 'impression_url', 'ad_photo_played_t3s_url', 'actionbar_click_url',
                      'click_track_url', 'impression_url', 'ad_photo_played_t3s_url', 'actionbar_click_url',
                      'creative_category', 'creative_tag', 'image_cnt',
                      'creative_category', 'creative_tag', 'image_cnt',
                      'create_time', 'effective_time', 'expiry_time', 'timer_task_status',
                      'create_time', 'effective_time', 'expiry_time', 'timer_task_status',
-                     'single_appid', 'app_id_array']
+                     'single_appid', 'app_id_array','general_track']
         for col in drop_cols:
         for col in drop_cols:
             if col in group_params.keys():
             if col in group_params.keys():
                 del group_params[col]
                 del group_params[col]
@@ -217,7 +217,7 @@ class ParseAddCampaignOrAddGroupRequest(object):
         # 2 从请求的信息中更新组层级信息, 如组的名称、测试定向、测试出价等, update客户策略信息
         # 2 从请求的信息中更新组层级信息, 如组的名称、测试定向、测试出价等, update客户策略信息
         if (self.group_info is not None) and (len(self.group_info) > 0):
         if (self.group_info is not None) and (len(self.group_info) > 0):
             for key, value in self.group_info.items():
             for key, value in self.group_info.items():
-                if value:
+                if value is not None:
                     group_params.update({key: value})
                     group_params.update({key: value})
 
 
         # 3 smart_cover 和 asset_mining 需要将0/1 转化为 False/True
         # 3 smart_cover 和 asset_mining 需要将0/1 转化为 False/True
@@ -260,7 +260,7 @@ class ParseAddCampaignOrAddGroupRequest(object):
         # 2 从请求的信息中更新创意层级的信息,如广告语
         # 2 从请求的信息中更新创意层级的信息,如广告语
         if (self.creative_info is not None) and (len(self.creative_info) > 0):
         if (self.creative_info is not None) and (len(self.creative_info) > 0):
             for key, value in self.creative_info.items():
             for key, value in self.creative_info.items():
-                if value:
+                if value is not None:
                     creative_params.update({key: value})
                     creative_params.update({key: value})
 
 
         # 3 拼装json的 创意参数
         # 3 拼装json的 创意参数
@@ -294,7 +294,7 @@ class ParseAddCampaignOrAddGroupRequest(object):
         # 2 从请求的信息中更新创意层级的信息,如广告语,创意名称等
         # 2 从请求的信息中更新创意层级的信息,如广告语,创意名称等
         if (self.creative_info is not None) and (len(self.creative_info) > 0):
         if (self.creative_info is not None) and (len(self.creative_info) > 0):
             for key, value in self.creative_info.items():
             for key, value in self.creative_info.items():
-                if value:
+                if value is not None:
                     creative_params.update({key: value})
                     creative_params.update({key: value})
 
 
         # 3 程序化创意部分字段发生改变,需要重命名
         # 3 程序化创意部分字段发生改变,需要重命名

+ 314 - 146
ai_time_task_creative_handler.py

@@ -3,10 +3,11 @@ from utils.UrlConfig import *
 import json
 import json
 import logging
 import logging
 import traceback
 import traceback
+import random
 import tornado.web
 import tornado.web
 from concurrent_log import ConcurrentTimedRotatingFileHandler
 from concurrent_log import ConcurrentTimedRotatingFileHandler
 from utils.CommonFunction import get_history_video_info, get_new_video_info, get_missing_video_info, \
 from utils.CommonFunction import get_history_video_info, get_new_video_info, get_missing_video_info, \
-                                 get_top_video_info, get_campaign_and_group_name_rule,get_app_detail
+                                 get_top_video_info, get_campaign_and_group_name_rule,get_app_detail, get_request_data
 from utils.ConstantConfig import *
 from utils.ConstantConfig import *
 from ai_strategy_request_func import ai_strategy_request_parse
 from ai_strategy_request_func import ai_strategy_request_parse
 from utils.DataBaseConfig import *
 from utils.DataBaseConfig import *
@@ -41,7 +42,10 @@ class AiHistoricalMissingMaterial(tornado.web.RequestHandler):
             """ % account_id
             """ % account_id
             df = pd.read_sql(sql, engine)
             df = pd.read_sql(sql, engine)
             if df['general_track'].values[0] == 0:
             if df['general_track'].values[0] == 0:
-                for app_id in df['app_id_array'].values[0]:
+                app_id_array = eval(df['app_id_array'].values[0])
+                random.shuffle(app_id_array)
+                app_id_cnt = 0
+                for app_id in app_id_array:
                     # 1、获取该 app_id 的应该详情
                     # 1、获取该 app_id 的应该详情
                     app_id_info = get_app_detail(account_id=account_id,
                     app_id_info = get_app_detail(account_id=account_id,
                                                  url=get_app_detail_url,
                                                  url=get_app_detail_url,
@@ -68,9 +72,9 @@ class AiHistoricalMissingMaterial(tornado.web.RequestHandler):
                             campaign_id = getattr(row, 'campaign_id')
                             campaign_id = getattr(row, 'campaign_id')
                             break
                             break
 
 
-                    # 3、获取通用视频5
+                    # 3、获取通用视频1
                     general_video_info = get_missing_video_info(account_id=account_id,
                     general_video_info = get_missing_video_info(account_id=account_id,
-                                                                cnt=5,
+                                                                cnt=1,
                                                                 url=get_missing_video_url,
                                                                 url=get_missing_video_url,
                                                                 start_time=missing_video_start_time,
                                                                 start_time=missing_video_start_time,
                                                                 end_time=missing_video_end_time,
                                                                 end_time=missing_video_end_time,
@@ -79,9 +83,9 @@ class AiHistoricalMissingMaterial(tornado.web.RequestHandler):
                         logger.info('account_id=%s, app_id=%s, the res of general_video_info is %s' %
                         logger.info('account_id=%s, app_id=%s, the res of general_video_info is %s' %
                                     (account_id, app_id, general_video_info['message']))
                                     (account_id, app_id, general_video_info['message']))
 
 
-                    # 4、获取app_id对应的视频50
+                    # 4、获取app_id对应的视频1
                     special_video_info = get_missing_video_info(account_id=account_id,
                     special_video_info = get_missing_video_info(account_id=account_id,
-                                                                cnt=50,
+                                                                cnt=1,
                                                                 url=get_missing_video_url,
                                                                 url=get_missing_video_url,
                                                                 start_time=missing_video_start_time,
                                                                 start_time=missing_video_start_time,
                                                                 end_time=missing_video_end_time,
                                                                 end_time=missing_video_end_time,
@@ -112,11 +116,10 @@ class AiHistoricalMissingMaterial(tornado.web.RequestHandler):
                                                         click_track_url=track_url)
                                                         click_track_url=track_url)
                         request = ai_strategy_request_parse(request_data)
                         request = ai_strategy_request_parse(request_data)
                         logger.info("account_id=%s, app_id=%s, ai策略的返回信息:%s" % (account_id, app_id, request))
                         logger.info("account_id=%s, app_id=%s, ai策略的返回信息:%s" % (account_id, app_id, request))
-                    else:
-                        logger.info("account_id=%s, app_id=%s, 没有获取到视频,不发送ai策略请求!" % (account_id, app_id))
-
-                # TODO 返回信息如何组织内容
-                self.write(json.dumps({"account_id=%s, 多应用的补充遗漏素材请求已走完!" % account_id}))
+                        app_id_cnt += 1
+                    if app_id_cnt >= 50:
+                        break
+                self.write(json.dumps({"message": "account_id=%s, 多应用的补充遗漏素材请求已走完!" % account_id}))
                 self.flush()
                 self.flush()
             else:
             else:
                 video_info = get_missing_video_info(account_id,
                 video_info = get_missing_video_info(account_id,
@@ -242,7 +245,7 @@ class AiAutoCreative(tornado.web.RequestHandler):
                     else:
                     else:
                         logger.info("account_id=%s, app_id=%s, 没有获取到视频,不发送ai策略请求!" % (account_id, app_id))
                         logger.info("account_id=%s, app_id=%s, 没有获取到视频,不发送ai策略请求!" % (account_id, app_id))
 
 
-                self.write(json.dumps({"account_id=%s, 多应用的素材自动上新请求已走完!" % account_id}))
+                self.write(json.dumps({"message": "account_id=%s, 多应用的素材自动上新请求已走完!" % account_id}))
                 self.flush()
                 self.flush()
             else:
             else:
                 start_time = (datetime.date.today()).strftime('%Y-%m-%d %H:%M:%S')
                 start_time = (datetime.date.today()).strftime('%Y-%m-%d %H:%M:%S')
@@ -310,7 +313,10 @@ class AiHighQualityMaterial(tornado.web.RequestHandler):
                      """ % account_id
                      """ % account_id
             df = pd.read_sql(sql, engine)
             df = pd.read_sql(sql, engine)
             if df['general_track'].values[0] == 0:
             if df['general_track'].values[0] == 0:
-                for app_id in df['app_id_array'].values[0]:
+                app_id_array = eval(df['app_id_array'].values[0])
+                random.shuffle(app_id_array)
+                app_id_cnt = 0
+                for app_id in app_id_array:
                     # 1、获取该 app_id 的应该详情
                     # 1、获取该 app_id 的应该详情
                     app_id_info = get_app_detail(account_id=account_id,
                     app_id_info = get_app_detail(account_id=account_id,
                                                  url=get_app_detail_url,
                                                  url=get_app_detail_url,
@@ -337,25 +343,27 @@ class AiHighQualityMaterial(tornado.web.RequestHandler):
                             campaign_id = getattr(row, 'campaign_id')
                             campaign_id = getattr(row, 'campaign_id')
                             break
                             break
 
 
-                    # 3、获取通用视频
+                    # 3、获取1个通用视频
                     general_video_info = get_top_video_info(account_id=account_id,
                     general_video_info = get_top_video_info(account_id=account_id,
                                                             url=get_high_quality_video_url,
                                                             url=get_high_quality_video_url,
                                                             start_time=(datetime.datetime.now() +
                                                             start_time=(datetime.datetime.now() +
                                                                         datetime.timedelta(days=-high_quality_video_days)).
                                                                         datetime.timedelta(days=-high_quality_video_days)).
-                                                            strftime("%Y-%m-%d"),
-                                                            end_time=str(datetime.date.today()),
+                                                            strftime("%Y-%m-%d %H:%M:%S"),
+                                                            end_time=datetime.date.today().strftime("%Y-%m-%d %H:%M:%S"),
+                                                            cnt=1,
                                                             app_version='all')
                                                             app_version='all')
                     if general_video_info['code'] != 0:
                     if general_video_info['code'] != 0:
                         logger.info('account_id=%s, app_id=%s, the res of general_video_info is %s' %
                         logger.info('account_id=%s, app_id=%s, the res of general_video_info is %s' %
                                     (account_id, app_id, general_video_info['message']))
                                     (account_id, app_id, general_video_info['message']))
 
 
-                    # 4、获取app_id对应的视频
+                    # 4、获取app_id对应的1个视频
                     special_video_info = get_top_video_info(account_id=account_id,
                     special_video_info = get_top_video_info(account_id=account_id,
                                                             url=get_high_quality_video_url,
                                                             url=get_high_quality_video_url,
                                                             start_time=(datetime.datetime.now() +
                                                             start_time=(datetime.datetime.now() +
                                                                         datetime.timedelta(days=-high_quality_video_days)).
                                                                         datetime.timedelta(days=-high_quality_video_days)).
-                                                            strftime("%Y-%m-%d"),
-                                                            end_time=str(datetime.date.today()),
+                                                            strftime("%Y-%m-%d %H:%M:%S"),
+                                                            end_time=datetime.date.today().strftime("%Y-%m-%d %H:%M:%S"),
+                                                            cnt=1,
                                                             app_version=app_version)
                                                             app_version=app_version)
                     if special_video_info['code'] != 0:
                     if special_video_info['code'] != 0:
                         logger.info('account_id=%s, app_id=%s, the res of special_video_info is %s' %
                         logger.info('account_id=%s, app_id=%s, the res of special_video_info is %s' %
@@ -383,16 +391,17 @@ class AiHighQualityMaterial(tornado.web.RequestHandler):
                                                         click_track_url=track_url)
                                                         click_track_url=track_url)
                         request = ai_strategy_request_parse(request_data)
                         request = ai_strategy_request_parse(request_data)
                         logger.info("account_id=%s, app_id=%s, ai策略的返回信息:%s" % (account_id, app_id, request))
                         logger.info("account_id=%s, app_id=%s, ai策略的返回信息:%s" % (account_id, app_id, request))
-                    else:
-                        logger.info("account_id=%s, app_id=%s, 没有获取到视频,不发送ai策略请求!" % (account_id, app_id))
-
-                self.write(json.dumps({"account_id=%s, 多应用的高质量素材复建请求已走完!" % account_id}))
+                        app_id_cnt += 1
+                    if app_id_cnt >= 50:
+                        break
+                self.write(json.dumps({"message": "account_id=%s, 多应用的高质量素材复建请求已走完!" % account_id}))
                 self.flush()
                 self.flush()
             else:
             else:
                 video_info = get_top_video_info(account_id, high_quality_video_cnt,
                 video_info = get_top_video_info(account_id, high_quality_video_cnt,
                                                 (datetime.datetime.now() + datetime.timedelta(
                                                 (datetime.datetime.now() + datetime.timedelta(
-                                                    days=-high_quality_video_days)).strftime("%Y-%m-%d"),
-                                                str(datetime.date.today()), get_high_quality_video_url)
+                                                    days=-high_quality_video_days)).strftime("%Y-%m-%d %H:%M:%S"),
+                                                datetime.date.today().strftime("%Y-%m-%d %H:%M:%S"),
+                                                get_high_quality_video_url)
                 if video_info['code'] != 0:
                 if video_info['code'] != 0:
                     logger.info("the res of video is %s" % video_info['message'])
                     logger.info("the res of video is %s" % video_info['message'])
                     logger.info("没有获取到视频,不发送ai策略请求!")
                     logger.info("没有获取到视频,不发送ai策略请求!")
@@ -422,12 +431,9 @@ class AiHighQualityMaterial(tornado.web.RequestHandler):
             self.flush()
             self.flush()
 
 
 
 
-
-
-
 class AiCheckAndUpTOFullCreative(tornado.web.RequestHandler):
 class AiCheckAndUpTOFullCreative(tornado.web.RequestHandler):
     """
     """
-    每天22:00 调用该任务,检查当天创意是否创建达到上限,否则使用历史高质量素材填满  -- 测试通过 在AD后台创建成功,检查AD信息和数据库表 没有问题
+    每天22:00 调用该任务,检查当天创意是否创建达到上限,否则使用历史高质量素材填满
     """
     """
     def post(self):
     def post(self):
         data = self.request.body
         data = self.request.body
@@ -439,24 +445,15 @@ class AiCheckAndUpTOFullCreative(tornado.web.RequestHandler):
 
 
         logger.info("账户信息=%s, 当前进程=%s, 当前进程的主进程=%s,  raw data from request is %s" %
         logger.info("账户信息=%s, 当前进程=%s, 当前进程的主进程=%s,  raw data from request is %s" %
                     (account_id, os.getpid(), os.getppid(), data))
                     (account_id, os.getpid(), os.getppid(), data))
+
+
+
         try:
         try:
             start_time = (datetime.date.today()).strftime('%Y-%m-%d %H:%M:%S')
             start_time = (datetime.date.today()).strftime('%Y-%m-%d %H:%M:%S')
             end_time = (datetime.datetime.now()).strftime('%Y-%m-%d %H:%M:%S')
             end_time = (datetime.datetime.now()).strftime('%Y-%m-%d %H:%M:%S')
+            now = datetime.datetime.now()
 
 
-            # 1-1 获取当天计划中包含“高质量素材”计划的,计划id
-            sql = """
-                    select campaign_id, campaign_name from ctop_kuaishou_campaign 
-                    where account_id = %s
-                    and put_create_time >= '%s'
-                    and put_create_time <= '%s'
-                    """ % (account_id, start_time, end_time)
-            df = pd.read_sql(sql, engine)
-            for row in df.itertuples():
-                if '高质量素材' in getattr(row, 'campaign_name'):
-                    campaign_id = getattr(row, 'campaign_id')
-                    break
-
-            # 2-1 从客户策略表中获取该账户下 每个素材搭配的封面个数, 来计算需要补充的素材个数
+            # 1-1 从客户策略表中获取该账户下 每个素材搭配的封面个数, 来计算需要补充的素材个数
             sql = """
             sql = """
             select image_cnt from ctop_ai_kuaishou_advertiser_strategy 
             select image_cnt from ctop_ai_kuaishou_advertiser_strategy 
             where account_id = %s 
             where account_id = %s 
@@ -466,7 +463,7 @@ class AiCheckAndUpTOFullCreative(tornado.web.RequestHandler):
             df = pd.read_sql(sql, engine)
             df = pd.read_sql(sql, engine)
             image_cnt = int(df['image_cnt'].values[0])
             image_cnt = int(df['image_cnt'].values[0])
 
 
-            # 3-1 从 ctop_kuaishou_creative 获取当天该账户到此刻 已经创建的创意个数
+            # 2-1 从 ctop_kuaishou_creative 获取当天该账户到此刻 已经创建的创意个数
             video_cnt = 0
             video_cnt = 0
             sql = """
             sql = """
                    select count(1) creative_cnt from ctop_kuaishou_creative 
                    select count(1) creative_cnt from ctop_kuaishou_creative 
@@ -482,42 +479,125 @@ class AiCheckAndUpTOFullCreative(tornado.web.RequestHandler):
             else:
             else:
                 video_cnt = (2000 - creative_cnt) // image_cnt
                 video_cnt = (2000 - creative_cnt) // image_cnt
 
 
-            # 4-1 获取视频信息
+            # 3-1 获取视频信息
             if video_cnt == 0:
             if video_cnt == 0:
                 logger.info("创意已经建满,不需要补充素材!")
                 logger.info("创意已经建满,不需要补充素材!")
                 self.write(json.dumps("message: 创意已经建满,不需要补充素材!"))
                 self.write(json.dumps("message: 创意已经建满,不需要补充素材!"))
                 self.flush()
                 self.flush()
             else:
             else:
                 logger.info("需要补充的视频数量:%s" % video_cnt)
                 logger.info("需要补充的视频数量:%s" % video_cnt)
-                now = datetime.datetime.now()
-                video_info = get_top_video_info(account_id,
-                                                video_cnt,
-                                                (now + datetime.timedelta(days=-2*high_quality_video_days)).strftime("%Y-%m-%d"),
-                                                (now + datetime.timedelta(days=-high_quality_video_days)).strftime("%Y-%m-%d"),
-                                                get_high_quality_video_url)
-                if video_info['code'] != 0:
-                    logger.info("the res of video is %s" % video_info['message'])
-                    logger.info("没有获取到视频,不发送ai策略请求!")
-                    self.write(json.dumps({"message": "没有获取到视频,不发送ai策略请求!"}))
-                    self.flush()
-                else:
-                    campaign_name, group_name = get_campaign_and_group_name_rule(account_id)
-                    if (campaign_name is None) or (group_name is None):
-                        logger.info("没有获取到广告计划命名规则 或 广告组命名规则,不发送ai策略请求!")
-                        self.write(json.dumps({"message": "没有获取到广告计划命名规则 或 广告组命名规则,不发送ai策略请求!"}))
-                        self.flush()
-                    else:
+
+                sql = """select account_id, single_appid, app_id_array, general_track from ctop_ai_kuaishou_advertiser_strategy
+                                 where account_id=%s and status=1 order by create_time desc limit 1
+                              """ % account_id
+                df = pd.read_sql(sql, engine)
+                if df['general_track'].values[0] == 0:
+                    needed_app_id_cnt = video_cnt
+                    app_id_array = eval(df['app_id_array'].values[0])
+                    random.shuffle(app_id_array)
+                    app_id_cnt = 0
+                    for app_id in app_id_array:
+                        # 1、获取该 app_id 的应该详情
+                        app_id_info = get_app_detail(account_id=account_id,
+                                                     url=get_app_detail_url,
+                                                     app_id=app_id)
+                        if app_id_info['code'] != 0:
+                            logger.info('account_id=%s, app_id=%s,the res of get_app_detail is %s' %
+                                        (account_id, app_id, app_id_info['message']))
+                            continue
+
+                        # 2、依据 appVersion 的值,来判断当天是否已经有对应的计划,如果有则获取 campaign_id, 没有则设置 campaign_name
+                        app_version = app_id_info['data'].get('appVersion', 'error')
+                        track_url = app_id_info['data'].get('trackUrl', 'error')
+
+                        start_time = (datetime.date.today()).strftime('%Y-%m-%d %H:%M:%S')
+                        end_time = (datetime.datetime.now()).strftime('%Y-%m-%d %H:%M:%S')
+                        sql = """ select campaign_id, campaign_name from ctop_kuaishou_campaign 
+                                                      where account_id = %s
+                                                      and put_create_time >= '%s'
+                                                      and put_create_time <= '%s'
+                                                      """ % (account_id, start_time, end_time)
+                        campaign_df = pd.read_sql(sql, engine)
+                        for row in campaign_df.itertuples():
+                            if ('高质量素材' in getattr(row, 'campaign_name')) and (
+                                    app_version in getattr(row, 'campaign_name')):
+                                campaign_id = getattr(row, 'campaign_id')
+                                break
+
+                        # 3、获取app_id对应的1个视频
+                        special_video_info = get_top_video_info(account_id=account_id,
+                                                                url=get_high_quality_video_url,
+                                                                start_time=(now + datetime.timedelta(days=-2*high_quality_video_days)).strftime("%Y-%m-%d %H:%M:%S"),
+                                                                end_time=(now + datetime.timedelta(days=-high_quality_video_days)).strftime("%Y-%m-%d %H:%M:%S"),
+                                                                cnt=1,
+                                                                app_version=app_version)
+                        if special_video_info['code'] != 0:
+                            logger.info('account_id=%s, app_id=%s, the res of special_video_info is %s' %
+                                        (account_id, app_id, special_video_info['message']))
+                            continue
+
+                        # 6、拼装request_data,调用ai_strategy_request_parse方法
+                        # 广告计划名称:渠道包 - 游戏名称 - 版位 - 日期
+                        # 广告组名称:渠道包 - 游戏名称 - 优选 - 不限(定向)-自定义 / 程序化 - 日期
                         request_data = get_request_data(account_id=account_id,
                         request_data = get_request_data(account_id=account_id,
                                                         campaign_id=campaign_id,
                                                         campaign_id=campaign_id,
-                                                        video_info=video_info['data'],
-                                                        campaign_name=campaign_name,
-                                                        group_name=group_name,
+                                                        video_info=special_video_info['data'],
+                                                        campaign_name=app_version + '-优选广告位-' + '高质量素材',
+                                                        group_name=app_version + '-优选广告位-不限-自定义-' + '高质量素材',
                                                         ai_strategy_remark="用高质量素材补满创意",
                                                         ai_strategy_remark="用高质量素材补满创意",
-                                                        name_replace="高质量素材")
+                                                        unit_type=4,
+                                                        app_id=app_id,
+                                                        click_track_url=track_url)
                         request = ai_strategy_request_parse(request_data)
                         request = ai_strategy_request_parse(request_data)
-                        logger.info("ai策略的返回信息:%s" % request)
-                        self.write(json.dumps(request))
+                        logger.info("account_id=%s, app_id=%s, ai策略的返回信息:%s" % (account_id, app_id, request))
+                        app_id_cnt += 1
+                        if app_id_cnt >= needed_app_id_cnt:
+                            break
+                    self.write(json.dumps({"message": "account_id=%s, 多应用的高质量素材补满创意的请求已走完!" % account_id}))
+                    self.flush()
+                else:
+                    # 1-1 获取当天计划中包含“高质量素材”计划的,计划id
+                    sql = """
+                                       select campaign_id, campaign_name from ctop_kuaishou_campaign 
+                                       where account_id = %s
+                                       and put_create_time >= '%s'
+                                       and put_create_time <= '%s'
+                                       """ % (account_id, start_time, end_time)
+                    df = pd.read_sql(sql, engine)
+                    for row in df.itertuples():
+                        if '高质量素材' in getattr(row, 'campaign_name'):
+                            campaign_id = getattr(row, 'campaign_id')
+                            break
+
+
+                    video_info = get_top_video_info(account_id,
+                                                    video_cnt,
+                                                    (now + datetime.timedelta(days=-2*high_quality_video_days)).strftime("%Y-%m-%d %H:%M:%S"),
+                                                    (now + datetime.timedelta(days=-high_quality_video_days)).strftime("%Y-%m-%d %H:%M:%S"),
+                                                    get_high_quality_video_url)
+                    if video_info['code'] != 0:
+                        logger.info("the res of video is %s" % video_info['message'])
+                        logger.info("没有获取到视频,不发送ai策略请求!")
+                        self.write(json.dumps({"message": "没有获取到视频,不发送ai策略请求!"}))
                         self.flush()
                         self.flush()
+                    else:
+                        campaign_name, group_name = get_campaign_and_group_name_rule(account_id)
+                        if (campaign_name is None) or (group_name is None):
+                            logger.info("没有获取到广告计划命名规则 或 广告组命名规则,不发送ai策略请求!")
+                            self.write(json.dumps({"message": "没有获取到广告计划命名规则 或 广告组命名规则,不发送ai策略请求!"}))
+                            self.flush()
+                        else:
+                            request_data = get_request_data(account_id=account_id,
+                                                            campaign_id=campaign_id,
+                                                            video_info=video_info['data'],
+                                                            campaign_name=campaign_name,
+                                                            group_name=group_name,
+                                                            ai_strategy_remark="用高质量素材补满创意",
+                                                            name_replace="高质量素材")
+                            request = ai_strategy_request_parse(request_data)
+                            logger.info("ai策略的返回信息:%s" % request)
+                            self.write(json.dumps(request))
+                            self.flush()
         except Exception:
         except Exception:
             logger.error(traceback.format_exc())
             logger.error(traceback.format_exc())
             self.write(json.dumps(traceback.format_exc()))
             self.write(json.dumps(traceback.format_exc()))
@@ -555,36 +635,92 @@ class AiProgramCreativeHighQualityMaterial(tornado.web.RequestHandler):
         campaign_id = data.get('campaign_id')
         campaign_id = data.get('campaign_id')
         logger.info("账户信息=%s, 当前进程=%s, 当前进程的主进程=%s,  raw data from request is %s" %
         logger.info("账户信息=%s, 当前进程=%s, 当前进程的主进程=%s,  raw data from request is %s" %
                     (account_id, os.getpid(), os.getppid(), data))
                     (account_id, os.getpid(), os.getppid(), data))
-
         try:
         try:
-            video_info = get_top_video_info(account_id, programme_high_quality_video_cnt,
-                                            (datetime.datetime.now() + datetime.timedelta(
-                                             days=-high_quality_video_days)).strftime("%Y-%m-%d"),
-                                            str(datetime.date.today()), get_high_quality_video_url)
-            if video_info['code'] != 0:
-                logger.info("the res of video is %s" % video_info['message'])
-                logger.info("没有获取到视频,不发送ai策略请求!")
-                self.write(json.dumps({"message": "没有获取到视频,不发送ai策略请求!"}))
-                self.flush()
-            else:
-                campaign_name, group_name = get_campaign_and_group_name_rule(account_id)
-                if (campaign_name is None) or (group_name is None):
-                    logger.info("没有获取到广告计划命名规则 或 广告组命名规则,不发送ai策略请求!")
-                    self.write(json.dumps({"message": "没有获取到广告计划命名规则 或 广告组命名规则,不发送ai策略请求!"}))
-                    self.flush()
-                else:
+            sql = """select account_id, single_appid, app_id_array, general_track from ctop_ai_kuaishou_advertiser_strategy
+                     where account_id=%s and status=1 order by create_time desc limit 1
+                  """ % account_id
+            df = pd.read_sql(sql, engine)
+            if df['general_track'].values[0] == 0:
+                app_id_array = eval(df['app_id_array'].values[0])
+                random.shuffle(app_id_array)
+                app_id_cnt = 0
+                for app_id in app_id_array:
+                    # 1、获取该 app_id 的应该详情
+                    app_id_info = get_app_detail(account_id=account_id,
+                                                 url=get_app_detail_url,
+                                                 app_id=app_id)
+                    if app_id_info['code'] != 0:
+                        logger.info('account_id=%s, app_id=%s, the res of get_app_detail is %s' %
+                                    (account_id, app_id, app_id_info['message']))
+                        continue
+
+                    app_version = app_id_info['data'].get('appVersion', 'error')
+                    track_url = app_id_info['data'].get('trackUrl', 'error')
+
+                    # 2、获取特定视频
+                    special_video_info = get_top_video_info(account_id=account_id,
+                                                            url=get_high_quality_video_url,
+                                                            start_time=(datetime.datetime.now() +
+                                                                        datetime.timedelta(days=-high_quality_video_days)).
+                                                            strftime("%Y-%m-%d %H:%M:%S"),
+                                                            end_time=datetime.date.today().strftime("%Y-%m-%d %H:%M:%S"),
+                                                            cnt=5,
+                                                            app_version=app_version)
+                    if special_video_info['code'] != 0:
+                        logger.info('account_id=%s, app_id=%s, the res of special_video_info is %s' %
+                                    (account_id, app_id, special_video_info['message']))
+                        continue
+
+                    # 3、拼装request_data,调用ai_strategy_request_parse方法
+                    # 广告计划名称:渠道包 - 游戏名称 - 版位 - 日期
+                    # 广告组名称:渠道包 - 游戏名称 - 优选 - 不限(定向)-自定义 / 程序化 - 日期
                     request_data = get_request_data(account_id=account_id,
                     request_data = get_request_data(account_id=account_id,
                                                     campaign_id=campaign_id,
                                                     campaign_id=campaign_id,
-                                                    video_info=video_info['data'],
-                                                    campaign_name=campaign_name,
-                                                    group_name=group_name,
+                                                    video_info=special_video_info['data'],
+                                                    campaign_name=app_version + '-优选广告位-' + '程序化高质量素材',
+                                                    group_name=app_version + '-优选广告位-不限-程序化-' + '高质量素材',
                                                     ai_strategy_remark="程序化高质量素材",
                                                     ai_strategy_remark="程序化高质量素材",
-                                                    name_replace="程序化高质量素材",
-                                                    unit_type=7)
+                                                    unit_type=7,
+                                                    app_id=app_id,
+                                                    click_track_url=track_url)
                     request = ai_strategy_request_parse(request_data)
                     request = ai_strategy_request_parse(request_data)
-                    logger.info("ai策略的返回信息:%s" % request)
-                    self.write(json.dumps(request))
+                    logger.info("account_id=%s, app_id=%s, ai策略的返回信息:%s" % (account_id, app_id, request))
+                    app_id_cnt += 1
+                    if app_id_cnt >= 30:
+                        break
+
+                self.write(json.dumps({"message": "account_id=%s, 多应用的高质量素材程序化创意的请求已走完!" % account_id}))
+                self.flush()
+            else:
+                video_info = get_top_video_info(account_id, programme_high_quality_video_cnt,
+                                                (datetime.datetime.now() + datetime.timedelta(
+                                                 days=-high_quality_video_days)).strftime("%Y-%m-%d %H:%M:%S"),
+                                                datetime.date.today().strftime("%Y-%m-%d %H:%M:%S"),
+                                                get_high_quality_video_url)
+                if video_info['code'] != 0:
+                    logger.info("the res of video is %s" % video_info['message'])
+                    logger.info("没有获取到视频,不发送ai策略请求!")
+                    self.write(json.dumps({"message": "没有获取到视频,不发送ai策略请求!"}))
                     self.flush()
                     self.flush()
+                else:
+                    campaign_name, group_name = get_campaign_and_group_name_rule(account_id)
+                    if (campaign_name is None) or (group_name is None):
+                        logger.info("没有获取到广告计划命名规则 或 广告组命名规则,不发送ai策略请求!")
+                        self.write(json.dumps({"message": "没有获取到广告计划命名规则 或 广告组命名规则,不发送ai策略请求!"}))
+                        self.flush()
+                    else:
+                        request_data = get_request_data(account_id=account_id,
+                                                        campaign_id=campaign_id,
+                                                        video_info=video_info['data'],
+                                                        campaign_name=campaign_name,
+                                                        group_name=group_name,
+                                                        ai_strategy_remark="程序化高质量素材",
+                                                        name_replace="程序化高质量素材",
+                                                        unit_type=7)
+                        request = ai_strategy_request_parse(request_data)
+                        logger.info("ai策略的返回信息:%s" % request)
+                        self.write(json.dumps(request))
+                        self.flush()
         except Exception:
         except Exception:
             logger.error(traceback.format_exc())
             logger.error(traceback.format_exc())
             self.write(json.dumps(traceback.format_exc()))
             self.write(json.dumps(traceback.format_exc()))
@@ -593,7 +729,7 @@ class AiProgramCreativeHighQualityMaterial(tornado.web.RequestHandler):
 
 
 class AiProgramCreativeNewMaterial(tornado.web.RequestHandler):
 class AiProgramCreativeNewMaterial(tornado.web.RequestHandler):
     """
     """
-    使用近期创意数关联小于10(当天创意关联数小于10的,150个素材)的素材创建程序化创意
+    使用2天内 创意数关联小于10(当天创意关联数小于10的,150个素材)的素材创建程序化创意
     计划名称--新素材程序化
     计划名称--新素材程序化
     timeTask: 每天上午10点执行 --(0 0 10 * * ?)
     timeTask: 每天上午10点执行 --(0 0 10 * * ?)
     """
     """
@@ -606,64 +742,96 @@ class AiProgramCreativeNewMaterial(tornado.web.RequestHandler):
         campaign_id = data.get('campaign_id')
         campaign_id = data.get('campaign_id')
         logger.info("账户信息=%s, 当前进程=%s, 当前进程的主进程=%s,  raw data from request is %s" %
         logger.info("账户信息=%s, 当前进程=%s, 当前进程的主进程=%s,  raw data from request is %s" %
                     (account_id, os.getpid(), os.getppid(), data))
                     (account_id, os.getpid(), os.getppid(), data))
-
         try:
         try:
-            video_info = get_history_video_info(account_id=account_id,
-                                                url=get_history_video_url,
-                                                start_time=(datetime.datetime.now() + datetime.timedelta(days=-2)).
-                                                strftime("%Y-%m-%d"),
-                                                end_time=str(datetime.date.today()),
-                                                video_cnt=programme_new_video_cnt,
-                                                related_creative_max_cnt=related_creative_max_cnt)
-            if video_info['code'] != 0:
-                logger.info("the res of video is %s" % video_info['message'])
-                logger.info("没有获取到视频,不发送ai策略请求!")
-                self.write(json.dumps({"message": "没有获取到视频,不发送ai策略请求!"}))
-                self.flush()
-            else:
-                campaign_name, group_name = get_campaign_and_group_name_rule(account_id)
-                if (campaign_name is None) or (group_name is None):
-                    logger.info("没有获取到广告计划命名规则 或 广告组命名规则,不发送ai策略请求!")
-                    self.write(json.dumps({"message": "没有获取到广告计划命名规则 或 广告组命名规则,不发送ai策略请求!"}))
-                    self.flush()
-                else:
+            sql = """select account_id, single_appid, app_id_array, general_track from ctop_ai_kuaishou_advertiser_strategy
+                     where account_id=%s and status=1 order by create_time desc limit 1
+                  """ % account_id
+            df = pd.read_sql(sql, engine)
+            if df['general_track'].values[0] == 0:
+                app_id_array = eval(df['app_id_array'].values[0])
+                random.shuffle(app_id_array)
+                app_id_cnt = 0
+                for app_id in app_id_array:
+                    # 1、获取该 app_id 的应该详情
+                    app_id_info = get_app_detail(account_id=account_id,
+                                                 url=get_app_detail_url,
+                                                 app_id=app_id)
+                    if app_id_info['code'] != 0:
+                        logger.info('account_id=%s, app_id=%s, the res of get_app_detail is %s' %
+                                    (account_id, app_id, app_id_info['message']))
+                        continue
+
+                    app_version = app_id_info['data'].get('appVersion', 'error')
+                    track_url = app_id_info['data'].get('trackUrl', 'error')
+
+                    # 2、获取特定视频
+                    special_video_info = get_history_video_info(account_id=account_id,
+                                                                url=get_history_video_url,
+                                                                start_time=(datetime.datetime.now() + datetime.timedelta(days=-200)).
+                                                                strftime("%Y-%m-%d %H:%M:%S"),
+                                                                end_time=datetime.date.today().strftime("%Y-%m-%d %H:%M:%S"),
+                                                                video_cnt=5,
+                                                                related_creative_max_cnt=related_creative_max_cnt,
+                                                                app_version=app_version
+                                                                )
+                    if special_video_info['code'] != 0:
+                        logger.info('account_id=%s, app_id=%s, the res of special_video_info is %s' %
+                                    (account_id, app_id, special_video_info['message']))
+                        continue
+
+                    # 3、拼装request_data,调用ai_strategy_request_parse方法
+                    # 广告计划名称:渠道包 - 游戏名称 - 版位 - 日期
+                    # 广告组名称:渠道包 - 游戏名称 - 优选 - 不限(定向)-自定义 / 程序化 - 日期
                     request_data = get_request_data(account_id=account_id,
                     request_data = get_request_data(account_id=account_id,
                                                     campaign_id=campaign_id,
                                                     campaign_id=campaign_id,
-                                                    video_info=video_info['data'],
-                                                    campaign_name=campaign_name,
-                                                    group_name=group_name,
+                                                    video_info=special_video_info['data'],
+                                                    campaign_name=app_version + '-优选广告位-' + '程序化上新素材',
+                                                    group_name=app_version + '-优选广告位-不限-程序化-' + '上新素材',
                                                     ai_strategy_remark="程序化上新素材",
                                                     ai_strategy_remark="程序化上新素材",
-                                                    name_replace="程序化上新素材",
-                                                    unit_type=7)
+                                                    unit_type=7,
+                                                    app_id=app_id,
+                                                    click_track_url=track_url)
                     request = ai_strategy_request_parse(request_data)
                     request = ai_strategy_request_parse(request_data)
-                    logger.info("ai策略的返回信息:%s" % request)
-                    self.write(json.dumps(request))
+                    logger.info("account_id=%s, app_id=%s, ai策略的返回信息:%s" % (account_id, app_id, request))
+                    app_id_cnt += 1
+                    if app_id_cnt >= 30:
+                        break
+
+                self.write(json.dumps({"message": "account_id=%s, 多应用的上新素材程序化创意的请求已走完!" % account_id}))
+                self.flush()
+            else:
+                video_info = get_history_video_info(account_id=account_id,
+                                                    url=get_history_video_url,
+                                                    start_time=(datetime.datetime.now() + datetime.timedelta(days=-2)).
+                                                    strftime("%Y-%m-%d %H:%M:%S"),
+                                                    end_time=datetime.date.today().strftime("%Y-%m-%d %H:%M:%S"),
+                                                    video_cnt=programme_new_video_cnt,
+                                                    related_creative_max_cnt=related_creative_max_cnt)
+                if video_info['code'] != 0:
+                    logger.info("the res of video is %s" % video_info['message'])
+                    logger.info("没有获取到视频,不发送ai策略请求!")
+                    self.write(json.dumps({"message": "没有获取到视频,不发送ai策略请求!"}))
                     self.flush()
                     self.flush()
+                else:
+                    campaign_name, group_name = get_campaign_and_group_name_rule(account_id)
+                    if (campaign_name is None) or (group_name is None):
+                        logger.info("没有获取到广告计划命名规则 或 广告组命名规则,不发送ai策略请求!")
+                        self.write(json.dumps({"message": "没有获取到广告计划命名规则 或 广告组命名规则,不发送ai策略请求!"}))
+                        self.flush()
+                    else:
+                        request_data = get_request_data(account_id=account_id,
+                                                        campaign_id=campaign_id,
+                                                        video_info=video_info['data'],
+                                                        campaign_name=campaign_name,
+                                                        group_name=group_name,
+                                                        ai_strategy_remark="程序化上新素材",
+                                                        name_replace="程序化上新素材",
+                                                        unit_type=7)
+                        request = ai_strategy_request_parse(request_data)
+                        logger.info("ai策略的返回信息:%s" % request)
+                        self.write(json.dumps(request))
+                        self.flush()
         except Exception:
         except Exception:
             logger.error(traceback.format_exc())
             logger.error(traceback.format_exc())
             self.write(json.dumps(traceback.format_exc()))
             self.write(json.dumps(traceback.format_exc()))
-            self.flush()
-
-
-def get_request_data(account_id, campaign_id, video_info, campaign_name, group_name,
-                     ai_strategy_remark, name_replace='',
-                     unit_type=4, click_track_url=None, app_id=None):
-    res = {
-        "video": video_info,
-        "operation_type": 1,
-        "account_id": account_id,
-        "ai_strategy_remark": ai_strategy_remark,
-        "campaign_info":
-            {"campaign_id": campaign_id,
-             "campaign_name": (campaign_name.replace('自定义', name_replace) + str(datetime.datetime.now()))
-             if not name_replace else (campaign_name + str(datetime.datetime.now()))},
-        'group_info':
-            {'group_name': (group_name.replace('自定义', name_replace) + str(datetime.datetime.now()))
-                if not name_replace else (group_name + str(datetime.datetime.now())),
-             'begin_time': str(datetime.date.today()),
-             'unit_type': unit_type,
-             'app_id': app_id},
-        'creative_info': {'is_sticky': 0,
-                          'click_track_url': click_track_url}
-    }
-    return res
+            self.flush()

+ 4 - 3
manual_request_json.py

@@ -21,9 +21,10 @@ def main():
     # res = ai_strategy_request_parse(request_dict)
     # res = ai_strategy_request_parse(request_dict)
     # print(res)
     # print(res)
 
 
-    data = json.dumps({"account_id": 9743727})
-    # url = 'http://192.168.1.193:31012/ai_programme_new_material'
-    url = 'http://192.168.1.193:31012/ai_programme_high_quality_material'
+    # data = json.dumps({"account_id": 23212})
+    data = json.dumps({"account_id": 9864909})
+    url = 'http://192.168.1.193:31012/ai_programme_new_material'
+    # url = 'http://192.168.1.193:31012/ai_programme_high_quality_material'
     # url = 'http://192.168.1.193:31012/ai_historical_missing_material'
     # url = 'http://192.168.1.193:31012/ai_historical_missing_material'
     request = requests.post(url, data)
     request = requests.post(url, data)
     print(request.text)
     print(request.text)

+ 54 - 11
utils/CommonFunction.py

@@ -2,6 +2,7 @@ import requests
 from utils.UrlConfig import headers
 from utils.UrlConfig import headers
 import json
 import json
 import pandas as pd
 import pandas as pd
+import datetime
 from utils.DataBaseConfig import *
 from utils.DataBaseConfig import *
 
 
 
 
@@ -17,7 +18,7 @@ def get_lower_case_name(name):
 def get_app_detail(account_id, url, app_id):
 def get_app_detail(account_id, url, app_id):
     """
     """
     获取应用详情
     获取应用详情
-    url:http://localhost:8080/jeecg-boot/ai/aiKuaiShouAppInfo/getAppDetail
+    url:http://192.168.1.8:8080/jeecg-boot/ai/aiKuaiShouAppInfo/getAppDetail
     请求方式:post
     请求方式:post
     入参:accountId 账户id
     入参:accountId 账户id
          appId     应用id
          appId     应用id
@@ -51,7 +52,7 @@ def get_app_detail(account_id, url, app_id):
     return request
     return request
 
 
 
 
-def get_history_video_info(account_id, url, start_time, end_time, video_cnt, related_creative_max_cnt):
+def get_history_video_info(account_id, url, start_time, end_time, video_cnt, related_creative_max_cnt, app_version=None):
     """
     """
     url:http://192.168.1.8:8080/jeecg-boot/kuaishou/material/getHistoryVideoList
     url:http://192.168.1.8:8080/jeecg-boot/kuaishou/material/getHistoryVideoList
     请求方式:POST
     请求方式:POST
@@ -62,24 +63,37 @@ def get_history_video_info(account_id, url, start_time, end_time, video_cnt, rel
          createCount   关联创意数 (小于该值)
          createCount   关联创意数 (小于该值)
          num           获取数量 (随机num个)
          num           获取数量 (随机num个)
     """
     """
-    request_data = {"accountId": account_id,
-                    "startDate": start_time,
-                    "endDate": end_time,
-                    "num": video_cnt,
-                    "createCount": related_creative_max_cnt}
+    if not app_version:
+        request_data = {"accountId": account_id,
+                        "startDate": start_time,
+                        "endDate": end_time,
+                        "num": video_cnt,
+                        "createCount": related_creative_max_cnt}
+
+    else:
+        request_data = {"accountId": account_id,
+                        "startDate": start_time,
+                        "endDate": end_time,
+                        "num": video_cnt,
+                        "createCount": related_creative_max_cnt,
+                        "appVersion": app_version}
     request = requests.post(url, headers=headers, data=json.JSONEncoder().encode(request_data)).text
     request = requests.post(url, headers=headers, data=json.JSONEncoder().encode(request_data)).text
     request = json.loads(request)
     request = json.loads(request)
     return request
     return request
 
 
 
 
-def get_new_video_info(account_id, url):
+def get_new_video_info(account_id, url, app_version=None):
     """
     """
     url:http://192.168.1.8:8080/jeecg-boot/kuaishou/material/getNewVideoList
     url:http://192.168.1.8:8080/jeecg-boot/kuaishou/material/getNewVideoList
     请求方式:POST
     请求方式:POST
     remark: 返回 upload_time 在上次调用时间到本次调用时间内的素材(第一次调用返回5分钟前到本次调用时间的素材)
     remark: 返回 upload_time 在上次调用时间到本次调用时间内的素材(第一次调用返回5分钟前到本次调用时间的素材)
     入参:accountId
     入参:accountId
     """
     """
-    request_data = {"accountId": account_id}
+    if not app_version:
+        request_data = {"accountId": account_id}
+    else:
+        request_data = {"accountId": account_id, 'appVersion': app_version}
+
     request = requests.post(url, headers=headers, data=json.JSONEncoder().encode(request_data)).text
     request = requests.post(url, headers=headers, data=json.JSONEncoder().encode(request_data)).text
     request = json.loads(request)
     request = json.loads(request)
     return request
     return request
@@ -107,7 +121,7 @@ def get_missing_video_info(account_id, cnt, url, start_time, end_time, app_versi
     return request
     return request
 
 
 
 
-def get_top_video_info(account_id, cnt, start_time, end_time, url):
+def get_top_video_info(account_id, cnt, start_time, end_time, url, app_version=None):
     """
     """
     url:http://192.168.1.8:8080/jeecg-boot/kuaishou/material/getHistoryTopVideoList
     url:http://192.168.1.8:8080/jeecg-boot/kuaishou/material/getHistoryTopVideoList
     请求方式:POST
     请求方式:POST
@@ -134,7 +148,12 @@ def get_top_video_info(account_id, cnt, start_time, end_time, url):
         ],
         ],
     "message": "SUCCESS"
     "message": "SUCCESS"
     """
     """
-    request_data = {"accountId": account_id, "num": cnt, "startTime": start_time, "endTime": end_time}
+
+    if not app_version:
+        request_data = {"accountId": account_id, "num": cnt, "startTime": start_time, "endTime": end_time}
+    else:
+        request_data = {"accountId": account_id, "num": cnt, "startTime": start_time, "endTime": end_time,
+                        'appVersion': app_version}
     request = requests.post(url, headers=headers, data=json.JSONEncoder().encode(request_data)).text
     request = requests.post(url, headers=headers, data=json.JSONEncoder().encode(request_data)).text
     request = json.loads(request)
     request = json.loads(request)
     return request
     return request
@@ -153,3 +172,27 @@ def get_campaign_and_group_name_rule(account_id):
     campaign_name = df['campaign_name'].values[0]
     campaign_name = df['campaign_name'].values[0]
     group_name = df['group_name'].values[0]
     group_name = df['group_name'].values[0]
     return campaign_name, group_name
     return campaign_name, group_name
+
+
+def get_request_data(account_id, campaign_id, video_info, campaign_name, group_name,
+                     ai_strategy_remark, name_replace='',
+                     unit_type=4, click_track_url=None, app_id=None):
+    res = {
+        "video": video_info,
+        "operation_type": 1,
+        "account_id": account_id,
+        "ai_strategy_remark": ai_strategy_remark,
+        "campaign_info":
+            {"campaign_id": campaign_id,
+             "campaign_name": (campaign_name.replace('自定义', name_replace) + str(datetime.datetime.now()))
+             if not name_replace else (campaign_name + str(datetime.datetime.now()))},
+        'group_info':
+            {'group_name': (group_name.replace('自定义', name_replace) + str(datetime.datetime.now()))
+                if not name_replace else (group_name + str(datetime.datetime.now())),
+             'begin_time': str(datetime.date.today()),
+             'unit_type': unit_type,
+             'app_id': app_id},
+        'creative_info': {'is_sticky': 0,
+                          'click_track_url': click_track_url}
+    }
+    return res

+ 3 - 3
utils/ConstantConfig.py

@@ -7,7 +7,7 @@ os_env_code_status = os.getenv('LYY_STATUS', 'product')
 if os_env_code_status == 'dev':
 if os_env_code_status == 'dev':
     print("测试环境的 常量信息!")
     print("测试环境的 常量信息!")
     # 近多少天的爆量视频
     # 近多少天的爆量视频
-    high_quality_video_days = 14
+    high_quality_video_days = 140
     high_quality_video_cnt = 2
     high_quality_video_cnt = 2
 
 
     # 遗漏视频的开始时间  和 结束时间
     # 遗漏视频的开始时间  和 结束时间
@@ -30,8 +30,8 @@ else:
     high_quality_video_cnt = 100
     high_quality_video_cnt = 100
 
 
     # 遗漏视频的开始时间  和 结束时间
     # 遗漏视频的开始时间  和 结束时间
-    missing_video_start_time = (datetime.datetime.now() + datetime.timedelta(days=-60)).strftime("%Y-%m-%d")
-    missing_video_end_time = str(datetime.date.today())
+    missing_video_start_time = (datetime.datetime.now() + datetime.timedelta(days=-60)).strftime("%Y-%m-%d %H:%M:%S")
+    missing_video_end_time = datetime.date.today().strftime("%Y-%m-%d %H:%M:%S")
     # 补充历史遗落素材的个数
     # 补充历史遗落素材的个数
     missing_video_cnt = 100
     missing_video_cnt = 100
 
 

+ 1 - 1
utils/UrlConfig.py

@@ -17,7 +17,7 @@ if os_env_code_status == 'dev':
     # 获取历史高质量视频url
     # 获取历史高质量视频url
     get_high_quality_video_url = "http://192.168.1.8:8080/jeecg-boot/kuaishou/material/getHistoryTopVideoList"
     get_high_quality_video_url = "http://192.168.1.8:8080/jeecg-boot/kuaishou/material/getHistoryTopVideoList"
     # 获取应用详情
     # 获取应用详情
-    get_app_detail_url = "http://localhost:8080/jeecg-boot/ai/aiKuaiShouAppInfo/getAppDetail"
+    get_app_detail_url = "http://192.168.1.8:8080/jeecg-boot/ai/aiKuaiShouAppInfo/getAppDetail"
 else:
 else:
     print("生产环境--url!")
     print("生产环境--url!")
     # 创建计划url
     # 创建计划url