事物使用

DB::beginTransaction();
try {
    DB::table('funds')->insert($data);
    DB::table('users')->where('id', $uid)->increment('balance', $fee);
} catch (\Exception $e) {
    DB::rollBack();
    Log::channel('mysql_error')->info($e);
}
DB::commit();

猜你喜欢

转载自blog.csdn.net/tianjingang1/article/details/83114288
今日推荐