时间:2021-07-01 10:21:17 帮助过:13人阅读
public function index(){
6 //echo 111;
7 $data[‘operator‘] = ‘Testss‘;
8 M()->startTrans();
9 $result = M(‘feehistory‘)->add($data);
10 $result1 = $result2 = true;
11 if(!empty($result)){
12 $regdelData[‘level‘] = ‘111‘;
13 $result1 = M(‘regdel‘)->add($regdelData);
14
15 $regData[‘level‘] = ‘101‘;
16 $result2 = M(‘reg‘)->where("registryCode=‘13693536752-SJB-HUAX-12345678‘")->save($regData);
17
18 }
19
20 if(!empty($result) && !empty($result1) && !empty($result2) ){
21 M()->commit();
22 //$this->success(‘事物提交‘,__ROOT__);
23 echo ‘事物提交‘;
24 }else{
25 M()->rollback();
26 //$this->error(‘事物回滚‘,__ROOT__);
27 echo ‘事物回滚‘;
28 }
29 }
tp3.2数据库事务使用例子
标签:cti 事物 使用 ror 提交 root code comm tor