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

add stop equipment

... ... @@ -11,6 +11,7 @@ namespace app\portal\controller;
use app\portal\model\EquipmentModel;
use cmf\controller\AdminBaseController;
use app\portal\Controller\OrderController;
use PHPExcel;
use PHPExcel_IOFactory;
use PHPExcel_Style_Alignment;
... ... @@ -123,6 +124,29 @@ class AdminEquipmentController extends AdminBaseController{
$this->success('删除成功');
}
public function unUse(){
/*解除设备占用*/
$id=$this->request->param('id');
$eq=Db::name('equipment')->where('id',$id)->find();
dump($eq);
/*查找对应订单*/
$map['eq_name']=$eq['name'];
$order=\db('order')->where($map)->find();
//Db::name('equipment')->where('id',$id)->update(['use'=>0]);
/*结束订单*/
$data['end_time']=time();
$Order=new OrderController();
$data['price']= $Order->getPrice($order['users_id'],$order['start_time'],time());
dump($data);
// \db('order')->where($map)->update();
}
//批量导入设备信息
public function batch_add(){
... ...
... ... @@ -108,7 +108,7 @@
</td>
<td>
<if condition="$vo.use eq 1">
11111111111
<a href="{:url('AdminEquipment/unuse',array('id'=>$vo['id']))}" class="js-ajax-delete">解除占用</a>
</if>
<a onclick="doEdit(Number('{$vo.id}'))">{:lang('EDIT')}</a>
<a href="{:url('AdminEquipment/delete',array('id'=>$vo['id']))}" class="js-ajax-delete">{:lang('DELETE')}</a>
... ...