From 0a3cfb49cf3d5573d91e4827de8e6b71c6bbaff4 Mon Sep 17 00:00:00 2001 From: liugang Date: Wed, 11 Dec 2024 11:22:05 +0800 Subject: [PATCH] * [refac] rollback transaction if there's dao error. --- module/user/model.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/module/user/model.php b/module/user/model.php index bc52419489..927fb010ef 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -1939,8 +1939,13 @@ class userModel extends model $this->dao->begin(); $this->dao->delete()->from(TABLE_USERVIEW)->where('account')->eq($account)->exec(); $this->dao->insert(TABLE_USERVIEW)->data($userView)->exec(); - $this->dao->commit(); + if(dao::isError()) + { + $this->dao->rollback(); + return $userView; + } + $this->dao->commit(); return $userView; }