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

add stop equipment

@@ -11,6 +11,7 @@ namespace app\portal\controller; @@ -11,6 +11,7 @@ namespace app\portal\controller;
11 11
12 use app\portal\model\EquipmentModel; 12 use app\portal\model\EquipmentModel;
13 use cmf\controller\AdminBaseController; 13 use cmf\controller\AdminBaseController;
  14 +use app\portal\Controller\OrderController;
14 use PHPExcel; 15 use PHPExcel;
15 use PHPExcel_IOFactory; 16 use PHPExcel_IOFactory;
16 use PHPExcel_Style_Alignment; 17 use PHPExcel_Style_Alignment;
@@ -123,6 +124,29 @@ class AdminEquipmentController extends AdminBaseController{ @@ -123,6 +124,29 @@ class AdminEquipmentController extends AdminBaseController{
123 $this->success('删除成功'); 124 $this->success('删除成功');
124 } 125 }
125 126
  127 + public function unUse(){
  128 + /*解除设备占用*/
  129 + $id=$this->request->param('id');
  130 +
  131 + $eq=Db::name('equipment')->where('id',$id)->find();
  132 +
  133 + dump($eq);
  134 + /*查找对应订单*/
  135 + $map['eq_name']=$eq['name'];
  136 + $order=\db('order')->where($map)->find();
  137 + //Db::name('equipment')->where('id',$id)->update(['use'=>0]);
  138 + /*结束订单*/
  139 + $data['end_time']=time();
  140 + $Order=new OrderController();
  141 + $data['price']= $Order->getPrice($order['users_id'],$order['start_time'],time());
  142 + dump($data);
  143 +
  144 + // \db('order')->where($map)->update();
  145 +
  146 +
  147 + }
  148 +
  149 +
126 150
127 //批量导入设备信息 151 //批量导入设备信息
128 public function batch_add(){ 152 public function batch_add(){
@@ -108,7 +108,7 @@ @@ -108,7 +108,7 @@
108 </td> 108 </td>
109 <td> 109 <td>
110 <if condition="$vo.use eq 1"> 110 <if condition="$vo.use eq 1">
111 - 11111111111 111 + <a href="{:url('AdminEquipment/unuse',array('id'=>$vo['id']))}" class="js-ajax-delete">解除占用</a>
112 </if> 112 </if>
113 <a onclick="doEdit(Number('{$vo.id}'))">{:lang('EDIT')}</a> 113 <a onclick="doEdit(Number('{$vo.id}'))">{:lang('EDIT')}</a>
114 <a href="{:url('AdminEquipment/delete',array('id'=>$vo['id']))}" class="js-ajax-delete">{:lang('DELETE')}</a> 114 <a href="{:url('AdminEquipment/delete',array('id'=>$vo['id']))}" class="js-ajax-delete">{:lang('DELETE')}</a>