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" . str_pad(SysSerial::getSerial(), 16, '0') . random_string(8); $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; } }