diff --git a/application/controllers/Api/Cage.php b/application/controllers/Api/Cage.php index 8fd632f..f42a526 100644 --- a/application/controllers/Api/Cage.php +++ b/application/controllers/Api/Cage.php @@ -156,5 +156,14 @@ class Api_CageController extends Ctrl_Api{ } Tool_Fnc::apiMsg('获取成功 ', '200',$data); } + public function delcageAction(){ + $uid = empty($this->POST['uid'])?Tool_Fnc::apiMsg('请先登录', '500'):$this->POST['uid']; + $id = empty($this->POST['id'])?Tool_Fnc::apiMsg('小鼠ID', '500'):$this->POST['id']; + $ids = implode(",",$id); + $sql = "update {$this->Cagemodel->table} set is_delete=1 where c_user_id={$uid} and id in ({$ids})"; + if(!$this->Cagemodel->exec($sql)) Tool_Fnc::apiMsg('删除失败', '500'); + Tool_Fnc::apiMsg('已删除', '200'); + + } } diff --git a/application/models/Cage.php b/application/models/Cage.php index b555390..c7a82c2 100644 --- a/application/models/Cage.php +++ b/application/models/Cage.php @@ -20,7 +20,7 @@ class CageModel extends Orm_Base{ $cagemodel = new CageSetModel(); $shownum = $cagemodel->field('line_num')->where("c_user_id='{$params['uid']}'")->fRow(); $limmit = empty($shownum['line_num'])?20:$shownum['line_num']*4; - $sql = "select id,number,color,strains,type from cage where c_user_id={$params['uid']}"; + $sql = "select id,number,color,strains,type from cage where c_user_id={$params['uid']} and is_delete=0"; if(!empty($params['keyword'])){ $sql .=" and (number like '%{$params['keyword']}%' or strains like '%{$params['keyword']}%')"; }