创建student和system模块修改主页与欢迎页内容为动态
This commit is contained in:
1 parent
b881bdfef6
commit
663cafe365
17 files changed
+432
-17
No files matched your search
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\controller;
|
||||
|
||||
use think\Controller;
|
||||
|
||||
class Base extends Controller
|
||||
{
|
||||
//初始化
|
||||
protected function initialize()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Base extends Model
|
||||
{
|
||||
//开启自动时间戳
|
||||
protected $autoWriteTimestamp = false;
|
||||
}
|
||||
@@ -1,18 +1,61 @@
|
||||
<?php
|
||||
namespace app\index\controller;
|
||||
|
||||
use think\Controller;
|
||||
// 引用控制器基类
|
||||
use app\common\controller\Base;
|
||||
// 引用与此控制器同名的数据模型
|
||||
use app\system\model\SystemBase as sysbasemod;
|
||||
|
||||
class Index extends Controller
|
||||
class Index extends Base
|
||||
{
|
||||
// 主页
|
||||
public function index()
|
||||
{
|
||||
//实例化数据模型
|
||||
$sysbasemod = new sysbasemod();
|
||||
|
||||
// 查询最新记录
|
||||
$list = $sysbasemod
|
||||
->order(['id'=>'desc'])
|
||||
->field('title,keywords,description')
|
||||
->limit(1)
|
||||
->find();
|
||||
|
||||
// 获取版本号
|
||||
$list->version = config('version');
|
||||
|
||||
// 模版赋值
|
||||
$this->assign('list',$list);
|
||||
|
||||
// $url = url('welcome');
|
||||
// halt($url);
|
||||
|
||||
// 渲染输出
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
public function welcome()
|
||||
{
|
||||
//实例化数据模型
|
||||
$sysbasemod = new sysbasemod();
|
||||
|
||||
// 查询最新记录
|
||||
$list = $sysbasemod
|
||||
->order(['id'=>'desc'])
|
||||
->field('title,copyright,thinks')
|
||||
->limit(1)
|
||||
->find();
|
||||
|
||||
// 获取版本号
|
||||
$list->version = config('version');
|
||||
|
||||
// 模版赋值
|
||||
$this->assign('list',$list);
|
||||
|
||||
// $url = url('welcome');
|
||||
// halt($url);
|
||||
|
||||
// 渲染输出
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
||||
Loaded 3 of 17 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user