['cid', 'title', 'is_show'], ]; } /** * @notes 获取商品列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author BD * @date 2024/03/11 01:58 */ public function lists(): array { $goods = Goods::where($this->searchWhere) ->append(['cate_name']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select() ->toArray(); foreach ($goods as &$item) { $item['num'] = 1; $item['langs'] = json_decode($item['langs'], JSON_UNESCAPED_UNICODE); // foreach ($item['langs'] as &$content_lang) { // $content_lang['image'] = FileService::getFileUrl($content_lang['image']); // } } return $goods; } /** * @notes 获取商品数量 * @return int * @author BD * @date 2024/03/11 01:58 */ public function count(): int { return Goods::where($this->searchWhere)->count(); } }