mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 15:02:47 +08:00
改进代码
This commit is contained in:
@@ -506,13 +506,14 @@ abstract class Connection
|
||||
*/
|
||||
public function transaction($callback)
|
||||
{
|
||||
$this->startTrans(NOW_TIME);
|
||||
$label = microtime(true);
|
||||
$this->startTrans($label);
|
||||
try {
|
||||
$result = null;
|
||||
if (is_callable($callback)) {
|
||||
$result = call_user_func_array($callback, []);
|
||||
}
|
||||
$this->commit(NOW_TIME);
|
||||
$this->commit($label);
|
||||
return $result;
|
||||
} catch (\PDOException $e) {
|
||||
$this->rollback();
|
||||
|
||||
Reference in New Issue
Block a user