yangsai@163.com 6 months ago
parent 62a0794271
commit 52facad353
  1. 9
      application/controllers/Api/Cage.php
  2. 2
      application/models/Cage.php

@ -156,5 +156,14 @@ class Api_CageController extends Ctrl_Api{
} }
Tool_Fnc::apiMsg('获取成功 ', '200',$data); 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');
}
} }

@ -20,7 +20,7 @@ class CageModel extends Orm_Base{
$cagemodel = new CageSetModel(); $cagemodel = new CageSetModel();
$shownum = $cagemodel->field('line_num')->where("c_user_id='{$params['uid']}'")->fRow(); $shownum = $cagemodel->field('line_num')->where("c_user_id='{$params['uid']}'")->fRow();
$limmit = empty($shownum['line_num'])?20:$shownum['line_num']*4; $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'])){ if(!empty($params['keyword'])){
$sql .=" and (number like '%{$params['keyword']}%' or strains like '%{$params['keyword']}%')"; $sql .=" and (number like '%{$params['keyword']}%' or strains like '%{$params['keyword']}%')";
} }

Loading…
Cancel
Save