From c7f4d77792588dd891fa21ea346f0a2fa3eee3ac Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Sun, 27 Mar 2022 23:37:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=AB=99=E7=82=B9=E5=9F=9F?= =?UTF-8?q?=E5=90=8D=E8=AE=BE=E7=BD=AE=E5=92=8C=E7=BB=86=E8=8A=82=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/Common.php | 3 + app/admin/view/default/site/base/index.html | 30 +++++ .../view/default/site/extends/index.html | 21 ---- app/index/controller/Common.php | 3 + app/service/ConfigService.php | 3 +- app/service/GoodsService.php | 21 +++- app/service/SystemBaseService.php | 9 +- app/service/UserService.php | 2 +- config/shopxo.php | 10 ++ public/core.php | 7 +- public/static/common/js/common.js | 106 ++++++++++++++++-- public/static/index/default/css/goods.css | 44 +++++--- 12 files changed, 207 insertions(+), 52 deletions(-) diff --git a/app/admin/controller/Common.php b/app/admin/controller/Common.php index 5a31f2ed8..7c656d1b1 100755 --- a/app/admin/controller/Common.php +++ b/app/admin/controller/Common.php @@ -187,6 +187,9 @@ class Common extends BaseController MyViewAssign('public_host', MyConfig('shopxo.public_host')); // 当前url地址 + MyViewAssign('my_domain', __MY_DOMAIN__); + + // 当前完整url地址 MyViewAssign('my_url', __MY_URL__); // 项目public目录URL地址 diff --git a/app/admin/view/default/site/base/index.html b/app/admin/view/default/site/base/index.html index 668c7a689..af1497bbb 100755 --- a/app/admin/view/default/site/base/index.html +++ b/app/admin/view/default/site/base/index.html @@ -106,6 +106,36 @@ + +
+
+

站点域名地址

+
+
+
+ +

2. 站点域名未设置则使用当前站点域名域名地址[ {{$my_domain}} ]

+

2. 附件和静态地址未设置则使用当前站点静态域名地址[ {{$my_public_url}} ]

+
+

在命令行模式下运行项目,该区域地址必须配置、否则项目中一些地址会缺失域名信息。

+

请勿乱配置、错误地址会导致网站无法访问(地址配置以http开头)

+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+
diff --git a/app/admin/view/default/site/extends/index.html b/app/admin/view/default/site/extends/index.html index ff55de022..2c163da53 100644 --- a/app/admin/view/default/site/extends/index.html +++ b/app/admin/view/default/site/extends/index.html @@ -89,27 +89,6 @@
- - -
-
-

CDN配置

-
-
-
- -

未设置则使用当前站点域名[ {{$my_public_url}} ]

