This commit is contained in:
chenbo 2024-02-04 09:58:55 +08:00
parent a586bf0ada
commit 3a7be52fa5
1 changed files with 3 additions and 0 deletions

View File

@ -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'] = '';