add 基地列表
This commit is contained in:
parent
1150d4eab4
commit
12b0e98a1c
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
use app\common\model\farm\Farm;
|
||||||
|
|
||||||
|
class FarmController extends BaseApiController
|
||||||
|
{
|
||||||
|
public function lists()
|
||||||
|
{
|
||||||
|
$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();
|
||||||
|
return $this->success('请求成功',$data);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue