Browse Source

社媒对接

moshaorui 19 hours ago
parent
commit
2c4ce6e477

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

@@ -145,7 +145,7 @@ class TimerSsmPost extends Command
             try {
             try {
                 $expiresAt = Carbon::parse($account->expires_at);
                 $expiresAt = Carbon::parse($account->expires_at);
                 //少于15分钟就开始刷新access_token
                 //少于15分钟就开始刷新access_token
-                if ($expiresAt->diffInSeconds(Carbon::now()) <= 900) {
+                //if ($expiresAt->diffInSeconds(Carbon::now()) <= 900) {
                     Log::info('开始刷新access_token:'. $account->name);
                     Log::info('开始刷新access_token:'. $account->name);
                     $mediaName = $account->getParent->name;
                     $mediaName = $account->getParent->name;
                     $configData = ['accountInfo' => $account->toArray()];
                     $configData = ['accountInfo' => $account->toArray()];
@@ -162,7 +162,7 @@ class TimerSsmPost extends Command
                     } else {
                     } else {
                         Log::info('access_token 刷新失败:'. $result['data']);
                         Log::info('access_token 刷新失败:'. $result['data']);
                     }
                     }
-                }
+               // }
             } catch (\Exception $e) {
             } catch (\Exception $e) {
                 Log::info('access_token 刷新失败:'. $account->name.$e->getMessage());
                 Log::info('access_token 刷新失败:'. $account->name.$e->getMessage());
             }
             }

+ 4 - 1
app/Distributor/Repositories/SmmUserAccount.php

@@ -90,7 +90,10 @@ class SmmUserAccount extends EloquentRepository
         $youTube = $model->where('name', 'YouTube')->first();
         $youTube = $model->where('name', 'YouTube')->first();
         $twitter = $model->where('name', 'Twitter')->first();
         $twitter = $model->where('name', 'Twitter')->first();
         $parentIds = [$youTube->id,$twitter->id];
         $parentIds = [$youTube->id,$twitter->id];
-        $accounts = $model->whereIn('parent_id',$parentIds)->where('expires_at','>', Carbon::now())->orderBy('id', 'asc')->get();
+        //15分钟前
+        $time = Carbon::now()->addMinutes(15);
+        $accounts = $model->whereIn('parent_id',$parentIds)->where('expires_at','<', $time)->where('expires_at','>', Carbon::now())->orderBy('id', 'asc')->get();
+        //dd($accounts->toArray());
         return $accounts;
         return $accounts;
     }
     }