This commit is contained in:
chenbo 2024-01-30 16:04:59 +08:00
parent 712c8ad436
commit fbd76bbfad
1 changed files with 2 additions and 2 deletions

View File

@ -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');
})