From 5bef77ee64beb6bd35d0ed0eedc7a4e1f3a01bf9 Mon Sep 17 00:00:00 2001 From: gongfuxiang <2499232802@qq.com> Date: Sun, 23 Jun 2019 00:27:49 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=84=E4=BB=B6=E6=8E=A5=E5=8F=A3=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E6=96=B0=E5=A2=9Eapi=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api.php | 17 ++ application/admin/config/app.php | 183 ------------------ .../admin/view/default/article/save_info.html | 2 +- .../view/default/customview/save_info.html | 2 +- .../admin/view/default/public/footer.html | 2 +- application/api/config/app.php | 183 ++++++++++++++++++ application/api/controller/Common.php | 2 +- .../{admin => api}/controller/Ueditor.php | 9 +- application/common.php | 19 +- .../index/view/default/public/footer.html | 2 +- config/app.php | 2 +- public/api.php | 25 +++ 12 files changed, 248 insertions(+), 200 deletions(-) create mode 100644 api.php rename application/{admin => api}/controller/Ueditor.php (98%) create mode 100644 public/api.php diff --git a/api.php b/api.php new file mode 100644 index 000000000..219fd24f6 --- /dev/null +++ b/api.php @@ -0,0 +1,17 @@ + \ No newline at end of file diff --git a/application/admin/config/app.php b/application/admin/config/app.php index fb4bd7fd1..7f3b3c7e1 100755 --- a/application/admin/config/app.php +++ b/application/admin/config/app.php @@ -30,188 +30,5 @@ return [ // 设置默认的模板主题 'DEFAULT_THEME' => 'Default', - - // 百度编辑器配置信息 ueditor - 'ueditor_config' => [ - // 上传图片配置项 - // 执行上传图片的action名称 - 'imageActionName' => 'uploadimage', - - // 提交的图片表单名称 - 'imageFieldName' => 'upfile', - - // 上传大小限制,单位B - 'imageMaxSize' => MyC('home_max_limit_image', 2048000, true), - - // 上传图片格式显示 - 'imageAllowFiles' => ['.png', '.jpg', '.jpeg', '.gif', '.bmp'], - - // 是否压缩图片,默认是true - 'imageCompressEnable' => true, - - // 图片压缩最长边限制 - 'imageCompressBorder' => 1600, - - // 插入的图片浮动方式 - 'imageInsertAlign' => 'none', - - // 图片访问路径前缀 - 'imageUrlPrefix' => '', - - // 上传保存路径,可以自定义保存路径和文件名格式 - 'imagePathFormat' => __MY_ROOT_PUBLIC__.'static/upload/images/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', - - - // 涂鸦图片上传配置项 - // 执行上传涂鸦的action名称 - 'scrawlActionName' => 'uploadscrawl', - - // 提交的图片表单名称 - 'scrawlFieldName' => 'upfile', - - // 上传保存路径,可以自定义保存路径和文件名格式 - 'scrawlPathFormat' => __MY_ROOT_PUBLIC__.'static/upload/images/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', - - // 上传大小限制,单位B - 'scrawlMaxSize' => MyC('home_max_limit_image', 2048000, true), - - // 上传图片格式显示 - 'scrawlAllowFiles' => ['.png', '.jpg', '.jpeg', '.gif', '.bmp'], - - // 图片访问路径前缀 - 'scrawlUrlPrefix' => '', - - // 插入的图片浮动方式 - 'scrawlInsertAlign' => 'none', - - - // 截图工具上传 - // 执行上传截图的action名称 - 'snapscreenActionName' => 'uploadimage', - - // 上传保存路径,可以自定义保存路径和文件名格式 - 'snapscreenPathFormat' => __MY_ROOT_PUBLIC__.'static/upload/images/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', - - // 图片访问路径前缀 - 'snapscreenUrlPrefix' => '', - - // 插入的图片浮动方式 - 'snapscreenInsertAlign' => 'none', - - - // 抓取远程图片配置 - // 执行抓取远程图片的action名称 - 'catcherLocalDomain' => ['127.0.0.1', 'localhost', 'img.baidu.com'], - - // 执行抓取远程图片的action名称 - 'catcherActionName' => 'catchimage', - - // 提交的图片列表表单名称 - 'catcherFieldName' => 'source', - - // 上传保存路径,可以自定义保存路径和文件名格式 - 'catcherPathFormat' => __MY_ROOT_PUBLIC__.'static/upload/images/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', - - // 图片访问路径前缀 - 'catcherUrlPrefix' => '', - - // 上传大小限制,单位B - 'catcherMaxSize' => MyC('home_max_limit_image', 2048000, true), - - // 抓取图片格式显示 - 'catcherAllowFiles' => ['.png', '.jpg', '.jpeg', '.gif', '.bmp'], - - - // 上传视频配置 - // 执行上传视频的action名称 - 'videoActionName' => 'uploadvideo', - - // 提交的视频表单名称 - 'videoFieldName' => 'upfile', - - // 上传保存路径,可以自定义保存路径和文件名格式 - 'videoPathFormat' => __MY_ROOT_PUBLIC__.'static/upload/video/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', - - // 视频访问路径前缀 - 'videoUrlPrefix' => '', - - // 上传大小限制,单位B,默认100MB - 'videoMaxSize' => MyC('home_max_limit_video', 102400000, true), - - // 上传视频格式显示 - 'videoAllowFiles' => ['.swf', '.ogg', '.ogv', '.mp4', '.webm', '.mp3'], - - - // 上传文件配置 - // controller里,执行上传视频的action名称 - 'fileActionName' => 'uploadfile', - - // 提交的文件表单名称 - 'fileFieldName' => 'upfile', - - // 上传保存路径,可以自定义保存路径和文件名格式 - 'filePathFormat' => __MY_ROOT_PUBLIC__.'static/upload/file/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', - - // 文件访问路径前缀 - 'fileUrlPrefix' => '', - - // 上传大小限制,单位B,默认50MB - 'fileMaxSize' => MyC('home_max_limit_file', 51200000, true), - - // 上传文件格式显示 - 'fileAllowFiles' => ['.png', '.jpg', '.jpeg', '.gif', '.bmp', '.flv', '.swf', '.mkv', '.avi', '.rm', '.rmvb', '.mpeg', '.mpg', '.ogg', '.ogv', '.mov', '.wmv', '.mp4', '.webm', '.mp3', '.wav', '.mid','.rar', '.zip', '.tar', '.gz', '.7z', '.bz2', '.cab', '.iso', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.pdf', '.txt', '.md', '.xml'], - - - // 列出指定目录下的图片 - // 执行图片管理的action名称 - 'imageManagerActionName'=> 'listimage', - - // 指定要列出图片的目录 - 'imageManagerListPath' => __MY_ROOT_PUBLIC__.'static/upload/images/'.input('path_type', 'other').'/', - - // 每次列出文件数量 - 'imageManagerListSize' => 20, - - // 图片访问路径前缀 - 'imageManagerUrlPrefix' => '', - - // 插入的图片浮动方式 - 'imageManagerInsertAlign'=> 'none', - - // 列出的文件类型 - 'imageManagerAllowFiles'=> ['.png', '.jpg', '.jpeg', '.gif', '.bmp'], - - - // 列出指定目录下的文件 - // 执行文件管理的action名称 - 'fileManagerActionName' => 'listfile', - - // 指定要列出文件的目录 - 'fileManagerListPath' => __MY_ROOT_PUBLIC__.'static/upload/file/'.input('path_type', 'other').'/', - - // 文件访问路径前缀 - 'fileManagerUrlPrefix' => '', - - // 每次列出文件数量 - 'fileManagerListSize' => 20, - - // 列出的文件类型 - 'fileManagerAllowFiles' => ['.png', '.jpg', '.jpeg', '.gif', '.bmp', '.flv', '.swf', '.mkv', '.avi', '.rm', '.rmvb', '.mpeg', '.mpg', '.ogg', '.ogv', '.mov', '.wmv', '.mp4', '.webm', '.mp3', '.wav', '.mid','.rar', '.zip', '.tar', '.gz', '.7z', '.bz2', '.cab', '.iso', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.pdf', '.txt', '.md', '.xml'], - - // 执行视频管理的action名称 - 'videoManagerActionName' => 'listvideo', - - // 指定要列出文件的目录 - 'videoManagerListPath' => __MY_ROOT_PUBLIC__.'static/upload/video/'.input('path_type', 'other').'/', - - // 文件访问路径前缀 - 'videoManagerUrlPrefix' => '', - - // 每次列出文件数量 - 'videoManagerListSize' => 20, - - // 列出的文件类型 - 'videoManagerAllowFiles' => ['.swf', '.ogg', '.ogv', '.mp4', '.webm', '.mp3'], - ], ]; ?> \ No newline at end of file diff --git a/application/admin/view/default/article/save_info.html b/application/admin/view/default/article/save_info.html index b327f6b24..8848ba29f 100755 --- a/application/admin/view/default/article/save_info.html +++ b/application/admin/view/default/article/save_info.html @@ -50,7 +50,7 @@
- +
diff --git a/application/admin/view/default/customview/save_info.html b/application/admin/view/default/customview/save_info.html index f3ac2f25b..0f5304595 100755 --- a/application/admin/view/default/customview/save_info.html +++ b/application/admin/view/default/customview/save_info.html @@ -41,7 +41,7 @@
- +
diff --git a/application/admin/view/default/public/footer.html b/application/admin/view/default/public/footer.html index 919224a45..e954f4d31 100755 --- a/application/admin/view/default/public/footer.html +++ b/application/admin/view/default/public/footer.html @@ -1,5 +1,5 @@ - + {{if !empty($plugins_admin_view_common_bottom_data) and is_array($plugins_admin_view_common_bottom_data) and (!isset($is_footer) or $is_footer eq 1)}} diff --git a/application/api/config/app.php b/application/api/config/app.php index 713ff87ae..68fe47c9a 100755 --- a/application/api/config/app.php +++ b/application/api/config/app.php @@ -24,5 +24,188 @@ return [ 'default_ajax_return' => 'json', // 默认JSONP格式返回的处理方法 'default_jsonp_handler' => 'jsonpReturn', + + // 百度编辑器配置信息 ueditor + 'ueditor_config' => [ + // 上传图片配置项 + // 执行上传图片的action名称 + 'imageActionName' => 'uploadimage', + + // 提交的图片表单名称 + 'imageFieldName' => 'upfile', + + // 上传大小限制,单位B + 'imageMaxSize' => MyC('home_max_limit_image', 2048000, true), + + // 上传图片格式显示 + 'imageAllowFiles' => ['.png', '.jpg', '.jpeg', '.gif', '.bmp'], + + // 是否压缩图片,默认是true + 'imageCompressEnable' => true, + + // 图片压缩最长边限制 + 'imageCompressBorder' => 1600, + + // 插入的图片浮动方式 + 'imageInsertAlign' => 'none', + + // 图片访问路径前缀 + 'imageUrlPrefix' => '', + + // 上传保存路径,可以自定义保存路径和文件名格式 + 'imagePathFormat' => __MY_ROOT_PUBLIC__.'static/upload/images/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', + + + // 涂鸦图片上传配置项 + // 执行上传涂鸦的action名称 + 'scrawlActionName' => 'uploadscrawl', + + // 提交的图片表单名称 + 'scrawlFieldName' => 'upfile', + + // 上传保存路径,可以自定义保存路径和文件名格式 + 'scrawlPathFormat' => __MY_ROOT_PUBLIC__.'static/upload/images/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', + + // 上传大小限制,单位B + 'scrawlMaxSize' => MyC('home_max_limit_image', 2048000, true), + + // 上传图片格式显示 + 'scrawlAllowFiles' => ['.png', '.jpg', '.jpeg', '.gif', '.bmp'], + + // 图片访问路径前缀 + 'scrawlUrlPrefix' => '', + + // 插入的图片浮动方式 + 'scrawlInsertAlign' => 'none', + + + // 截图工具上传 + // 执行上传截图的action名称 + 'snapscreenActionName' => 'uploadimage', + + // 上传保存路径,可以自定义保存路径和文件名格式 + 'snapscreenPathFormat' => __MY_ROOT_PUBLIC__.'static/upload/images/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', + + // 图片访问路径前缀 + 'snapscreenUrlPrefix' => '', + + // 插入的图片浮动方式 + 'snapscreenInsertAlign' => 'none', + + + // 抓取远程图片配置 + // 执行抓取远程图片的action名称 + 'catcherLocalDomain' => ['127.0.0.1', 'localhost', 'img.baidu.com'], + + // 执行抓取远程图片的action名称 + 'catcherActionName' => 'catchimage', + + // 提交的图片列表表单名称 + 'catcherFieldName' => 'source', + + // 上传保存路径,可以自定义保存路径和文件名格式 + 'catcherPathFormat' => __MY_ROOT_PUBLIC__.'static/upload/images/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', + + // 图片访问路径前缀 + 'catcherUrlPrefix' => '', + + // 上传大小限制,单位B + 'catcherMaxSize' => MyC('home_max_limit_image', 2048000, true), + + // 抓取图片格式显示 + 'catcherAllowFiles' => ['.png', '.jpg', '.jpeg', '.gif', '.bmp'], + + + // 上传视频配置 + // 执行上传视频的action名称 + 'videoActionName' => 'uploadvideo', + + // 提交的视频表单名称 + 'videoFieldName' => 'upfile', + + // 上传保存路径,可以自定义保存路径和文件名格式 + 'videoPathFormat' => __MY_ROOT_PUBLIC__.'static/upload/video/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', + + // 视频访问路径前缀 + 'videoUrlPrefix' => '', + + // 上传大小限制,单位B,默认100MB + 'videoMaxSize' => MyC('home_max_limit_video', 102400000, true), + + // 上传视频格式显示 + 'videoAllowFiles' => ['.swf', '.ogg', '.ogv', '.mp4', '.webm', '.mp3'], + + + // 上传文件配置 + // controller里,执行上传视频的action名称 + 'fileActionName' => 'uploadfile', + + // 提交的文件表单名称 + 'fileFieldName' => 'upfile', + + // 上传保存路径,可以自定义保存路径和文件名格式 + 'filePathFormat' => __MY_ROOT_PUBLIC__.'static/upload/file/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', + + // 文件访问路径前缀 + 'fileUrlPrefix' => '', + + // 上传大小限制,单位B,默认50MB + 'fileMaxSize' => MyC('home_max_limit_file', 51200000, true), + + // 上传文件格式显示 + 'fileAllowFiles' => ['.png', '.jpg', '.jpeg', '.gif', '.bmp', '.flv', '.swf', '.mkv', '.avi', '.rm', '.rmvb', '.mpeg', '.mpg', '.ogg', '.ogv', '.mov', '.wmv', '.mp4', '.webm', '.mp3', '.wav', '.mid','.rar', '.zip', '.tar', '.gz', '.7z', '.bz2', '.cab', '.iso', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.pdf', '.txt', '.md', '.xml'], + + + // 列出指定目录下的图片 + // 执行图片管理的action名称 + 'imageManagerActionName'=> 'listimage', + + // 指定要列出图片的目录 + 'imageManagerListPath' => __MY_ROOT_PUBLIC__.'static/upload/images/'.input('path_type', 'other').'/', + + // 每次列出文件数量 + 'imageManagerListSize' => 20, + + // 图片访问路径前缀 + 'imageManagerUrlPrefix' => '', + + // 插入的图片浮动方式 + 'imageManagerInsertAlign'=> 'none', + + // 列出的文件类型 + 'imageManagerAllowFiles'=> ['.png', '.jpg', '.jpeg', '.gif', '.bmp'], + + + // 列出指定目录下的文件 + // 执行文件管理的action名称 + 'fileManagerActionName' => 'listfile', + + // 指定要列出文件的目录 + 'fileManagerListPath' => __MY_ROOT_PUBLIC__.'static/upload/file/'.input('path_type', 'other').'/', + + // 文件访问路径前缀 + 'fileManagerUrlPrefix' => '', + + // 每次列出文件数量 + 'fileManagerListSize' => 20, + + // 列出的文件类型 + 'fileManagerAllowFiles' => ['.png', '.jpg', '.jpeg', '.gif', '.bmp', '.flv', '.swf', '.mkv', '.avi', '.rm', '.rmvb', '.mpeg', '.mpg', '.ogg', '.ogv', '.mov', '.wmv', '.mp4', '.webm', '.mp3', '.wav', '.mid','.rar', '.zip', '.tar', '.gz', '.7z', '.bz2', '.cab', '.iso', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.pdf', '.txt', '.md', '.xml'], + + // 执行视频管理的action名称 + 'videoManagerActionName' => 'listvideo', + + // 指定要列出文件的目录 + 'videoManagerListPath' => __MY_ROOT_PUBLIC__.'static/upload/video/'.input('path_type', 'other').'/', + + // 文件访问路径前缀 + 'videoManagerUrlPrefix' => '', + + // 每次列出文件数量 + 'videoManagerListSize' => 20, + + // 列出的文件类型 + 'videoManagerAllowFiles' => ['.swf', '.ogg', '.ogv', '.mp4', '.webm', '.mp3'], + ], ]; ?> \ No newline at end of file diff --git a/application/api/controller/Common.php b/application/api/controller/Common.php index a7528d181..2e94af04b 100755 --- a/application/api/controller/Common.php +++ b/application/api/controller/Common.php @@ -123,7 +123,7 @@ class Common extends Controller { if(empty($this->user)) { - exit(json_encode(DataReturn('登录失效,请重新登录', -400))); + exit(json_encode(DataReturn('登录失效,请重新登录sss', -400))); } } diff --git a/application/admin/controller/Ueditor.php b/application/api/controller/Ueditor.php similarity index 98% rename from application/admin/controller/Ueditor.php rename to application/api/controller/Ueditor.php index 69f015185..b943e7c09 100755 --- a/application/admin/controller/Ueditor.php +++ b/application/api/controller/Ueditor.php @@ -8,7 +8,7 @@ // +---------------------------------------------------------------------- // | Author: Devil // +---------------------------------------------------------------------- -namespace app\admin\controller; +namespace app\api\controller; use think\facade\Hook; @@ -51,13 +51,6 @@ class Ueditor extends Common $this->current_config = config('ueditor_config'); $this->current_action = input('action'); - // 非获取配置信息登录校验 - if($this->current_action != 'config') - { - // 登录校验 - $this->IsLogin(); - } - // action switch($this->current_action) { diff --git a/application/common.php b/application/common.php index 80203e0db..bde8d6906 100755 --- a/application/common.php +++ b/application/common.php @@ -437,9 +437,15 @@ function MyUrl($path, $params=[]) // 避免从后台生成url入口错误 $script_name = CurrentScriptName(); - if($script_name != 'index.php' && substr($path, 0, 6) == 'index/') + if($script_name != 'index.php') { - $url = str_replace($script_name, 'index.php', $url); + if(substr($path, 0, 6) == 'index/') + { + $url = str_replace($script_name, 'index.php', $url); + } elseif(substr($path, 0, 4) == 'api/') + { + $url = str_replace($script_name, 'api.php', $url); + } } return $url; @@ -479,7 +485,14 @@ function PluginsHomeUrl($plugins_name, $plugins_control, $plugins_action, $param } // 避免从后台生成url入口错误 - $url = str_replace(CurrentScriptName(), 'index.php', $url); + $script_name = CurrentScriptName(); + if(substr($path, 0, 6) == 'index/') + { + $url = str_replace($script_name, 'index.php', $url); + } elseif(substr($path, 0, 4) == 'api/') + { + $url = str_replace($script_name, 'api.php', $url); + } return $url; } diff --git a/application/index/view/default/public/footer.html b/application/index/view/default/public/footer.html index d720b3765..b2707845e 100755 --- a/application/index/view/default/public/footer.html +++ b/application/index/view/default/public/footer.html @@ -1,5 +1,5 @@ - + {{if !isset($is_footer) or $is_footer eq 1}} diff --git a/config/app.php b/config/app.php index 3d956197d..85cbfacdc 100755 --- a/config/app.php +++ b/config/app.php @@ -19,7 +19,7 @@ return [ // 应用地址 'app_host' => '', // 应用调试模式 - 'app_debug' => false, + 'app_debug' => true, // 应用Trace 'app_trace' => false, // 是否支持多模块 diff --git a/public/api.php b/public/api.php new file mode 100644 index 000000000..c897aa310 --- /dev/null +++ b/public/api.php @@ -0,0 +1,25 @@ +run()->send(); +?> \ No newline at end of file -- GitLab