Ver Fonte

社媒对接

moshaorui há 1 dia atrás
pai
commit
2288a03a0c

+ 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;