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

Merge branch 'dev_api_init' of weapp/video_decode into master

jihuaqiang 22 órája
szülő
commit
62354f2e34
3 módosított fájl, 11 hozzáadás és 11 törlés
  1. 4 4
      models/decode_task_result.py
  2. 6 6
      utils/params.py
  3. 1 1
      utils/sync_mysql_help.py

+ 4 - 4
models/decode_task_result.py

@@ -55,11 +55,11 @@ class WorkflowDecodeTaskResult(BaseModel):
             task_id=task_id,
             channel_content_id=content.channel_content_id,
             images=images_str,
-            title=content.title[:64] if len(content.title) > 64 else content.title,  # 限制长度
+            title=content.title[:64] if content.title and len(content.title) > 64 else (content.title or ''),  # 限制长度
             channel_account_id=content.channel_account_id,
-            channel_account_name=content.channel_account_name[:64] if content.channel_account_name and len(content.channel_account_name) > 64 else content.channel_account_name,
-            body_text=content.body_text,
-            video_url=content.video_url[:100] if content.video_url and len(content.video_url) > 100 else content.video_url,
+            channel_account_name=content.channel_account_name[:64] if content.channel_account_name and len(content.channel_account_name) > 64 else (content.channel_account_name or ''),
+            body_text=content.body_text or '',
+            video_url=content.video_url[:100] if content.video_url and len(content.video_url) > 100 else (content.video_url or ''),
             result_payload=None,
             result_size=0
         )

+ 6 - 6
utils/params.py

@@ -21,13 +21,13 @@ class ContentTypeEnum(IntEnum):
 
 
 class ContentParam(BaseModel):
-    channel_content_id: str
-    video_url: str
+    channel_content_id: str  # 必传
+    video_url: Optional[str] = None
     images: List[str] = []
-    body_text: str
-    title: str
-    channel_account_id: str
-    channel_account_name: str
+    body_text: Optional[str] = None
+    title: Optional[str] = None
+    channel_account_id: Optional[str] = None
+    channel_account_name: Optional[str] = None
 
 
 class DecodeContentParam(BaseModel):

+ 1 - 1
utils/sync_mysql_help.py

@@ -31,7 +31,7 @@ class SyncMySQLHelper(object):
             port = int(os.getenv('DB_PORT', '3306'))
             user = os.getenv('DB_USER', 'content_rw')
             password = os.getenv('DB_PASSWORD', 'bC1aH4bA1lB0')
-            database = os.getenv('DB_NAME', 'content-deconstruction-supply-test')
+            database = os.getenv('DB_NAME', 'content-deconstruction-supply')
             logger.info(f"✅ 当前使用数据库 : {database}")