This commit is contained in:
chenbo 2024-01-30 16:00:15 +08:00
parent 19cde256a1
commit 712c8ad436
1 changed files with 8 additions and 0 deletions

View File

@ -75,6 +75,10 @@ class FenceHouseController extends BaseApiController
{ {
$params = $this->request->param(); $params = $this->request->param();
$pageNo = $params['page_no'] ?? 1; $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){ $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'); return FenceHouse::where('id', $data['fence_house_id'])->value('fence_house_name');
})->page($pageNo, $params['page_size'])->select(); })->page($pageNo, $params['page_size'])->select();
@ -101,6 +105,10 @@ class FenceHouseController extends BaseApiController
public function exchangeList() public function exchangeList()
{ {
$params = $this->request->param(); $params = $this->request->param();
$where = [];
if (!empty($params['keyword'])) {
$where[] = ['animal_sn', 'like', '%' . $params['keyword'] . '%'];
}
$pageNo = $params['page_no'] ?? 1; $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)->append(['old_fence_house_name', 'new_fence_house_name'])
->withAttr('old_fence_house_name',function ($value, $data){ ->withAttr('old_fence_house_name',function ($value, $data){