From f5746423bf496cac556b14c809f98f9f98be1bed Mon Sep 17 00:00:00 2001 From: Linux Date: Wed, 9 Oct 2024 22:55:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=E4=B8=8D=E6=98=BE=E7=A4=BA=E5=BD=93=E6=97=A5=E6=B5=81?= =?UTF-8?q?=E9=87=8F=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/StatisticalService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Services/StatisticalService.php b/app/Services/StatisticalService.php index 3ec016e..3a727f0 100644 --- a/app/Services/StatisticalService.php +++ b/app/Services/StatisticalService.php @@ -108,14 +108,14 @@ class StatisticalService /** * 获取指定用户的流量使用情况 */ - public function getStatUserByUserID($userId): array + public function getStatUserByUserID(int|string $userId): array { $stats = []; $statsUser = $this->redis->zrange($this->statUserKey, 0, -1, true); foreach ($statsUser as $member => $value) { list($rate, $uid, $type) = explode('_', $member); - if ($uid !== $userId) + if (intval($uid) !== intval($userId)) continue; $key = "{$rate}_{$uid}"; $stats[$key] = $stats[$key] ?? [