moshaorui 1 settimana fa
parent
commit
c9c3777f97

+ 1 - 1
app/Console/Commands/TimerSsmPost.php

@@ -86,7 +86,7 @@ class TimerSsmPost extends Command
                 $accountInfo = SmmUserAccount::getAccountById($log->account_id);
                 $accessToken = $accountInfo->access_token;
                 //发送帖子
-                $configData = ['accountInfo' => $accountInfo->toArray()];
+                $configData = ['accountInfo' => $accountInfo->toArray(),'postData'=>$post->toArray()];
                 $ssmService = new SmmService($mediaName,$configData);
                 if ($postType == 0) {
                     //图片帖子

+ 10 - 3
app/Services/Smm/YoutubeService.php

@@ -100,6 +100,12 @@ class YoutubeService implements SmmPlatformInterface
         if ($fileSize['status'] === false) {
             return ['status' => false, 'data' => $fileSize['data']];
         }*/
+
+        $backup_field1 = $this->configData['postData']['backup_field1'] ?? '';
+        $backup_field1 = json_decode($backup_field1, true);
+        $title = $backup_field1['yutube_title'] ?? '';
+        $category = $backup_field1['yutube_category'] ?? '';
+
         $videoPath = toStoragePath($videoPath);
         // 处理 OAuth 回调
         $this->client->setAccessToken($accessToken);
@@ -108,11 +114,12 @@ class YoutubeService implements SmmPlatformInterface
         try {
             // 定义视频元数据
             $snippetData = [
-                'title' => $message,
-                'description' => '',
+                'title' => $title,
+                'description' => $message,
                 'tags' => [],
-                'categoryId' => '22' // 人物与博客
+                'categoryId' => $category // 人物与博客
             ];
+            Log::info('YouTube 定义视频元数据'.json_encode($snippetData));
             $snippet = new Google_Service_YouTube_VideoSnippet();
             $snippet->setTitle($snippetData['title']);
             $snippet->setDescription($snippetData['description']);