From bbfc767843ca65caaf120cd07191bcd008903830 Mon Sep 17 00:00:00 2001 From: "yangsai@163.com" <2624183217@qq.com> Date: Wed, 15 May 2024 18:01:42 +0800 Subject: [PATCH] =?UTF-8?q?YS:=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/models/Squirrel.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/application/models/Squirrel.php b/application/models/Squirrel.php index 48de419..b312242 100644 --- a/application/models/Squirrel.php +++ b/application/models/Squirrel.php @@ -30,8 +30,18 @@ class SquirrelModel extends Orm_Base{ ); public $pk = 'id'; public function getModelList($params){ + $cageModel = new CageModel(); //获取仓鼠信息 - $data['slist']=$this->field('*')->where("is_delete=0 and is_kill=0 {$params['where']}")->fList(); + $data['slist']=$this->field('id,number,sex,birthday,father,mother,strains_id as strains,gene,hair_color,cage,remark')->where("is_delete=0 and is_kill=0 {$params['where']}")->fList(); + foreach($data['slist'] as $key => &$val){ + $father = $this->getOneInfo($val['father']); + $mother = $this->getOneInfo($val['mother']); + $val['sex'] = $val['sex']=1?'公':'母'; + $val['father'] = empty($father)?'无':$father['number']; + $val['mother'] = empty($mother)?'无':$mother['number']; + //获取笼位号 + $val['cage'] =$cageModel->getOneInfo($val['cage'])['number']; + } //获取繁殖笼幼崽信息 $data['youzailishi'] = $params['type']==2?:[]; return $data; @@ -60,5 +70,8 @@ class SquirrelModel extends Orm_Base{ } return $data; } + public function getOneInfo($cage){ + return $this->field('*')->where("id={$cage}")->fRow(); + } }