-
-
- - -
-
- - -
-
-
diff --git a/app/index/controller/Common.php b/app/index/controller/Common.php index c312e2cdc..c03c2c865 100755 --- a/app/index/controller/Common.php +++ b/app/index/controller/Common.php @@ -258,6 +258,9 @@ class Common extends BaseController MyViewAssign('public_host', MyConfig('shopxo.public_host')); // 当前url地址 + MyViewAssign('my_domain', __MY_DOMAIN__); + + // 当前完整url地址 MyViewAssign('my_url', __MY_URL__); // 项目public目录URL地址 diff --git a/app/service/ConfigService.php b/app/service/ConfigService.php index 8ec229c6c..6af93edb6 100755 --- a/app/service/ConfigService.php +++ b/app/service/ConfigService.php @@ -95,7 +95,8 @@ class ConfigService 'common_session_is_use_cache', 'common_cache_session_redis_prefix', - // cdn地址 + // 站点域名地址和cdn地址 + 'common_domain_host', 'common_cdn_attachment_host', 'common_cdn_public_host', diff --git a/app/service/GoodsService.php b/app/service/GoodsService.php index d37560bac..626701413 100755 --- a/app/service/GoodsService.php +++ b/app/service/GoodsService.php @@ -2806,7 +2806,7 @@ class GoodsService $class_name = (APPLICATION == 'web') ? 'buy-event login-event' : ''; // 购买 - $data[] = [ + $buy = [ 'color' => 'main', 'type' => 'buy', 'title' => '点此按钮到下一步确认购买信息', @@ -2816,11 +2816,12 @@ class GoodsService ]; // 商品类型是否和当前站点类型一致 + $cart = []; $res = self::IsGoodsSiteTypeConsistent($goods['id'], $goods['site_type']); if($res['code'] == 0) { // 加入购物车 - $data[] = [ + $cart = [ 'color' => 'second', 'type' => 'cart', 'title' => '加入购物车', @@ -2831,6 +2832,22 @@ class GoodsService } else { $error = $res['msg']; } + + // 主按钮顺序处理,手机端立即购买放在最后面 + if(APPLICATION == 'app') + { + if(!empty($cart)) + { + $data[] = $cart; + } + $data[] = $buy; + } else { + $data[] = $buy; + if(!empty($cart)) + { + $data[] = $cart; + } + } } } diff --git a/app/service/SystemBaseService.php b/app/service/SystemBaseService.php index 04024a44f..6f562bd3f 100644 --- a/app/service/SystemBaseService.php +++ b/app/service/SystemBaseService.php @@ -56,6 +56,11 @@ class SystemBaseService 'common_app_is_online_service' => (int) MyC('common_app_is_online_service', 0), 'common_app_customer_service_tel' => MyC('common_app_customer_service_tel', null, true), + // 基础-站点域名和CDN + 'common_domain_host' => MyC('common_domain_host', null, true), + 'common_cdn_attachment_host' => MyC('common_cdn_attachment_host', null, true), + 'common_cdn_public_host' => MyC('common_cdn_public_host', null, true), + // 扩展项-留言、问答 'common_is_login_answer' => (int) MyC('common_is_login_answer', 0, true), @@ -64,10 +69,6 @@ class SystemBaseService 'common_order_success_limit_time' => (int) MyC('common_order_success_limit_time', 21600, true), 'common_pay_log_order_close_limit_time' => (int) MyC('common_pay_log_order_close_limit_time', 30, true), - // 扩展项-CDN - 'common_cdn_attachment_host' => MyC('common_cdn_attachment_host', null, true), - 'common_cdn_public_host' => MyC('common_cdn_public_host', null, true), - // 验证码 'common_verify_expire_time' => (int) MyC('common_verify_expire_time', 600, true), 'common_verify_interval_time' => (int) MyC('common_verify_interval_time', 60, true), diff --git a/app/service/UserService.php b/app/service/UserService.php index e502ae6d9..01c2803eb 100755 --- a/app/service/UserService.php +++ b/app/service/UserService.php @@ -111,7 +111,7 @@ class UserService * @desc description * @param [string] $token [用户token] */ - private static function UserTokenData($token) + public static function UserTokenData($token) { $user = MyCache(MyConfig('shopxo.cache_user_info').$token); if($user !== null && isset($user['id'])) diff --git a/config/shopxo.php b/config/shopxo.php index a99c02907..b167e2c7c 100755 --- a/config/shopxo.php +++ b/config/shopxo.php @@ -13,6 +13,13 @@ // | 应用设置 // +---------------------------------------------------------------------- +// 站点域名地址 +$domain_url = MyFileConfig('common_domain_host', '', __MY_DOMAIN__, true); +if(substr($domain_url, -1) != DS) +{ + $domain_url .= DS; +} + // cdn地址 $cdn_attachment_host = MyFileConfig('common_cdn_attachment_host', '', __MY_PUBLIC_URL__, true); $cdn_public_host = MyFileConfig('common_cdn_public_host', '', __MY_PUBLIC_URL__, true); @@ -96,6 +103,9 @@ return [ // 首页展示的友情链接列表数据 'cache_home_link_list_key' => 'cache_home_link_list_data', + // 站点域名地址 + 'domain_url' => $domain_url, + // 附件host、最后不要带/斜杠结尾, 数据库图片地址以/static/...开头 'attachment_host' => $cdn_attachment_host, diff --git a/public/core.php b/public/core.php index 722811358..715421fc7 100755 --- a/public/core.php +++ b/public/core.php @@ -55,8 +55,11 @@ define('__MY_ADDR__', empty($_SERVER['SERVER_ADDR']) ? '' : $_SERVER['SERVER_ADD // 项目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); +// 项目HOST地址 +define('__MY_DOMAIN__', empty($_SERVER['HTTP_HOST']) ? '' : __MY_HTTP__.'://'.__MY_HOST__.DS); + +// 项目完整HOST地址 +define('__MY_URL__', empty($_SERVER['HTTP_HOST']) ? '' : __MY_DOMAIN__.$my_root); // 项目public目录URL地址 define('__MY_PUBLIC_URL__', empty($_SERVER['HTTP_HOST']) ? '' : __MY_HTTP__.'://'.__MY_HOST__.__MY_ROOT_PUBLIC__); diff --git a/public/static/common/js/common.js b/public/static/common/js/common.js index 2e9881f78..0ec4f691e 100755 --- a/public/static/common/js/common.js +++ b/public/static/common/js/common.js @@ -2007,18 +2007,85 @@ function HtmlToString(html_str) * @version 1.0.0 * @date 2021-02-22 * @desc description - * @param {[string]} field [参数字段名称] + * @param {[string]} field [参数字段名称、null则返回全部参数] */ -function GetQueryValue(field) +function GetQueryValue(field = null) { - var query = window.location.search.substring(1); - var vars = query.split('&'); - for(var i=0;i 0) { - return pair[1]; + for(var i in temp) + { + // 参数是否为斜杠参数、仅首条记录处理 + if(i == 0 && temp[i].indexOf('/') != -1) + { + var temp_field = null; + var temp_ds = temp[i].split('/'); + var temp_count = temp_ds.length; + for(var x in temp_ds) + { + // 奇数则忽略第一个参数(为系统路由名称) + if(temp_count%2 != 0 && x == 0) + { + continue; + } + + // 参数组合 + if(temp_field == null) + { + temp_field = temp_ds[x]; + } else { + vars[temp_field] = temp_ds[x].replace('.'+__seo_url_suffix__, ''); + temp_field = null; + } + } + } else { + var pair = temp[i].split('='); + if(pair.length == 2) + { + vars[pair[0]] = pair[1]; + } + } + } + } + } + + // 是否指定字段 + if(field === null) + { + return vars; + } else { + // 是否存在该字段数据 + for(var i in vars) + { + if(i == field) + { + return vars[i]; + } } } return false; @@ -2042,6 +2109,29 @@ function UUId() }); } +/** + * 打开新窗口 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-03-21 + * @desc description + * @param {String} url [url地址] + * @param {String} name [网页名称] + * @param {Number} width [宽度] + * @param {Number} height [高度] + */ +function OpenWindow(url, name = '', width = 850, height = 600) +{ + // window.screen.height获得屏幕的高 + // window.screen.width获得屏幕的宽 + // 获得窗口的垂直位置; + var top = (window.screen.height-30-height)/2; + // 获得窗口的水平位置; + var left = (window.screen.width-10-width)/2; + window.open(url, name, 'height='+height+',innerHeight='+height+',width='+width+',innerWidth='+width+',top='+top+',left='+left+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no'); +} + // 公共数据操作 diff --git a/public/static/index/default/css/goods.css b/public/static/index/default/css/goods.css index 1c19f42cd..3f01cf61f 100755 --- a/public/static/index/default/css/goods.css +++ b/public/static/index/default/css/goods.css @@ -314,6 +314,19 @@ flex: 1 1 0%;line-height: 16px;cursor: pointer;} .buy-nav .buy-submit-container .buy-btn-second { border: 1px solid #ffeded; } + .buy-nav .nav-icon { + display:inline-block; + width: 50%; + float: left; + cursor: pointer; + text-align: center; + } + .goods-not-buy-tips, + .buy-nav .nav-icon { + border-top: 1px solid #f5f5f5; + border-left: 1px solid #f5f5f5; + float: left; + } .buy-submit-container-number-0 .buy-btn, .buy-submit-container-number-1 .buy-btn { width: 100% !important; @@ -345,19 +358,24 @@ flex: 1 1 0%;line-height: 16px;cursor: pointer;} .buy-submit-container-number-10 .buy-btn { width: 10% !important; } - .buy-nav .nav-icon { - display:inline-block; - width: 50%; - float: left; - cursor: pointer; - text-align: center; - } - .goods-not-buy-tips, - .buy-nav .nav-icon { - border-top: 1px solid #f5f5f5; - border-left: 1px solid #f5f5f5; - float: left; - } + .buy-nav-opt-number-1 .nav-icon { + width: 100% !important; + } + .buy-nav-opt-number-2 .nav-icon { + width: 50% !important; + } + .buy-nav-opt-number-3 .nav-icon { + width: 33.33% !important; + } + .buy-nav-opt-number-4 .nav-icon { + width: 25% !important; + } + .buy-nav-opt-number-5 .nav-icon { + width: 20% !important; + } + .buy-nav-opt-number-6 .nav-icon { + width: 16.66% !important; + } } @media only screen and (min-width: 1025px) { .buy-nav .buy-nav-opt {