diff --git a/.bowerrc b/.bowerrc new file mode 100644 index 0000000000000000000000000000000000000000..39903e1ad5a587da948b18e96b14a3937a2b4775 --- /dev/null +++ b/.bowerrc @@ -0,0 +1,14 @@ +{ + "directory": "public/assets/libs", + "ignoredDependencies": [ + "es6-promise", + "file-saver", + "html2canvas", + "jspdf", + "jspdf-autotable", + "pdfmake" + ], + "scripts":{ + "postinstall": "node bower-cleanup.js" + } +} diff --git a/.gitignore b/.gitignore index b209131183756f6928824b5efc4c11f27584ffd7..56bdaf6973fa702982698349fce5f4f92d4f508a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ /public/assets/libs/ /public/assets/addons/* /public/uploads/* +.DS_Store .idea composer.lock *.log diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000000000000000000000000000000000000..bbcd57ba7a3e383fa344915fa60c03304424dc00 --- /dev/null +++ b/.npmrc @@ -0,0 +1,4 @@ +# 使用自定义镜像源 +registry=http://mirrors.tencent.com/npm/ +#关闭SSL验证 +strict-ssl=false \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index 5fc383837b620e96d3a0d0ecc2f4c3b5179aef7a..69b14f3d9cf3d6c77fc821ee33beca1aa3016ae7 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -14,7 +14,7 @@ module.exports = function (grunt) { compile: { options: type === 'js' ? { optimizeCss: "standard", - optimize: "none", //可使用uglify|closure|none + optimize: "uglify", //可使用uglify|closure|none preserveLicenseComments: true, removeCombined: false, baseUrl: "./public/assets/js/", //JS文件所在的基础目录 @@ -23,7 +23,7 @@ module.exports = function (grunt) { } : { optimizeCss: "default", optimize: "uglify", //可使用uglify|closure|none - cssIn: "./public/assets/css/" + module + ".css", //JS文件所在的基础目录 + cssIn: "./public/assets/css/" + module + ".css", //CSS文件所在的基础目录 out: "./public/assets/css/" + module + ".min.css" //目标文件 } } @@ -110,11 +110,25 @@ module.exports = function (grunt) { let dists = mainPackage.dists || []; let files = []; + // 兼容旧版本bower使用的目录 + let specialKey = { + 'fastadmin-bootstraptable': 'bootstrap-table', + 'sortablejs': 'Sortable', + 'tableexport.jquery.plugin': 'tableExport.jquery.plugin', + }; 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 + "/"}); + files.push({expand: true, cwd: nodeModulesDir + "/" + key, src: src, dest: 'public/assets/libs/' + (specialKey[key] || key) + "/"}); }); + + // 兼容bower历史路径文件 + files = [...files, + {src: nodeModulesDir + "/toastr/build/toastr.min.css", dest: "public/assets/libs/toastr/toastr.min.css"}, + {src: nodeModulesDir + "/bootstrap-slider/dist/css/bootstrap-slider.css", dest: "public/assets/libs/bootstrap-slider/slider.css"}, + {expand: true, cwd: nodeModulesDir + "/bootstrap-slider/dist", src: ["*.js"], dest: "public/assets/libs/bootstrap-slider/"} + ] + grunt.config.set('copy.main.files', files); grunt.task.run("copy:main"); }); diff --git a/README.md b/README.md index 0a0673784073aae1e0c9e99838d710d924ea98d5..9296a29221580374c8e877136bda8587fbe537cd 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端扫码支付 @@ -57,9 +55,9 @@ https://demo.fastadmin.net 问答社区: https://ask.fastadmin.net -Github: https://github.com/karsonzhang/fastadmin +Github: https://github.com/fastadminnet/fastadmin -Gitee: https://gitee.com/karson/fastadmin +Gitee: https://gitee.com/fastadminnet/fastadmin ## 特别鸣谢 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 @@