diff --git a/application/admin/controller/Admin.php b/application/admin/controller/Admin.php index f40a253b7..331ad0d05 100755 --- a/application/admin/controller/Admin.php +++ b/application/admin/controller/Admin.php @@ -290,7 +290,7 @@ class Admin extends Common */ public function Logout() { - session_destroy(); + session('admin', null); return redirect(MyUrl('admin/admin/logininfo')); } } diff --git a/application/admin/controller/Cache.php b/application/admin/controller/Cache.php index 42cccae91..79425b617 100755 --- a/application/admin/controller/Cache.php +++ b/application/admin/controller/Cache.php @@ -69,6 +69,10 @@ class Cache extends Common \base\FileUtil::UnlinkDir(ROOT.'runtime'.DS.'cache'); \base\FileUtil::UnlinkDir(ROOT.'runtime'.DS.'temp'); \base\FileUtil::UnlinkDir(ROOT.'runtime'.DS.'data'); + + // 缓存操作清除 + \think\facade\Cache::clear(); + return $this->success('更新成功'); } diff --git a/application/admin/controller/Site.php b/application/admin/controller/Site.php index 2da4e5236..cccc9d7a4 100755 --- a/application/admin/controller/Site.php +++ b/application/admin/controller/Site.php @@ -12,6 +12,7 @@ namespace app\admin\controller; use app\service\ConfigService; use app\service\GoodsService; +use app\service\BaseConfigHandleService; /** * 站点设置 @@ -223,12 +224,23 @@ class Site extends Common { switch($nav_type) { + // 登录 case 'login' : cache(config('shopxo.cache_user_login_left_key'), null); + // 密码找回 case 'forgetpwd' : cache(config('shopxo.cache_user_forgetpwd_left_key'), null); break; + + // 缓存 + case 'cache' : + $res = BaseConfigHandleService::Run(); + if($res['code'] != 0) + { + return $res; + } + break; } } diff --git a/application/admin/view/default/site/base.html b/application/admin/view/default/site/base.html index b27767689..b1d3f5c71 100755 --- a/application/admin/view/default/site/base.html +++ b/application/admin/view/default/site/base.html @@ -9,88 +9,126 @@
-
- - -
-
- - -
+选择logo
+ +
+
+

基础配置

+
+
+
+ + +
+
+ +
    + {{if !empty($data['home_site_logo']['value'])}} +
  • + + +
  • + {{/if}} +
+
+选择logo
+
+ +
+ +
    + {{if !empty($data['home_site_logo_wap']['value'])}} +
  • + + +
  • + {{/if}} +
+
+选择logo
+
+ +
+ +
    + {{if !empty($data['home_site_desktop_icon']['value'])}} +
  • + + +
  • + {{/if}} +
+
+选择logo
+
+ +
+ + +
+
-
- -
    - {{if !empty($data['home_site_logo_wap']['value'])}} -
  • - - -
  • - {{/if}} -
-
+选择logo
+ +
+
+

站点状态

+
+
+
+ + +
+
+ + +
+
-
- -
    - {{if !empty($data['home_site_desktop_icon']['value'])}} -
  • - - -
  • - {{/if}} -
-
+选择logo
-
+ +
+
+

备案信息

+
+
+
+ + +
-
- - -
- -
- - -
-
- - -
- -
- -
- - - - +
+ + +
+
+ + +
-
- - -
-
- - + + +
+
+

其它

+
+
+
+ + +
+
+ + +
+
+
diff --git a/application/admin/view/default/site/beian.html b/application/admin/view/default/site/beian.html deleted file mode 100644 index a682927d7..000000000 --- a/application/admin/view/default/site/beian.html +++ /dev/null @@ -1,38 +0,0 @@ -{{include file="public/header" /}} - - -
-
- - {{include file="site/nav" /}} - - - - -
- - -
- -
- - -
-
- - -
- -
- - -
- - -
-
- - - -{{include file="public/footer" /}} - \ No newline at end of file diff --git a/application/admin/view/default/site/cache.html b/application/admin/view/default/site/cache.html new file mode 100644 index 000000000..779e7208c --- /dev/null +++ b/application/admin/view/default/site/cache.html @@ -0,0 +1,84 @@ +{{include file="public/header" /}} + + +
+
+ + {{include file="site/nav" /}} + + + +
+ +
+
+

