From 3a7be52fa5445a51d7798e5da308c13dff7bc1bf Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Sun, 4 Feb 2024 09:58:55 +0800 Subject: [PATCH] update --- app/api/controller/dataview/FarmController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/api/controller/dataview/FarmController.php b/app/api/controller/dataview/FarmController.php index b38959b..e17ae55 100644 --- a/app/api/controller/dataview/FarmController.php +++ b/app/api/controller/dataview/FarmController.php @@ -43,6 +43,9 @@ class FarmController extends BaseApiController $totalScale = $query->sum('form_scale'); // 基地列表 $farmList = $query->select()->each(function ($farm){ + // 档案数量 + $fenceHouseIds = FenceHouse::where('farm_id', $farm['id'])->column('id'); + $farm['animal_count'] = AnimalInfo::whereIn('fence_house_id', $fenceHouseIds)->count(); $fenceHouse = FenceHouse::where('farm_id', $farm['id'])->order('id desc')->findOrEmpty()->toArray(); if(empty($fenceHouse)){ $farm['video_url'] = '';