From bc65e6a7107d8d2cd3b7ec660f63a165f3cc7a21 Mon Sep 17 00:00:00 2001 From: Simon Asika Date: Sat, 1 Jun 2024 17:06:21 +0800 Subject: [PATCH] fix(account): Fix account import --- src/Module/Api/AccountController.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Module/Api/AccountController.php b/src/Module/Api/AccountController.php index 546a2cb..e06c672 100644 --- a/src/Module/Api/AccountController.php +++ b/src/Module/Api/AccountController.php @@ -186,9 +186,17 @@ public function saveMultiple( foreach ($accounts as $i => $account) { $id = $account->getId(); - $current = $orm->findOne(Account::class, $id); + $current = null; + + if ($id) { + $current = $orm->findOne(Account::class, $id); + } if ($current) { + if ((string) $current->getUserId() !== (string) $currentUser->getId()) { + continue; + } + $orm->updateOne(Account::class, $account); } else { $accountService->validateUserNotExceedAccountLimit($currentUser);