浏览代码

社媒对接

moshaorui 1 天之前
父节点
当前提交
2288a03a0c
共有 2 个文件被更改,包括 3 次插入2 次删除
  1. 1 1
      app/Console/Commands/TimerSsmPost.php
  2. 2 1
      app/Services/Smm/TwitterService.php

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

@@ -146,7 +146,7 @@ class TimerSsmPost extends Command
             try {
                 $expiresAt = Carbon::parse($account->expires_at);
                 //少于10分钟就开始刷新access_token
-                if ($expiresAt->diffInSeconds(Carbon::now()) <= 600) {
+                if ($expiresAt->diffInSeconds(Carbon::now()) <= 60000) {
                     Log::info('开始刷新access_token:'. $account->name);
                     $mediaName = $account->getParent->name;
                     $configData = ['accountInfo' => $account->toArray()];

+ 2 - 1
app/Services/Smm/TwitterService.php

@@ -103,7 +103,7 @@ class TwitterService implements SmmPlatformInterface
                         'userId' => $userId,
                         'userName' => $username,
                         'accessToken_expiresAt' => $expiresAt,
-                        'refresh_token' => $refresh_token,
+                        'refreshToken' => $refresh_token,
                     ]
                 ];
             } else {
@@ -421,6 +421,7 @@ class TwitterService implements SmmPlatformInterface
                 throw new \Exception("Access token not found in response");
             }
 
+
             $newAccessToken = $authData['access_token'];
             $newRefreshToken = $authData['refresh_token'] ?? $refreshToken; // 使用新的refresh_token,若未返回则保留原值
             $expiresIn = $authData['expires_in'] ?? 0;