初始化应用

This commit is contained in:
augushong
2020-08-08 22:02:18 +08:00
parent 3bc46a4b9c
commit d263417b51
34 changed files with 181 additions and 1411 deletions

View File

@@ -6,6 +6,7 @@ use app\model\Category;
use app\model\Nav;
use app\model\Post;
use app\model\PostCategory;
use think\facade\View;
use think\Request;
class Index extends Common
@@ -19,44 +20,7 @@ class Index extends Common
{
//
return $this->fetch();
}
public function __blogIndex()
{
$list_category = Category::where('type','blog_post')->select();
$this->assign('list_category',$list_category);
$category_id = $this->request->param('category_id');
if(!empty($category_id)){
$model_list_post = Post::hasWhere('categorys',['category_id'=>$category_id])->order('sort desc');
}else{
$model_list_post = Post::order('sort desc');
}
$model_list_post->where('type','blog_post');
$list_post = $model_list_post->paginate();
$this->assign('list_post',$list_post);
}
public function __documentsIndex()
{
$list_index_documents_nav = Nav::where('type',9)->select();
$this->assign('list_index_documents_nav',$list_index_documents_nav);
}
public function __articlesIndex()
{
$sub_category = [];
if(!empty($this->request->param('category_id'))){
@@ -89,11 +53,14 @@ class Index extends Common
$list_post = $model_post->paginate();
$this->assign('sub_category',$sub_category);
View::assign('sub_category',$sub_category);
$this->assign('list_post',$list_post);
View::assign('list_post',$list_post);
return View::fetch();
}
/**
* 显示创建资源表单页.
*