|
|
|
@ -86,15 +86,20 @@ class SquirrelModel extends Orm_Base{ |
|
|
|
|
public function partent($cage){ |
|
|
|
|
$time = date('Y-m-d',time()); |
|
|
|
|
|
|
|
|
|
$exec=$this->field('id,number,sex')->where("is_delete=0 and is_kill=0 and grow_time<'{$time}'"); |
|
|
|
|
$data=$this->field('id,number,sex')->where("is_delete=0 and is_kill=0 and grow_time<'{$time}' and sex in (1,2)")->fList(); |
|
|
|
|
$data[] = ['id'=>0,'number'=>"未知",'sex'=>2]; |
|
|
|
|
$data[] = ['id'=>0,'number'=>"未知",'sex'=>1]; |
|
|
|
|
if(!empty($cage)){ |
|
|
|
|
$CageModel = new CageModel(); |
|
|
|
|
$cageinfo = $CageModel->field("type")->where("id={$cage}")->fRow(); |
|
|
|
|
if($cageinfo['type']==2) $exec->where("cage={$cage}"); |
|
|
|
|
if($cageinfo['type']==2) { |
|
|
|
|
$data = []; |
|
|
|
|
$n = $this->field('id,number,sex')->where("is_delete=0 and is_kill=0 and grow_time<'{$time}' and sex=1 and cage={$cage}")->fRow(); |
|
|
|
|
$m = $this->field('id,number,sex')->where("is_delete=0 and is_kill=0 and grow_time<'{$time}' and sex=2 and cage={$cage}")->fList(); |
|
|
|
|
$data[]=empty($n)?['id'=>0,'number'=>"未知",'sex'=>1]:$n; |
|
|
|
|
$data[]=empty($m)?['id'=>0,'number'=>"未知",'sex'=>2]:$m; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$data = $exec->fList(); |
|
|
|
|
$data[] = ['id'=>0,'number'=>"未知",'sex'=>2]; |
|
|
|
|
$data[] = ['id'=>0,'number'=>"未知",'sex'=>1]; |
|
|
|
|
return $data; |
|
|
|
|
} |
|
|
|
|
public function getIcon($squirrel){ |
|
|
|
|