Prechádzať zdrojové kódy

2024-09-25
发布新版本文章匹配小程序服务

罗俊辉 7 mesiacov pred
rodič
commit
184b99d6dc
3 zmenil súbory, kde vykonal 14 pridanie a 2 odobranie
  1. 1 1
      app.py
  2. 11 0
      applications/config/__init__.py
  3. 2 1
      server/api/get_off_videos.py

+ 1 - 1
app.py

@@ -8,7 +8,7 @@ from applications.config import Config
 
 # 初始化 App
 app = Quart(__name__, static_folder='applications/static')
-config = Config()
+config = Config(env="copy1")
 # 注册连接池
 AsyncMySQL = AsyncMySQLClient(app)
 app_routes = Routes(AsyncMySQL, config)

+ 11 - 0
applications/config/__init__.py

@@ -44,6 +44,17 @@ class Config(object):
                     config_server_url="http://preapolloconfig-internal.piaoquantv.com/",
                     timeout=10
                 )
+            case "copy1":
+                self.articleVideos = "long_articles_match_videos_copy1"
+                self.articleText = "long_articles_text_copy1"
+                self.articleCrawlerVideos = "long_articles_crawler_videos_copy1"
+                self.rootSourceIdTable = "long_articles_root_source_id_copy1"
+                self.getOffVideos = "get_off_videos_copy1"
+                self.apolloConnection = pyapollos.ApolloClient(
+                    app_id="LongArticlesMatchServer",
+                    config_server_url="http://preapolloconfig-internal.piaoquantv.com/",
+                    timeout=10
+                )
 
     def getConfigValue(self, key):
         """

+ 2 - 1
server/api/get_off_videos.py

@@ -14,6 +14,7 @@ class GetOffVideos(object):
         self.params = params
         self.mysql_client = mysql_client
         self.articles_video = config.articleVideos
+        self.get_off_videos = config.getOffVideos
         self.trace_id = None
 
     def checkParams(self):
@@ -47,7 +48,7 @@ class GetOffVideos(object):
                 video_id = video['videoId']
                 try:
                     update_sql = f"""
-                    INSERT INTO get_off_videos
+                    INSERT INTO {self.get_off_videos}
                     (video_id, publish_time, video_status, trace_id)
                     values 
                     (%s, %s, %s, %s);