From faff0b594d4d637b1e234c784262c5754237e04b Mon Sep 17 00:00:00 2001 From: lmrwork <59361885@qq.com> Date: Thu, 12 Apr 2018 16:40:40 +0800 Subject: [PATCH 01/14] amplist --- application/controllers/info_amp.php | 83 ++++++++++++++++++++------ application/models/infoMetas_model.php | 23 +++++++ 2 files changed, 88 insertions(+), 18 deletions(-) diff --git a/application/controllers/info_amp.php b/application/controllers/info_amp.php index 4e77ad13..3d02474f 100644 --- a/application/controllers/info_amp.php +++ b/application/controllers/info_amp.php @@ -19,52 +19,52 @@ class Info_amp extends CI_Controller public function save_amp() { - $icid = $this->input->post('icid'); - $json = $this->input->post('json'); - $html = $this->input->post('html'); - $css = $this->input->post('css'); - $schema = $this->input->post('schema'); - $script = $this->input->post('script'); - $status = $this->input->post('status'); + $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'); + $meta = $this->InfoMetas_model->get_post($icid, 'AMP_BODY'); if ($meta === false) { $this->InfoMetas_model->add($icid, 'AMP_BODY', $html); } else { $this->InfoMetas_model->update($icid, 'AMP_BODY', $html); } //json - $meta = $this->InfoMetas_model->get($icid, 'AMP_JSON'); + $meta = $this->InfoMetas_model->get_post($icid, 'AMP_JSON'); if ($meta === false) { $this->InfoMetas_model->add($icid, 'AMP_JSON', $json); } else { $this->InfoMetas_model->update($icid, 'AMP_JSON', $json); } //css - $meta = $this->InfoMetas_model->get($icid, 'AMP_CSS'); + $meta = $this->InfoMetas_model->get_post($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'); + $meta = $this->InfoMetas_model->get_post($icid, 'AMP_SCRIPT'); if ($meta === false) { $this->InfoMetas_model->add($icid, 'AMP_SCRIPT', $script); } else { $this->InfoMetas_model->update($icid, 'AMP_SCRIPT', $script); } //schema - $meta = $this->InfoMetas_model->get($icid, 'AMP_SCHEMA'); + $meta = $this->InfoMetas_model->get_post($icid, 'AMP_SCHEMA'); if ($meta === false) { $this->InfoMetas_model->add($icid, 'AMP_SCHEMA', $schema); } else { $this->InfoMetas_model->update($icid, 'AMP_SCHEMA', $schema); } //status - $meta = $this->InfoMetas_model->get($icid, 'AMP_STATUS'); + $meta = $this->InfoMetas_model->get_post($icid, 'AMP_STATUS'); if ($meta === false) { $this->InfoMetas_model->add($icid, 'AMP_STATUS', $status); } else { @@ -89,7 +89,7 @@ class Info_amp extends CI_Controller public function load_amp() { - $icid = $this->input->post('icid'); + $icid = $this->input->get_post('icid'); if (!$icid) { echo json_encode(array( "succ" => false, @@ -97,9 +97,9 @@ class Info_amp extends CI_Controller )); return false; } - $json = $this->InfoMetas_model->get($icid, 'AMP_JSON'); - $status = $this->InfoMetas_model->get($icid, 'AMP_STATUS'); - $schema = $this->InfoMetas_model->get($icid, 'AMP_SCHEMA'); + $json = $this->InfoMetas_model->get_post($icid, 'AMP_JSON'); + $status = $this->InfoMetas_model->get_post($icid, 'AMP_STATUS'); + $schema = $this->InfoMetas_model->get_post($icid, 'AMP_SCHEMA'); if ($json) { echo json_encode(array( "succ" => true, @@ -116,9 +116,56 @@ class Info_amp extends CI_Controller } } + public function list_amp() + { + $site = $this->input->get_post('site'); + switch ($site) { + case 'https://www.viaje-a-china.com': + $site_code = 'vac'; + break; + case 'https://www.voyageschine.com': + $site_code = 'vc'; + break; + case 'https://www.arachina.com': + $site_code = 'jp'; + break; + case 'https://www.chinahighlights.ru': + $site_code = 'ru'; + break; + case 'http://www.viaggio-in-cina.it': + $site_code = 'it'; + break; + case 'https://www.chinahighlights.com': + $site_code = 'cht'; + break; + case 'https://www.chinarundreisen.com/': + $site_code = 'gm'; + break; + default: + $site_code = false; + break; + } + if (!$site_code) { + echo json_encode(array( + "succ" => false, + "message" => "list_amp() -> 参数传递错误。" + )); + return false; + } + $rs = $this->InfoMetas_model->list_amp($icid, 'AMP_JSON'); + if (!empty($rs)) { + echo json_encode($rs); + } else { + echo json_encode(array( + "succ" => false, + "message" => "load_amp() -> 无数据返回。" + )); + } + } + public function load_info() { - $icid = $this->input->post('icid'); + $icid = $this->input->get_post('icid'); if ($icid) { $ic = $this->InfoContents_model->get_ic_contents2($icid); if ($ic) { diff --git a/application/models/infoMetas_model.php b/application/models/infoMetas_model.php index 1010b214..90c3ee23 100644 --- a/application/models/infoMetas_model.php +++ b/application/models/infoMetas_model.php @@ -34,6 +34,29 @@ class InfoMetas_model extends CI_Model { return $query->result(); } + function list_amp($site_code) { + $sql = " + SELECT im.im_id + ,im.im_ic_id + ,im.im_key + ,im.im_value as json + ,im2.im_value as staus + ,im3.im_value as schema + FROM infoMetas im + inner join infoContents c + on c.ic_id = im.im_ic_id + left join infoMetas im2 + on im2.im_ic_id = im.im_ic_id and im2.im_key = 'AMP_STATUS' + left join infoMetas im3 + on im3.im_ic_id = im.im_ic_id and im2.im_key = 'AMP_SCHEMA' + WHERE im.im_key = 'AMP_JSON' + and c.ic_sitecode = ? + and CONVERT(varchar, im2.im_value) = '1' + "; + $query = $this->HT->query($sql, array($site_code)); + return $query->result(); + } + function get($im_ic_id, $im_key) { $sql = "SELECT im.im_value \n" . "FROM infoMetas im \n" From 421416ff102e5da47495f721fc8bea2689d22b79 Mon Sep 17 00:00:00 2001 From: lmrwork <59361885@qq.com> Date: Thu, 12 Apr 2018 16:45:09 +0800 Subject: [PATCH 02/14] amplist v1 --- application/controllers/info_amp.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/application/controllers/info_amp.php b/application/controllers/info_amp.php index 3d02474f..a9d11742 100644 --- a/application/controllers/info_amp.php +++ b/application/controllers/info_amp.php @@ -29,42 +29,42 @@ class Info_amp extends CI_Controller if ($icid && $json && $html) { try { //html - $meta = $this->InfoMetas_model->get_post($icid, 'AMP_BODY'); + $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); } //json - $meta = $this->InfoMetas_model->get_post($icid, 'AMP_JSON'); + $meta = $this->InfoMetas_model->get($icid, 'AMP_JSON'); if ($meta === false) { $this->InfoMetas_model->add($icid, 'AMP_JSON', $json); } else { $this->InfoMetas_model->update($icid, 'AMP_JSON', $json); } //css - $meta = $this->InfoMetas_model->get_post($icid, 'AMP_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_post($icid, 'AMP_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); } //schema - $meta = $this->InfoMetas_model->get_post($icid, 'AMP_SCHEMA'); + $meta = $this->InfoMetas_model->get($icid, 'AMP_SCHEMA'); if ($meta === false) { $this->InfoMetas_model->add($icid, 'AMP_SCHEMA', $schema); } else { $this->InfoMetas_model->update($icid, 'AMP_SCHEMA', $schema); } //status - $meta = $this->InfoMetas_model->get_post($icid, 'AMP_STATUS'); + $meta = $this->InfoMetas_model->get($icid, 'AMP_STATUS'); if ($meta === false) { $this->InfoMetas_model->add($icid, 'AMP_STATUS', $status); } else { @@ -97,9 +97,9 @@ class Info_amp extends CI_Controller )); return false; } - $json = $this->InfoMetas_model->get_post($icid, 'AMP_JSON'); - $status = $this->InfoMetas_model->get_post($icid, 'AMP_STATUS'); - $schema = $this->InfoMetas_model->get_post($icid, 'AMP_SCHEMA'); + $json = $this->InfoMetas_model->get($icid, 'AMP_JSON'); + $status = $this->InfoMetas_model->get($icid, 'AMP_STATUS'); + $schema = $this->InfoMetas_model->get($icid, 'AMP_SCHEMA'); if ($json) { echo json_encode(array( "succ" => true, From c662932a26bd26d6691ad8156ff1fcc720cd36fc Mon Sep 17 00:00:00 2001 From: lmrwork <59361885@qq.com> Date: Thu, 12 Apr 2018 16:47:21 +0800 Subject: [PATCH 03/14] amplist v2 --- application/controllers/info_amp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/info_amp.php b/application/controllers/info_amp.php index a9d11742..ce6babab 100644 --- a/application/controllers/info_amp.php +++ b/application/controllers/info_amp.php @@ -152,7 +152,7 @@ class Info_amp extends CI_Controller )); return false; } - $rs = $this->InfoMetas_model->list_amp($icid, 'AMP_JSON'); + $rs = $this->InfoMetas_model->list_amp($site_code); if (!empty($rs)) { echo json_encode($rs); } else { From 0acfb044cf192d8d63648435d8d5860de677d310 Mon Sep 17 00:00:00 2001 From: lmrwork <59361885@qq.com> Date: Thu, 12 Apr 2018 16:48:45 +0800 Subject: [PATCH 04/14] amplist v3 --- application/models/infoMetas_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/models/infoMetas_model.php b/application/models/infoMetas_model.php index 90c3ee23..ac3b2910 100644 --- a/application/models/infoMetas_model.php +++ b/application/models/infoMetas_model.php @@ -34,7 +34,7 @@ class InfoMetas_model extends CI_Model { return $query->result(); } - function list_amp($site_code) { + public function list_amp($site_code) { $sql = " SELECT im.im_id ,im.im_ic_id From e5529180e4bb54570774d43095905fa6b584f6a5 Mon Sep 17 00:00:00 2001 From: lmrwork <59361885@qq.com> Date: Thu, 12 Apr 2018 16:50:43 +0800 Subject: [PATCH 05/14] amplist v4 --- application/models/infoMetas_model.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/models/infoMetas_model.php b/application/models/infoMetas_model.php index ac3b2910..9434c920 100644 --- a/application/models/infoMetas_model.php +++ b/application/models/infoMetas_model.php @@ -39,9 +39,9 @@ class InfoMetas_model extends CI_Model { SELECT im.im_id ,im.im_ic_id ,im.im_key - ,im.im_value as json - ,im2.im_value as staus - ,im3.im_value as schema + ,im.im_value as amp_json + ,im2.im_value as amp_staus + ,im3.im_value as amp_schema FROM infoMetas im inner join infoContents c on c.ic_id = im.im_ic_id From bfb18131eda0eea57feb4e1f5efe11752a326495 Mon Sep 17 00:00:00 2001 From: lmrwork <59361885@qq.com> Date: Thu, 12 Apr 2018 16:56:57 +0800 Subject: [PATCH 06/14] amplist v5 --- application/models/infoMetas_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/models/infoMetas_model.php b/application/models/infoMetas_model.php index 9434c920..d1fa0ffe 100644 --- a/application/models/infoMetas_model.php +++ b/application/models/infoMetas_model.php @@ -38,10 +38,10 @@ class InfoMetas_model extends CI_Model { $sql = " SELECT im.im_id ,im.im_ic_id - ,im.im_key ,im.im_value as amp_json ,im2.im_value as amp_staus ,im3.im_value as amp_schema + ,c.ic_url FROM infoMetas im inner join infoContents c on c.ic_id = im.im_ic_id From 7cdc5ecf5f4ad22c3a1255ce6368dea8d033df64 Mon Sep 17 00:00:00 2001 From: lmrwork <59361885@qq.com> Date: Thu, 12 Apr 2018 17:00:36 +0800 Subject: [PATCH 07/14] amplist v6 --- application/models/infoMetas_model.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/application/models/infoMetas_model.php b/application/models/infoMetas_model.php index d1fa0ffe..4dfd3dc0 100644 --- a/application/models/infoMetas_model.php +++ b/application/models/infoMetas_model.php @@ -38,9 +38,6 @@ class InfoMetas_model extends CI_Model { $sql = " SELECT im.im_id ,im.im_ic_id - ,im.im_value as amp_json - ,im2.im_value as amp_staus - ,im3.im_value as amp_schema ,c.ic_url FROM infoMetas im inner join infoContents c From c80519e4ddf93c1a322b933f34970772ed045958 Mon Sep 17 00:00:00 2001 From: LMR <59361885@qq.com> Date: Sat, 14 Apr 2018 23:01:01 +0800 Subject: [PATCH 08/14] fix amp it --- application/controllers/info_amp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/info_amp.php b/application/controllers/info_amp.php index ce6babab..ad169c7c 100644 --- a/application/controllers/info_amp.php +++ b/application/controllers/info_amp.php @@ -132,7 +132,7 @@ class Info_amp extends CI_Controller case 'https://www.chinahighlights.ru': $site_code = 'ru'; break; - case 'http://www.viaggio-in-cina.it': + case 'https://www.viaggio-in-cina.it': $site_code = 'it'; break; case 'https://www.chinahighlights.com': From cc25270c4c3150c3f058967d34595e4a1bf24ebe Mon Sep 17 00:00:00 2001 From: LMR <59361885@qq.com> Date: Sun, 15 Apr 2018 13:56:58 +0800 Subject: [PATCH 09/14] todo: update amp --- application/controllers/info_amp.php | 49 ++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) 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() -> 参数传递错误。" + )); + } + } + } From 1b1084f88744c9814ba93ccb529756cd096b24b3 Mon Sep 17 00:00:00 2001 From: lmrwork <59361885@qq.com> Date: Mon, 16 Apr 2018 10:44:40 +0800 Subject: [PATCH 10/14] remove amp uodate --- application/controllers/info_amp.php | 51 ---------------------------- 1 file changed, 51 deletions(-) diff --git a/application/controllers/info_amp.php b/application/controllers/info_amp.php index ef6c04b7..9667e3d3 100644 --- a/application/controllers/info_amp.php +++ b/application/controllers/info_amp.php @@ -190,55 +190,4 @@ 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() -> 参数传递错误。" - )); - } - } - } - From e7d5f5657111e37dab31c4d08ed511866096610c Mon Sep 17 00:00:00 2001 From: lmrwork <59361885@qq.com> Date: Tue, 17 Apr 2018 13:15:02 +0800 Subject: [PATCH 11/14] amp api --- application/controllers/info_amp.php | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/application/controllers/info_amp.php b/application/controllers/info_amp.php index 9667e3d3..f77665cc 100644 --- a/application/controllers/info_amp.php +++ b/application/controllers/info_amp.php @@ -97,6 +97,42 @@ class Info_amp extends CI_Controller )); return false; } + //信息~ + $ic = $this->InfoContents_model->get_ic_contents2($icid); + if (empty($ic)) { + echo json_encode(array( + "succ" => false, + "message" => "load_amp() -> 无信息" + )); + return false; + } + switch (strtolower($ic->ic_site_code)) { + case 'vac': + $site = 'https://www.viaje-a-china.com'; + break; + case 'vc': + $site = 'https://www.voyageschine.com'; + break; + case 'jp': + $site = 'https://www.arachina.com'; + break; + case 'ru': + $site = 'https://www.chinahighlights.ru'; + break; + case 'it': + $site = 'https://www.viaggio-in-cina.it'; + break; + case 'cht': + $site = 'https://www.chinahighlights.com'; + break; + case 'gm': + $site = 'https://www.chinarundreisen.com/'; + break; + default: + $site = ''; + break; + } + $json = $this->InfoMetas_model->get($icid, 'AMP_JSON'); $status = $this->InfoMetas_model->get($icid, 'AMP_STATUS'); $schema = $this->InfoMetas_model->get($icid, 'AMP_SCHEMA'); @@ -104,6 +140,7 @@ class Info_amp extends CI_Controller echo json_encode(array( "succ" => true, "icid" => $icid, + "icurl" => $site.$ic->ic_url, "json" => $json, "schema" => $schema, "status" => $status From 1470a5512a6c1783f01966bb46d5e3785550e5a3 Mon Sep 17 00:00:00 2001 From: lmrwork <59361885@qq.com> Date: Tue, 17 Apr 2018 13:15:36 +0800 Subject: [PATCH 12/14] amp api --- application/controllers/info_amp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/info_amp.php b/application/controllers/info_amp.php index f77665cc..533fe6c3 100644 --- a/application/controllers/info_amp.php +++ b/application/controllers/info_amp.php @@ -106,7 +106,7 @@ class Info_amp extends CI_Controller )); return false; } - switch (strtolower($ic->ic_site_code)) { + switch (strtolower($ic->ic_sitecode)) { case 'vac': $site = 'https://www.viaje-a-china.com'; break; From 4ae807db533e02f695bb1e0d7f219936954bf6f9 Mon Sep 17 00:00:00 2001 From: lmrwork <59361885@qq.com> Date: Tue, 17 Apr 2018 13:20:31 +0800 Subject: [PATCH 13/14] amp api v2 --- application/models/infoContents_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/models/infoContents_model.php b/application/models/infoContents_model.php index aa37343e..25667ef8 100644 --- a/application/models/infoContents_model.php +++ b/application/models/infoContents_model.php @@ -126,7 +126,7 @@ class InfoContents_model extends CI_Model public function get_ic_contents2($ic_id) { - $sql="SELECT top 1 ic_id, ic_content, ic_title, ic_url, ic_photo from infoContents where ic_id=?"; + $sql="SELECT top 1 ic_id, ic_content, ic_title, ic_url, ic_photo, ic_sitecode from infoContents where ic_id=?"; $query=$this->HT->query($sql,array($ic_id)); if ($query->result()) { From 9eb4144513cc2332091be7e51a49023eb6cf4258 Mon Sep 17 00:00:00 2001 From: lmrwork <59361885@qq.com> Date: Tue, 17 Apr 2018 13:20:48 +0800 Subject: [PATCH 14/14] amp api v3 --- application/controllers/info_amp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/controllers/info_amp.php b/application/controllers/info_amp.php index 533fe6c3..5718c589 100644 --- a/application/controllers/info_amp.php +++ b/application/controllers/info_amp.php @@ -97,7 +97,7 @@ class Info_amp extends CI_Controller )); return false; } - //信息~ + //信息~返回信息 $ic = $this->InfoContents_model->get_ic_contents2($icid); if (empty($ic)) { echo json_encode(array(