Forráskód Böngészése

刘第一次提交

liuhairui 3 éve
szülő
commit
9f71a3ed4d

+ 0 - 97
README.md

@@ -1,97 +0,0 @@
-FastAdmin是一款基于ThinkPHP+Bootstrap的极速后台开发框架。
-
-
-## 主要特性
-
-* 基于`Auth`验证的权限管理系统
-    * 支持无限级父子级权限继承,父级的管理员可任意增删改子级管理员及权限设置
-    * 支持单管理员多角色
-    * 支持管理子级数据或个人数据
-* 强大的一键生成功能
-    * 一键生成CRUD,包括控制器、模型、视图、JS、语言包、菜单、回收站等
-    * 一键压缩打包JS和CSS文件,一键CDN静态资源部署
-    * 一键生成控制器菜单和规则
-    * 一键生成API接口文档
-* 完善的前端功能组件开发
-    * 基于`AdminLTE`二次开发
-    * 基于`Bootstrap`开发,自适应手机、平板、PC
-    * 基于`RequireJS`进行JS模块管理,按需加载
-    * 基于`Less`进行样式开发
-* 强大的插件扩展功能,在线安装卸载升级插件
-* 通用的会员模块和API模块
-* 共用同一账号体系的Web端会员中心权限验证和API接口会员权限验证
-* 二级域名部署支持,同时域名支持绑定到应用插件
-* 多语言支持,服务端及客户端支持
-* 支持大文件分片上传、剪切板粘贴上传、拖拽上传,进度条显示,图片上传前压缩
-* 支持表格固定列、固定表头、跨页选择、Excel导出、模板渲染等功能
-* 强大的第三方应用模块支持([CMS](https://www.fastadmin.net/store/cms.html)、[博客](https://www.fastadmin.net/store/blog.html)、[知识付费问答](https://www.fastadmin.net/store/ask.html)、[在线投票系统](https://www.fastadmin.net/store/vote.html)、[B2C商城](https://www.fastadmin.net/store/shopro.html)、[B2B2C商城](https://www.fastadmin.net/store/wanlshop.html))
-* 支持CMS、博客、知识付费问答无缝整合[Xunsearch全文搜索](https://www.fastadmin.net/store/xunsearch.html)
-* 第三方小程序支持([CMS小程序](https://www.fastadmin.net/store/cms.html)、[预订小程序](https://www.fastadmin.net/store/ball.html)、[问答小程序](https://www.fastadmin.net/store/ask.html)、[点餐小程序](https://www.fastadmin.net/store/unidrink.html)、[B2C小程序](https://www.fastadmin.net/store/shopro.html)、[B2B2C小程序](https://www.fastadmin.net/store/wanlshop.html)、[博客小程序](https://www.fastadmin.net/store/blog.html))
-* 整合第三方短信接口(阿里云、腾讯云短信)
-* 无缝整合第三方云存储(七牛云、阿里云OSS、又拍云)功能,支持云储存分片上传
-* 第三方富文本编辑器支持(Summernote、Kindeditor、百度编辑器)
-* 第三方登录(QQ、微信、微博)整合
-* 第三方支付(微信、支付宝)无缝整合,微信支持PC端扫码支付
-* 丰富的插件应用市场
-
-## 安装使用
-
-https://doc.fastadmin.net
-
-## 在线演示
-
-https://demo.fastadmin.net
-
-用户名:admin
-
-密 码:123456
-
-提 示:演示站数据无法进行修改,请下载源码安装体验全部功能
-
-## 界面截图
-![控制台](https://images.gitee.com/uploads/images/2020/0929/202947_8db2d281_10933.gif "控制台")
-
-## 问题反馈
-
-在使用中有任何问题,请使用以下联系方式联系我们
-
-交流社区: https://ask.fastadmin.net
-
-QQ群: [636393962](https://jq.qq.com/?_wv=1027&k=487PNBb)(满) [708784003](https://jq.qq.com/?_wv=1027&k=5ObjtwM)(满) [964776039](https://jq.qq.com/?_wv=1027&k=59qjU2P)(3群) [749803490](https://jq.qq.com/?_wv=1027&k=5tczi88)(满) [767103006](https://jq.qq.com/?_wv=1027&k=5Z1U751)(满) [675115483](https://jq.qq.com/?_wv=1027&k=54I6mts)(6群)
-
-Github: https://github.com/karsonzhang/fastadmin
-
-Gitee: https://gitee.com/karson/fastadmin
-
-## 特别鸣谢
-
-感谢以下的项目,排名不分先后
-
-ThinkPHP:http://www.thinkphp.cn
-
-AdminLTE:https://adminlte.io
-
-Bootstrap:http://getbootstrap.com
-
-jQuery:http://jquery.com
-
-Bootstrap-table:https://github.com/wenzhixin/bootstrap-table
-
-Nice-validator: https://validator.niceue.com
-
-SelectPage: https://github.com/TerryZ/SelectPage
-
-Layer: https://layer.layui.com
-
-DropzoneJS: https://www.dropzonejs.com
-
-
-## 版权信息
-
-FastAdmin遵循Apache2开源协议发布,并提供免费使用。
-
-本项目包含的第三方源码和二进制文件之版权信息另行标注。
-
-版权所有Copyright © 2017-2022 by FastAdmin (https://www.fastadmin.net)
-
-All rights reserved。

+ 0 - 243
application/admin/controller/Command.php

@@ -1,243 +0,0 @@
-<?php
-
-namespace app\admin\controller;
-
-use app\common\controller\Backend;
-use think\Config;
-use think\console\Input;
-use think\Db;
-use think\Exception;
-
-/**
- * 在线命令管理
- *
- * @icon fa fa-circle-o
- */
-class Command extends Backend
-{
-
-    /**
-     * Command模型对象
-     */
-    protected $model = null;
-    protected $noNeedRight = ['get_controller_list', 'get_field_list'];
-
-    public function _initialize()
-    {
-        parent::_initialize();
-        $this->model = model('Command');
-        $this->view->assign("statusList", $this->model->getStatusList());
-    }
-
-    /**
-     * 添加
-     */
-    public function add()
-    {
-
-        $tableList = [];
-        $list = \think\Db::query("SHOW TABLES");
-        foreach ($list as $key => $row) {
-            $tableList[reset($row)] = reset($row);
-        }
-
-        $this->view->assign("tableList", $tableList);
-        return $this->view->fetch();
-    }
-
-    /**
-     * 获取字段列表
-     * @internal
-     */
-    public function get_field_list()
-    {
-        $dbname = Config::get('database.database');
-        $prefix = Config::get('database.prefix');
-        $table = $this->request->request('table');
-        //从数据库中获取表字段信息
-        $sql = "SELECT * FROM `information_schema`.`columns` "
-            . "WHERE TABLE_SCHEMA = ? AND table_name = ? "
-            . "ORDER BY ORDINAL_POSITION";
-        //加载主表的列
-        $columnList = Db::query($sql, [$dbname, $table]);
-        $fieldlist = [];
-        foreach ($columnList as $index => $item) {
-            $fieldlist[] = $item['COLUMN_NAME'];
-        }
-        $this->success("", null, ['fieldlist' => $fieldlist]);
-    }
-
-    /**
-     * 获取控制器列表
-     * @internal
-     */
-    public function get_controller_list()
-    {
-        //搜索关键词,客户端输入以空格分开,这里接收为数组
-        $word = (array)$this->request->request("q_word/a");
-        $word = implode('', $word);
-
-        $adminPath = dirname(__DIR__) . DS;
-        $controllerDir = $adminPath . 'controller' . DS;
-        $files = new \RecursiveIteratorIterator(
-            new \RecursiveDirectoryIterator($controllerDir), \RecursiveIteratorIterator::LEAVES_ONLY
-        );
-        $list = [];
-        foreach ($files as $name => $file) {
-            if (!$file->isDir()) {
-                $filePath = $file->getRealPath();
-                $name = str_replace($controllerDir, '', $filePath);
-                $name = str_replace(DS, "/", $name);
-                if (!preg_match("/(.*)\.php\$/", $name)) {
-                    continue;
-                }
-                if (!$word || stripos($name, $word) !== false) {
-                    $list[] = ['id' => $name, 'name' => $name];
-                }
-            }
-        }
-        $pageNumber = $this->request->request("pageNumber");
-        $pageSize = $this->request->request("pageSize");
-        return json(['list' => array_slice($list, ($pageNumber - 1) * $pageSize, $pageSize), 'total' => count($list)]);
-    }
-
-    /**
-     * 详情
-     */
-    public function detail($ids)
-    {
-        $row = $this->model->get($ids);
-        if (!$row) {
-            $this->error(__('No Results were found'));
-        }
-        $this->view->assign("row", $row);
-        return $this->view->fetch();
-    }
-
-    /**
-     * 执行
-     */
-    public function execute($ids)
-    {
-        $row = $this->model->get($ids);
-        if (!$row) {
-            $this->error(__('No Results were found'));
-        }
-        $result = $this->doexecute($row['type'], json_decode($row['params'], true));
-        $this->success("", null, ['result' => $result]);
-    }
-
-    /**
-     * 执行命令
-     */
-    public function command($action = '')
-    {
-        $commandtype = $this->request->request("commandtype");
-        $params = $this->request->request();
-        $allowfields = [
-            'crud' => 'table,controller,model,fields,force,local,delete,menu',
-            'menu' => 'controller,delete',
-            'min'  => 'module,resource,optimize',
-            'api'  => 'url,module,output,template,force,title,author,class,language,addon',
-        ];
-        $argv = [];
-        $allowfields = isset($allowfields[$commandtype]) ? explode(',', $allowfields[$commandtype]) : [];
-        $allowfields = array_filter(array_intersect_key($params, array_flip($allowfields)));
-        if (isset($params['local']) && !$params['local']) {
-            $allowfields['local'] = $params['local'];
-        } else {
-            unset($allowfields['local']);
-        }
-        foreach ($allowfields as $key => $param) {
-            $argv[] = "--{$key}=" . (is_array($param) ? implode(',', $param) : $param);
-        }
-        if ($commandtype == 'crud') {
-            $extend = 'setcheckboxsuffix,enumradiosuffix,imagefield,filefield,intdatesuffix,switchsuffix,citysuffix,selectpagesuffix,selectpagessuffix,ignorefields,sortfield,editorsuffix,headingfilterfield,tagsuffix,jsonsuffix,fixedcolumns';
-            $extendArr = explode(',', $extend);
-            foreach ($params as $index => $item) {
-                if (in_array($index, $extendArr)) {
-                    foreach (explode(',', $item) as $key => $value) {
-                        if ($value) {
-                            $argv[] = "--{$index}={$value}";
-                        }
-                    }
-                }
-            }
-            $isrelation = (int)$this->request->request('isrelation');
-            if ($isrelation && isset($params['relation'])) {
-                foreach ($params['relation'] as $index => $relation) {
-                    foreach ($relation as $key => $value) {
-                        $argv[] = "--{$key}=" . (is_array($value) ? implode(',', $value) : $value);
-                    }
-                }
-            }
-        } else {
-            if ($commandtype == 'menu') {
-                if (isset($params['allcontroller']) && $params['allcontroller']) {
-                    $argv[] = "--controller=all-controller";
-                } else {
-                    foreach (explode(',', $params['controllerfile']) as $index => $param) {
-                        if ($param) {
-                            $argv[] = "--controller=" . substr($param, 0, -4);
-                        }
-                    }
-                }
-            } else {
-                if ($commandtype == 'min') {
-
-                } else {
-                    if ($commandtype == 'api') {
-
-                    } else {
-
-                    }
-                }
-            }
-        }
-        if ($action == 'execute') {
-            if (stripos(implode(' ', $argv), '--controller=all-controller') !== false) {
-                $this->error("只允许在命令行执行该命令,执行前请做好菜单规则备份!!!");
-            }
-            if (config('app_debug')) {
-                $result = $this->doexecute($commandtype, $argv);
-                $this->success("", null, ['result' => $result]);
-            } else {
-                $this->error("只允许在开发环境下执行命令");
-            }
-        } else {
-            $this->success("", null, ['command' => "php think {$commandtype} " . implode(' ', $argv)]);
-        }
-
-        return;
-    }
-
-    protected function doexecute($commandtype, $argv)
-    {
-        $commandName = "\\app\\admin\\command\\" . ucfirst($commandtype);
-        $input = new Input($argv);
-        $output = new \addons\command\library\Output();
-        $command = new $commandName($commandtype);
-        $data = [
-            'type'        => $commandtype,
-            'params'      => json_encode($argv),
-            'command'     => "php think {$commandtype} " . implode(' ', $argv),
-            'executetime' => time(),
-        ];
-        $this->model->save($data);
-        try {
-            $command->run($input, $output);
-            $result = implode("\n", $output->getMessage());
-            $this->model->status = 'successed';
-        } catch (Exception $e) {
-            $result = implode("\n", $output->getMessage()) . "\n";
-            $result .= $e->getMessage();
-            $this->model->status = 'failured';
-        }
-        $result = trim($result);
-        $this->model->content = $result;
-        $this->model->save();
-        return $result;
-    }
-
-
-}

+ 0 - 16
application/admin/lang/zh-cn/command.php

@@ -1,16 +0,0 @@
-<?php
-
-return [
-    'Id'            => 'ID',
-    'Type'          => '类型',
-    'Params'        => '参数',
-    'Command'       => '命令',
-    'Content'       => '返回结果',
-    'Executetime'   => '执行时间',
-    'Createtime'    => '创建时间',
-    'Updatetime'    => '更新时间',
-    'Execute again' => '再次执行',
-    'Successed'     => '成功',
-    'Failured'      => '失败',
-    'Status'        => '状态'
-];

+ 0 - 59
application/admin/model/Command.php

@@ -1,59 +0,0 @@
-<?php
-
-namespace app\admin\model;
-
-use think\Model;
-
-class Command extends Model
-{
-    // 表名
-    protected $name = 'command';
-
-    // 自动写入时间戳字段
-    protected $autoWriteTimestamp = 'int';
-
-    // 定义时间戳字段名
-    protected $createTime = 'createtime';
-    protected $updateTime = 'updatetime';
-
-    // 追加属性
-    protected $append = [
-        'executetime_text',
-        'type_text',
-        'status_text'
-    ];
-
-
-    public function getStatusList()
-    {
-        return ['successed' => __('Successed'), 'failured' => __('Failured')];
-    }
-
-
-    public function getExecutetimeTextAttr($value, $data)
-    {
-        $value = $value ? $value : $data['executetime'];
-        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
-    }
-
-    public function getTypeTextAttr($value, $data)
-    {
-        $value = $value ? $value : $data['type'];
-        $list = ['crud' => '一键生成CRUD', 'menu' => '一键生成菜单', 'min' => '一键压缩打包', 'api' => '一键生成文档'];
-        return isset($list[$value]) ? $list[$value] : '';
-    }
-
-    public function getStatusTextAttr($value, $data)
-    {
-        $value = $value ? $value : $data['status'];
-        $list = $this->getStatusList();
-        return isset($list[$value]) ? $list[$value] : '';
-    }
-
-    protected function setExecutetimeAttr($value)
-    {
-        return $value && !is_numeric($value) ? strtotime($value) : $value;
-    }
-
-
-}

+ 0 - 234
public/assets/js/backend/command.js

@@ -1,234 +0,0 @@
-define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function ($, undefined, Backend, Table, Form, Template) {
-
-    var Controller = {
-        index: function () {
-            // 初始化表格参数配置
-            Table.api.init({
-                extend: {
-                    index_url: 'command/index',
-                    add_url: 'command/add',
-                    edit_url: '',
-                    del_url: 'command/del',
-                    multi_url: 'command/multi',
-                    table: 'command',
-                }
-            });
-
-            var table = $("#table");
-
-            // 初始化表格
-            table.bootstrapTable({
-                url: $.fn.bootstrapTable.defaults.extend.index_url,
-                pk: 'id',
-                sortName: 'id',
-                columns: [
-                    [
-                        {checkbox: true},
-                        {field: 'id', title: __('Id')},
-                        {field: 'type', title: __('Type'), formatter: Table.api.formatter.search},
-                        {field: 'type_text', title: __('Type')},
-                        {
-                            field: 'command', title: __('Command'), formatter: function (value, row, index) {
-                                return '<input type="text" class="form-control" value="' + value + '">';
-                            }
-                        },
-                        {
-                            field: 'executetime',
-                            title: __('Executetime'),
-                            operate: 'RANGE',
-                            addclass: 'datetimerange',
-                            formatter: Table.api.formatter.datetime
-                        },
-                        {
-                            field: 'createtime',
-                            title: __('Createtime'),
-                            operate: 'RANGE',
-                            addclass: 'datetimerange',
-                            formatter: Table.api.formatter.datetime
-                        },
-                        {
-                            field: 'updatetime',
-                            title: __('Updatetime'),
-                            operate: 'RANGE',
-                            addclass: 'datetimerange',
-                            formatter: Table.api.formatter.datetime
-                        },
-                        {
-                            field: 'status',
-                            title: __('Status'),
-                            table: table,
-                            custom: {"successed": 'success', "failured": 'danger'},
-                            searchList: {"successed": __('Successed'), "failured": __('Failured')},
-                            formatter: Table.api.formatter.status
-                        },
-                        {
-                            field: 'operate',
-                            title: __('Operate'),
-                            buttons: [
-                                {
-                                    name: 'execute',
-                                    title: __('Execute again'),
-                                    text: __('Execute again'),
-                                    url: 'command/execute',
-                                    icon: 'fa fa-repeat',
-                                    classname: 'btn btn-success btn-xs btn-execute btn-ajax',
-                                    success: function (data) {
-                                        Layer.alert("<textarea class='form-control' cols='60' rows='5'>" + data.result + "</textarea>", {
-                                            title: __("执行结果"),
-                                            shadeClose: true
-                                        });
-                                        table.bootstrapTable('refresh');
-                                        return false;
-                                    }
-                                },
-                                {
-                                    name: 'execute',
-                                    title: __('Detail'),
-                                    text: __('Detail'),
-                                    url: 'command/detail',
-                                    icon: 'fa fa-list',
-                                    classname: 'btn btn-info btn-xs btn-execute btn-dialog'
-                                }
-                            ],
-                            table: table,
-                            events: Table.api.events.operate,
-                            formatter: Table.api.formatter.operate
-                        }
-                    ]
-                ]
-            });
-
-            // 为表格绑定事件
-            Table.api.bindevent(table);
-        },
-        add: function () {
-            require(['bootstrap-select', 'bootstrap-select-lang']);
-            var mainfields = [];
-            var relationfields = {};
-            var maintable = [];
-            var relationtable = [];
-            var relationmode = ["belongsto", "hasone"];
-
-            var renderselect = function (select, data) {
-                var html = [];
-                for (var i = 0; i < data.length; i++) {
-                    html.push("<option value='" + data[i] + "'>" + data[i] + "</option>");
-                }
-                $(select).html(html.join(""));
-                select.trigger("change");
-                if (select.data("selectpicker")) {
-                    select.selectpicker('refresh');
-                }
-                return select;
-            };
-
-            $("select[name=table] option").each(function () {
-                maintable.push($(this).val());
-            });
-            $(document).on('change', "input[name='isrelation']", function () {
-                $("#relation-zone").toggleClass("hide", !$(this).prop("checked"));
-            });
-            $(document).on('change', "select[name='table']", function () {
-                var that = this;
-                Fast.api.ajax({
-                    url: "command/get_field_list",
-                    data: {table: $(that).val()},
-                }, function (data, ret) {
-                    mainfields = data.fieldlist;
-                    $("#relation-zone .relation-item").remove();
-                    renderselect($("#fields"), mainfields);
-                    return false;
-                });
-                return false;
-            });
-            $(document).on('click', "a.btn-newrelation", function () {
-                var that = this;
-                var index = parseInt($(that).data("index")) + 1;
-                var content = Template("relationtpl", {index: index});
-                content = $(content.replace(/\[index\]/, index));
-                $(this).data("index", index);
-                $(content).insertBefore($(that).closest(".row"));
-                $('select', content).selectpicker();
-                var exists = [$("select[name='table']").val()];
-                $("select.relationtable").each(function () {
-                    exists.push($(this).val());
-                });
-                relationtable = [];
-                $.each(maintable, function (i, j) {
-                    if ($.inArray(j, exists) < 0) {
-                        relationtable.push(j);
-                    }
-                });
-                renderselect($("select.relationtable", content), relationtable);
-                $("select.relationtable", content).trigger("change");
-            });
-            $(document).on('click', "a.btn-removerelation", function () {
-                $(this).closest(".row").remove();
-            });
-            $(document).on('change', "#relation-zone select.relationmode", function () {
-                var table = $("select.relationtable", $(this).closest(".row")).val();
-                var that = this;
-                Fast.api.ajax({
-                    url: "command/get_field_list",
-                    data: {table: table},
-                }, function (data, ret) {
-                    renderselect($(that).closest(".row").find("select.relationprimarykey"), $(that).val() == 'belongsto' ? data.fieldlist : mainfields);
-                    renderselect($(that).closest(".row").find("select.relationforeignkey"), $(that).val() == 'hasone' ? data.fieldlist : mainfields);
-                    return false;
-                });
-            });
-            $(document).on('change', "#relation-zone select.relationtable", function () {
-                var that = this;
-                Fast.api.ajax({
-                    url: "command/get_field_list",
-                    data: {table: $(that).val()},
-                }, function (data, ret) {
-                    renderselect($(that).closest(".row").find("select.relationmode"), relationmode);
-                    renderselect($(that).closest(".row").find("select.relationfields"), mainfields)
-                    renderselect($(that).closest(".row").find("select.relationforeignkey"), data.fieldlist)
-                    renderselect($(that).closest(".row").find("select.relationfields"), data.fieldlist)
-                    return false;
-                });
-            });
-            $(document).on('click', ".btn-command", function () {
-                var form = $(this).closest("form");
-                var textarea = $("textarea[rel=command]", form);
-                textarea.val('');
-                Fast.api.ajax({
-                    url: "command/command/action/command",
-                    data: form.serialize(),
-                }, function (data, ret) {
-                    textarea.val(data.command);
-                    return false;
-                });
-            });
-            $(document).on('click', ".btn-execute", function () {
-                var form = $(this).closest("form");
-                var textarea = $("textarea[rel=result]", form);
-                textarea.val('');
-                Fast.api.ajax({
-                    url: "command/command/action/execute",
-                    data: form.serialize(),
-                }, function (data, ret) {
-                    textarea.val(data.result);
-                    window.parent.$(".toolbar .btn-refresh").trigger('click');
-                    top.window.Fast.api.refreshmenu();
-                    return false;
-                }, function () {
-                    window.parent.$(".toolbar .btn-refresh").trigger('click');
-                });
-            });
-            $("select[name='table']").trigger("change");
-            Controller.api.bindevent();
-        },
-        edit: function () {
-            Controller.api.bindevent();
-        },
-        api: {
-            bindevent: function () {
-                Form.api.bindevent($("form[role=form]"));
-            }
-        }
-    };
-    return Controller;
-});