From 52facad3530da2a8646e0451107e42b6689856df Mon Sep 17 00:00:00 2001 From: "yangsai@163.com" <2624183217@qq.com> Date: Thu, 6 Jun 2024 18:03:46 +0800 Subject: [PATCH] YS --- application/controllers/Api/Cage.php | 9 +++++++++ application/models/Cage.php | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) 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']}%')"; }