From 2ec31f5c516997e070444726665f37ff3ff8f79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B9=E8=AF=9A=E8=AF=9A?= Date: Mon, 15 Aug 2022 14:00:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=9C=E7=A8=8B=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=95=B0=E6=8D=AE=E5=BA=93=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../third_party/fastapi/controllers/index.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/application/third_party/fastapi/controllers/index.php b/application/third_party/fastapi/controllers/index.php index 2e6328d2..aa61b105 100644 --- a/application/third_party/fastapi/controllers/index.php +++ b/application/third_party/fastapi/controllers/index.php @@ -25,18 +25,22 @@ class Index extends CI_Controller public function query() { if ($this->input->ip_address() !== '116.8.4.34' && $this->input->ip_address() !== '127.0.0.1') { //不是公司的网络则不能访问 - echo $this->input->ip_address(); + //echo $this->input->ip_address(); Header("HTTP/1.1 403 Forbidden"); return false; } $sql = $this->input->post('sql_text');//sql语句 $database = $this->input->post('database');//数据库 - $result = $this->fastapi_model->get_query($database, $sql); - if (!empty($result)) { - echo json_encode(array('result' => 'ok', 'data' => $result)); + if (!empty($sql) && !empty($database)) { + $result = $this->fastapi_model->get_query($database, $sql); + if (!empty($result)) { + echo json_encode(array('result' => 'ok', 'data' => $result)); + } else { + echo json_encode(array('result' => 'no', 'data' => '查询不到数据')); + } } else { - echo json_encode(array('result' => 'no', 'data' => '查询不到数据')); + echo json_encode(array('result' => 'no', 'data' => '参数为空')); } }