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' => '参数为空')); } }