authorizeStoreReceivingBills(); $validated = $request->validate([ 'month' => ['nullable', 'date_format:Y-m'], ]); try { return response()->json($service->overview( (string) ($validated['month'] ?? now('Asia/Shanghai')->format('Y-m')), )); } catch (Throwable $exception) { report($exception); return response()->json([ 'message' => '账户余额总览暂时无法读取,请稍后重试。', ], 503); } } private function authorizeStoreReceivingBills(): void { $section = collect(SidebarPermissions::navigationFor(user())) ->firstWhere('slug', 'billing-transactions'); $page = collect($section['pages'] ?? []) ->firstWhere('slug', 'store-receiving-bills'); abort_if(empty($page), 403, '当前账号没有店铺收款账户账单权限。'); } }