where($Map)->count();// 查询满足要求的总记录数 $List = M("object_share")->where($Map)->limit($Page,$GetSize)->order('id desc')->select(); $Info = array( 'totalRow' => $Count, 'list' => $List, ); echo json_encode($Info); }else{ $this->display(); } } public function add(){ if (IS_POST) { $Data=I(); if(strlen($Data['owner_code']) < 1){ $this->mtReturn(300,'请填写完整的设备编号'); } if(strlen($Data['device_name']) < 1){ $this->mtReturn(300,'请填写完整的设备名称'); } if(strlen($Data['object_name']) < 1){ $this->mtReturn(300,'请填写完整的安装位置'); } if(strlen($Data['dwtype']) < 1){ $this->mtReturn(300,'请填写完整的监控数据类型'); } if(strlen($Data['object_code']) < 1){ $this->mtReturn(300,'请填写完整的监控对象编号'); } if(strlen($Data['start_port']) < 1){ $this->mtReturn(300,'请填写完整的数据起始端口号'); } if(strlen($Data['rec_cur']) < 1){ $this->mtReturn(300,'请填写完整的同步记录号'); } if(strlen($Data['min_level']) < 1){ $this->mtReturn(300,'请填写完整的所在楼层(最低)'); } if(strlen($Data['max_level']) < 1){ $this->mtReturn(300,'请填写完整的所在楼层(最高)'); } $res =M('object_share')->add($Data); if($res) $this->mtReturn(200,'新增成功'); else $this->mtReturn(300,'新增失败'); }else{ $this->assign('action','/home/DeviceInformation/add'); $this->display(); } } public function object_modify(){ $Data=I(); if(IS_POST) { if (!empty($Data['owner_code'])){ $Data1['owner_code']=$Data['owner_code']; $res=M('object_share')->where('owner_code='.$Data1['owner_code'])->save($Data); } if($res) $this->mtReturn(200,'修改成功'); else $this->mtReturn(300,'修改失败'); }else{ $bao=M('object_share') ->where('owner_code='.$Data['code']) ->select(); // print_r($bao); $this->assign('list2',$bao); $this->assign('code',$Data['code']); $this->assign('action','/home/DeviceInformation/object_modify'); } $this->display(); } public function deldata(){ $Model=M('object_share'); $Data=I(); $res=$Model->where('id='.$Data['id'])->delete(); if($res) $this->mtReturn(200,'删除成功'); else $this->mtReturn(300,'删除失败'); } }