['type', 'is_show'], '%like%' => ['title'], ]; } /** * @notes 获取项目列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author BD * @date 2024/01/16 13:23 */ public function lists(): array { $items = Item::where($this->searchWhere) ->append(['vip_name']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select() ->toArray(); foreach ($items as &$item) { $item['langs'] = json_decode($item['langs'], JSON_UNESCAPED_UNICODE); foreach ($item['langs'] as &$content_lang) { $content_lang['image'] = FileService::getFileUrl($content_lang['image']); $content_lang['content'] = get_file_domain($content_lang['content']); } } return $items; } /** * @notes 获取项目数量 * @return int * @author BD * @date 2024/01/16 13:23 */ public function count(): int { return Item::where($this->searchWhere)->count(); } }