From 45f8a09b1c6d4c80d206ef01168140beb509255f Mon Sep 17 00:00:00 2001 From: augushong Date: Sat, 15 Aug 2020 00:08:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96url,=E5=A4=9A=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E4=B9=8B=E9=97=B4=E4=B8=8D=E8=83=BD=E4=BA=92=E7=9B=B8?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E8=B7=AF=E7=94=B1=E7=94=9F=E6=88=90url,?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E7=A0=94=E7=A9=B6=E9=80=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Post.php | 3 +++ app/admin/route/index.php | 2 ++ app/index/controller/Index.php | 3 +-- app/index/controller/Post.php | 4 ++-- app/index/route/index.php | 7 +++++++ app/model/Post.php | 7 +++++++ route/app.php | 5 ----- view/admin/post/index.html | 2 +- view/index/index/index.html | 2 +- 9 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 app/admin/route/index.php create mode 100644 app/index/route/index.php diff --git a/app/admin/controller/Post.php b/app/admin/controller/Post.php index 53162f0..9baea3e 100644 --- a/app/admin/controller/Post.php +++ b/app/admin/controller/Post.php @@ -9,6 +9,7 @@ use app\model\Post as ModelPost; use app\model\PostCategory; use app\model\PostTag; use app\model\Tag; +use think\facade\Route; use think\facade\View; use think\Request; @@ -56,6 +57,8 @@ class Post extends Common // $post_data = $request->post(); + $post_data['uid'] = uniqid(); + $categorys = []; $tags = []; if (isset($post_data['categorys'])) { diff --git a/app/admin/route/index.php b/app/admin/route/index.php new file mode 100644 index 0000000..f3e9077 --- /dev/null +++ b/app/admin/route/index.php @@ -0,0 +1,2 @@ +request->param('category_id'))){ diff --git a/app/index/controller/Post.php b/app/index/controller/Post.php index 0fe8ffd..950c744 100644 --- a/app/index/controller/Post.php +++ b/app/index/controller/Post.php @@ -47,11 +47,11 @@ class Post extends Common * @param int $id * @return \think\Response */ - public function read($id) + public function read($uid) { // - $model_post = ModelPost::find($id); + $model_post = ModelPost::where('uid',$uid)->find(); $model_post->hits = $model_post->hits + 1; diff --git a/app/index/route/index.php b/app/index/route/index.php new file mode 100644 index 0000000..bd8b4ca --- /dev/null +++ b/app/index/route/index.php @@ -0,0 +1,7 @@ +domain('www')); + + return $url_info['scheme'].'://'.$url_info['host'].'/a'.$this->getData('uid').'.html'; + } } diff --git a/route/app.php b/route/app.php index d8e09e3..7b2f51b 100644 --- a/route/app.php +++ b/route/app.php @@ -10,8 +10,3 @@ // +---------------------------------------------------------------------- use think\facade\Route; -Route::get('think', function () { - return 'hello,ThinkPHP6!'; -}); - -Route::get('hello/:name', 'index/hello'); diff --git a/view/admin/post/index.html b/view/admin/post/index.html index c2c07a1..e745958 100644 --- a/view/admin/post/index.html +++ b/view/admin/post/index.html @@ -73,7 +73,7 @@
- 查看 + 查看 编辑
删除
diff --git a/view/index/index/index.html b/view/index/index/index.html index f039d4f..eebd1b1 100644 --- a/view/index/index/index.html +++ b/view/index/index/index.html @@ -55,7 +55,7 @@
{volist name='list_post' id='post'} - {notempty name='$post->getData("poster")'}