diff --git a/app/api/controller/FenceHouseController.php b/app/api/controller/FenceHouseController.php index 60beead..c9ea3cd 100644 --- a/app/api/controller/FenceHouseController.php +++ b/app/api/controller/FenceHouseController.php @@ -75,6 +75,10 @@ class FenceHouseController extends BaseApiController { $params = $this->request->param(); $pageNo = $params['page_no'] ?? 1; + $where = []; + 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){ return FenceHouse::where('id', $data['fence_house_id'])->value('fence_house_name'); })->page($pageNo, $params['page_size'])->select(); @@ -101,6 +105,10 @@ class FenceHouseController extends BaseApiController public function exchangeList() { $params = $this->request->param(); + $where = []; + if (!empty($params['keyword'])) { + $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']) ->withAttr('old_fence_house_name',function ($value, $data){