代码如下
$db = app::get('sysshop')->database();
$db->beginTransaction();
try
{
$objMdlAccount->update($accountDisable, $accountFilter);
$objMdlSeller->update($data, $accountFilter);
$db->commit();
if($userID['user_id']){
kernel::single('topapi_server')->topapiSellerlog('员工编辑',$userID['user_id'],$params['seller_id'],$sellerInfo['shop_id'],'update','seller');
}
return true;
}
catch( Exception $e )
{
$db->rollback();
throw new Exception('修改失败');
}
如果事务已提交,但是之后执行sql语句,报错的话
会报There is no active transaction