From fbd76bbfadf0adcee5510b6a2ed6f58c738c05ad Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Tue, 30 Jan 2024 16:04:59 +0800 Subject: [PATCH] update --- app/api/controller/FenceHouseController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/controller/FenceHouseController.php b/app/api/controller/FenceHouseController.php index c9ea3cd..fd5d39e 100644 --- a/app/api/controller/FenceHouseController.php +++ b/app/api/controller/FenceHouseController.php @@ -79,7 +79,7 @@ class FenceHouseController extends BaseApiController if (!empty($params['keyword'])) { $where[] = ['animal_sn', 'like', '%' . $params['keyword'] . '%']; } - $lists = Db::name('leave_fence_house_log')->where('user_id', $this->userId)->append(['fence_house_name'])->withAttr('fence_house_name',function ($value, $data){ + $lists = Db::name('leave_fence_house_log')->where('user_id', $this->userId)->where($where)->append(['fence_house_name'])->withAttr('fence_house_name',function ($value, $data){ return FenceHouse::where('id', $data['fence_house_id'])->value('fence_house_name'); })->page($pageNo, $params['page_size'])->select(); $data = [ @@ -110,7 +110,7 @@ class FenceHouseController extends BaseApiController $where[] = ['animal_sn', 'like', '%' . $params['keyword'] . '%']; } $pageNo = $params['page_no'] ?? 1; - $lists = Db::name('change_fence_house_log')->where('user_id', $this->userId)->append(['old_fence_house_name', 'new_fence_house_name']) + $lists = Db::name('change_fence_house_log')->where('user_id', $this->userId)->where($where)->append(['old_fence_house_name', 'new_fence_house_name']) ->withAttr('old_fence_house_name',function ($value, $data){ return FenceHouse::where('id', $data['old_fence_house_id'])->value('fence_house_name'); })