This commit is contained in:
chenbo 2024-01-17 17:05:16 +08:00
parent 7d656a3fc4
commit 7643305054
2 changed files with 3 additions and 14 deletions

View File

@ -6,18 +6,12 @@ use app\common\model\farm\Farm;
class FarmController extends BaseApiController
{
public function lists()
public function list()
{
$params = $this->request->get(['page_no','page_size','keyword']);
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
$pageSize = empty($params['page_size']) ? 6 : $params['page_size'];
$where = [
['user_id','=',$this->userId]
];
if(!empty($params['keyword'])){
$where[] = ['farm_name','like','%'.$params['keyword'].'%'];
}
$data = Farm::where($where)->page($pageNo,$pageSize)->order('create_time desc')->select()->toArray();
$data = Farm::where($where)->order('create_time desc')->select()->toArray();
return $this->success('请求成功',$data);
}
}

View File

@ -54,12 +54,7 @@ class IndexController extends BaseApiController
//todo 请求python接口
$data['monitor'] = [];
$monitorThreshold = MonitorThreshold::find();
if($monitorThreshold->toArray()!=null){
$monitorThreshold=$monitorThreshold[0];
}else{
$monitorThreshold=[];
}
$monitorThreshold = MonitorThreshold::where('fence_house_id', $params['fence_house_id'])->find();
$data['monitor']['threshold'] = $monitorThreshold;