yangsai@163.com 9 months ago
parent 9baea40770
commit 7d7b61ce86
  1. 15
      application/models/NewSquirrel.php
  2. 8
      application/models/Squirrel.php

@ -24,14 +24,21 @@ class NewSquirrelModel extends Orm_Base{
);
public $pk = 'id';
public function getModelList($params){
$SquirrelModel = new SquirrelModel;
$CageModel = new CageModel();
//获取幼崽信息
$data=$this->field('id,count,birthday,father,mother,strains,gene,remark')->where("id>0 {$params['where']}")->fList();
$data=$this->field('id,count,birthday,father,mother,strains,gene,remark,cage')->where("id>0 {$params['where']}")->fList();
foreach($data as $key => &$val){
$val['cage'] = $CageModel->field('number')->where("id={$val['cage']}")->fRow()['number'];
$val['icon'] = "/public/icon/small.png";
}
return $data;
}
public function getOneInfo($squirrel){
return $this->field('id,count,birthday,father,mother,strains,gene,remark')->where("id={$squirrel}")->fRow();
$CageModel = new CageModel();
$data = $this->field('id,count,birthday,father,mother,strains,gene,remark,cage')->where("id={$squirrel}")->fRow();
$data['cage'] = $CageModel->field('number')->where("id={$data['cage']}")->fRow()['number'];
$data['icon'] = "/public/icon/small.png";
return $data;
}
}

@ -84,10 +84,14 @@ class SquirrelModel extends Orm_Base{
public function getIcon($squirrel){
$date = strtotime(date('Y-m-d',time()));
$info = $this->field('nursing_time')->where("id={$squirrel}")->fRow();
if(strtotime($info['nursing_time'])>$date){
if(empty($info)){
$data['icon'] = Yaf_Registry::get("config")->cangshu->url->small;
}else{
$data['icon'] = Yaf_Registry::get("config")->cangshu->url->big;
if(strtotime($info['nursing_time'])<$date){
$data['icon'] = Yaf_Registry::get("config")->cangshu->url->big;
}else{
$data['icon'] = Yaf_Registry::get("config")->cangshu->url->small;
}
}
return $data;
}

Loading…
Cancel
Save