diff --git a/README.md b/README.md old mode 100755 new mode 100644 index cdb569da3..7e6412439 --- a/README.md +++ b/README.md @@ -41,6 +41,15 @@ ThinkPHP是一个快速、简单的基于MVC和面向对象的轻量级PHP开发 ##### 轻量级,高性能       Amaze UI 面向 HTML5 开发,使用 CSS3 来做动画交互,平滑、高效,更适合移动设备,让 Web 应用更快速载入。 +# 小程序图片展示(微信、支付宝) +![小程序](https://images.gitee.com/uploads/images/2019/0111/104727_fb5ce133_488475.jpeg "xcx-1500.jpg") + +# PC端图片展示 +![电脑端](https://images.gitee.com/uploads/images/2019/0111/104442_0a307119_488475.gif "1547174456822.gif") + +# 后台管理图片展示 +![后台管理](https://images.gitee.com/uploads/images/2019/0111/104511_63926cf8_488475.gif "1547174286447.gif") + # 项目结构 ``` shopxo diff --git a/application/admin/config/app.php b/application/admin/config/app.php index 3631d367c..977df45ed 100755 --- a/application/admin/config/app.php +++ b/application/admin/config/app.php @@ -59,7 +59,7 @@ return [ 'imageUrlPrefix' => '', // 上传保存路径,可以自定义保存路径和文件名格式 - 'imagePathFormat' => __MY_ROOT__.'static/upload/images/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', + 'imagePathFormat' => __MY_ROOT_PUBLIC__.'static/upload/images/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', // 涂鸦图片上传配置项 @@ -70,7 +70,7 @@ return [ 'scrawlFieldName' => 'upfile', // 上传保存路径,可以自定义保存路径和文件名格式 - 'scrawlPathFormat' => __MY_ROOT__.'static/upload/images/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', + '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), @@ -87,7 +87,7 @@ return [ 'snapscreenActionName' => 'uploadimage', // 上传保存路径,可以自定义保存路径和文件名格式 - 'snapscreenPathFormat' => __MY_ROOT__.'static/upload/images/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', + 'snapscreenPathFormat' => __MY_ROOT_PUBLIC__.'static/upload/images/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', // 图片访问路径前缀 'snapscreenUrlPrefix' => '', @@ -107,7 +107,7 @@ return [ 'catcherFieldName' => 'source', // 上传保存路径,可以自定义保存路径和文件名格式 - 'catcherPathFormat' => __MY_ROOT__.'static/upload/images/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', + 'catcherPathFormat' => __MY_ROOT_PUBLIC__.'static/upload/images/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', // 图片访问路径前缀 'catcherUrlPrefix' => '', @@ -127,7 +127,7 @@ return [ 'videoFieldName' => 'upfile', // 上传保存路径,可以自定义保存路径和文件名格式 - 'videoPathFormat' => __MY_ROOT__.'static/upload/video/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', + 'videoPathFormat' => __MY_ROOT_PUBLIC__.'static/upload/video/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', // 视频访问路径前缀 'videoUrlPrefix' => '', @@ -147,7 +147,7 @@ return [ 'fileFieldName' => 'upfile', // 上传保存路径,可以自定义保存路径和文件名格式 - 'filePathFormat' => __MY_ROOT__.'static/upload/file/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', + 'filePathFormat' => __MY_ROOT_PUBLIC__.'static/upload/file/'.input('path_type', 'other').'/{yyyy}/{mm}/{dd}/{time}{rand:6}', // 文件访问路径前缀 'fileUrlPrefix' => '', @@ -164,7 +164,7 @@ return [ 'imageManagerActionName'=> 'listimage', // 指定要列出图片的目录 - 'imageManagerListPath' => __MY_ROOT__.'static/upload/images/'.input('path_type', 'other').'/', + 'imageManagerListPath' => __MY_ROOT_PUBLIC__.'static/upload/images/'.input('path_type', 'other').'/', // 每次列出文件数量 'imageManagerListSize' => 20, @@ -184,7 +184,7 @@ return [ 'fileManagerActionName' => 'listfile', // 指定要列出文件的目录 - 'fileManagerListPath' => __MY_ROOT__.'static/upload/file/'.input('path_type', 'other').'/', + 'fileManagerListPath' => __MY_ROOT_PUBLIC__.'static/upload/file/'.input('path_type', 'other').'/', // 文件访问路径前缀 'fileManagerUrlPrefix' => '', @@ -199,7 +199,7 @@ return [ 'videoManagerActionName' => 'listvideo', // 指定要列出文件的目录 - 'videoManagerListPath' => __MY_ROOT__.'static/upload/video/'.input('path_type', 'other').'/', + 'videoManagerListPath' => __MY_ROOT_PUBLIC__.'static/upload/video/'.input('path_type', 'other').'/', // 文件访问路径前缀 'videoManagerUrlPrefix' => '', diff --git a/application/admin/controller/Appminialipaylist.php b/application/admin/controller/Appminialipaylist.php index a15e40903..25c6296f4 100755 --- a/application/admin/controller/Appminialipaylist.php +++ b/application/admin/controller/Appminialipaylist.php @@ -76,7 +76,17 @@ class AppMiniAlipayList extends Common $this->error('非法访问'); } + // 配置内容 + $app_mini_title = MyC('common_app_mini_alipay_title'); + $app_mini_describe = MyC('common_app_mini_alipay_describe'); + if(empty($app_mini_title) || empty($app_mini_describe)) + { + return DataReturn('配置信息不能为空', -1); + } + // 开始操作 + $this->params['app_mini_title'] = $app_mini_title; + $this->params['app_mini_describe'] = $app_mini_describe; return AppMiniService::Created($this->params); } diff --git a/application/admin/controller/Appminiweixinlist.php b/application/admin/controller/Appminiweixinlist.php index 60ea42463..7abbd9983 100755 --- a/application/admin/controller/Appminiweixinlist.php +++ b/application/admin/controller/Appminiweixinlist.php @@ -76,7 +76,17 @@ class AppMiniWeixinList extends Common $this->error('非法访问'); } + // 配置内容 + $app_mini_title = MyC('common_app_mini_weixin_title'); + $app_mini_describe = MyC('common_app_mini_weixin_describe'); + if(empty($app_mini_title) || empty($app_mini_describe)) + { + return DataReturn('配置信息不能为空', -1); + } + // 开始操作 + $this->params['app_mini_title'] = $app_mini_title; + $this->params['app_mini_describe'] = $app_mini_describe; return AppMiniService::Created($this->params); } diff --git a/application/admin/controller/Common.php b/application/admin/controller/Common.php index fbe3b4dce..0729ed62d 100755 --- a/application/admin/controller/Common.php +++ b/application/admin/controller/Common.php @@ -75,7 +75,7 @@ class Common extends Controller ConfigService::ConfigInit(); // url模式,后端采用兼容模式 - \think\facade\Url::root(__MY_ROOT__.'index.php?s='); + \think\facade\Url::root(__MY_ROOT_PUBLIC__.'index.php?s='); } /** diff --git a/application/admin/controller/Ueditor.php b/application/admin/controller/Ueditor.php index 028bc5339..40eab781d 100755 --- a/application/admin/controller/Ueditor.php +++ b/application/admin/controller/Ueditor.php @@ -130,7 +130,7 @@ class Ueditor extends Common $path = input('path'); if(!empty($path)) { - $path = (__MY_ROOT__ == '/') ? substr(ROOT_PATH, 0, -1).$path : str_replace(__MY_ROOT__, ROOT_PATH, $path); + $path = (__MY_ROOT_PUBLIC__ == '/') ? substr(ROOT_PATH, 0, -1).$path : str_replace(__MY_ROOT_PUBLIC__, ROOT_PATH, $path); if(file_exists($path)) { if(is_writable($path)) diff --git a/application/admin/view/default/navigation/index.html b/application/admin/view/default/navigation/index.html index c338009b6..957c9b61b 100755 --- a/application/admin/view/default/navigation/index.html +++ b/application/admin/view/default/navigation/index.html @@ -142,7 +142,7 @@ {{foreach $article_list as $v}} - + {{if !empty($v['items'])}} {{foreach $v.items as $vs}} {{/foreach}} @@ -254,9 +254,11 @@ {{if !empty($v['items'])}} {{foreach $v.items as $vs}} - {{foreach $vs.items as $vss}} - - {{/foreach}} + {{if !empty($vs['items'])}} + {{foreach $vs.items as $vss}} + + {{/foreach}} + {{/if}} {{/foreach}} {{/if}} {{/foreach}} diff --git a/application/admin/view/default/public/footer.html b/application/admin/view/default/public/footer.html index 473832023..b56463f34 100755 --- a/application/admin/view/default/public/footer.html +++ b/application/admin/view/default/public/footer.html @@ -6,29 +6,29 @@ - - - + + + - - - + + + - + - + - - - - + + + + - + - + {{if !empty($module_js)}} - + {{/if}} \ No newline at end of file diff --git a/application/admin/view/default/public/header.html b/application/admin/view/default/public/header.html index aa50ff5ad..9bfb1348c 100755 --- a/application/admin/view/default/public/header.html +++ b/application/admin/view/default/public/header.html @@ -5,15 +5,15 @@ ShopXO后台管理系统 - - - - - - - + + + + + + + {{if !empty($module_css)}} - + {{/if}} - - - + + + + - - - + + + - + - - - + + + - + - + - - + + {{if !empty($module_js)}} - + {{/if}} {{:MyC('home_footer_info')}} \ No newline at end of file diff --git a/application/index/view/default/public/header.html b/application/index/view/default/public/header.html index fb4b474d5..e0e6e19e7 100755 --- a/application/index/view/default/public/header.html +++ b/application/index/view/default/public/header.html @@ -17,20 +17,20 @@ - - - - + + + + - - + + {{if !empty($module_css)}} - + {{/if}} - - - \ No newline at end of file + + + + \ No newline at end of file diff --git a/application/install/view/public/header.html b/application/install/view/public/header.html index 046e4469d..cf92b01d0 100755 --- a/application/install/view/public/header.html +++ b/application/install/view/public/header.html @@ -12,11 +12,11 @@ - - - - + + + + - - + + \ No newline at end of file diff --git a/application/service/AppMiniService.php b/application/service/AppMiniService.php index 36c65d6be..34b9dc91f 100755 --- a/application/service/AppMiniService.php +++ b/application/service/AppMiniService.php @@ -104,9 +104,7 @@ class AppMiniService self::Init($params); // 配置内容 - $app_mini_alipay_title = MyC('common_app_mini_alipay_title'); - $app_mini_alipay_describe = MyC('common_app_mini_alipay_describe'); - if(empty($app_mini_alipay_title) || empty($app_mini_alipay_describe)) + if(empty($params['app_mini_title']) || empty($params['app_mini_describe'])) { return DataReturn('配置信息不能为空', -1); } @@ -141,14 +139,14 @@ class AppMiniService // 替换内容 // app.js - $status = file_put_contents($new_dir.DS.'app.js', str_replace(['{{request_url}}', '{{application_title}}', '{{application_describe}}'], [__MY_URL__, $app_mini_alipay_title, $app_mini_alipay_describe], file_get_contents($new_dir.DS.'app.js'))); + $status = file_put_contents($new_dir.DS.'app.js', str_replace(['{{request_url}}', '{{application_title}}', '{{application_describe}}'], [__MY_URL__, $params['app_mini_title'], $params['app_mini_describe']], file_get_contents($new_dir.DS.'app.js'))); if($status === false) { return DataReturn('基础配置替换失败', -4); } // app.json - $status = file_put_contents($new_dir.DS.'app.json', str_replace(['{{application_title}}'], [$app_mini_alipay_title], file_get_contents($new_dir.DS.'app.json'))); + $status = file_put_contents($new_dir.DS.'app.json', str_replace(['{{application_title}}'], [$params['app_mini_title']], file_get_contents($new_dir.DS.'app.json'))); if($status === false) { return DataReturn('基础配置替换失败', -4); diff --git a/application/service/ResourcesService.php b/application/service/ResourcesService.php index c004784c5..b937ea30d 100755 --- a/application/service/ResourcesService.php +++ b/application/service/ResourcesService.php @@ -42,7 +42,7 @@ class ResourcesService // 内容写入 case 'add': - return str_replace(array(__MY_PUBLIC_URL__.'static/', __MY_ROOT__.'static/'), '/static/', $content); + return str_replace(array(__MY_PUBLIC_URL__.'static/', __MY_ROOT_PUBLIC__.'static/'), '/static/', $content); } return $content; } @@ -58,7 +58,7 @@ class ResourcesService */ public static function AttachmentPathHandle($value) { - return empty($value) ? '' : str_replace([__MY_PUBLIC_URL__, __MY_ROOT__], DS, $value); + return empty($value) ? '' : str_replace([__MY_PUBLIC_URL__, __MY_ROOT_PUBLIC__], DS, $value); } /** diff --git a/application/service/ThemeService.php b/application/service/ThemeService.php index b5bb97061..41389eb95 100755 --- a/application/service/ThemeService.php +++ b/application/service/ThemeService.php @@ -42,9 +42,14 @@ class ThemeService { if($dh = opendir($dir)) { - $default_preview = __MY_URL__.'static'.DS.'common'.DS.'images'.DS.'default-preview.jpg'; + $default_preview = __MY_PUBLIC_URL__.'static'.DS.'common'.DS.'images'.DS.'default-preview.jpg'; while(($temp_file = readdir($dh)) !== false) { + if(in_array($temp_file, ['.', '..', 'index.html'])) + { + continue; + } + $config = $dir.$temp_file.DS.'config.json'; if(!file_exists($config)) { @@ -66,7 +71,7 @@ class ThemeService 'ver' => str_replace(array(',',','), ', ', htmlentities($data['ver'])), 'author' => htmlentities($data['author']), 'home' => isset($data['home']) ? $data['home'] : '', - 'preview' => file_exists($preview) ? __MY_URL__.'static'.DS.'index'.DS.$temp_file.DS.'images'.DS.'preview.jpg' : $default_preview, + 'preview' => file_exists($preview) ? __MY_PUBLIC_URL__.'static'.DS.'index'.DS.$temp_file.DS.'images'.DS.'preview.jpg' : $default_preview, 'is_delete' => ($temp_file == 'default') ? 0 : 1, ); } diff --git a/extend/base/FileUtil.php b/extend/base/FileUtil.php index 81be0621c..d651ccf32 100755 --- a/extend/base/FileUtil.php +++ b/extend/base/FileUtil.php @@ -45,14 +45,18 @@ class FileUtil */ public static function CreateDir($aim_url) { + // 根目录前不参与,避免虚拟机没有权限 + $aim_dir = ROOT; + $aim_url = str_replace($aim_dir, '', $aim_url); + + // 空转成目录 $aim_url = str_replace('', '/', $aim_url); - $aim_dir = ''; $arr = explode('/', $aim_url); $result = true; foreach($arr as $str) { $aim_dir .= $str . '/'; - if(!file_exists($aim_dir)) + if($aim_dir != '/' && !is_dir($aim_dir)) { $result = mkdir($aim_dir); } diff --git a/public/core.php b/public/core.php index e5ac4b417..4442c852c 100755 --- a/public/core.php +++ b/public/core.php @@ -9,39 +9,39 @@ // | Author: Devil // +---------------------------------------------------------------------- +// 检测PHP环境 +if(version_compare(PHP_VERSION,'5.6.0','<')) die('PHP版本最低 5.6.0'); + // 开启缓冲区 ob_start(); -// 检测PHP环境 -if(version_compare(PHP_VERSION,'5.3.0','<')) die('require PHP > 5.3.0 !'); - -// HTTP类型 -define('__MY_HTTP__', (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') ? 'http' : 'https'); - -// 根目录 -$my_root = empty($_SERVER['SCRIPT_NAME']) ? '' : substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], '/')+1); - -define('__MY_ROOT__', defined('IS_ROOT_ACCESS') ? $my_root.'public/' : $my_root); - -// 项目HOST -define('__MY_HOST__', empty($_SERVER['HTTP_HOST']) ? '' : $_SERVER['HTTP_HOST']); - -// 项目URL地址 -define('__MY_URL__', empty($_SERVER['HTTP_HOST']) ? '' : __MY_HTTP__.'://'.__MY_HOST__.$my_root); - -// 项目public目录URL地址 -define('__MY_PUBLIC_URL__', empty($_SERVER['HTTP_HOST']) ? '' : __MY_HTTP__.'://'.__MY_HOST__.__MY_ROOT__); - -// 当前页面url地址 -$request_url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; -define('__MY_VIEW_URL__', substr(__MY_URL__, 0, -1).$request_url); - // 系统版本 define('APPLICATION_VERSION', 'v1.2.0'); // 定义系统目录分隔符 define('DS', '/'); +// HTTP类型 +define('__MY_HTTP__', (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == 'off') ? 'http' : 'https'); + +// 根目录 +$my_root = empty($_SERVER['SCRIPT_NAME']) ? '' : substr($_SERVER['SCRIPT_NAME'], 1, strrpos($_SERVER['SCRIPT_NAME'], '/')); +define('__MY_ROOT__', defined('IS_ROOT_ACCESS') ? $my_root : str_replace('public'.DS, '', $my_root)); +define('__MY_ROOT_PUBLIC__', defined('IS_ROOT_ACCESS') ? DS.$my_root.'public'.DS : DS.$my_root); + +// 项目HOST +define('__MY_HOST__', empty($_SERVER['HTTP_HOST']) ? '' : $_SERVER['HTTP_HOST']); + +// 项目URL地址 +define('__MY_URL__', empty($_SERVER['HTTP_HOST']) ? '' : __MY_HTTP__.'://'.__MY_HOST__.DS.$my_root); + +// 项目public目录URL地址 +define('__MY_PUBLIC_URL__', empty($_SERVER['HTTP_HOST']) ? '' : __MY_HTTP__.'://'.__MY_HOST__.__MY_ROOT_PUBLIC__); + +// 当前页面url地址 +$request_url = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; +define('__MY_VIEW_URL__', substr(__MY_URL__, 0, -1).$request_url); + // 系统根目录 define('ROOT_PATH', dirname(__FILE__).DS);