diff --git a/Application/Admin/Controller/ArticleController.class.php b/Application/Admin/Controller/ArticleController.class.php index e85f25567..cf37c0992 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); @@ -943,11 +944,49 @@ class ArticleController extends AdminController { if (!$rule) { return $this->error('记录不存在'); } + if (empty($rule['document_route'])) { + $doc = "当前无文档"; + }else { + $document_route_arr = explode("/", $rule['document_route']); + $doc = $document_route_arr[2]; + } + + $this->assign("doc", $doc); $rule['pop_time'] = $rule['type'] == 1 ? date("Y-m-d", $rule['pop_time']) : $rule['pop_time']; $this->assign('rule', $rule); } } $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/'; + if (is_dir($savePath)) { + move_uploaded_file($tmp_name,$savePath.$name); + }else { + mkdir($savePath, 0777, true); + move_uploaded_file($tmp_name,$savePath.$name); + } + $file_name = $savePath.$name; + $error=$upfile["error"];//上传后系统返回的值 + $data['document_route'] = 'Uploads/Documents/'.$name; + $updateres = M('document_pop_rules')->where(['id' => $id])->save($data); + if ($updateres) { + $backData['code'] = 10000; + $backData['filename'] = $name; + }else { + $backData['code'] = 10001; + } + $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..c019ce359 100644 --- a/Application/Admin/View/Article/pop_rule_edit.html +++ b/Application/Admin/View/Article/pop_rule_edit.html @@ -14,6 +14,24 @@ + +
  • + + + + +
  • + +
  • + + + + + 当前文档:{$doc} + + +
  • +
  • @@ -65,6 +83,36 @@ + + + + + + +
    + + + + +

    {$rule.title}

    +
    {$rule.content}
    +
    + + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + \ No newline at end of file diff --git a/Application/Home/View/default/Promote/pop_rule_detail.html b/Application/Home/View/default/Promote/pop_rule_detail.html index 5cb08a123..5a5df817f 100644 --- a/Application/Home/View/default/Promote/pop_rule_detail.html +++ b/Application/Home/View/default/Promote/pop_rule_detail.html @@ -91,7 +91,7 @@