自己写的,完全没问题
<?php $data = [ 0=>[
//id为主键 'id'=>1, 'type'=>3 ], 1=>[ 'id'=>2, 'type'=>3 ] ]; $OrderModel = new OrderModel(); $OrderModel->startTrans(); try{ $OrderModel->allowField(true)->isUpdate(true)->saveAll($data); }catch (Exception $e){ $OrderModel->rollback(); return; } OrderModel->commit();