model = new SysApi(); $this->validate = true; $this->validateClass = new ApiValidate(); } public function select(Request $request): Response { [$where, $format, $limit, $field, $order] = $this->selectInput($request); $order = $request->get('order', 'desc'); $field = $field ?? 'api_addtimes'; $query = $this->doSelect($where, $field, $order); return $this->doFormat($query, $format, $limit); } protected function insertInput(Request $request): array { $data = $this->inputFilter($request->post()); $data['api_id'] = "AP" . date('ymdH') . random_string(6, 'up'); $data['api_extend_json'] = $data['api_extend_json'] ?? '{}'; $data['api_request_json'] = $data['api_request_json'] ?? '{}'; $data['api_response_json'] = $data['api_response_json'] ?? '{}'; return $data; } }