From c0c64a43f7cdc5e0f5f277a2a076460d8477be91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Sun, 23 Feb 2025 09:32:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=20SystemService::upda?= =?UTF-8?q?te=20=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/service/SystemService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/service/SystemService.php b/src/service/SystemService.php index 055f4e8f..6cb35a74 100644 --- a/src/service/SystemService.php +++ b/src/service/SystemService.php @@ -191,7 +191,7 @@ public static function update($query, array $data, string $key = 'id', $map = [] try { $query = Helper::buildQuery($query)->master()->strict(false)->where($map); if (empty($map[$key])) $query->where([$key => $data[$key] ?? null]); - return (clone $query)->count() > 0 ? (clone $query)->update($data) : (clone $query)->save($data); + return (clone $query)->count() > 0 ? (clone $query)->update($data) : (clone $query)->findOrEmpty()->save($data); } catch (\Exception $exception) { throw new Exception($exception->getMessage(), $exception->getCode()); }