diff --git a/application/common/QueueRedis.php b/application/common/QueueRedis.php index 1aaacbf..f8a77d1 100644 --- a/application/common/QueueRedis.php +++ b/application/common/QueueRedis.php @@ -161,6 +161,14 @@ LUA; { try { $redis = $this->connect(); + //判断是否执行 + $sStatus = $redis->hGet($key, 'status'); + if (!empty($sStatus) && $sStatus == 'completed') { + return 2; + } + if (!empty($sStatus) && $sStatus == 'processing') { + return 3; + } $redis->hMSet($key, [ 'status' => 'processing', 'total' => $totalQuestions, @@ -168,9 +176,9 @@ LUA; 'start_time' => time() ]); $redis->expire($key, 10800); // 6小时过期 - return true; + return 1; } catch (\Exception $e) { - return false; + return 4; } } // 多问题按条件拆分成两个队列新增日志记录