账单明细联动:行数为0的取值不展示,联动结果缓存放宽到5分钟

This commit is contained in:
yueyang 2026-10-09 11:19:21 +08:00
parent cfdda94da8
commit 0f7f72be71

View File

@ -342,7 +342,7 @@ class BillingDetailsPageData
try {
return cache()->remember(
'billing-details-facets-v1:' . $signature,
now()->addSeconds(60),
now()->addMinutes(5),
fn (): array => $this->computeFacets($filters),
);
} catch (Throwable $exception) {
@ -648,11 +648,17 @@ class BillingDetailsPageData
{
$values = [];
foreach ($order as $value) {
if (isset($counts[$value])) {
if (($counts[$value] ?? 0) > 0) {
$values[] = $value;
}
}
$rest = array_values(array_diff(array_keys($counts), $values));
// 行数为 0 的取值不展示(当前已勾选的会由前端补回列表,方便取消)
$rest = [];
foreach ($counts as $value => $count) {
if ($count > 0 && ! in_array($value, $values, true)) {
$rest[] = $value;
}
}
sort($rest, SORT_NATURAL | SORT_FLAG_CASE);
$values = array_merge($values, $rest);