where('pay_addtimes', '<', $timeUnix) ->get(); foreach ($payDetails as $payDetail) { // 订单主表 PayDetail::where('pay_id', $payDetail->pay_id)->update([ 'pay_status' => 'CANCEL', ]); } Db::commit(); } catch (\Exception $e) { Db::rollBack(); } } }