From 7d779d93ca233d9d2d9082892e563dbbeffa0a27 Mon Sep 17 00:00:00 2001 From: "yangsai@163.com" <2624183217@qq.com> Date: Thu, 6 Jun 2024 17:28:27 +0800 Subject: [PATCH] YS --- application/controllers/Admin/Squirrel.php | 2 +- application/models/Cage.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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'];