diff --git a/application/controllers/info_amp.php b/application/controllers/info_amp.php index ad169c7c..ef6c04b7 100644 --- a/application/controllers/info_amp.php +++ b/application/controllers/info_amp.php @@ -191,5 +191,54 @@ class Info_amp extends CI_Controller } } + public function update_amp() + { + $icid = $this->input->get_post('icid'); + $json = $this->input->get_post('json'); + $html = $this->input->get_post('html'); + $css = $this->input->get_post('css'); + $schema = $this->input->get_post('schema'); + $script = $this->input->get_post('script'); + $status = $this->input->get_post('status'); + if ($icid && $json && $html) { + try { + //html + $meta = $this->InfoMetas_model->get($icid, 'AMP_BODY'); + if ($meta === false) { + $this->InfoMetas_model->add($icid, 'AMP_BODY', $html); + } else { + $this->InfoMetas_model->update($icid, 'AMP_BODY', $html); + } + //css + $meta = $this->InfoMetas_model->get($icid, 'AMP_CSS'); + if ($meta === false) { + $this->InfoMetas_model->add($icid, 'AMP_CSS', $css); + } else { + $this->InfoMetas_model->update($icid, 'AMP_CSS', $css); + } + //script + $meta = $this->InfoMetas_model->get($icid, 'AMP_SCRIPT'); + if ($meta === false) { + $this->InfoMetas_model->add($icid, 'AMP_SCRIPT', $script); + } else { + $this->InfoMetas_model->update($icid, 'AMP_SCRIPT', $script); + } + echo json_encode(array( + "succ" => true + )); + } catch(Exception $e) { + echo json_encode(array( + "succ" => false, + "message" => "update_amp() -> ".$e->getMessage() + )); + } + } else { + echo json_encode(array( + "succ" => false, + "message" => "update_amp() -> 参数传递错误。" + )); + } + } + }