moshaorui před 1 dnem
rodič
revize
b9a069c4dd
1 změnil soubory, kde provedl 8 přidání a 8 odebrání
  1. 8 8
      app/Distributor/Repositories/SmmPostLog.php

+ 8 - 8
app/Distributor/Repositories/SmmPostLog.php

@@ -43,21 +43,21 @@ class SmmPostLog extends EloquentRepository
     public static function getSendLog($limit = 5)
     {
         $log = new Model();
-        $logs = $log->where('status', 1)->first();//查找状态为1的日志,发送中的日志
-        if ($logs) {
+        $result = $log->where('status', 1)->first();//查找状态为1的日志,发送中的日志
+        if ($result) {
             //updated_at与当前时间差距30分钟以上,则更新日志状态为3
             $nowTime = Carbon::now();
-            $diffTime = $nowTime->diffInMinutes($logs->updated_at);
+            $diffTime = $nowTime->diffInMinutes($result->updated_at);
             if ($diffTime >= 30) {
-                $logs->status = 3;
-                $log->request_count = $log->request_count + 1;
-                $logs->save();
+                $result->status = 3;
+                $result->request_count = $result->request_count + 1;
+                $result->save();
             }
             return [];
         }
         //找出待发送与发送失败的日志
-        $logs = $log->wherein('status', [0,3])->where('request_count', '<=', 2)->where('send_time', '<', Carbon::now())->limit($limit)->get();
-        return $logs;
+        $result = $log->wherein('status', [0,3])->where('request_count', '<=', 2)->where('send_time', '<', Carbon::now())->limit($limit)->get();
+        return $result;
     }