first commit
This commit is contained in:
commit
40676f8b14
1
.example.env
Normal file
1
.example.env
Normal file
@ -0,0 +1 @@
|
|||||||
|
APP_DEBUG = false
[APP]
DEFAULT_TIMEZONE = Asia/Shanghai
[DATABASE]
TYPE = mysql
HOSTNAME = 127.0.0.1
DATABASE = test
USERNAME = username
PASSWORD = password
HOSTPORT = 3306
CHARSET = utf8
DEBUG = true
[LANG]
default_lang = zh-cn
|
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
/.idea
|
||||||
|
/.vscode
|
||||||
|
/vendor
|
||||||
|
*.log
|
||||||
|
.env
|
42
.travis.yml
Normal file
42
.travis.yml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
sudo: false
|
||||||
|
|
||||||
|
language: php
|
||||||
|
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- stable
|
||||||
|
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- $HOME/.composer/cache
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- composer self-update
|
||||||
|
|
||||||
|
install:
|
||||||
|
- composer install --no-dev --no-interaction --ignore-platform-reqs
|
||||||
|
- zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip .
|
||||||
|
- composer require --update-no-dev --no-interaction "topthink/think-image:^1.0"
|
||||||
|
- composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0"
|
||||||
|
- composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0"
|
||||||
|
- composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0"
|
||||||
|
- composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0"
|
||||||
|
- composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0"
|
||||||
|
- composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0"
|
||||||
|
- composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0"
|
||||||
|
- composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0"
|
||||||
|
- zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip .
|
||||||
|
|
||||||
|
script:
|
||||||
|
- php think unit
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
provider: releases
|
||||||
|
api_key:
|
||||||
|
secure: TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw=
|
||||||
|
file:
|
||||||
|
- ThinkPHP_Core.zip
|
||||||
|
- ThinkPHP_Full.zip
|
||||||
|
skip_cleanup: true
|
||||||
|
on:
|
||||||
|
tags: true
|
32
LICENSE.txt
Normal file
32
LICENSE.txt
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
|
||||||
|
版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn)
|
||||||
|
All rights reserved。
|
||||||
|
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
|
||||||
|
|
||||||
|
Apache Licence是著名的非盈利开源组织Apache采用的协议。
|
||||||
|
该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,
|
||||||
|
允许代码修改,再作为开源或商业软件发布。需要满足
|
||||||
|
的条件:
|
||||||
|
1. 需要给代码的用户一份Apache Licence ;
|
||||||
|
2. 如果你修改了代码,需要在被修改的文件中说明;
|
||||||
|
3. 在延伸的代码中(修改和有源代码衍生的代码中)需要
|
||||||
|
带有原来代码中的协议,商标,专利声明和其他原来作者规
|
||||||
|
定需要包含的说明;
|
||||||
|
4. 如果再发布的产品中包含一个Notice文件,则在Notice文
|
||||||
|
件中需要带有本协议内容。你可以在Notice中增加自己的
|
||||||
|
许可,但不可以表现为对Apache Licence构成更改。
|
||||||
|
具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
52
README.md
Normal file
52
README.md
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
ThinkPHP 6.0
|
||||||
|
===============
|
||||||
|
|
||||||
|
> 运行环境要求PHP7.1+。
|
||||||
|
|
||||||
|
## 主要新特性
|
||||||
|
|
||||||
|
* 采用`PHP7`强类型(严格模式)
|
||||||
|
* 支持更多的`PSR`规范
|
||||||
|
* 原生多应用支持
|
||||||
|
* 更强大和易用的查询
|
||||||
|
* 全新的事件系统
|
||||||
|
* 模型事件和数据库事件统一纳入事件系统
|
||||||
|
* 模板引擎分离出核心
|
||||||
|
* 内部功能中间件化
|
||||||
|
* SESSION/Cookie机制改进
|
||||||
|
* 对Swoole以及协程支持改进
|
||||||
|
* 对IDE更加友好
|
||||||
|
* 统一和精简大量用法
|
||||||
|
|
||||||
|
## 安装
|
||||||
|
|
||||||
|
~~~
|
||||||
|
composer create-project topthink/think tp 6.0.*-dev
|
||||||
|
~~~
|
||||||
|
|
||||||
|
如果需要更新框架使用
|
||||||
|
~~~
|
||||||
|
composer update topthink/framework
|
||||||
|
~~~
|
||||||
|
|
||||||
|
## 文档
|
||||||
|
|
||||||
|
[完全开发手册](https://www.kancloud.cn/manual/thinkphp6_0/content)
|
||||||
|
|
||||||
|
## 参与开发
|
||||||
|
|
||||||
|
请参阅 [ThinkPHP 核心框架包](https://github.com/top-think/framework)。
|
||||||
|
|
||||||
|
## 版权信息
|
||||||
|
|
||||||
|
ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
|
||||||
|
|
||||||
|
本项目包含的第三方源码和二进制文件之版权信息另行标注。
|
||||||
|
|
||||||
|
版权所有Copyright © 2006-2019 by ThinkPHP (http://thinkphp.cn)
|
||||||
|
|
||||||
|
All rights reserved。
|
||||||
|
|
||||||
|
ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
|
||||||
|
|
||||||
|
更多细节参阅 [LICENSE.txt](LICENSE.txt)
|
1
app/.htaccess
Normal file
1
app/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
deny from all
|
118
app/BaseController.php
Normal file
118
app/BaseController.php
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
<?php
|
||||||
|
declare (strict_types = 1);
|
||||||
|
|
||||||
|
namespace app;
|
||||||
|
|
||||||
|
use catcher\CatchAdmin;
|
||||||
|
use think\App;
|
||||||
|
use think\exception\ValidateException;
|
||||||
|
use think\facade\View;
|
||||||
|
use think\helper\Str;
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 控制器基础类
|
||||||
|
*/
|
||||||
|
abstract class BaseController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Request实例
|
||||||
|
* @var \think\Request
|
||||||
|
*/
|
||||||
|
protected $request;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用实例
|
||||||
|
* @var \think\App
|
||||||
|
*/
|
||||||
|
protected $app;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否批量验证
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $batchValidate = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 控制器中间件
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $middleware = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造方法
|
||||||
|
* @access public
|
||||||
|
* @param App $app 应用对象
|
||||||
|
*/
|
||||||
|
public function __construct(App $app)
|
||||||
|
{
|
||||||
|
$this->app = $app;
|
||||||
|
$this->request = $this->app->request;
|
||||||
|
|
||||||
|
// 控制器初始化
|
||||||
|
$this->initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化
|
||||||
|
protected function initialize()
|
||||||
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证数据
|
||||||
|
* @access protected
|
||||||
|
* @param array $data 数据
|
||||||
|
* @param string|array $validate 验证器名或者验证规则数组
|
||||||
|
* @param array $message 提示信息
|
||||||
|
* @param bool $batch 是否批量验证
|
||||||
|
* @return array|string|true
|
||||||
|
* @throws ValidateException
|
||||||
|
*/
|
||||||
|
protected function validate(array $data, $validate, array $message = [], bool $batch = false)
|
||||||
|
{
|
||||||
|
if (is_array($validate)) {
|
||||||
|
$v = new Validate();
|
||||||
|
$v->rule($validate);
|
||||||
|
} else {
|
||||||
|
if (strpos($validate, '.')) {
|
||||||
|
// 支持场景
|
||||||
|
list($validate, $scene) = explode('.', $validate);
|
||||||
|
}
|
||||||
|
$class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate);
|
||||||
|
$v = new $class();
|
||||||
|
if (!empty($scene)) {
|
||||||
|
$v->scene($scene);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$v->message($message);
|
||||||
|
|
||||||
|
// 是否批量验证
|
||||||
|
if ($batch || $this->batchValidate) {
|
||||||
|
$v->batch(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $v->failException(true)->check($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @time 2019年11月28日
|
||||||
|
* @param string $template
|
||||||
|
* @throws \Exception
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function fetch($template = ''): string
|
||||||
|
{
|
||||||
|
if (Str::contains($template, '::')) {
|
||||||
|
[$module, $template] = explode('::', $template);
|
||||||
|
|
||||||
|
View::config([
|
||||||
|
'view_path' => CatchAdmin::getViews()[$module]
|
||||||
|
]);
|
||||||
|
|
||||||
|
return View::fetch($template);
|
||||||
|
}
|
||||||
|
|
||||||
|
return View::fetch($template);
|
||||||
|
}
|
||||||
|
}
|
61
app/ExceptionHandle.php
Normal file
61
app/ExceptionHandle.php
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
namespace app;
|
||||||
|
|
||||||
|
use catcher\JsonResponse;
|
||||||
|
use think\db\exception\DataNotFoundException;
|
||||||
|
use think\db\exception\ModelNotFoundException;
|
||||||
|
use think\exception\Handle;
|
||||||
|
use think\exception\HttpException;
|
||||||
|
use think\exception\HttpResponseException;
|
||||||
|
use think\exception\ValidateException;
|
||||||
|
use think\Response;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用异常处理类
|
||||||
|
*/
|
||||||
|
class ExceptionHandle extends Handle
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 不需要记录信息(日志)的异常类列表
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $ignoreReport = [
|
||||||
|
HttpException::class,
|
||||||
|
HttpResponseException::class,
|
||||||
|
ModelNotFoundException::class,
|
||||||
|
DataNotFoundException::class,
|
||||||
|
ValidateException::class,
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录异常信息(包括日志或者其它方式记录)
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param Throwable $exception
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function report(Throwable $exception): void
|
||||||
|
{
|
||||||
|
// 使用内置的方式记录异常日志
|
||||||
|
parent::report($exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render an exception into an HTTP response.
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param \think\Request $request
|
||||||
|
* @param Throwable $e
|
||||||
|
* @return Response
|
||||||
|
*/
|
||||||
|
public function render($request, Throwable $e): Response
|
||||||
|
{
|
||||||
|
// 添加自定义异常处理机制
|
||||||
|
if ($request->isAjax()) {
|
||||||
|
return JsonResponse::fail($e->getMessage(), $e->getCode());
|
||||||
|
}
|
||||||
|
// 其他错误交给系统处理
|
||||||
|
return parent::render($request, $e);
|
||||||
|
}
|
||||||
|
}
|
40
app/Request.php
Normal file
40
app/Request.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
namespace app;
|
||||||
|
|
||||||
|
// 应用请求对象类
|
||||||
|
use app\exceptions\ValidateFailedException;
|
||||||
|
|
||||||
|
class Request extends \think\Request
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Request constructor.
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
$this->validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化验证
|
||||||
|
*
|
||||||
|
* @time 2019年11月27日
|
||||||
|
* @throws \Exception
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
protected function validate()
|
||||||
|
{
|
||||||
|
if (method_exists($this, 'getValidate')) {
|
||||||
|
$validate = $this->getValidate();
|
||||||
|
|
||||||
|
if (!$validate->check(request()->param())) {
|
||||||
|
throw new ValidateFailedException($validate->getError());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
2
app/common.php
Normal file
2
app/common.php
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<?php
|
||||||
|
// 应用公共文件
|
20
app/event.php
Normal file
20
app/event.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
// 事件定义文件
|
||||||
|
return [
|
||||||
|
'bind' => [
|
||||||
|
],
|
||||||
|
|
||||||
|
'listen' => [
|
||||||
|
'AppInit' => [],
|
||||||
|
'HttpRun' => [],
|
||||||
|
'HttpEnd' => [],
|
||||||
|
'LogLevel' => [],
|
||||||
|
'LogWrite' => [],
|
||||||
|
'RouteLoaded' => [
|
||||||
|
\app\event\LoadModuleRoutes::class,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
'subscribe' => [
|
||||||
|
],
|
||||||
|
];
|
25
app/event/LoadModuleRoutes.php
Normal file
25
app/event/LoadModuleRoutes.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
declare (strict_types = 1);
|
||||||
|
|
||||||
|
namespace app\event;
|
||||||
|
|
||||||
|
use catcher\CatchAdmin;
|
||||||
|
use think\Route;
|
||||||
|
|
||||||
|
class LoadModuleRoutes
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 处理
|
||||||
|
*
|
||||||
|
* @time 2019年11月29日
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function handle(): void
|
||||||
|
{
|
||||||
|
$router = app(Route::class);
|
||||||
|
|
||||||
|
$router->group(function () use ($router) {
|
||||||
|
include CatchAdmin::getRoutes();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
7
app/exceptions/LoginFailedException.php
Normal file
7
app/exceptions/LoginFailedException.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\exceptions;
|
||||||
|
|
||||||
|
class LoginFailedException extends \Exception
|
||||||
|
{
|
||||||
|
protected $code = 10002;
|
||||||
|
}
|
7
app/exceptions/ValidateFailedException.php
Normal file
7
app/exceptions/ValidateFailedException.php
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\exceptions;
|
||||||
|
|
||||||
|
class ValidateFailedException extends \Exception
|
||||||
|
{
|
||||||
|
protected $code = 10001;
|
||||||
|
}
|
10
app/middleware.php
Normal file
10
app/middleware.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
// 全局中间件定义文件
|
||||||
|
return [
|
||||||
|
// 全局请求缓存
|
||||||
|
// \think\middleware\CheckRequestCache::class,
|
||||||
|
// 多语言加载
|
||||||
|
// \think\middleware\LoadLangPack::class,
|
||||||
|
// Session初始化
|
||||||
|
\think\middleware\SessionInit::class
|
||||||
|
];
|
9
app/provider.php
Normal file
9
app/provider.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
use app\ExceptionHandle;
|
||||||
|
use app\Request;
|
||||||
|
|
||||||
|
// 容器Provider定义文件
|
||||||
|
return [
|
||||||
|
'think\Request' => Request::class,
|
||||||
|
'think\exception\Handle' => ExceptionHandle::class,
|
||||||
|
];
|
5
app/service.php
Normal file
5
app/service.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
return [
|
||||||
|
\jaguarjack\think\module\ThinkModuleService::class,
|
||||||
|
\catchAdmin\CatchAdminService::class,
|
||||||
|
];
|
22
catchAdmin/CatchAdminService.php
Normal file
22
catchAdmin/CatchAdminService.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
namespace catchAdmin;
|
||||||
|
|
||||||
|
use catcher\command\InstallCommand;
|
||||||
|
use catcher\command\ModuleCacheCommand;
|
||||||
|
use think\Service;
|
||||||
|
|
||||||
|
class CatchAdminService extends Service
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @time 2019年11月29日
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
$this->commands([
|
||||||
|
InstallCommand::class,
|
||||||
|
ModuleCacheCommand::class,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
22
catchAdmin/helper.php
Normal file
22
catchAdmin/helper.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模块 view path
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
use think\helper\Arr;
|
||||||
|
|
||||||
|
if (!function_exists('getModuleViewPath()')) {
|
||||||
|
function getModuleViewPath($module) {
|
||||||
|
|
||||||
|
if (file_exists($views = app()->getRuntimePath() . 'module' . DIRECTORY_SEPARATOR . 'view.php')) {
|
||||||
|
$views = include $views;
|
||||||
|
|
||||||
|
return $views[$module];
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
12
catchAdmin/index/controller/Index.php
Normal file
12
catchAdmin/index/controller/Index.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
namespace catchAdmin\index\controller;
|
||||||
|
|
||||||
|
use app\BaseController;
|
||||||
|
|
||||||
|
class Index extends BaseController
|
||||||
|
{
|
||||||
|
public function index(): string
|
||||||
|
{
|
||||||
|
return $this->fetch('index::index');
|
||||||
|
}
|
||||||
|
}
|
13
catchAdmin/index/module.json
Normal file
13
catchAdmin/index/module.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "首页管理",
|
||||||
|
"alias": "index",
|
||||||
|
"description": "",
|
||||||
|
"keywords": [],
|
||||||
|
"order": 0,
|
||||||
|
"services": [
|
||||||
|
"catchAdmin\\index\\IndexService"
|
||||||
|
],
|
||||||
|
"aliases": {},
|
||||||
|
"files": [],
|
||||||
|
"requires": []
|
||||||
|
}
|
3
catchAdmin/index/route.php
Normal file
3
catchAdmin/index/route.php
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$router->get('/', '\catchAdmin\index\controller\index/index');
|
252
catchAdmin/index/view/index.html
Normal file
252
catchAdmin/index/view/index.html
Normal file
@ -0,0 +1,252 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
<link href="./assets/images/favicon.ico" rel="icon">
|
||||||
|
<title>EasyWeb后台开发框架</title>
|
||||||
|
<link rel="stylesheet" href="/static/assets/libs/layui/css/layui.css"/>
|
||||||
|
<link rel="stylesheet" href="/static/assets/module/admin.css?v=315"/>
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||||
|
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
</head>
|
||||||
|
<body class="layui-layout-body">
|
||||||
|
<div class="layui-layout layui-layout-admin">
|
||||||
|
<!-- 头部 -->
|
||||||
|
<div class="layui-header">
|
||||||
|
<div class="layui-logo">
|
||||||
|
<img src="/static/assets/images/logo.png"/>
|
||||||
|
<cite> EasyWeb Iframe</cite>
|
||||||
|
</div>
|
||||||
|
<ul class="layui-nav layui-layout-left">
|
||||||
|
<li class="layui-nav-item" lay-unselect>
|
||||||
|
<a ew-event="flexible" title="侧边伸缩"><i class="layui-icon layui-icon-shrink-right"></i></a>
|
||||||
|
</li>
|
||||||
|
<li class="layui-nav-item" lay-unselect>
|
||||||
|
<a ew-event="refresh" title="刷新"><i class="layui-icon layui-icon-refresh-3"></i></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="layui-nav layui-layout-right">
|
||||||
|
<li class="layui-nav-item" lay-unselect>
|
||||||
|
<a ew-event="message" title="消息">
|
||||||
|
<i class="layui-icon layui-icon-notice"></i>
|
||||||
|
<span class="layui-badge-dot"></span><!--小红点-->
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="layui-nav-item" lay-unselect>
|
||||||
|
<a ew-event="note" title="便签"><i class="layui-icon layui-icon-note"></i></a>
|
||||||
|
</li>
|
||||||
|
<li class="layui-nav-item layui-hide-xs" lay-unselect>
|
||||||
|
<a ew-event="fullScreen" title="全屏"><i class="layui-icon layui-icon-screen-full"></i></a>
|
||||||
|
</li>
|
||||||
|
<li class="layui-nav-item" lay-unselect>
|
||||||
|
<a>
|
||||||
|
<img src="assets/images/head.png" class="layui-nav-img">
|
||||||
|
<cite>管理员</cite>
|
||||||
|
</a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd lay-unselect>
|
||||||
|
<a ew-href="page/template/user-info.html">个人中心</a>
|
||||||
|
</dd>
|
||||||
|
<dd lay-unselect>
|
||||||
|
<a ew-event="psw">修改密码</a>
|
||||||
|
</dd>
|
||||||
|
<hr>
|
||||||
|
<dd lay-unselect>
|
||||||
|
<a ew-event="logout" data-url="page/template/login.html">退出</a>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
<li class="layui-nav-item" lay-unselect>
|
||||||
|
<a ew-event="theme" title="主题"><i class="layui-icon layui-icon-more-vertical"></i></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 侧边栏 -->
|
||||||
|
<div class="layui-side">
|
||||||
|
<div class="layui-side-scroll">
|
||||||
|
<ul class="layui-nav layui-nav-tree arrow2" lay-filter="admin-side-nav" lay-accordion="true"
|
||||||
|
style="margin-top: 15px;">
|
||||||
|
<li class="layui-nav-item">
|
||||||
|
<a><i class="layui-icon layui-icon-home"></i> <cite>Dashboard</cite></a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a lay-href="page/console/console.html">控制台</a></dd>
|
||||||
|
<dd><a lay-href="page/console/introduction.html">介绍页</a></dd>
|
||||||
|
<dd><a lay-href="page/console/dashboard.html">分析页</a></dd>
|
||||||
|
<dd><a lay-href="page/console/welcome.html">欢迎页</a></dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
<li class="layui-nav-item">
|
||||||
|
<a><i class="layui-icon layui-icon-set"></i> <cite>系统管理</cite></a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a lay-href="page/system/user.html">用户管理</a></dd>
|
||||||
|
<dd><a lay-href="page/system/role.html">角色管理</a></dd>
|
||||||
|
<dd><a lay-href="page/system/authorities.html">菜单管理</a></dd>
|
||||||
|
<dd><a lay-href="page/system/loginRecord.html">登录日志</a></dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
<li class="layui-nav-item">
|
||||||
|
<a><i class="layui-icon layui-icon-template"></i> <cite>模板页面</cite></a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd>
|
||||||
|
<a>表单页</a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a lay-href="page/template/form/form-basic.html">基础表单</a></dd>
|
||||||
|
<dd><a lay-href="page/template/form/form-advance.html">复杂表单</a></dd>
|
||||||
|
<dd><a lay-href="page/template/form/form-step.html">分步表单</a></dd>
|
||||||
|
</dl>
|
||||||
|
</dd>
|
||||||
|
<dd>
|
||||||
|
<a>表格页</a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a lay-href="page/template/table/table-basic.html">数据表格</a></dd>
|
||||||
|
<dd><a lay-href="page/template/table/table-advance.html">复杂查询</a></dd>
|
||||||
|
<dd><a lay-href="page/template/table/table-ltrt.html">左树右表</a></dd>
|
||||||
|
<dd><a lay-href="page/template/table/table-img.html">表格缩略图</a></dd>
|
||||||
|
</dl>
|
||||||
|
</dd>
|
||||||
|
<dd>
|
||||||
|
<a>错误页</a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a lay-href="page/template/error/error-500.html">500</a></dd>
|
||||||
|
<dd><a lay-href="page/template/error/error-404.html">404</a></dd>
|
||||||
|
<dd><a lay-href="page/template/error/error-403.html">403</a></dd>
|
||||||
|
</dl>
|
||||||
|
</dd>
|
||||||
|
<dd><a lay-href="page/template/user-info.html">个人中心</a></dd>
|
||||||
|
<dd><a lay-href="page/template/empty.html">空白页面</a></dd>
|
||||||
|
<dd><a href="page/template/login.html" target="_blank">登录页面</a></dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
<li class="layui-nav-item">
|
||||||
|
<a><i class="layui-icon layui-icon-component"></i> <cite>扩展组件</cite></a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd>
|
||||||
|
<a>常用组件</a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a lay-href="page/plugin/basic/dialog.html">弹出层</a></dd>
|
||||||
|
<dd><a lay-href="page/plugin/basic/dropdown.html">下拉菜单</a></dd>
|
||||||
|
<dd><a lay-href="page/plugin/basic/cascader.html">级联选择器</a></dd>
|
||||||
|
<dd><a lay-href="page/plugin/basic/notice.html">消息通知</a></dd>
|
||||||
|
<dd><a lay-href="page/plugin/basic/tips.html">文字提示</a></dd>
|
||||||
|
<dd><a lay-href="page/plugin/basic/tagsInput.html">标签输入</a></dd>
|
||||||
|
<dd><a lay-href="page/plugin/basic/split.html">分割面板</a></dd>
|
||||||
|
<dd><a lay-href="page/plugin/basic/circleProgress.html">圆形进度条</a></dd>
|
||||||
|
</dl>
|
||||||
|
</dd>
|
||||||
|
<dd>
|
||||||
|
<a>进阶组件</a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a lay-href="page/plugin/advance/tableX.html">表格扩展</a></dd>
|
||||||
|
<dd><a lay-href="page/plugin/advance/formX.html">表单扩展</a></dd>
|
||||||
|
<dd><a lay-href="page/plugin/advance/dataGrid.html">数据列表</a></dd>
|
||||||
|
<dd><a lay-href="page/plugin/advance/printer.html">打印插件</a></dd>
|
||||||
|
<dd><a lay-href="page/plugin/advance/ckeditor.html">富文本编辑</a></dd>
|
||||||
|
<dd><a lay-href="page/plugin/advance/player.html">视频播放器</a></dd>
|
||||||
|
<dd><a lay-href="page/plugin/advance/introJs.html">引导插件</a></dd>
|
||||||
|
</dl>
|
||||||
|
</dd>
|
||||||
|
<dd>
|
||||||
|
<a>工具组件</a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a lay-href="page/plugin/util/contextMenu.html">ContextMenu</a></dd>
|
||||||
|
<dd><a lay-href="page/plugin/util/mousewheel.html">MouseWheel</a></dd>
|
||||||
|
<dd><a lay-href="page/plugin/util/other.html">其他</a></dd>
|
||||||
|
</dl>
|
||||||
|
</dd>
|
||||||
|
<dd><a lay-href="page/plugin/more.html">更多扩展</a></dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
<li class="layui-nav-item">
|
||||||
|
<a><i class="layui-icon layui-icon-app"></i> <cite>经典实例</cite></a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a lay-href="page/example/dialog.html">弹窗实例</a></dd>
|
||||||
|
<dd><a lay-href="page/example/syxm.html">经典实例2</a></dd>
|
||||||
|
<dd><a lay-href="page/example/form.html">表单实例</a></dd>
|
||||||
|
<dd><a lay-href="page/example/file.html">文件管理</a></dd>
|
||||||
|
<dd><a lay-href="page/example/table-crud.html">表格CRUD</a></dd>
|
||||||
|
<dd><a href="page/example/side-more.html" target="_blank">多系统模式</a></dd>
|
||||||
|
<dd><a href="page/example/side-ajax.html" target="_blank">Ajax侧边栏</a></dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
<li class="layui-nav-item">
|
||||||
|
<a><i class="layui-icon layui-icon-release"></i> <cite>LayUI组件</cite></a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a lay-href="https://www.layui.com/demo/button.html">组件演示</a></dd>
|
||||||
|
<dd><a lay-href="https://www.layui.com/doc/element/button.html#use">layui文档</a></dd>
|
||||||
|
<dd><a lay-href="https://layer.layui.com/">layer弹窗组件</a></dd>
|
||||||
|
<dd><a lay-href="https://www.layui.com/laydate/">laydate日期组件</a></dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
<li class="layui-nav-item">
|
||||||
|
<a><i class="layui-icon layui-icon-unlink"></i> <cite>多级菜单</cite></a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a>二级菜单</a></dd>
|
||||||
|
<dd>
|
||||||
|
<a>二级菜单</a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a>三级菜单</a></dd>
|
||||||
|
<dd>
|
||||||
|
<a>三级菜单</a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a>四级菜单</a></dd>
|
||||||
|
<dd>
|
||||||
|
<a>四级菜单</a>
|
||||||
|
<dl class="layui-nav-child">
|
||||||
|
<dd><a>五级菜单</a></dd>
|
||||||
|
<dd>
|
||||||
|
<a lay-href="https://baidu.com">百度一下</a>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
<li class="layui-nav-item">
|
||||||
|
<a lay-href="//baidu.com"><i class="layui-icon layui-icon-unlink"></i> <cite>一级菜单</cite></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 主体部分 -->
|
||||||
|
<div class="layui-body"></div>
|
||||||
|
<!-- 底部 -->
|
||||||
|
<div class="layui-footer">
|
||||||
|
copyright © 2019 <a href="http://easyweb.vip" target="_blank">easyweb.vip</a> all rights reserved.
|
||||||
|
<span class="pull-right">Version 3.1.5</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 加载动画 -->
|
||||||
|
<div class="page-loading">
|
||||||
|
<div class="ball-loader">
|
||||||
|
<span></span><span></span><span></span><span></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- js部分 -->
|
||||||
|
<script type="text/javascript" src="/static/assets/libs/layui/layui.js"></script>
|
||||||
|
<script type="text/javascript" src="/static/assets/js/common.js?v=315"></script>
|
||||||
|
<script>
|
||||||
|
layui.use(['index'], function () {
|
||||||
|
var $ = layui.jquery;
|
||||||
|
var index = layui.index;
|
||||||
|
|
||||||
|
// 默认加载主页
|
||||||
|
index.loadHome({
|
||||||
|
menuPath: 'page/console/console.html',
|
||||||
|
menuName: '<i class="layui-icon layui-icon-home"></i>'
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
56
catchAdmin/login/Auth.php
Normal file
56
catchAdmin/login/Auth.php
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?php
|
||||||
|
namespace catchAdmin\login;
|
||||||
|
|
||||||
|
use app\exceptions\LoginFailedException;
|
||||||
|
use think\Db;
|
||||||
|
use think\facade\Session;
|
||||||
|
|
||||||
|
class Auth
|
||||||
|
{
|
||||||
|
protected $loginUser = 'admin_user';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auth constructor.
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->loginUser = md5($this->loginUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登陆
|
||||||
|
*
|
||||||
|
* @time 2019年11月28日
|
||||||
|
* @param $params
|
||||||
|
* @throws LoginFailedException
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function login($params)
|
||||||
|
{
|
||||||
|
$user = Db::table('admin_users')
|
||||||
|
->where('name', $params['name'])
|
||||||
|
// ->where('password', $params['password'])
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if (!password_verify($params('password'), $user->password)) {
|
||||||
|
throw new LoginFailedException('登陆失败, 请检查用户名和密码');
|
||||||
|
}
|
||||||
|
|
||||||
|
Session::set($this->loginUser, $user);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出登陆
|
||||||
|
*
|
||||||
|
* @time 2019年11月28日
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function logout()
|
||||||
|
{
|
||||||
|
Session::delete($this->loginUser);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
49
catchAdmin/login/controller/Index.php
Normal file
49
catchAdmin/login/controller/Index.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?php
|
||||||
|
namespace catchAdmin\login\controller;
|
||||||
|
|
||||||
|
use app\BaseController;
|
||||||
|
use catchAdmin\login\Auth;
|
||||||
|
use catchAdmin\login\request\LoginRequest;
|
||||||
|
|
||||||
|
class Index extends BaseController
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 登录
|
||||||
|
*
|
||||||
|
* @time 2019年11月30日
|
||||||
|
* @throws \Exception
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return $this->fetch('login::index');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登陆
|
||||||
|
*
|
||||||
|
* @time 2019年11月28日
|
||||||
|
* @param LoginRequest $request
|
||||||
|
* @return bool|string
|
||||||
|
* @throws \app\exceptions\LoginFailedException
|
||||||
|
*/
|
||||||
|
public function login(LoginRequest $request)
|
||||||
|
{
|
||||||
|
(new Auth())->login($request->post());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登出
|
||||||
|
*
|
||||||
|
* @time 2019年11月28日
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function logout(): bool
|
||||||
|
{
|
||||||
|
if ((new Auth())->logout()) {
|
||||||
|
return redirect(url('login'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
13
catchAdmin/login/module.json
Normal file
13
catchAdmin/login/module.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "登陆",
|
||||||
|
"alias": "login",
|
||||||
|
"description": "",
|
||||||
|
"keywords": [],
|
||||||
|
"order": 1,
|
||||||
|
"services": [
|
||||||
|
"catchAdmin\\login\\LoginService"
|
||||||
|
],
|
||||||
|
"aliases": {},
|
||||||
|
"files": [],
|
||||||
|
"requires": []
|
||||||
|
}
|
19
catchAdmin/login/request/LoginRequest.php
Normal file
19
catchAdmin/login/request/LoginRequest.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
namespace catchAdmin\login\request;
|
||||||
|
|
||||||
|
use app\Request;
|
||||||
|
use catchAdmin\login\validate\LoginValidate;
|
||||||
|
|
||||||
|
class LoginRequest extends Request
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @time 2019年11月27日
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function getValidate()
|
||||||
|
{
|
||||||
|
// TODO: Implement getValidate() method.
|
||||||
|
return new LoginValidate();
|
||||||
|
}
|
||||||
|
}
|
8
catchAdmin/login/route.php
Normal file
8
catchAdmin/login/route.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
# 登陆页面
|
||||||
|
$router->get('login', '\catchAdmin\login\controller\Index/index');
|
||||||
|
# 登入
|
||||||
|
$router->post('login', '\catchAdmin\login\controller\Index/login');
|
||||||
|
# 登出
|
||||||
|
$router->post('logout', '\catchAdmin\login\controller\Index/logout');
|
14
catchAdmin/login/validate/LoginValidate.php
Normal file
14
catchAdmin/login/validate/LoginValidate.php
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace catchAdmin\login\validate;
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class LoginValidate extends Validate
|
||||||
|
{
|
||||||
|
protected $rule = [
|
||||||
|
'name|用户名' => 'require|max:25',
|
||||||
|
'password|密码' => 'require',
|
||||||
|
'captcha|验证码' => 'require|captcha'
|
||||||
|
];
|
||||||
|
}
|
117
catchAdmin/login/view/index.html
Normal file
117
catchAdmin/login/view/index.html
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8"/>
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
<title>登录</title>
|
||||||
|
<link rel="stylesheet" href="/static/assets/libs/layui/css/layui.css"/>
|
||||||
|
<link rel="stylesheet" href="/static/assets/css/login.css?v=315">
|
||||||
|
<link rel="stylesheet" href="/static/assets/module/admin.css?v=315">
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||||
|
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
<script>
|
||||||
|
if (window != top) {
|
||||||
|
top.location.replace(location.href);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
.captcha {
|
||||||
|
width: 114px;
|
||||||
|
height: 38px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="login-wrapper">
|
||||||
|
<div class="login-header">
|
||||||
|
<img src="/static/assets/images/logo.png"> EasyWeb后台开发框架
|
||||||
|
</div>
|
||||||
|
<div class="login-body">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-header">
|
||||||
|
<i class="layui-icon layui-icon-engine"></i> 用户登录
|
||||||
|
</div>
|
||||||
|
<form class="layui-card-body layui-form layui-form-pane">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label"><i class="layui-icon layui-icon-username"></i></label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input name="name" type="text" placeholder="账号" class="layui-input"
|
||||||
|
lay-verType="tips" lay-verify="required" required/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label"><i class="layui-icon layui-icon-password"></i></label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input name="password" type="password" placeholder="密码" class="layui-input"
|
||||||
|
lay-verType="tips" lay-verify="required" required/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label"><i class="layui-icon layui-icon-vercode"></i></label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<div class="layui-row inline-block">
|
||||||
|
<div class="layui-col-xs7">
|
||||||
|
<input name="captcha" type="text" placeholder="验证码" class="layui-input"
|
||||||
|
autocomplete="off" lay-verType="tips" lay-verify="required" required/>
|
||||||
|
</div>
|
||||||
|
<div class="layui-col-xs5" style="padding-left: 6px;">
|
||||||
|
<img src="{:captcha_src()}" alt="captcha" class="captcha" onclick="this.src = this.src + '?t=' + (new Date).getTime();"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<!--<a href="javascript:;" class="layui-link">帐号注册</a>-->
|
||||||
|
<!--<a href="javascript:;" class="layui-link pull-right">忘记密码?</a>-->
|
||||||
|
</div>
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<button lay-filter="login-submit" class="layui-btn layui-btn-fluid" lay-submit>登 录</button>
|
||||||
|
</div>
|
||||||
|
<!--<div class="layui-form-item login-other">
|
||||||
|
<label>第三方登录</label>
|
||||||
|
<a href="javascript:;"><i class="layui-icon layui-icon-login-qq"></i></a>
|
||||||
|
<a href="javascript:;"><i class="layui-icon layui-icon-login-wechat"></i></a>
|
||||||
|
<a href="javascript:;"><i class="layui-icon layui-icon-login-weibo"></i></a>
|
||||||
|
</div>-->
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="login-footer">
|
||||||
|
<p>© 2015 ~ {:date('Y', time())} @Lawyer 版权所有</p>
|
||||||
|
<!--<p>
|
||||||
|
<span><a href="https://easyweb.vip" target="_blank">获取授权</a></span>
|
||||||
|
<span><a href="https://easyweb.vip/doc/" target="_blank">开发文档</a></span>
|
||||||
|
<span><a href="https://demo.easyweb.vip/spa/" target="_blank">单页面版</a></span>
|
||||||
|
</p>-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- js部分 -->
|
||||||
|
<script type="text/javascript" src="/static/assets/libs/layui/layui.js"></script>
|
||||||
|
<script type="text/javascript" src="/static/assets/js/common.js?v=315"></script>
|
||||||
|
<script>
|
||||||
|
layui.use(['layer', 'form'], function () {
|
||||||
|
var $ = layui.jquery;
|
||||||
|
var layer = layui.layer;
|
||||||
|
var form = layui.form;
|
||||||
|
|
||||||
|
// 表单提交
|
||||||
|
form.on('submit(login-submit)', function (obj) {
|
||||||
|
$.ajax({
|
||||||
|
url: "{:url('login')}",
|
||||||
|
type: 'post',
|
||||||
|
data: obj.field,
|
||||||
|
success: function(response) {
|
||||||
|
layer.msg(response.msg)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
13
catchAdmin/permissions/module.json
Normal file
13
catchAdmin/permissions/module.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "权限管理",
|
||||||
|
"alias": "permissions",
|
||||||
|
"description": "",
|
||||||
|
"keywords": [],
|
||||||
|
"order": 2,
|
||||||
|
"services": [
|
||||||
|
"catchAdmin\\permissions\\PermissionService"
|
||||||
|
],
|
||||||
|
"aliases": {},
|
||||||
|
"files": [],
|
||||||
|
"requires": []
|
||||||
|
}
|
1
catchAdmin/permissions/route.php
Normal file
1
catchAdmin/permissions/route.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php
|
10
catchAdmin/services.php
Normal file
10
catchAdmin/services.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
// This file is automatically generated at:2019-11-29 08:20:23
|
||||||
|
declare (strict_types = 1);
|
||||||
|
return array (
|
||||||
|
'module\\index\\IndexService' => false,
|
||||||
|
'module\\install\\InstallService' => false,
|
||||||
|
'module\\login\\LoginService' => false,
|
||||||
|
'module\\permissions\\PermissionService' => false,
|
||||||
|
'module\\user\\UserService' => false,
|
||||||
|
);
|
33
catchAdmin/user/controller/Index.php
Normal file
33
catchAdmin/user/controller/Index.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
namespace catchAdmin\user\controller;
|
||||||
|
|
||||||
|
use app\BaseController;
|
||||||
|
|
||||||
|
class Index extends BaseController
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save()
|
||||||
|
{}
|
||||||
|
|
||||||
|
public function read()
|
||||||
|
{}
|
||||||
|
|
||||||
|
public function edit()
|
||||||
|
{}
|
||||||
|
|
||||||
|
public function update()
|
||||||
|
{}
|
||||||
|
|
||||||
|
public function delete()
|
||||||
|
{}
|
||||||
|
|
||||||
|
}
|
44
catchAdmin/user/database/migrations/20191128114204_users.php
Normal file
44
catchAdmin/user/database/migrations/20191128114204_users.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use think\migration\Migrator;
|
||||||
|
use think\migration\db\Column;
|
||||||
|
|
||||||
|
class Users extends Migrator
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Change Method.
|
||||||
|
*
|
||||||
|
* Write your reversible migrations using this method.
|
||||||
|
*
|
||||||
|
* More information on writing migrations is available here:
|
||||||
|
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
|
||||||
|
*
|
||||||
|
* The following commands can be used in this method and Phinx will
|
||||||
|
* automatically reverse them when rolling back:
|
||||||
|
*
|
||||||
|
* createTable
|
||||||
|
* renameTable
|
||||||
|
* addColumn
|
||||||
|
* renameColumn
|
||||||
|
* addIndex
|
||||||
|
* addForeignKey
|
||||||
|
*
|
||||||
|
* Remember to call "create()" or "update()" and NOT "save()" when working
|
||||||
|
* with the Table class.
|
||||||
|
*/
|
||||||
|
public function change()
|
||||||
|
{
|
||||||
|
$table = $this->table('users',array('engine'=>'Innodb'));
|
||||||
|
$table->addColumn('username', 'string',array('limit' => 15,'default'=>'','comment'=>'用户名'))
|
||||||
|
->addColumn('password', 'string',array('limit' => 255,'comment'=>'用户密码'))
|
||||||
|
->addColumn('email', 'string',array('limit' => 100, 'comment'=>'邮箱 登录'))
|
||||||
|
->addColumn('status', 'boolean',array('limit' => 1,'default'=> 1,'comment'=>'用户状态 1 正常 2 禁用'))
|
||||||
|
->addColumn('last_login_ip', 'integer',array('limit' => 11,'default'=>0,'comment'=>'最后登录IP'))
|
||||||
|
->addColumn('last_login_time', 'integer',array('default'=>0,'comment'=>'最后登录时间', 'unsigned' => true))
|
||||||
|
->addColumn('created_at', 'integer',array('default'=>0,'comment'=>'创建时间', 'unsigned' => true))
|
||||||
|
->addColumn('updated_at', 'integer',array('default'=>0,'comment'=>'更新时间', 'unsigned' => true))
|
||||||
|
->addColumn('delete_at', 'boolean',array('limit' => 1,'default'=>0,'comment'=>'删除状态,0未删除 >0 已删除', 'unsigned' => true))
|
||||||
|
->addIndex(array('email'), array('unique' => true))
|
||||||
|
->create();
|
||||||
|
}
|
||||||
|
}
|
19
catchAdmin/user/database/seeds/Abc.php
Normal file
19
catchAdmin/user/database/seeds/Abc.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use think\migration\Seeder;
|
||||||
|
|
||||||
|
class Abc extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run Method.
|
||||||
|
*
|
||||||
|
* Write your database seeder using this method.
|
||||||
|
*
|
||||||
|
* More information on writing seeders is available here:
|
||||||
|
* http://docs.phinx.org/en/latest/seeding.html
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
13
catchAdmin/user/module.json
Normal file
13
catchAdmin/user/module.json
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"name": "用户管理",
|
||||||
|
"alias": "user",
|
||||||
|
"description": "",
|
||||||
|
"keywords": [],
|
||||||
|
"order": 2,
|
||||||
|
"services": [
|
||||||
|
"catchAdmin\\user\\UserService"
|
||||||
|
],
|
||||||
|
"aliases": {},
|
||||||
|
"files": [],
|
||||||
|
"requires": []
|
||||||
|
}
|
3
catchAdmin/user/route.php
Normal file
3
catchAdmin/user/route.php
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$router->resource('user', '\catchAdmin\user\controller\Index');
|
10
catchAdmin/user/view/create.html
Normal file
10
catchAdmin/user/view/create.html
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
10
catchAdmin/user/view/edit.html
Normal file
10
catchAdmin/user/view/edit.html
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
10
catchAdmin/user/view/index.html
Normal file
10
catchAdmin/user/view/index.html
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
52
composer.json
Normal file
52
composer.json
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
"name": "topthink/think",
|
||||||
|
"description": "the new thinkphp framework",
|
||||||
|
"type": "project",
|
||||||
|
"keywords": [
|
||||||
|
"framework",
|
||||||
|
"thinkphp",
|
||||||
|
"ORM"
|
||||||
|
],
|
||||||
|
"homepage": "http://thinkphp.cn/",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "liu21st",
|
||||||
|
"email": "liu21st@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"php": ">=7.1.0",
|
||||||
|
"topthink/framework": "^6.0.0",
|
||||||
|
"topthink/think-orm": "^2.0",
|
||||||
|
"topthink/think-view": "^1.0",
|
||||||
|
"topthink/think-migration": "^3.0",
|
||||||
|
"topthink/think-captcha": "^3.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"symfony/var-dumper": "^4.2",
|
||||||
|
"topthink/think-trace":"^1.0"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"files": [
|
||||||
|
"catchAdmin/helper.php"
|
||||||
|
],
|
||||||
|
"psr-4": {
|
||||||
|
"app\\": "app",
|
||||||
|
"catchAdmin\\": "catchAdmin",
|
||||||
|
"jaguarjack\\think\\module\\": "extend/think-module/src"
|
||||||
|
},
|
||||||
|
"psr-0": {
|
||||||
|
"": "extend/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"config": {
|
||||||
|
"preferred-install": "dist"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"post-autoload-dump": [
|
||||||
|
"@php think service:discover",
|
||||||
|
"@php think vendor:publish"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
1067
composer.lock
generated
Normal file
1067
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
36
config/app.php
Normal file
36
config/app.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 应用设置
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
use think\facade\Env;
|
||||||
|
|
||||||
|
return [
|
||||||
|
// 应用地址
|
||||||
|
'app_host' => Env::get('app.host', ''),
|
||||||
|
// 应用的命名空间
|
||||||
|
'app_namespace' => '',
|
||||||
|
// 是否启用路由
|
||||||
|
'with_route' => true,
|
||||||
|
// 是否启用事件
|
||||||
|
'with_event' => true,
|
||||||
|
// 默认应用
|
||||||
|
'default_app' => 'index',
|
||||||
|
// 默认时区
|
||||||
|
'default_timezone' => 'Asia/Shanghai',
|
||||||
|
|
||||||
|
// 应用映射(自动多应用模式有效)
|
||||||
|
'app_map' => [],
|
||||||
|
// 域名绑定(自动多应用模式有效)
|
||||||
|
'domain_bind' => [],
|
||||||
|
// 禁止URL访问的应用列表(自动多应用模式有效)
|
||||||
|
'deny_app_list' => [],
|
||||||
|
|
||||||
|
// 异常页面的模板文件
|
||||||
|
'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',
|
||||||
|
|
||||||
|
// 错误显示信息,非调试模式有效
|
||||||
|
'error_message' => '页面错误!请稍后再试~',
|
||||||
|
// 显示错误信息
|
||||||
|
'show_error_msg' => false,
|
||||||
|
];
|
30
config/cache.php
Normal file
30
config/cache.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
use think\facade\Env;
|
||||||
|
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 缓存设置
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
return [
|
||||||
|
// 默认缓存驱动
|
||||||
|
'default' => Env::get('cache.driver', 'file'),
|
||||||
|
|
||||||
|
// 缓存连接方式配置
|
||||||
|
'stores' => [
|
||||||
|
'file' => [
|
||||||
|
// 驱动方式
|
||||||
|
'type' => 'File',
|
||||||
|
// 缓存保存目录
|
||||||
|
'path' => '',
|
||||||
|
// 缓存前缀
|
||||||
|
'prefix' => '',
|
||||||
|
// 缓存有效期 0表示永久缓存
|
||||||
|
'expire' => 0,
|
||||||
|
// 缓存标签前缀
|
||||||
|
'tag_prefix' => 'tag:',
|
||||||
|
// 序列化机制 例如 ['serialize', 'unserialize']
|
||||||
|
'serialize' => [],
|
||||||
|
],
|
||||||
|
// 更多的缓存连接
|
||||||
|
],
|
||||||
|
];
|
39
config/captcha.php
Normal file
39
config/captcha.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Captcha配置文件
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
return [
|
||||||
|
//验证码位数
|
||||||
|
'length' => 5,
|
||||||
|
// 验证码字符集合
|
||||||
|
'codeSet' => '2345678abcdefhijkmnpqrstuvwxyzABCDEFGHJKLMNPQRTUVWXY',
|
||||||
|
// 验证码过期时间
|
||||||
|
'expire' => 1800,
|
||||||
|
// 是否使用中文验证码
|
||||||
|
'useZh' => false,
|
||||||
|
// 是否使用算术验证码
|
||||||
|
'math' => false,
|
||||||
|
// 是否使用背景图
|
||||||
|
'useImgBg' => false,
|
||||||
|
//验证码字符大小
|
||||||
|
'fontSize' => 25,
|
||||||
|
// 是否使用混淆曲线
|
||||||
|
'useCurve' => true,
|
||||||
|
//是否添加杂点
|
||||||
|
'useNoise' => true,
|
||||||
|
// 验证码字体 不设置则随机
|
||||||
|
'fontttf' => '',
|
||||||
|
//背景颜色
|
||||||
|
'bg' => [243, 251, 254],
|
||||||
|
// 验证码图片高度
|
||||||
|
'imageH' => 0,
|
||||||
|
// 验证码图片宽度
|
||||||
|
'imageW' => 0,
|
||||||
|
|
||||||
|
// 添加额外的验证码设置
|
||||||
|
// verify => [
|
||||||
|
// 'length'=>4,
|
||||||
|
// ...
|
||||||
|
//],
|
||||||
|
];
|
9
config/console.php
Normal file
9
config/console.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 控制台配置
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
return [
|
||||||
|
// 指令定义
|
||||||
|
'commands' => [
|
||||||
|
],
|
||||||
|
];
|
18
config/cookie.php
Normal file
18
config/cookie.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Cookie设置
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
return [
|
||||||
|
// cookie 保存时间
|
||||||
|
'expire' => 0,
|
||||||
|
// cookie 保存路径
|
||||||
|
'path' => '/',
|
||||||
|
// cookie 有效域名
|
||||||
|
'domain' => '',
|
||||||
|
// cookie 启用安全传输
|
||||||
|
'secure' => false,
|
||||||
|
// httponly设置
|
||||||
|
'httponly' => false,
|
||||||
|
// 是否使用 setcookie
|
||||||
|
'setcookie' => true,
|
||||||
|
];
|
63
config/database.php
Normal file
63
config/database.php
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
use think\facade\Env;
|
||||||
|
|
||||||
|
return [
|
||||||
|
// 默认使用的数据库连接配置
|
||||||
|
'default' => Env::get('database.driver', 'mysql'),
|
||||||
|
|
||||||
|
// 自定义时间查询规则
|
||||||
|
'time_query_rule' => [],
|
||||||
|
|
||||||
|
// 自动写入时间戳字段
|
||||||
|
// true为自动识别类型 false关闭
|
||||||
|
// 字符串则明确指定时间字段类型 支持 int timestamp datetime date
|
||||||
|
'auto_timestamp' => true,
|
||||||
|
|
||||||
|
// 时间字段取出后的默认时间格式
|
||||||
|
'datetime_format' => 'Y-m-d H:i:s',
|
||||||
|
|
||||||
|
// 数据库连接配置信息
|
||||||
|
'connections' => [
|
||||||
|
'mysql' => [
|
||||||
|
// 数据库类型
|
||||||
|
'type' => Env::get('database.type', 'mysql'),
|
||||||
|
// 服务器地址
|
||||||
|
'hostname' => Env::get('database.hostname', '127.0.0.1'),
|
||||||
|
// 数据库名
|
||||||
|
'database' => Env::get('database.database', ''),
|
||||||
|
// 用户名
|
||||||
|
'username' => Env::get('database.username', 'root'),
|
||||||
|
// 密码
|
||||||
|
'password' => Env::get('database.password', ''),
|
||||||
|
// 端口
|
||||||
|
'hostport' => Env::get('database.hostport', '3306'),
|
||||||
|
// 数据库连接参数
|
||||||
|
'params' => [],
|
||||||
|
// 数据库编码默认采用utf8
|
||||||
|
'charset' => Env::get('database.charset', 'utf8'),
|
||||||
|
// 数据库表前缀
|
||||||
|
'prefix' => Env::get('database.prefix', ''),
|
||||||
|
|
||||||
|
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
|
||||||
|
'deploy' => 0,
|
||||||
|
// 数据库读写是否分离 主从式有效
|
||||||
|
'rw_separate' => false,
|
||||||
|
// 读写分离后 主服务器数量
|
||||||
|
'master_num' => 1,
|
||||||
|
// 指定从服务器序号
|
||||||
|
'slave_no' => '',
|
||||||
|
// 是否严格检查字段是否存在
|
||||||
|
'fields_strict' => true,
|
||||||
|
// 是否需要断线重连
|
||||||
|
'break_reconnect' => false,
|
||||||
|
// 监听SQL
|
||||||
|
'trigger_sql' => true,
|
||||||
|
// 开启字段缓存
|
||||||
|
'fields_cache' => false,
|
||||||
|
// 字段缓存路径
|
||||||
|
'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR,
|
||||||
|
],
|
||||||
|
|
||||||
|
// 更多的数据库配置信息
|
||||||
|
],
|
||||||
|
];
|
26
config/filesystem.php
Normal file
26
config/filesystem.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use think\facade\Env;
|
||||||
|
|
||||||
|
return [
|
||||||
|
// 默认磁盘
|
||||||
|
'default' => Env::get('filesystem.driver', 'local'),
|
||||||
|
// 磁盘列表
|
||||||
|
'disks' => [
|
||||||
|
'local' => [
|
||||||
|
'type' => 'local',
|
||||||
|
'root' => app()->getRuntimePath() . 'storage',
|
||||||
|
],
|
||||||
|
'public' => [
|
||||||
|
// 磁盘类型
|
||||||
|
'type' => 'local',
|
||||||
|
// 磁盘路径
|
||||||
|
'root' => app()->getRootPath() . 'public/storage',
|
||||||
|
// 磁盘路径对应的外部URL路径
|
||||||
|
'url' => '/storage',
|
||||||
|
// 可见性
|
||||||
|
'visibility' => 'public',
|
||||||
|
],
|
||||||
|
// 更多的磁盘配置信息
|
||||||
|
],
|
||||||
|
];
|
27
config/lang.php
Normal file
27
config/lang.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 多语言设置
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
use think\facade\Env;
|
||||||
|
|
||||||
|
return [
|
||||||
|
// 默认语言
|
||||||
|
'default_lang' => Env::get('lang.default_lang', 'zh-cn'),
|
||||||
|
// 允许的语言列表
|
||||||
|
'allow_lang_list' => [],
|
||||||
|
// 多语言自动侦测变量名
|
||||||
|
'detect_var' => 'lang',
|
||||||
|
// 是否使用Cookie记录
|
||||||
|
'use_cookie' => true,
|
||||||
|
// 多语言cookie变量
|
||||||
|
'cookie_var' => 'think_lang',
|
||||||
|
// 扩展语言包
|
||||||
|
'extend_list' => [],
|
||||||
|
// Accept-Language转义为对应语言包名称
|
||||||
|
'accept_language' => [
|
||||||
|
'zh-hans-cn' => 'zh-cn',
|
||||||
|
],
|
||||||
|
// 是否支持语言分组
|
||||||
|
'allow_group' => false,
|
||||||
|
];
|
46
config/log.php
Normal file
46
config/log.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
use think\facade\Env;
|
||||||
|
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 日志设置
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
return [
|
||||||
|
// 默认日志记录通道
|
||||||
|
'default' => Env::get('log.channel', 'file'),
|
||||||
|
// 日志记录级别
|
||||||
|
'level' => [],
|
||||||
|
// 日志类型记录的通道 ['error'=>'email',...]
|
||||||
|
'type_channel' => [],
|
||||||
|
// 关闭全局日志写入
|
||||||
|
'close' => false,
|
||||||
|
// 全局日志处理 支持闭包
|
||||||
|
'processor' => null,
|
||||||
|
|
||||||
|
// 日志通道列表
|
||||||
|
'channels' => [
|
||||||
|
'file' => [
|
||||||
|
// 日志记录方式
|
||||||
|
'type' => 'File',
|
||||||
|
// 日志保存目录
|
||||||
|
'path' => '',
|
||||||
|
// 单文件日志写入
|
||||||
|
'single' => false,
|
||||||
|
// 独立日志级别
|
||||||
|
'apart_level' => [],
|
||||||
|
// 最大日志文件数量
|
||||||
|
'max_files' => 0,
|
||||||
|
// 使用JSON格式记录
|
||||||
|
'json' => false,
|
||||||
|
// 日志处理
|
||||||
|
'processor' => null,
|
||||||
|
// 关闭通道日志写入
|
||||||
|
'close' => false,
|
||||||
|
// 日志输出格式化
|
||||||
|
'format' => '[%s][%s] %s',
|
||||||
|
// 是否实时写入
|
||||||
|
'realtime_write' => false,
|
||||||
|
],
|
||||||
|
// 其它日志通道配置
|
||||||
|
],
|
||||||
|
|
||||||
|
];
|
8
config/middleware.php
Normal file
8
config/middleware.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
// 中间件配置
|
||||||
|
return [
|
||||||
|
// 别名或分组
|
||||||
|
'alias' => [],
|
||||||
|
// 优先级设置,此数组中的中间件会按照数组中的顺序优先执行
|
||||||
|
'priority' => [],
|
||||||
|
];
|
45
config/route.php
Normal file
45
config/route.php
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 路由设置
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
return [
|
||||||
|
// pathinfo分隔符
|
||||||
|
'pathinfo_depr' => '/',
|
||||||
|
// URL伪静态后缀
|
||||||
|
'url_html_suffix' => 'html',
|
||||||
|
// URL普通方式参数 用于自动生成
|
||||||
|
'url_common_param' => true,
|
||||||
|
// 是否开启路由延迟解析
|
||||||
|
'url_lazy_route' => false,
|
||||||
|
// 是否强制使用路由
|
||||||
|
'url_route_must' => false,
|
||||||
|
// 合并路由规则
|
||||||
|
'route_rule_merge' => false,
|
||||||
|
// 路由是否完全匹配
|
||||||
|
'route_complete_match' => false,
|
||||||
|
// 访问控制器层名称
|
||||||
|
'controller_layer' => 'controller',
|
||||||
|
// 空控制器名
|
||||||
|
'empty_controller' => 'Error',
|
||||||
|
// 是否使用控制器后缀
|
||||||
|
'controller_suffix' => false,
|
||||||
|
// 默认的路由变量规则
|
||||||
|
'default_route_pattern' => '[\w\.]+',
|
||||||
|
// 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
|
||||||
|
'request_cache' => false,
|
||||||
|
// 请求缓存有效期
|
||||||
|
'request_cache_expire' => null,
|
||||||
|
// 全局请求缓存排除规则
|
||||||
|
'request_cache_except' => [],
|
||||||
|
// 默认控制器名
|
||||||
|
'default_controller' => 'Index',
|
||||||
|
// 默认操作名
|
||||||
|
'default_action' => 'index',
|
||||||
|
// 操作方法后缀
|
||||||
|
'action_suffix' => '',
|
||||||
|
// 默认JSONP格式返回的处理方法
|
||||||
|
'default_jsonp_handler' => 'jsonpReturn',
|
||||||
|
// 默认JSONP处理方法
|
||||||
|
'var_jsonp_handler' => 'callback',
|
||||||
|
];
|
19
config/session.php
Normal file
19
config/session.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 会话设置
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
return [
|
||||||
|
// session name
|
||||||
|
'name' => 'PHPSESSID',
|
||||||
|
// SESSION_ID的提交变量,解决flash上传跨域
|
||||||
|
'var_session_id' => '',
|
||||||
|
// 驱动方式 支持file cache
|
||||||
|
'type' => 'file',
|
||||||
|
// 存储连接标识 当type使用cache的时候有效
|
||||||
|
'store' => null,
|
||||||
|
// 过期时间
|
||||||
|
'expire' => 1440,
|
||||||
|
// 前缀
|
||||||
|
'prefix' => '',
|
||||||
|
];
|
10
config/trace.php
Normal file
10
config/trace.php
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Trace设置 开启调试模式后有效
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
return [
|
||||||
|
// 内置Html和Console两种方式 支持扩展
|
||||||
|
'type' => 'Html',
|
||||||
|
// 读取的日志通道名
|
||||||
|
'channel' => '',
|
||||||
|
];
|
25
config/view.php
Normal file
25
config/view.php
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 模板设置
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
return [
|
||||||
|
// 模板引擎类型使用Think
|
||||||
|
'type' => 'Think',
|
||||||
|
// 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法
|
||||||
|
'auto_rule' => 1,
|
||||||
|
// 模板目录名
|
||||||
|
'view_dir_name' => 'view',
|
||||||
|
// 模板后缀
|
||||||
|
'view_suffix' => 'html',
|
||||||
|
// 模板文件名分隔符
|
||||||
|
'view_depr' => DIRECTORY_SEPARATOR,
|
||||||
|
// 模板引擎普通标签开始标记
|
||||||
|
'tpl_begin' => '{',
|
||||||
|
// 模板引擎普通标签结束标记
|
||||||
|
'tpl_end' => '}',
|
||||||
|
// 标签库标签开始标记
|
||||||
|
'taglib_begin' => '{',
|
||||||
|
// 标签库标签结束标记
|
||||||
|
'taglib_end' => '}',
|
||||||
|
];
|
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use think\migration\Migrator;
|
||||||
|
use think\migration\db\Column;
|
||||||
|
|
||||||
|
class AnyClassNameYouWant extends Migrator
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Change Method.
|
||||||
|
*
|
||||||
|
* Write your reversible migrations using this method.
|
||||||
|
*
|
||||||
|
* More information on writing migrations is available here:
|
||||||
|
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
|
||||||
|
*
|
||||||
|
* The following commands can be used in this method and Phinx will
|
||||||
|
* automatically reverse them when rolling back:
|
||||||
|
*
|
||||||
|
* createTable
|
||||||
|
* renameTable
|
||||||
|
* addColumn
|
||||||
|
* renameColumn
|
||||||
|
* addIndex
|
||||||
|
* addForeignKey
|
||||||
|
*
|
||||||
|
* Remember to call "create()" or "update()" and NOT "save()" when working
|
||||||
|
* with the Table class.
|
||||||
|
*/
|
||||||
|
public function change()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
19
database/seeds/Abc.php
Normal file
19
database/seeds/Abc.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use think\migration\Seeder;
|
||||||
|
|
||||||
|
class Abc extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run Method.
|
||||||
|
*
|
||||||
|
* Write your database seeder using this method.
|
||||||
|
*
|
||||||
|
* More information on writing seeders is available here:
|
||||||
|
* http://docs.phinx.org/en/latest/seeding.html
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
2
extend/.gitignore
vendored
Normal file
2
extend/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
8
public/.htaccess
Normal file
8
public/.htaccess
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<IfModule mod_rewrite.c>
|
||||||
|
Options +FollowSymlinks -Multiviews
|
||||||
|
RewriteEngine On
|
||||||
|
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
|
||||||
|
</IfModule>
|
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
24
public/index.php
Normal file
24
public/index.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2006-2019 http://thinkphp.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: liu21st <liu21st@gmail.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
// [ 应用入口文件 ]
|
||||||
|
namespace think;
|
||||||
|
|
||||||
|
require __DIR__ . '/../vendor/autoload.php';
|
||||||
|
|
||||||
|
// 执行HTTP应用并响应
|
||||||
|
$http = (new App())->http;
|
||||||
|
|
||||||
|
$response = $http->run();
|
||||||
|
|
||||||
|
$response->send();
|
||||||
|
|
||||||
|
$http->end($response);
|
2
public/robots.txt
Normal file
2
public/robots.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
User-agent: *
|
||||||
|
Disallow:
|
17
public/router.php
Normal file
17
public/router.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: liu21st <liu21st@gmail.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// $Id$
|
||||||
|
|
||||||
|
if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
require __DIR__ . "/index.php";
|
||||||
|
}
|
2
public/static/.gitignore
vendored
Normal file
2
public/static/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
12
route/app.php
Normal file
12
route/app.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: liu21st <liu21st@gmail.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
2
runtime/.gitignore
vendored
Normal file
2
runtime/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
10
think
Normal file
10
think
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
namespace think;
|
||||||
|
|
||||||
|
// 命令行入口文件
|
||||||
|
// 加载基础文件
|
||||||
|
require __DIR__ . '/vendor/autoload.php';
|
||||||
|
|
||||||
|
// 应用初始化
|
||||||
|
(new App())->console->run();
|
1
view/README.md
Normal file
1
view/README.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
如果不使用模板,可以删除该目录
|
Loading…
x
Reference in New Issue
Block a user