From 18c6dbd1792e800c9beaaef385ae85eba62621b8 Mon Sep 17 00:00:00 2001 From: "yangsai@163.com" <2624183217@qq.com> Date: Mon, 20 May 2024 14:16:04 +0800 Subject: [PATCH] =?UTF-8?q?YS=EF=BC=9A=E5=B9=BC=E5=B4=BD=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/models/NewSquirrel.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/application/models/NewSquirrel.php b/application/models/NewSquirrel.php index 321b8ef..3b0c1a8 100644 --- a/application/models/NewSquirrel.php +++ b/application/models/NewSquirrel.php @@ -26,17 +26,12 @@ class NewSquirrelModel extends Orm_Base{ public function getModelList($params){ $SquirrelModel = new SquirrelModel; //获取幼崽信息 - $data=$this->field('count,birthday,father,mother,strains,gene,remark')->where("id>0 {$params['where']}")->fList(); - foreach($data as $key => &$val){ - $father = $SquirrelModel->getOneInfo($val['father']); - $mother = $SquirrelModel->getOneInfo($val['mother']); - $val['father'] = empty($father)?'无':$father['number']; - $val['mother'] = empty($mother)?'无':$mother['number']; - } + $data=$this->field('id,count,birthday,father,mother,strains,gene,remark')->where("id>0 {$params['where']}")->fList(); + return $data; } public function getOneInfo($squirrel){ - return $this->field('count,birthday,father,mother,strains,gene,remark')->where("id={$squirrel}")->fRow(); + return $this->field('id,count,birthday,father,mother,strains,gene,remark')->where("id={$squirrel}")->fRow(); } }