基础配置

+
+
+
+ + +
+
+ + +
+
+
+ + +
+
+

Redis配置

+
+
+
+ + +
+ +
+ + +
+
+ + +
+
+ +
+ + + + +
+
+
+ + +
+
+
+ +
+ + +
+
+ +
+
+ + + +{{include file="public/footer" /}} + \ No newline at end of file diff --git a/application/admin/view/default/site/nav.html b/application/admin/view/default/site/nav.html index 3e4ebb88f..a08512021 100644 --- a/application/admin/view/default/site/nav.html +++ b/application/admin/view/default/site/nav.html @@ -5,9 +5,6 @@
  • 网站设置
  • -
  • - 备案信息 -
  • 站点类型
  • @@ -20,15 +17,18 @@
  • 密码找回
  • -
  • - 附件 -
  • 验证码
  • 订单售后
  • +
  • + 附件 +
  • +
  • + 缓存 +
  • 扩展项
  • diff --git a/application/index/controller/Common.php b/application/index/controller/Common.php index 2073f3c74..2ad062725 100755 --- a/application/index/controller/Common.php +++ b/application/index/controller/Common.php @@ -350,11 +350,6 @@ class Common extends Controller $this->assign('home_seo_site_keywords', MyC('home_seo_site_keywords')); $this->assign('home_seo_site_description', MyC('home_seo_site_description')); - // 页面最大宽度 - $max_width = MyC('home_content_max_width', 0, true); - $max_width_style = ($max_width == 0) ? '' : 'max-width:'.$max_width.'px;'; - $this->assign('max_width_style', $max_width_style); - // 用户数据 $this->assign('user', $this->user); diff --git a/application/service/BaseConfigHandleService.php b/application/service/BaseConfigHandleService.php new file mode 100644 index 000000000..0da4b1c1a --- /dev/null +++ b/application/service/BaseConfigHandleService.php @@ -0,0 +1,185 @@ + 'redis', + // 连接地址 + 'host' => MyC('common_cache_redis_host', '127.0.0.1', true), + // 端口号 + 'port' => MyC('common_cache_redis_port', 6379, true), + // 密码 + 'password' => MyC('common_cache_redis_password', '', true), + // 全局缓存有效期、默认3600秒 + 'expire' => MyC('common_cache_redis_expire', 3600, true), + // 缓存前缀 + 'prefix' => MyC('common_cache_redis_prefix', 'shopxo', true), + ]; + } else { + $config = [ + // session_id + 'id' => '', + // SESSION_ID的提交变量,解决flash上传跨域 + 'var_session_id' => '', + // SESSION 前缀 + 'prefix' => 'shopxo', + // 驱动方式 支持redis memcache memcached + 'type' => '', + // 是否自动开启 SESSION + 'auto_start' => true, + ]; + } + // 配置文件 + $config_file = ROOT.'config'.DS.'session.php'; + + // 保存文件 + return self::ConfigFileSave($config_file, $config, 'Session配置'); + } + + /** + * cache配置处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-09-25 + * @desc description + * @param [array] $params [输入参数] + */ + public static function CacheHandle($params = []) + { + // 是否使用缓存 + if(MyC('common_data_is_use_cache') == 1) + { + $config = [ + // 使用redis + 'type' => 'redis', + // 连接地址 + 'host' => MyC('common_cache_redis_host', '127.0.0.1', true), + // 端口号 + 'port' => MyC('common_cache_redis_port', 6379, true), + // 密码 + 'password' => MyC('common_cache_redis_password', '', true), + // 全局缓存有效期(0为永久有效) + 'expire' => MyC('common_cache_redis_expire', 0, true), + // 缓存前缀 + 'prefix' => MyC('common_cache_redis_prefix', 'shopxo', true), + ]; + + } else { + $config = [ + // 驱动方式 + 'type' => 'File', + // 缓存保存目录 + 'path' => '', + // 缓存前缀 + 'prefix' => 'shopxo', + // 缓存有效期 0表示永久缓存 + 'expire' => 0, + ]; + } + + // 配置文件 + $config_file = ROOT.'config'.DS.'cache.php'; + + // 保存文件 + return self::ConfigFileSave($config_file, $config, '缓存配置'); + } + + /** + * 配置文件保存 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2020-09-25 + * @desc description + * @param [string] $config_file [文件路径] + * @param [array] $config [配置信息] + * @param [string] $name [描述名称] + */ + private static function ConfigFileSave($config_file, $config, $name) + { + // 是否有写权限 + if(file_exists($config_file) && !is_writable($config_file)) + { + return DataReturn('缓存配置文件没有操作权限'.'['.$config_file.']', -3); + } + + // 生成配置文件 + $ret = @file_put_contents($config_file, ""); + if($ret === false) + { + return DataReturn($name.'处理失败['.$config_file.']', -10); + } + return DataReturn('处理成功', 0); + } +} +?> \ No newline at end of file diff --git a/config/.gitignore b/config/.gitignore index 6b502227c..5051b7f2e 100755 --- a/config/.gitignore +++ b/config/.gitignore @@ -1 +1,3 @@ -database.php \ No newline at end of file +database.php +cache.php +session.php \ No newline at end of file diff --git a/config/cache.php b/config/cache.php deleted file mode 100755 index 02ff4889d..000000000 --- a/config/cache.php +++ /dev/null @@ -1,26 +0,0 @@ - 'File', - // 缓存保存目录 - 'path' => '', - // 缓存前缀 - 'prefix' => '', - // 缓存有效期 0表示永久缓存 - 'expire' => 0, -]; -?> \ No newline at end of file diff --git a/config/session.php b/config/session.php deleted file mode 100755 index c920d190e..000000000 --- a/config/session.php +++ /dev/null @@ -1,27 +0,0 @@ - '', - // SESSION_ID的提交变量,解决flash上传跨域 - 'var_session_id' => '', - // SESSION 前缀 - 'prefix' => 'shopxo', - // 驱动方式 支持redis memcache memcached - 'type' => '', - // 是否自动开启 SESSION - 'auto_start' => true, -]; -?> \ No newline at end of file diff --git a/public/static/common/css/common.css b/public/static/common/css/common.css index fcf1abea3..ffcbad3c9 100755 --- a/public/static/common/css/common.css +++ b/public/static/common/css/common.css @@ -54,7 +54,7 @@ form.am-form .am-form-group-refreshing, .plug-file-upload-view { border-bottom: /** * 公共提示信息 */ -#common-prompt {position:fixed;top:20px;left:0;right:0;text-align:center;padding:10px 15px;font-size:14px;z-index:10000; border-radius: 2px; width: 260px; margin: 0 auto;} +#common-prompt {position:fixed;top:20px;left:0;right:0;text-align:center;padding:10px 15px;font-size:14px;z-index:10000; border-radius: 2px; width: 260px; margin: 0 auto; word-break: break-all;} #common-prompt.am-alert-danger { background-color: #fef0f0; border-color: #f9d4d4; color: #f56c6c; box-shadow: 0 2px 4px #fef0f0, 0 0 6px rgba(0, 0, 0, 0); } #common-prompt.am-alert-warning { background-color: #ffe7d5; border-color: #fbceac; color: #f37b1d; box-shadow: 0 2px 4px #ffe7d5, 0 0 6px rgba(0, 0, 0, 0); } #common-prompt.am-alert-success { background-color: #e3fbd6; border-color: #bbe8a3; color: #67c23a; box-shadow: 0 2px 4px #e3fbd6, 0 0 6px rgba(0, 0, 0, 0); }