From a412fcb12fbd7b657217002b2f037d5b93f4865e Mon Sep 17 00:00:00 2001 From: chenxi Date: Tue, 29 Sep 2026 17:07:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E6=9C=88=E5=8A=A0=E6=9D=83?= =?UTF-8?q?=E5=B9=B3=E5=9D=87=E5=8D=95=E4=BB=B7=EF=BC=9A=E6=8C=87=E5=AE=9A?= =?UTF-8?q?=E6=9C=88=E4=BB=BD=E7=9A=84=E7=AD=9B=E9=80=89=E4=B8=A5=E6=A0=BC?= =?UTF-8?q?=E6=8C=89=E8=AF=A5=E6=9C=88=E5=8F=96=E6=95=B0=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E5=9B=9E=E9=80=80=E5=88=B0=E6=9C=80=E6=96=B0=E6=9C=88?= =?UTF-8?q?=E4=BB=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Business/Pages.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Business/Pages.php b/app/Http/Controllers/Business/Pages.php index 18c28131a..c0eb6a5f7 100644 --- a/app/Http/Controllers/Business/Pages.php +++ b/app/Http/Controllers/Business/Pages.php @@ -403,7 +403,8 @@ class Pages extends Controller // 筛选栏的月份选择器提交 Y-m,这里补成当月 1 号再匹配。 $requested .= '-01'; } - $month = in_array($requested, $months, true) ? $requested : ($months[0] ?? null); + // 明确指定月份时严格按该月份取数(该月没算出来就显示空表),避免筛选条件与数据不一致。 + $month = $requested !== '' ? $requested : ($months[0] ?? null); $limit = min(max((int) setting('default.list_limit', 25), 1), 50); $page = max((int) request('page', 1), 1); @@ -493,7 +494,7 @@ class Pages extends Controller ->where('status', 'computed')->orderByDesc('report_month')->pluck('report_month') ->map(static fn ($month): string => substr((string) $month, 0, 10))->all(); $requested = substr(trim((string) $request->query('month', '')), 0, 10); - $month = in_array($requested, $months, true) ? $requested : ($months[0] ?? null); + $month = $requested !== '' ? $requested : ($months[0] ?? null); $query = DB::connection($connection)->table('product_monthly_weighted_average_rows'); if ($month !== null) {