yangsai@163.com 6 months ago
parent 12469c9402
commit 17f5ad643c
  1. 6
      application/controllers/Api/Cage.php

@ -136,12 +136,14 @@ class Api_CageController extends Ctrl_Api{
public function cagemovellistAction(){ public function cagemovellistAction(){
$uid = empty($this->POST['uid'])?Tool_Fnc::apiMsg('请先登录', '500'):$this->POST['uid']; $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']; $id = empty($this->POST['id'])?Tool_Fnc::apiMsg('小鼠ID', '500'):$this->POST['id'];
$order = empty($this->POST['order'])?'id':$this->POST['order'];
$keyword = empty($this->POST['keyword'])?'':$this->POST['keyword']; $keyword = empty($this->POST['keyword'])?'':$this->POST['keyword'];
$squirrel = $this->SquirrelModel->getOneInfo($id); $squirrel = $this->SquirrelModel->getOneInfo($id);
$data = $this->Cagemodel->field('id,number,color,strains,type '); $data = $this->Cagemodel->field('id,number,color,strains,type ');
$data = $data->where("c_user_id='{$uid}' and id!={$squirrel['cage']} and is_delete=0"); $data = $data->where("c_user_id='{$uid}' and id!={$squirrel['cage']} and is_delete=0 order by {$order} desc");
if(!empty($keyword)){ if(!empty($keyword)){
$data = $data->where("c_user_id='{$uid}' and id!={$squirrel['cage']} and is_delete=0 and (number like '%{$keyword}%' or strains like '%{$keyword}%')"); $data = $data->where("c_user_id='{$uid}' and id!={$squirrel['cage']} and is_delete=0 and (number like '%{$keyword}%' or strains like '%{$keyword}%') order by {$order} desc");
} }
$data = $data->fList(); $data = $data->fList();
foreach($data as $key => $val){ foreach($data as $key => $val){

Loading…
Cancel
Save