作者 sgj
1 个管道 的构建 通过 耗费 0 秒

add stop equipment

@@ -138,6 +138,7 @@ class AdminEquipmentController extends AdminBaseController{ @@ -138,6 +138,7 @@ class AdminEquipmentController extends AdminBaseController{
138 $data['state']=2; 138 $data['state']=2;
139 $data['price']=$info['price']; 139 $data['price']=$info['price'];
140 $data['time']=ceil((time()-$order['start_time'])/3600); 140 $data['time']=ceil((time()-$order['start_time'])/3600);
  141 +
141 Db::startTrans(); 142 Db::startTrans();
142 try{ 143 try{
143 \db('equipment')->where('id',$id)->update(['use'=>0]); 144 \db('equipment')->where('id',$id)->update(['use'=>0]);
@@ -147,11 +148,13 @@ class AdminEquipmentController extends AdminBaseController{ @@ -147,11 +148,13 @@ class AdminEquipmentController extends AdminBaseController{
147 \db('users')->where('id',$order['users_id'])->update($user_updata); 148 \db('users')->where('id',$order['users_id'])->update($user_updata);
148 //echo \db('order')->getLastSql(); 149 //echo \db('order')->getLastSql();
149 //echo '<br />'; 150 //echo '<br />';
  151 + Db::commit();
150 } catch (\Exception $e){ 152 } catch (\Exception $e){
151 Db::rollback(); 153 Db::rollback();
152 $this->error('操作失败!'); 154 $this->error('操作失败!');
153 exit; 155 exit;
154 } 156 }
  157 +
155 $this->success('操作成功!'); 158 $this->success('操作成功!');
156 } 159 }
157 160