4 Star 20 Fork 2

小叮当的肚兜 / easydoadmin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

EasydoAdmin

简介

EasydoAdmin是一款基于PHP的Yii2框架和Bootstrap的AdminLte主题进行开发。包含管理员账号,模块管理,缓存管理,云存储设置以及权限管理功能。欢迎大家试用, 官方网站

安装说明

  • 需要php7以上版本
  • 必须开启短标签 php.ini short_open_tag = On
  • 建议试用的朋友先去了解一下Yii2的使用手册:https://www.yiichina.com/doc/guide/2.0
  • 下载源码后,导入项目根目录的sql文件到数据库中
  • 按照Yii2使用说明配置开发环境(dev)和线上环境(prod)的配置文件数据库信息
  • 项目根目录命令行模式下执行:
php init
  • http服务配置
#nginx
location / {
    try_files $uri $uri/ /index.php$is_args$args;
}

#apache
#项目backend和frontend的web目录中已经放入.htaccess文件

Options +FollowSymLinks
IndexIgnore /
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
  • 默认后台登录账号admin密码123456

应用模块功能

项目根目录下放置一个modules文件夹是存放模块的,暂时为空添加插件使用.

  • common\components\autoLoad\Load.php 在系统运行时,在common\config\config.php文件中自定义on beforeRequest事件
'on beforeRequest' => ['\common\components\autoLoad\Load','run']

该事件会从数据库表app_modules中获取应用模块信息,不同的应用(backend,console,frontend)会加载不同的模块

  • common\components\autoLoad\Log.php
    模块加载异常时会把错误信息放到根目录下common/runtime/logs/modulesLog.log文件中

  • 添加自定义组件说明,例:

    • modules文件夹下的模块必须有继承yii\base\Module类(\modules\demo\Module)
    • modules文件夹下的模块有继承common\components\autoLoad\Auth.php类(可选)
class \modules\demo\Auth extends \common\components\autoLoad\Auth
{
    /**
    * @var array 权限名称 
    */
    public $permissions = [];
    
    /**
    * @var array 菜单名称 
    */
    public $menus = [];
    
     /**
    * @var array 路由黑名单
    */
    public $blackList = [];
    
    /**
     * 添加权限前执行
     * beforeAdd 
     * @return bool
     */
    public function beforeAdd()
    {
        return true;
    }
    
    /**
     * 添加权限后执行
     * afterAdd 
     * @return bool
     */
    public function afterAdd()
    {
        return true;
    }
}

// \modules\demo\Module` 实现公共方法auth
namespace modules\demo;

class Module extends \yii\base\Module
{
    /**
     * auth
     * @param      $id
     * @param bool $boolStatus
     */
    public function auth($id, $boolStatus = true)
    {
        $auth = (new Auth($id));
        $boolStatus ? $auth->add() : $auth->remove();
    }
}

//定义插件信息
//在`modules\demo`目录下添加文件`modulesInfo.json`扩展信息,导入使用,
{
  "id": "demo",//模块唯一标识
  "type": "backend", //模块运行的应用名称
  "name": "测试的",//模块名称
  "class": "modules\\demo\\Module",//模块加载文件
  "config": "",//\modules\demo\Module的属性配置json字符,查看代码`backend\models\AppModules`第100行
  "status": 1//模块状态 1启用 0禁用
}

内置组件

项目根目录下backend/components/widget内置几个常用组件

  • 富文本编辑器 WangEditor
  • 上传组件backend/controllers/FileController.php
  • 日期选择组件 laydate
  • 图形开关组件(修改nick-denry/yii2-round-switch-column组件)
  • 基于AdminLte主题添加ActiveForm ActiveField ActionColumn GridView等常用组件
  • 基于AdminLte主题添加adminLteGii样式主题
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
    'class' => 'yii\gii\Module',
    'generators' => [
        'crud' => [
            'class' => 'yii\gii\generators\crud\Generator',
            'templates' => [
                'adminLTE' => '@backend/components/giiTemplate/crud/default',
            ]
        ],
        'model'=>[
            'class' => 'yii\gii\generators\model\Generator',
            'templates' => [
                'adminLTE' => '@backend/components/giiTemplate/model/default',
            ]
        ],
    ],
];

composer widget组件说明

##全局函数 文件common/components/helper/YiiHelper.php通过composer autoload files 自动加载此文件

文件缓存

公用配置文件common/config/main.php已修改文件缓存目录为@common/runtime/cache,保持多个应用能够统一获取缓存.

'cache' => [
    'class' => 'yii\caching\FileCache',
    'cachePath' => '@common/runtime/cache',
]
The Yii framework is free software. It is released under the terms of the following BSD License. Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com) All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Yii Software LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 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.

简介

EasydoAdmin是一款基于PHP的Yii2框架和Bootstrap的AdminLte主题进行开发。包含管理员账号,模块管理,缓存管理,云存储设置以及权限管理功能 展开 收起
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/matrixonline/easydoadmin.git
git@gitee.com:matrixonline/easydoadmin.git
matrixonline
easydoadmin
easydoadmin
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891