diff --git a/.bowerrc b/.bowerrc new file mode 100644 index 0000000000000000000000000000000000000000..3f53a7349a1ab72840db7f445effa12d8d6a2222 --- /dev/null +++ b/.bowerrc @@ -0,0 +1,11 @@ +{ + "directory": "public/assets/libs", + "ignoredDependencies": [ + "es6-promise", + "file-saver", + "html2canvas", + "jspdf", + "jspdf-autotable", + "pdfmake" + ] +} diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index 5fc383837b620e96d3a0d0ecc2f4c3b5179aef7a..0000000000000000000000000000000000000000 --- a/Gruntfile.js +++ /dev/null @@ -1,125 +0,0 @@ -module.exports = function (grunt) { - - grunt.initConfig({ - pkg: grunt.file.readJSON('package.json'), - copy: { - main: { - files: [] - } - } - }); - - var build = function (module, type, callback) { - var config = { - compile: { - options: type === 'js' ? { - optimizeCss: "standard", - optimize: "none", //可使用uglify|closure|none - preserveLicenseComments: true, - removeCombined: false, - baseUrl: "./public/assets/js/", //JS文件所在的基础目录 - name: "require-" + module, //来源文件,不包含后缀 - out: "./public/assets/js/require-" + module + ".min.js" //目标文件 - } : { - optimizeCss: "default", - optimize: "uglify", //可使用uglify|closure|none - cssIn: "./public/assets/css/" + module + ".css", //JS文件所在的基础目录 - out: "./public/assets/css/" + module + ".min.css" //目标文件 - } - } - }; - - - var content = grunt.file.read("./public/assets/js/require-" + module + ".js"), - pattern = /^require\.config\(\{[\r\n]?[\n]?(.*?)[\r\n]?[\n]?}\);/is; - - var matches = content.match(pattern); - if (matches) { - if (type === 'js') { - var data = matches[1].replaceAll(/(urlArgs|baseUrl):(.*)\n/gi, ''); - const parse = require('parse-config-file'), fs = require('fs'); - require('jsonminify'); - - data = JSON.minify("{\n" + data + "\n}"); - let options = parse(data); - options.paths.tableexport = "empty:"; - Object.assign(config.compile.options, options); - } - let requirejs = require("./application/admin/command/Min/r"); - - try { - requirejs.optimize(config.compile.options, function (buildResponse) { - // var contents = require('fs').readFileSync(config.compile.options.out, 'utf8'); - callback(); - }, function (err) { - console.error(err); - callback(); - }); - } catch (err) { - console.error(err); - callback(); - } - } - }; - - // 加载 "copy" 插件 - grunt.loadNpmTasks('grunt-contrib-copy'); - - grunt.registerTask('frontend:js', 'build frontend js', function () { - var done = this.async(); - build('frontend', 'js', done); - }); - - grunt.registerTask('backend:js', 'build backend js', function () { - var done = this.async(); - build('backend', 'js', done); - }); - - grunt.registerTask('frontend:css', 'build frontend css', function () { - var done = this.async(); - build('frontend', 'css', done); - }); - - grunt.registerTask('backend:css', 'build frontend css', function () { - var done = this.async(); - build('backend', 'css', done); - }); - - // 注册部署JS和CSS任务 - grunt.registerTask('deploy', 'deploy', function () { - const fs = require('fs'); - const path = require("path") - const nodeModulesDir = path.resolve(__dirname, "./node_modules"); - - const getAllFiles = function (dirPath, arrayOfFiles) { - files = fs.readdirSync(dirPath) - - arrayOfFiles = arrayOfFiles || [] - - files.forEach(function (file) { - if (fs.statSync(dirPath + "/" + file).isDirectory()) { - arrayOfFiles = getAllFiles(dirPath + "/" + file, arrayOfFiles) - } else { - arrayOfFiles.push(path.join(__dirname, dirPath, "/", file)) - } - }); - - return arrayOfFiles - }; - const mainPackage = grunt.config.get('pkg'); - let dists = mainPackage.dists || []; - let files = []; - - Object.keys(dists).forEach(key => { - let src = ["**/*LICENSE*", "**/*license*"]; - src = src.concat(Array.isArray(dists[key]) ? dists[key] : [dists[key]]); - files.push({expand: true, cwd: nodeModulesDir + "/" + key, src: src, dest: 'public/assets/libs/' + key + "/"}); - }); - grunt.config.set('copy.main.files', files); - grunt.task.run("copy:main"); - }); - - // 注册默认任务 - grunt.registerTask('default', ['deploy', 'frontend:js', 'backend:js', 'frontend:css', 'backend:css']); - -}; diff --git a/README.md b/README.md index 0a0673784073aae1e0c9e99838d710d924ea98d5..922d933c33470908e20bfdef3be3930b75fe4d81 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,9 @@ FastAdmin是一款基于ThinkPHP+Bootstrap的极速后台开发框架。 * 多语言支持,服务端及客户端支持 * 支持大文件分片上传、剪切板粘贴上传、拖拽上传,进度条显示,图片上传前压缩 * 支持表格固定列、固定表头、跨页选择、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)) +* 强大的第三方应用模块支持([CMS](https://www.fastadmin.net/store/cms.html)、[CRM](https://www.fastadmin.net/store/facrm.html)、[企业网站管理系统](https://www.fastadmin.net/store/ldcms.html)、[知识库文档系统](https://www.fastadmin.net/store/knowbase.html)、[在线投票系统](https://www.fastadmin.net/store/vote.html)、[B2C商城](https://www.fastadmin.net/store/shopro.html)、[B2B2C商城](https://www.fastadmin.net/store/wanlshop.html)) * 整合第三方短信接口(阿里云、腾讯云短信) -* 无缝整合第三方云存储(七牛云、阿里云OSS、又拍云)功能,支持云储存分片上传 +* 无缝整合第三方云存储(七牛云、阿里云OSS、腾讯云存储、又拍云)功能,支持云储存分片上传 * 第三方富文本编辑器支持(Summernote、百度编辑器) * 第三方登录(QQ、微信、微博)整合 * 第三方支付(微信、支付宝)无缝整合,微信支持PC端扫码支付 diff --git a/application/admin/command/Api.php b/application/admin/command/Api.php index caff52b4ffede64d49b9b5f657454a28a7decd1d..925cb9775da784afe87e65135f298d04f1c9939d 100644 --- a/application/admin/command/Api.php +++ b/application/admin/command/Api.php @@ -98,13 +98,19 @@ class Api extends Command foreach ($files as $name => $file) { if (!$file->isDir() && $file->getExtension() == 'php') { $filePath = $file->getRealPath(); - $classes[] = $this->getClassFromFile($filePath); + $className = $this->getClassFromFile($filePath); + if ($className) { + $classes[] = $className; + } } } } else { foreach ($controller as $index => $item) { $filePath = $moduleDir . Config::get('url_controller_layer') . DS . $item . '.php'; - $classes[] = $this->getClassFromFile($filePath); + $className = $this->getClassFromFile($filePath); + if ($className) { + $classes[] = $className; + } } } @@ -183,7 +189,7 @@ class Api extends Command } } } - - return $namespace . '\\' . $class; + $className = $namespace . '\\' . $class; + return preg_match('/([a-z0-9_\\]+)([a-z0-9_]+)$/i', $className) ? $className : ''; } } diff --git a/application/admin/command/Api/library/Builder.php b/application/admin/command/Api/library/Builder.php index 7037378b9a3f22459ca6224057b257b15b6f90a2..1b68d6cdbe0e78e29663d0e265c1fff512a27e1e 100755 --- a/application/admin/command/Api/library/Builder.php +++ b/application/admin/command/Api/library/Builder.php @@ -90,14 +90,15 @@ class Builder $typeArr = [ 'integer' => 'number', - 'file' => 'file', + 'file' => 'file', ]; $paramslist = array(); foreach ($docs['ApiParams'] as $params) { - $inputtype = $params['type'] && isset($typeArr[$params['type']]) ? $typeArr[$params['type']] : ($params['name'] == 'password' ? 'password' : 'text'); + $type = strtolower($params['type'] ?? 'string'); + $inputtype = $typeArr[$type] ?? ($params['name'] == 'password' ? 'password' : 'text'); $tr = array( 'name' => $params['name'], - 'type' => $params['type'] ?? 'string', + 'type' => $type, 'inputtype' => $inputtype, 'sample' => $params['sample'] ?? '', 'required' => $params['required'] ?? true, @@ -162,7 +163,7 @@ class Builder 'OPTIONS' => 'label-info' ); - return isset($labes[$method]) ? $labes[$method] : $labes['GET']; + return $labes[$method] ?? $labes['GET']; } public function parse() @@ -230,7 +231,7 @@ class Builder foreach ($docsList as $index => &$methods) { $methodSectorArr = []; foreach ($methods as $name => $method) { - $methodSectorArr[$name] = isset($method['weigh']) ? $method['weigh'] : 0; + $methodSectorArr[$name] = $method['weigh'] ?? 0; } arsort($methodSectorArr); $methods = array_merge(array_flip(array_keys($methodSectorArr)), $methods); @@ -253,7 +254,6 @@ class Builder public function render($template, $vars = []) { $docsList = $this->parse(); - return $this->view->display(file_get_contents($template), array_merge($vars, ['docsList' => $docsList])); } } diff --git a/application/admin/command/Api/template/index.html b/application/admin/command/Api/template/index.html index 365c929138c1b1fb0df505d4f244f77e7793002b..698e84c281ac0a39c8d37f1afe1d9a39e55ec12a 100755 --- a/application/admin/command/Api/template/index.html +++ b/application/admin/command/Api/template/index.html @@ -154,8 +154,8 @@