安装插件后的基础文件
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>
|
||||
37
plugin/demo/app/index/controller/Demo.php
Normal file
37
plugin/demo/app/index/controller/Demo.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
// +----------------------------------------------------------------------
|
||||
// | swiftAdmin 极速开发框架 [基于 WebMan 开发]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2020-2030 http://www.swiftadmin.net
|
||||
// +----------------------------------------------------------------------
|
||||
// | swiftAdmin.net High Speed Development Framework
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: meystack <coolsec@foxmail.com> Apache2 License
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\index\controller;
|
||||
|
||||
use app\HomeController;
|
||||
|
||||
/**
|
||||
* 插件示例
|
||||
*/
|
||||
class Demo extends HomeController
|
||||
{
|
||||
/**
|
||||
* 会员中心首页模板
|
||||
* @return \support\Response
|
||||
* @throws \Psr\SimpleCache\InvalidArgumentException
|
||||
*/
|
||||
public function index(): \support\Response
|
||||
{
|
||||
return view('/demo/index');
|
||||
}
|
||||
|
||||
public function demo()
|
||||
{
|
||||
return response('demo');
|
||||
}
|
||||
|
||||
}
|
||||
21
plugin/demo/app/index/view/demo/index.html
Normal file
21
plugin/demo/app/index/view/demo/index.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<layout name="layout:layout"/>
|
||||
<!-- 内容主体区域 -->
|
||||
<div id="content">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body"> 示例页面 TODO...</div>
|
||||
<!-- // 创建数据实例 -->
|
||||
<table id="lay-tableList" lay-filter="lay-tableList"></table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- // 列表工具栏 -->
|
||||
<script type="text/html" id="tableBar">
|
||||
<!-- // TODO-->
|
||||
</script>
|
||||
|
||||
<script>
|
||||
layui.use(['table','jquery'], function () {
|
||||
let $ = layui.jquery;
|
||||
let table = layui.table;
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user