PHP事务
//开启事务
Db::startTrans();
Db::commit();提交事务
Db::rollback(); 事务回滚
Db::startTrans();
Db::commit();提交事务
Db::rollback(); 事务回滚
举例:
Db::startTrans();
$row = DB::name('atmlog')->insert($data);
$re = change_user_money($userMoney['uid'],$type,'-',$lognum,'提现申请',5);
if($row && $re){
Db::commit();
return array("status"=>1,"message"=>"提现申请成功";)
}else{
Db::rollback();
return array("status"=>0,"message"=>"提现申请失败";)
}