From 4c16c47987cd4f12a75696d7b7bda74d489d9489 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 13:36:46 +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 | 42 ++++++++++++++++++ .../fastapi/models/fastapi_model.php | 26 +++++++++++ .../third_party/fastapi/views/welcome.php | 43 +++++++++++++++++++ echarts/views/echarts/mobile_deal.php | 16 +++---- 4 files changed, 119 insertions(+), 8 deletions(-) create mode 100644 application/third_party/fastapi/controllers/index.php create mode 100644 application/third_party/fastapi/models/fastapi_model.php create mode 100644 application/third_party/fastapi/views/welcome.php diff --git a/application/third_party/fastapi/controllers/index.php b/application/third_party/fastapi/controllers/index.php new file mode 100644 index 00000000..b628bbcc --- /dev/null +++ b/application/third_party/fastapi/controllers/index.php @@ -0,0 +1,42 @@ +load->model('fastapi_model'); + } + + public function index() + { + $this->permission->is_admin(); //需要登陆 + $data = array(); + $this->load->view('welcome'); + } + + + public function query() + { + if ($this->input->ip_address() !== '116.8.4.34' && $this->input->ip_address() !== '127.0.0.1') { //不是公司的网络则不能访问 + 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)); + } else { + echo json_encode(array('result' => 'no', 'data' => '查询不到数据')); + } + } + +} diff --git a/application/third_party/fastapi/models/fastapi_model.php b/application/third_party/fastapi/models/fastapi_model.php new file mode 100644 index 00000000..9adc6c99 --- /dev/null +++ b/application/third_party/fastapi/models/fastapi_model.php @@ -0,0 +1,26 @@ +HT = $this->load->database('TOURMANAGER_READ', TRUE); + $this->INFO = $this->load->database('INFORMATION_READ', TRUE); + } + + public function get_query($database, $sql) + { + if ($database === 'TOURMANAGER') { + $query = $this->HT->query($sql); + return $query->result(); + } else if ($database === 'INFOMANAGER') { + $query = $this->INFO->query($sql); + return $query->result(); + } + return false; + } + +} diff --git a/application/third_party/fastapi/views/welcome.php b/application/third_party/fastapi/views/welcome.php new file mode 100644 index 00000000..0e469fa6 --- /dev/null +++ b/application/third_party/fastapi/views/welcome.php @@ -0,0 +1,43 @@ + + + + + + + + fast api + + + + +

fast api

+
+ +
+ + + +
+ +
+ + diff --git a/echarts/views/echarts/mobile_deal.php b/echarts/views/echarts/mobile_deal.php index 62a70716..e5806ec1 100644 --- a/echarts/views/echarts/mobile_deal.php +++ b/echarts/views/echarts/mobile_deal.php @@ -29,32 +29,32 @@
  • @@ -85,7 +85,7 @@
    @@ -104,7 +104,7 @@