This commit is contained in:
2025-12-31 00:19:29 +08:00
parent c943d6258b
commit 89d5b604d6
5 changed files with 26 additions and 18 deletions
+10 -7
View File
@@ -116,8 +116,9 @@ class Model extends Base\Model
$connection->commit();
return $select;
} catch (\Throwable $throwable) {
$connection->rollback();
return \Kiri::getLogger()->failure($throwable);
$model->getLogger()->json_log($throwable);
$connection->rollback();
return false;
}
}
@@ -145,8 +146,9 @@ class Model extends Base\Model
$connection->commit();
return $select;
} catch (\Throwable $throwable) {
$connection->rollback();
return \Kiri::getLogger()->failure($throwable);
$model->getLogger()->json_log($throwable);
$connection->rollback();
return false;
}
}
@@ -206,9 +208,10 @@ class Model extends Base\Model
public static function inserts(array $data): bool
{
if (empty($data)) {
return trigger_print_error('Insert data empty.', 'mysql');
}
return static::query()->insert($data);
return \Kiri::getLogger()->logCategory('Insert data empty.', 'mysql');
} else {
return static::query()->insert($data);
}
}
/**