Skip to content

Commit

Permalink
[fix]修复日志保存时的事务失效问题 (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongshaofa authored Sep 6, 2021
1 parent 71321f6 commit 77b1847
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/admin/service/SystemLogService.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,13 @@ public static function instance()
*/
public function save($data)
{
$this->detectTable();
Db::startTrans();
try {
$this->detectTable();
Db::table($this->tableName)->insert($data);
Db::commit();
} catch (\Exception $e) {
Db::rollback();
return $e->getMessage();
}
return true;
Expand Down Expand Up @@ -132,4 +133,4 @@ protected function getCreateSql()
EOT;
}

}
}

0 comments on commit 77b1847

Please sign in to comment.