From 7ef47af2ae99ca39f1370f4a853c0c81a24c5c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E9=B9=8F?= Date: Thu, 10 Jun 2021 10:58:27 +0800 Subject: [PATCH] =?UTF-8?q?CT=E4=BB=8E=E6=97=A7URL=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E5=88=B0=E6=96=B0=E4=BF=A1=E6=81=AF=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ctmobilefirst/controllers/api.php | 24 ++++++++++++ .../ctmobilefirst/models/api_model.php | 28 +++++++++++++ .../views/bootstrap3/information_edit.php | 39 +++++++++++++++++++ 3 files changed, 91 insertions(+) diff --git a/application/third_party/ctmobilefirst/controllers/api.php b/application/third_party/ctmobilefirst/controllers/api.php index 0ef55030..2c8c7ffa 100644 --- a/application/third_party/ctmobilefirst/controllers/api.php +++ b/application/third_party/ctmobilefirst/controllers/api.php @@ -291,6 +291,30 @@ class Api extends CI_Controller { } } + /** + * @description: 拷贝旧内容 + * @param {*} 新信息ic_id ,旧URL + * @return {*} + * @Date Changed: + */ + public function copyOldUrl(){ + //参数 + $id = $this->input->post("id"); + $oldUrl = $this->input->post("oldurl"); + + //调用拷贝 + $update = $this->api_model->copyOldUrl($id,$oldUrl); + + if ($update){ + $result["status"]="ok"; + }else{ + $result["status"]="error"; + } + $result["id"]=$id; + $result["oldUrl"]=$oldUrl; + echo json_encode($result); + + } } /* End of file Api.php */ diff --git a/application/third_party/ctmobilefirst/models/api_model.php b/application/third_party/ctmobilefirst/models/api_model.php index 11285278..3998ef89 100644 --- a/application/third_party/ctmobilefirst/models/api_model.php +++ b/application/third_party/ctmobilefirst/models/api_model.php @@ -410,6 +410,34 @@ class Api_model extends CI_Model { return $strCdn; } + + /** + * @description: //旧数据导入新数据 + * @param {*} $id + * @param {*} $oldUrl + * @return {*} + * @Date Changed: + */ + function copyOldUrl($id,$oldUrl){ + $sql = "UPDATE icNew + SET icNew.ic_content = icOld.ic_content + ,icNew.ic_summary = icOld.ic_summary + ,icNew.ic_title = icOld.ic_title + ,icNew.ic_url_title = icOld.ic_url_title + ,icNew.ic_seo_title = icOld.ic_seo_title + ,icNew.ic_seo_description = icOld.ic_seo_description + ,icNew.ic_seo_keywords = icOld.ic_seo_keywords + ,icNew.ic_photo = icOld.ic_photo + FROM infoContents icNew + ,infoContents icOld + WHERE icNew.ic_id = ? + AND icNew.ic_sitecode = 'chinatravel' + AND icOld.ic_url = ? + AND icOld.ic_sitecode = 'ct'"; + + return $this->HT->query($sql, array($id,$oldUrl)); + } + } /* End of file Api_model.php */ diff --git a/application/views/bootstrap3/information_edit.php b/application/views/bootstrap3/information_edit.php index 8d8744d8..36244eee 100644 --- a/application/views/bootstrap3/information_edit.php +++ b/application/views/bootstrap3/information_edit.php @@ -508,6 +508,43 @@ }); }) + + function copyOldUrl(id){ + if (confirm("是否开始导入旧URL的数据到此新信息?")){ + if (id === undefined){ + alert("信息ID无效,请先保存一次新信息。"); + return false; + } + + var oldurl = $("#meta_ct_oldurl").val(); + if (oldurl==""){ + alert("旧URL没录入,请先录入旧URL。"); + return false; + } + //var ctApi = "http://202.103.68.104:61/info.php"; + var ctApi = "https://ct.mycht.cn/info.php"; //网前"; + $.ajax({ + type: "post", + dataType: "json", + url: ctApi+"/thirdparty/ctmobilefirst/api/copyOldUrl/", + data: {'id': id, 'oldurl': oldurl}, + success: function (data, textStatus) { + if (data.status=="ok"){ + //alert(data.id+","+data.oldUrl); + alert("导入成功,关闭此对话框,等页面自动刷新后检查数据是否已拷贝。如果没有,请手动刷新此页面查看更新!"); + location.reload(); + }else{ + alert("导入失败,检查旧URL对应的信息是否存在,或者此新信息是否存在!"); + } + }, + error: function () { + $.modaldialog.error('发生错误,请联系YCC'); + return false; + } + }); + } + } +
@@ -677,6 +714,8 @@ +      + [[点击拷贝旧URL的内容]]