This commit is contained in:
kuaifan 2022-12-12 10:58:00 +08:00
parent 6532382f43
commit 6f4945ac05

View File

@ -879,12 +879,10 @@ class SystemController extends AbstractController
$lastRecord = $records->whereBetween("created_at", $lastBetween)->last(); $lastRecord = $records->whereBetween("created_at", $lastBetween)->last();
$firstTimestamp = $firstRecord ? Carbon::parse($firstRecord->created_at)->timestamp : 0; $firstTimestamp = $firstRecord ? Carbon::parse($firstRecord->created_at)->timestamp : 0;
$lastTimestamp = $lastRecord ? Carbon::parse($lastRecord->created_at)->timestamp : 0; $lastTimestamp = $lastRecord ? Carbon::parse($lastRecord->created_at)->timestamp : 0;
if (Base::time() < $startT) { if (Base::time() < $startT + $secondStart) {
$firstResult = "-"; $firstResult = "-";
$lastResult = "-";
} else { } else {
$firstResult = "正常"; $firstResult = "正常";
$lastResult = "正常";
if (empty($firstTimestamp)) { if (empty($firstTimestamp)) {
$firstResult = "缺卡"; $firstResult = "缺卡";
$styles["E{$index}"] = ["font" => ["color" => ["rgb" => "ff0000"]]]; $styles["E{$index}"] = ["font" => ["color" => ["rgb" => "ff0000"]]];
@ -892,11 +890,14 @@ class SystemController extends AbstractController
$firstResult = "迟到"; $firstResult = "迟到";
$styles["E{$index}"] = ["font" => ["color" => ["rgb" => "436FF6"]]]; $styles["E{$index}"] = ["font" => ["color" => ["rgb" => "436FF6"]]];
} }
if (empty($lastTimestamp)) { }
if (Base::time() < $startT + $secondEnd) {
$lastResult = "-";
} else {
$lastResult = "正常";
if (empty($lastTimestamp) || $lastTimestamp === $firstTimestamp) {
$lastResult = "缺卡"; $lastResult = "缺卡";
$styles["G{$index}"] = ["font" => ["color" => ["rgb" => "ff0000"]]]; $styles["G{$index}"] = ["font" => ["color" => ["rgb" => "ff0000"]]];
} elseif ($lastTimestamp === $firstTimestamp) {
$lastResult = "-";
} elseif ($lastTimestamp < $startT + $secondEnd) { } elseif ($lastTimestamp < $startT + $secondEnd) {
$lastResult = "早退"; $lastResult = "早退";
$styles["G{$index}"] = ["font" => ["color" => ["rgb" => "436FF6"]]]; $styles["G{$index}"] = ["font" => ["color" => ["rgb" => "436FF6"]]];