validator; } /** * 构建查询条件 */ protected function buildQueryConfig(Request $request, string $scene = 'index'): array { $p = $request->all(); $config = []; $config['model'] = $this->modelClass; switch ($scene) { case 'index': if(empty($p['receipt_id'])){ throw new BusinessException('receipt_id不能为空'); } // ====== ====== 排序 ====== ====== $config['order']['id'] = 'desc'; // ====== ====== 筛选 ====== ====== $config['where']['receipt_id'] = $p['receipt_id']; break; case 'show': $config['where']['id'] = $p['id']; break; } return $config; } }