|
@@ -43,21 +43,21 @@ class SmmPostLog extends EloquentRepository
|
|
public static function getSendLog($limit = 5)
|
|
public static function getSendLog($limit = 5)
|
|
{
|
|
{
|
|
$log = new Model();
|
|
$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
|
|
//updated_at与当前时间差距30分钟以上,则更新日志状态为3
|
|
$nowTime = Carbon::now();
|
|
$nowTime = Carbon::now();
|
|
- $diffTime = $nowTime->diffInMinutes($logs->updated_at);
|
|
|
|
|
|
+ $diffTime = $nowTime->diffInMinutes($result->updated_at);
|
|
if ($diffTime >= 30) {
|
|
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 [];
|
|
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;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|