我是在webman用使用GatewayWorker,之后做一些数据库的查询新增操作
  // 启动事务
  Db::startTrans();
  try {
    $Hardwaredata = json_decode(trim($param), true);
      if ($Hardwaredata === null || !array_key_exists("xwst", $Hardwaredata)) {
          $this->StatusReturn(0, $client_id);
          return;
      }
  if($Hardwaredata['xwst']==1){
      if($boxinfo){
              //执行一些数据库查询和插入的操作
              Gateway::sendToClient($client, $send_datas);
              return;
          }else{
              Gateway::sendToClient($client, $send_datas);
              return;
      }
  }
    DB::commit();//提交至数据库
} catch (\Throwable $e) {
    DB::rollback();//数据库回滚
}我在使用事务的时候,我在Gateway::sendToClient 给用户发送消息 我就想不执行下面代码了 我就return了,但是貌似这个会变成数据库的数据没有提交,这样数据没有插入成功。这种情况怎么办呀
return 前 提交事务啊
人才 你终于出现了 事务 必须提交 然后 最好是使用try catch 防止 出现大量事务不提交 导致死锁 问题
不提交也不回滚吗