params; if (isset($params['type']) && $params['type'] != '') { $where[] = ['type', '=', $params['type']]; } if (isset($params['name']) && $params['name'] != '') { $where[] = ['neme', '%like%', $params['name']]; } 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 = Info::where($this->setSearch()) ->field('id,type,cid,title,synopsis,image,address,phone,latitude,longitude,sort,is_show,create_time,update_time') ->limit($this->limitOffset, $this->limitLength) ->append(['is_show_desc','type_desc','category']) ->order('sort desc,id desc') ->select() ->toArray(); return $lists; } /** * @notes 信息数量 * @return int * @author ljj * @date 2022/3/30 5:40 下午 */ public function count(): int { return Info::where($this->setSearch())->count(); } }