diff --git a/application/controllers/Admin/Squirrel.php b/application/controllers/Admin/Squirrel.php index d6a15a9..3153c96 100644 --- a/application/controllers/Admin/Squirrel.php +++ b/application/controllers/Admin/Squirrel.php @@ -14,7 +14,7 @@ class Admin_SquirrelController extends Ctrl_Admin{ $sql = "select * from {$SquirrelModel->table} order by id desc limit {$offset},{$limit} "; $data = $SquirrelModel->query($sql); foreach($data as $key => &$val){ - $val['sex'] = $val['sex']==1?'公':'母'; + $val['sex'] = $val['sex']==1?'雄':($val['sex']==2?'雌':'其他'); } $return['code'] = 0; $return['count'] = count($count); diff --git a/application/models/Cage.php b/application/models/Cage.php index 50744da..b555390 100644 --- a/application/models/Cage.php +++ b/application/models/Cage.php @@ -46,6 +46,12 @@ class CageModel extends Orm_Base{ if(!empty($womannum)){ $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':''; } $data['page'] = $params['page'];