params; if (isset($params['type']) && $params['type'] != '') { $where[] = ['type', '=', $params['type']]; } return $where; } /** * @notes 轮播图列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author ljj * @date 2022/3/30 5:40 下午 */ public function lists(): array { $lists = Banner::where($this->setSearch()) ->field('id,type,image,status,sort,create_time') ->limit($this->limitOffset, $this->limitLength) ->append(['status_desc','type_desc']) ->order('id', 'desc') ->select() ->toArray(); return $lists; } /** * @notes 轮播图数量 * @return int * @author ljj * @date 2022/3/30 5:40 下午 */ public function count(): int { return Banner::where($this->setSearch())->count(); } }