request->get(); $queryArr = explode(' ', $params['query'] ?? ''); $data = []; if (empty($queryArr)) { $this->success('请求成功', $data); } $model = Commands::where('status', 1)->field('id,type_id,command,note,cmd_tags,weigh'); foreach ($queryArr as &$value) { $word = addslashes(trim($value)); // $model->where('CONCAT(type_id, command, note, cmd_tags) LIKE ' . "'%{$word}%'"); $model->where('full_text', 'like', "%{$word}%"); } // echo $model->buildSql();exit; $list = $model->select(); foreach ($list as $item) { $data[] = $item['command'] . ' #' . $item['type_id'] . ':' . $item['note']; } $this->success('请求成功', $data); } catch (HttpResponseException $e) { throw $e; } catch (\Exception $e) { $this->error($e->getMessage()); } } }