From 17f5ad643c858fd4e463322fab0281c04f3b8dbf Mon Sep 17 00:00:00 2001 From: "yangsai@163.com" <2624183217@qq.com> Date: Tue, 11 Jun 2024 11:41:11 +0800 Subject: [PATCH] YS --- application/controllers/Api/Cage.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/application/controllers/Api/Cage.php b/application/controllers/Api/Cage.php index c6f9f3b..5d95b6f 100644 --- a/application/controllers/Api/Cage.php +++ b/application/controllers/Api/Cage.php @@ -136,12 +136,14 @@ class Api_CageController extends Ctrl_Api{ public function cagemovellistAction(){ $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']; + $order = empty($this->POST['order'])?'id':$this->POST['order']; $keyword = empty($this->POST['keyword'])?'':$this->POST['keyword']; $squirrel = $this->SquirrelModel->getOneInfo($id); + $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)){ - $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(); foreach($data as $key => $val){