YS:接口修改

master
yangsai@163.com 7 months ago
parent ec5c1db884
commit bbfc767843
  1. 15
      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();
}
}

Loading…
Cancel
Save