开始官网模板

This commit is contained in:
augushong
2020-04-19 13:18:57 +08:00
parent 1ec8c07250
commit 9910dd3e6d
42 changed files with 1435 additions and 219 deletions

View File

@@ -0,0 +1,93 @@
<?php
declare(strict_types=1);
namespace app\index\controller;
use app\model\Category as ModelCategory;
use think\Request;
class Category extends Common
{
/**
* 显示资源列表
*
* @return \think\Response
*/
public function index()
{
//
}
/**
* 显示创建资源表单页.
*
* @return \think\Response
*/
public function create()
{
//
}
/**
* 保存新建的资源
*
* @param \think\Request $request
* @return \think\Response
*/
public function save(Request $request)
{
//
}
/**
* 显示指定的资源
*
* @param int $id
* @return \think\Response
*/
public function read($id)
{
//
$model_category = ModelCategory::with('posts.post')->find($id);
$this->assign('category',$model_category);
return $this->fetch('read'.$model_category->tpl_name);
}
/**
* 显示编辑资源表单页.
*
* @param int $id
* @return \think\Response
*/
public function edit($id)
{
//
}
/**
* 保存更新的资源
*
* @param \think\Request $request
* @param int $id
* @return \think\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public function delete($id)
{
//
}
}

View File

@@ -0,0 +1,25 @@
<?php
namespace app\index\controller;
use app\model\Nav;
use think\facade\View;
class Common extends BaseController
{
public function initialize()
{
parent::initialize();
$list_header_nav = Nav::where('type',1)->order('sort asc')->where('status',1)->select();
View::assign('list_header_nav',$list_header_nav);
$list_nav_slide = Nav::where('type',3)->order('sort asc')->where('status',1)->select();
View::assign('list_nav_slide',$list_nav_slide);
$list_nav_index_block_1 = Nav::where('type',6)->order('sort asc')->where('status',1)->select();
View::assign('list_nav_index_block_1',$list_nav_index_block_1);
$list_nav_index_block_2 = Nav::where('type',7)->order('sort asc')->where('status',1)->select();
View::assign('list_nav_index_block_2',$list_nav_index_block_2);
$list_nav_friend_url = Nav::where('type',2)->order('sort asc')->where('status',1)->select();
View::assign('list_nav_friend_url',$list_nav_friend_url);
}
}

View File

@@ -5,7 +5,7 @@ namespace app\index\controller;
use think\facade\View;
use think\Request;
class Index extends BaseController
class Index extends Common
{
/**
* 显示资源列表
@@ -16,9 +16,7 @@ class Index extends BaseController
{
//
dump($this->request->action());
return $this->fetch('');
return $this->fetch();
}
/**