安装插件后的基础文件
This commit is contained in:
16
plugin/demo/app/admin/controller/demo/Index.php
Normal file
16
plugin/demo/app/admin/controller/demo/Index.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace app\admin\controller\demo;
|
||||
|
||||
use app\AdminController;
|
||||
|
||||
class Index extends AdminController{
|
||||
|
||||
|
||||
public function index() {
|
||||
echo '后台首页控制器<br/>';
|
||||
return view('/demo/index/index');
|
||||
}
|
||||
|
||||
}
|
||||
29
plugin/demo/app/admin/model/Demo.php
Normal file
29
plugin/demo/app/admin/model/Demo.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
/**
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class Demo extends Model
|
||||
{
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'create_time';
|
||||
protected $updatetime = 'update_time';
|
||||
|
||||
// 字段修改器
|
||||
public function setSortAttr($value)
|
||||
{
|
||||
if (is_empty($value)) {
|
||||
return self::max('id') + 1;
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
31
plugin/demo/app/admin/validate/Demo.php
Normal file
31
plugin/demo/app/admin/validate/Demo.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Demo extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
12
plugin/demo/app/admin/view/demo/index/index.html
Normal file
12
plugin/demo/app/admin/view/demo/index/index.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>我是后台首页控制器模板</title>
|
||||
</head>
|
||||
<body>
|
||||
我是后台首页控制器模板
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user