yangsai@163.com 6 months ago
parent 90499b82ac
commit 7d779d93ca
  1. 2
      application/controllers/Admin/Squirrel.php
  2. 6
      application/models/Cage.php

@ -14,7 +14,7 @@ class Admin_SquirrelController extends Ctrl_Admin{
$sql = "select * from {$SquirrelModel->table} order by id desc limit {$offset},{$limit} "; $sql = "select * from {$SquirrelModel->table} order by id desc limit {$offset},{$limit} ";
$data = $SquirrelModel->query($sql); $data = $SquirrelModel->query($sql);
foreach($data as $key => &$val){ foreach($data as $key => &$val){
$val['sex'] = $val['sex']==1?'公':'母'; $val['sex'] = $val['sex']==1?'雄':($val['sex']==2?'雌':'其他');
} }
$return['code'] = 0; $return['code'] = 0;
$return['count'] = count($count); $return['count'] = count($count);

@ -46,6 +46,12 @@ class CageModel extends Orm_Base{
if(!empty($womannum)){ if(!empty($womannum)){
$val['womannum'] = $womannum[0]['num']; $val['womannum'] = $womannum[0]['num'];
} }
//查询其他
$sql = "select count(*) num from squirrel where cage={$val['id']} and is_kill=0 and is_delete=0 and sex=0";
$othernum = $this->query($sql);
if(!empty($othernum)){
$val['othernum'] = $othernum[0]['num'];
}
$val['type_color'] = $val['type']==2?'#FF0000':''; $val['type_color'] = $val['type']==2?'#FF0000':'';
} }
$data['page'] = $params['page']; $data['page'] = $params['page'];

Loading…
Cancel
Save