新增站点域名设置和细节优化

feat/task1-c-wallet
gongfuxiang 2022-03-27 23:37:16 +08:00
parent 18b9e08abc
commit c7f4d77792
12 changed files with 207 additions and 52 deletions

View File

@ -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地址

View File

@ -106,6 +106,36 @@
</div>
</div>
<!-- 站点域名地址 -->
<div class="am-panel am-panel-default">
<div class="am-panel-hd">
<h3 class="am-panel-title">站点域名地址</h3>
</div>
<div class="am-panel-bd am-padding-vertical-xs">
<div class="am-alert am-alert-warning am-margin-top-xs" data-am-alert>
<button type="button" class="am-close">&times;</button>
<p>2. 站点域名未设置则使用当前站点域名域名地址[ <a href="{{$my_domain}}" target="_blank">{{$my_domain}}</a> ]</p>
<p>2. 附件和静态地址未设置则使用当前站点静态域名地址[ <a href="{{$my_public_url}}" target="_blank">{{$my_public_url}}</a> ]</p>
<div class="am-text-danger am-margin-top-xs">
<p>在命令行模式下运行项目,该区域地址必须配置、否则项目中一些地址会缺失域名信息。</p>
<p>请勿乱配置、错误地址会导致网站无法访问地址配置以http开头</p>
</div>
</div>
<div class="am-form-group">
<label>{{$data.common_domain_host.name}}<span class="am-form-group-label-tips">{{$data.common_domain_host.describe}}</span></label>
<input type="text" name="{{$data.common_domain_host.only_tag}}" placeholder="{{$data.common_domain_host.describe}}" data-validation-message="{{$data.common_domain_host.error_tips}}" class="am-radius" {{if !empty($data)}}value="{{$data.common_domain_host.value}}"{{/if}} />
</div>
<div class="am-form-group">
<label>{{$data.common_cdn_attachment_host.name}}<span class="am-form-group-label-tips">{{$data.common_cdn_attachment_host.describe}}</span></label>
<input type="text" name="{{$data.common_cdn_attachment_host.only_tag}}" placeholder="{{$data.common_cdn_attachment_host.describe}}" data-validation-message="{{$data.common_cdn_attachment_host.error_tips}}" class="am-radius" {{if !empty($data)}}value="{{$data.common_cdn_attachment_host.value}}"{{/if}} />
</div>
<div class="am-form-group">
<label>{{$data.common_cdn_public_host.name}}<span class="am-form-group-label-tips">{{$data.common_cdn_public_host.describe}}</span></label>
<input type="text" name="{{$data.common_cdn_public_host.only_tag}}" placeholder="{{$data.common_cdn_public_host.describe}}" data-validation-message="{{$data.common_cdn_public_host.error_tips}}" class="am-radius" {{if !empty($data)}}value="{{$data.common_cdn_public_host.value}}"{{/if}} />
</div>
</div>
</div>
<!-- 备案信息 -->
<div class="am-panel am-panel-default">
<div class="am-panel-hd">

View File

@ -89,27 +89,6 @@
</div>
</div>
</div>
<!-- CDN配置 -->
<div class="am-panel am-panel-default">
<div class="am-panel-hd">
<h3 class="am-panel-title">CDN配置</h3>
</div>
<div class="am-panel-bd am-padding-vertical-xs">
<div class="am-alert am-alert-warning am-margin-top-xs" data-am-alert>
<button type="button" class="am-close">&times;</button>
<p>未设置则使用当前站点域名[ <a href="{{$my_public_url}}" target="_blank">{{$my_public_url}}</a> ]</p>
</div>
<div class="am-form-group">
<label>{{$data.common_cdn_attachment_host.name}}<span class="am-form-group-label-tips">{{$data.common_cdn_attachment_host.describe}}</span></label>
<input type="text" name="{{$data.common_cdn_attachment_host.only_tag}}" placeholder="{{$data.common_cdn_attachment_host.describe}}" data-validation-message="{{$data.common_cdn_attachment_host.error_tips}}" class="am-radius" {{if !empty($data)}}value="{{$data.common_cdn_attachment_host.value}}"{{/if}} />
</div>
<div class="am-form-group">
<label>{{$data.common_cdn_public_host.name}}<span class="am-form-group-label-tips">{{$data.common_cdn_public_host.describe}}</span></label>
<input type="text" name="{{$data.common_cdn_public_host.only_tag}}" placeholder="{{$data.common_cdn_public_host.describe}}" data-validation-message="{{$data.common_cdn_public_host.error_tips}}" class="am-radius" {{if !empty($data)}}value="{{$data.common_cdn_public_host.value}}"{{/if}} />
</div>
</div>
</div>
<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
<input type="hidden" name="nav_type" value="{{$nav_type}}" />

View File

@ -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地址

View File

@ -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',

View File

@ -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;
}
}
}
}

View File

@ -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),

View File

@ -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']))

View File

@ -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,

View File

@ -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__);

View File

@ -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<vars.length;i++)
// 参数值
var query = window.location.search || null;
if(query == null)
{
var pair = vars[i].split('=');
if(pair[0] == field)
query = window.location.pathname || null;
} else {
query = query.substring(1);
}
// 首两个是否为s=字符,存在则去除
if(query.substr(0, 2) == 's=')
{
query = query.substr(2);
}
// 第一个字符为斜杠,存在则去除
if(query.substr(0, 1) == '/')
{
query = query.substr(1);
}
// 是否存在参数
var vars = [];
if(query != null)
{
var temp = query.split('&');
if(temp.length > 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');
}
// 公共数据操作

View File

@ -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 {