YS:幼崽信息接口更改

master
yangsai@163.com 8 months ago
parent 44bc3632b2
commit 18c6dbd179
  1. 11
      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();
}
}

Loading…
Cancel
Save