|
|
|
@ -32,13 +32,13 @@ class successful extends BaseModel |
|
|
|
|
* @param array $param 查询参数 |
|
|
|
|
* @return \think\Paginator |
|
|
|
|
*/ |
|
|
|
|
public function list($page ,$pageSize): \think\Paginator |
|
|
|
|
public function list(array $param): \think\Paginator |
|
|
|
|
{ |
|
|
|
|
// 假设从数据库查询数据 |
|
|
|
|
$query = self::order('sort', 'asc')->paginate($pageSize); |
|
|
|
|
|
|
|
|
|
$filter = $this->getFilter($param); |
|
|
|
|
// 使用分页方法 |
|
|
|
|
return $query; |
|
|
|
|
$list = $this->where($filter)->order('sort', 'asc')->paginate($param['pageSize'] ?? 15);; |
|
|
|
|
return $list; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -65,4 +65,23 @@ class successful extends BaseModel |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 设置查询条件 |
|
|
|
|
* @param array $param |
|
|
|
|
* @return array |
|
|
|
|
*/ |
|
|
|
|
private function getFilter(array $param): array |
|
|
|
|
{ |
|
|
|
|
// 设置默认的检索数据 |
|
|
|
|
$params = $this->setQueryDefaultValue($param, [ |
|
|
|
|
'successful' => '', // 查询内容 |
|
|
|
|
]); |
|
|
|
|
// 检索查询条件 |
|
|
|
|
$filter = []; |
|
|
|
|
// 用户昵称/订单号 |
|
|
|
|
!empty($params['successful']) && $filter[] = ['successful', 'like', "%{$params['successful']}%"]; |
|
|
|
|
return $filter; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |