From 5d710e6800cfd4d405369c4c69d3bf7f90c64a00 Mon Sep 17 00:00:00 2001 From: "lmr@hainatravel.com" <59361885@qq.com> Date: Thu, 22 Feb 2018 16:50:30 +0800 Subject: [PATCH] amp api --- application/controllers/info_amp.php | 60 ++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 application/controllers/info_amp.php diff --git a/application/controllers/info_amp.php b/application/controllers/info_amp.php new file mode 100644 index 00000000..6b68dc18 --- /dev/null +++ b/application/controllers/info_amp.php @@ -0,0 +1,60 @@ +permission->is_admin(); + $this->load->model('InfoMetas_model'); + //$this->output->enable_profiler(TRUE); + } + + public function save_amp() + { + $icid = $this->input->post('icid'); + $json = $this->input->post('json'); + $html = $this->input->post('html'); + $status = $this->input->post('status'); + if ($icid && $json && $html && $status) { + try { + $this->InfoMetas_model->add($ic_id, 'AMP', $html); + $this->InfoMetas_model->add($ic_id, 'AMP_JSON', $json); + $this->InfoMetas_model->add($ic_id, 'AMP_STATUS', $status); + echo json_encode(array( + "succ" => true + )); + } catch(Exception $e) { + echo json_encode(array( + "succ" => false, + "message" => $e->getMessage() + )); + } + } else { + echo json_encode(array( + "succ" => false, + "message" => "Post para error." + )); + } + } + + public function load_amp() + { + $icid = $this->input->post('icid'); + $html = $this->InfoMetas_model->get($ic_id, 'AMP'); + $json = $this->InfoMetas_model->get($ic_id, 'AMP_JSON'); + $status = $this->InfoMetas_model->get($ic_id, 'AMP_STATUS'); + echo json_encode(array( + "icid" => $icid, + "json" => $json, + "html" => $html, + "status" => $status + )); + } + +} +