From bdb688c9855370b9b32c580c4050e85eab1a0a5d Mon Sep 17 00:00:00 2001 From: sunke <18850253506@163.com> Date: Thu, 9 Apr 2020 13:07:32 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/ArticleController.class.php | 21 +++++++++++ .../Admin/View/Article/pop_rule_edit.html | 36 +++++++++++++++++++ .../Controller/PromoteController.class.php | 5 ++- .../Home/View/default/Promote/index.html | 9 +++-- 4 files changed, 67 insertions(+), 4 deletions(-) diff --git a/Application/Admin/Controller/ArticleController.class.php b/Application/Admin/Controller/ArticleController.class.php index e85f25567..ba62ede5f 100644 --- a/Application/Admin/Controller/ArticleController.class.php +++ b/Application/Admin/Controller/ArticleController.class.php @@ -918,6 +918,7 @@ class ArticleController extends AdminController { if ($_POST['type'] == 1 ) { $_POST['pop_time'] = strtotime($_POST['pop_time']); } + if ($id) { $pop_rules_model = M('document_pop_rules');//M('$this->$model_name','tab_'); $res = $pop_rules_model->where(['id'=>$id])->save($_POST); @@ -949,5 +950,25 @@ class ArticleController extends AdminController { } $this->display('pop_rule_edit'); } + + public function uploadDoc() { + $id = $_REQUEST['id']; + if(@is_uploaded_file($_FILES['file']['tmp_name'])){ + $upfile = $_FILES["file"]; + + $name = $upfile["name"]; + $type = $upfile["type"]; + $size = $upfile["size"]; + $tmp_name = $upfile["tmp_name"]; + $savePath = $_SERVER['DOCUMENT_ROOT'].__ROOT__.'/Uploads/Documents/'; + move_uploaded_file($tmp_name,$savePath.$name); + $file_name = $savePath.$name; + $error=$upfile["error"];//上传后系统返回的值 + $data['document_route'] = 'Uploads/Documents/'.$name; + M('document_pop_rules')->where(['id' => $id])->save($data); + $backData['tmp'] = $file_name; + $this->ajaxReturn(json_encode($backData,TRUE)); + } + } } diff --git a/Application/Admin/View/Article/pop_rule_edit.html b/Application/Admin/View/Article/pop_rule_edit.html index 3232af106..77aeab21d 100644 --- a/Application/Admin/View/Article/pop_rule_edit.html +++ b/Application/Admin/View/Article/pop_rule_edit.html @@ -14,6 +14,22 @@ + +
  • + + + + +
  • + +
  • + + + + + +
  • +
  • @@ -65,6 +81,26 @@ +