系统类型细节优化

feat/task1-c-wallet
gongfuxiang 2022-05-14 15:37:28 +08:00
parent 8cb3c15d24
commit e7a5791780
24 changed files with 159 additions and 75 deletions

View File

@ -63,6 +63,9 @@ class Common extends BaseController
protected $form_order_by;
protected $form_error;
// 系统类型
protected $system_type;
/**
* 构造方法
* @author Devil
@ -144,6 +147,13 @@ class Common extends BaseController
*/
public function ViewInit()
{
// 系统类型
$this->system_type = SystemService::SystemTypeValue();
MyViewAssign('system_type', $this->system_type);
// 公共参数
MyViewAssign('params', $this->data_request);
// 主题
$default_theme = 'default';
MyViewAssign('default_theme', $default_theme);

View File

@ -58,6 +58,7 @@
{{/if}}
</head>
<script type="text/javascript">
var __system_type__ = '{{$system_type}}';
var __root__ = '{{$public_host}}';
var __my_http__ = '{{$my_http}}';
var __my_url__ = '{{$my_url}}';

View File

@ -14,6 +14,7 @@ use app\BaseController;
use app\module\FormHandleModule;
use app\service\SystemService;
use app\service\SystemBaseService;
use app\service\StoreService;
use app\service\ResourcesService;
use app\service\GoodsService;
use app\service\NavigationService;
@ -71,6 +72,9 @@ class Common extends BaseController
protected $form_order_by;
protected $form_error;
// 系统类型
protected $system_type;
/**
* 构造方法
* @author Devil
@ -190,6 +194,10 @@ class Common extends BaseController
*/
public function ViewInit()
{
// 系统类型
$this->system_type = SystemService::SystemTypeValue();
MyViewAssign('system_type', $this->system_type);
// 公共参数
MyViewAssign('params', $this->data_request);
@ -364,6 +372,13 @@ class Common extends BaseController
// 系统环境参数最大数
MyViewAssign('env_max_input_vars_count', SystemService::EnvMaxInputVarsCount());
// 站点商店信息
$site_store_info = StoreService::SiteStoreInfo();
MyViewAssign('site_store_info', $site_store_info);
// 更多链接地址
$site_store_links = empty($site_store_info['links']) ? [] : $site_store_info['links'];
MyViewAssign('site_store_links', $site_store_links);
}
/**

View File

@ -0,0 +1,31 @@
<div class="am-alert am-alert-warning am-radius am-text-xs" data-am-alert>
<button type="button" class="am-close">&times;</button>
<div>
<p><strong>WEB页面</strong></p>
<div class="am-padding-left-lg">
<p>1. 以http开头</p>
<p>2. 如小程序中使用WEB页面、需要在小程序后台加入白名单</p>
</div>
</div>
<div class="am-margin-top-xs">
<p><strong>内部页面(小程序/APP内部地址)</strong></p>
<div class="am-padding-left-lg">
<p>1. 小程序或APP内部地址</p>
<p>2. 小程序以/pages开始</p>
<p>3. 例如:/pages/user/user</p>
<p>4. 支持带参数 ?x=xx</p>
{{if !empty($site_store_links) and !empty($site_store_links['app_mini_pages'])}}
<p>
<a href="{{$site_store_links.app_mini_pages}}" target="_blank">小程序页面地址配置说明 <i class="am-icon-external-link"></i></a>
</p>
{{/if}}
</div>
</div>
<div class="am-margin-top-xs">
<p><strong>跳转原生地图查看指定位置</strong></p>
<div class="am-padding-left-lg">
<p>1. 以 | 竖线分割,分别顺序 名称|地址|经度|纬度</p>
<p>2. 例如ShopXO|上海浦东新区张江高科技园区XXX号|121.626444|31.20843</p>
</div>
</div>
</div>

View File

@ -62,6 +62,7 @@
{{/if}}
<script type="text/javascript">
var __system_type__ = '{{$system_type}}';
var __root__ = '{{$public_host}}';
var __my_http__ = '{{$my_http}}';
var __my_url__ = '{{$my_url}}';

View File

@ -129,6 +129,16 @@ class SystemService
// 取默认值
$value = SYSTEM_TYPE;
// 默认值则判断是否参数存在值
if($value == 'default')
{
$system_type = MyInput('system_type');
if(!empty($system_type))
{
$value = $system_type;
}
}
// 系统类型钩子
$hook_name = 'plugins_service_system_system_type_value';
MyEventTrigger($hook_name, [

View File

@ -103,7 +103,7 @@ $(function()
// 发送验证码
$.ajax({
url: $('.verify-submit').data('url'),
url: RequestUrlHandle($('.verify-submit').data('url')),
type: 'POST',
data: {"accounts":$accounts.val(), "verify":verify, "type":$form_tag.find('input[name="type"]').val()},
dataType: 'json',

View File

@ -12,7 +12,7 @@ $(function()
// ajax请求
$.AMUI.progress.start();
$.ajax({
url: $('.data-list').data('select-url'),
url: RequestUrlHandle($('.data-list').data('select-url')),
type: 'POST',
dataType: 'json',
timeout: 10000,

View File

@ -115,7 +115,7 @@ function PackageUpgradeRequestHandle(params)
// ajax
$.ajax({
url: url,
url: RequestUrlHandle(url),
type: 'POST',
dataType: 'json',
timeout: 305000,

View File

@ -6,7 +6,7 @@ $(function()
// ajax请求
$.AMUI.progress.start();
$.ajax({
url: $(this).data('url'),
url: RequestUrlHandle($(this).data('url')),
type: 'POST',
dataType: 'json',
timeout: 30000,

View File

@ -26,7 +26,7 @@ function SystemUpgradeRequestHandle(params)
// ajax
$.ajax({
url: url,
url: RequestUrlHandle(url),
type: 'POST',
dataType: 'json',
timeout: 305000,
@ -430,7 +430,7 @@ function EchartsInit(e)
e.button('loading');
$.AMUI.progress.start();
$.ajax({
url: $('.content-right').data('url'),
url: RequestUrlHandle($('.content-right').data('url')),
type: 'POST',
dataType: 'json',
timeout: 30000,
@ -507,7 +507,7 @@ $(function()
// ajax请求
$.ajax({
url: $(this).data('url'),
url: RequestUrlHandle($(this).data('url')),
type: 'POST',
dataType: 'json',
timeout: 30000,

View File

@ -42,7 +42,7 @@ function RequestHandle(key, opt, msg)
// ajax
$.ajax({
url: url,
url: RequestUrlHandle(url),
type: 'POST',
dataType: 'json',
timeout: 305000,

View File

@ -62,7 +62,7 @@ $(function()
// ajax请求
$.AMUI.progress.start();
$.ajax({
url: $('.content ul.am-gallery-bordered').data('sort-save-url'),
url: RequestUrlHandle($('.content ul.am-gallery-bordered').data('sort-save-url')),
type: 'POST',
dataType: 'json',
timeout: 10000,

View File

@ -230,7 +230,7 @@ $(function()
$this.button('loading');
$('.goods-list-container ul.am-gallery').html('<div class="table-no"><i class="am-icon-spinner am-icon-pulse"></i> '+($('.goods-list-container').data('loading-msg'))+'</div>');
$.ajax({
url: url,
url: RequestUrlHandle(url),
type: 'post',
data: {"page":page, "category_id":category_id, "keywords":keywords, "goods_ids":goods_ids},
dataType: 'json',

View File

@ -12,7 +12,7 @@ $(function()
// ajax请求
$.AMUI.progress.start();
$.ajax({
url: $('.data-list').data('select-url'),
url: RequestUrlHandle($('.data-list').data('select-url')),
type: 'POST',
dataType: 'json',
timeout: 10000,

View File

@ -43,7 +43,7 @@ $(function()
$this.button('loading');
$('.goods-list-container ul.am-gallery').html('<div class="table-no"><i class="am-icon-spinner am-icon-pulse"></i> '+($('.goods-list-container').data('loading-msg'))+'</div>');
$.ajax({
url: url,
url: RequestUrlHandle(url),
type: 'post',
data: {"page":page, "warehouse_id":warehouse_id, "category_id":category_id, "keywords":keywords},
dataType: 'json',
@ -89,7 +89,7 @@ $(function()
$.AMUI.progress.start();
$.ajax({
url: url,
url: RequestUrlHandle(url),
type: 'post',
data: {"warehouse_id":warehouse_id, "goods_id":goods_id},
dataType: 'json',

View File

@ -521,7 +521,7 @@ function FromInit(form_name)
// ajax请求
$.AMUI.progress.start();
$.ajax({
url: action,
url: RequestUrlHandle(action),
type: method,
dataType: "json",
timeout: $form.attr('timeout') || 60000,
@ -669,12 +669,12 @@ function FormDataFill(json, tag)
function Tree(id, url, level, is_add_node, is_delete_all)
{
$.ajax({
url:url,
type:'POST',
dataType:"json",
timeout:60000,
data:{"id":id},
success:function(result)
url: RequestUrlHandle(url),
type: 'POST',
dataType: 'json',
timeout: 60000,
data: {"id":id},
success: function(result)
{
if(result.code == 0 && result.data.length > 0)
{
@ -700,7 +700,7 @@ function Tree(id, url, level, is_add_node, is_delete_all)
$('#tree').find('img').remove();
}
},
error:function(xhr, type)
error: function(xhr, type)
{
$('#tree').find('p').text(HtmlToString(xhr.responseText) || '异常错误');
$('#tree').find('img').remove();
@ -1077,7 +1077,7 @@ function ModalLoad(url, title, class_tag, full, full_max)
// 调用弹窗组件
AMUI.dialog.popup({
title: title || '',
content: '<iframe src="'+url+'" width="100%" height="100%"></iframe>',
content: '<iframe src="'+RequestUrlHandle(url)+'" width="100%" height="100%"></iframe>',
class: ent
});
}
@ -1143,12 +1143,12 @@ function DataDelete(e)
// 请求删除数据
$.AMUI.progress.start();
$.ajax({
url:url,
type:'POST',
dataType:"json",
timeout:e.attr('data-timeout') || 60000,
data:data,
success:function(result)
url: RequestUrlHandle(url),
type: 'POST',
dataType: 'json',
timeout: e.attr('data-timeout') || 60000,
data: data,
success: function(result)
{
$.AMUI.progress.done();
if(result.code == 0)
@ -1209,7 +1209,7 @@ function DataDelete(e)
Prompt(result.msg);
}
},
error:function(xhr, type)
error: function(xhr, type)
{
$.AMUI.progress.done();
Prompt(HtmlToString(xhr.responseText) || '异常错误', null, 30);
@ -1279,12 +1279,12 @@ function AjaxRequest(e)
// ajax
$.AMUI.progress.start();
$.ajax({
url:url,
type:'POST',
dataType:"json",
timeout:e.attr('data-timeout') || 60000,
data:data,
success:function(result)
url: RequestUrlHandle(url),
type: 'POST',
dataType: 'json',
timeout: e.attr('data-timeout') || 60000,
data: data,
success: function(result)
{
if(is_example)
{
@ -1328,7 +1328,7 @@ function AjaxRequest(e)
Prompt(result.msg);
}
},
error:function(xhr, type)
error: function(xhr, type)
{
if(is_example)
{
@ -1660,11 +1660,11 @@ function RegionNodeData(pid, name, next_name, value)
if(pid != null)
{
$.ajax({
url:$('.region-linkage').attr('data-url'),
type:'POST',
data:{"pid": pid},
dataType:'json',
success:function(result)
url: RequestUrlHandle($('.region-linkage').attr('data-url')),
type: 'POST',
data: {"pid": pid},
dataType: 'json',
success: function(result)
{
if(result.code == 0)
{
@ -2211,6 +2211,22 @@ function RegionLinkageInit()
}
}
/**
* 请求url地址处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2022-05-14
* @desc description
* @param {string} url [请求url地址]
*/
function RequestUrlHandle(url)
{
// 增加系统参数
url = UrlFieldReplace('system_type', __system_type__, url);
return url;
}
// 公共数据操作
@ -2271,9 +2287,9 @@ $(function()
$button.button('loading');
$.AMUI.progress.start();
$.ajax({
url: $button.data('url'),
url: RequestUrlHandle($button.data('url')),
type: 'POST',
dataType: "json",
dataType: 'json',
data: {"fields": fields, "md5_key": md5_key},
success: function(result)
{
@ -2384,7 +2400,7 @@ $(function()
// ajax请求操作
$.AMUI.progress.start();
$.ajax({
url: url,
url: RequestUrlHandle(url),
type: 'POST',
dataType: "json",
timeout: timeout,
@ -2519,12 +2535,12 @@ $(function()
// 请求更新数据
$.AMUI.progress.start();
$.ajax({
url:url,
type:'POST',
dataType:"json",
timeout:$tag.attr('data-timeout') || 60000,
url: RequestUrlHandle(url),
type: 'POST',
dataType: 'json',
timeout: $tag.attr('data-timeout') || 60000,
data:{"id":id, "state":state, "field":field},
success:function(result)
success: function(result)
{
$.AMUI.progress.done();
if(result.code == 0)
@ -2559,7 +2575,7 @@ $(function()
Prompt(result.msg);
}
},
error:function(xhr, type)
error: function(xhr, type)
{
$.AMUI.progress.done();
Prompt(HtmlToString(xhr.responseText) || '异常错误', null, 30);

View File

@ -803,7 +803,7 @@ function FormBackModuleConfigGoodsHandle(data)
var url = $offcanvas_config_goods.data('data-url');
$this.button('loading');
$.ajax({
url: url,
url: RequestUrlHandle(url),
type: 'post',
data: {
"data_type": data.goods_data_type,
@ -2657,7 +2657,7 @@ $(function()
$this.button('loading');
$('.goods-list-container ul.am-gallery').html('<div class="table-no"><i class="am-icon-spinner am-icon-pulse"></i> '+($('.goods-list-container').data('loading-msg'))+'</div>');
$.ajax({
url: url,
url: RequestUrlHandle(url),
type: 'post',
data: {"page":page, "category_field":category_field, "category_id":category_id, "keywords":keywords, "goods_ids":goods_ids},
dataType: 'json',
@ -2754,7 +2754,7 @@ $(function()
// 获取商品
$this.button('loading');
$.ajax({
url: url,
url: RequestUrlHandle(url),
type: 'post',
data: {"goods_ids":goods_ids},
dataType: 'json',
@ -3031,7 +3031,7 @@ $(function()
var $this = $(this);
$this.button('loading');
$.ajax({
url: $layout_operate_container.data('save-url'),
url: RequestUrlHandle($layout_operate_container.data('save-url')),
type: 'post',
data: data,
dataType: 'json',

View File

@ -64,7 +64,7 @@ $(function()
// ajax请求
$.ajax({
url: $('.cart-content').data('ajax-url'),
url: RequestUrlHandle($('.cart-content').data('ajax-url')),
type: 'post',
dataType: "json",
timeout: 10000,

View File

@ -37,7 +37,7 @@ function GoodsCommentsHtml(page)
}
$.ajax({
url: $('.goods-comment').data('url'),
url: RequestUrlHandle($('.goods-comment').data('url')),
type: 'POST',
data: {"goods_id": $('.goods-comment').data('goods-id'), "page": page || 1},
dataType: 'json',
@ -274,7 +274,7 @@ function GoodsSpecDetail()
// ajax请求
$.ajax({
url: $('.goods-detail').data('spec-detail-ajax-url'),
url: RequestUrlHandle($('.goods-detail').data('spec-detail-ajax-url')),
type: 'post',
dataType: "json",
timeout: 10000,
@ -331,7 +331,7 @@ function GoodsSpecType()
// ajax请求
$.ajax({
url: $('.goods-detail').data('spec-type-ajax-url'),
url: RequestUrlHandle($('.goods-detail').data('spec-type-ajax-url')),
type: 'post',
dataType: "json",
timeout: 10000,
@ -442,7 +442,7 @@ function GoodsNumberChange()
// ajax请求
$.ajax({
url: $('#text_box').data('ajax-url'),
url: RequestUrlHandle($('#text_box').data('ajax-url')),
type: 'post',
dataType: "json",
timeout: 10000,
@ -627,7 +627,7 @@ $(function() {
// ajax请求
$.AMUI.progress.start();
$.ajax({
url: $(this).data('ajax-url'),
url: RequestUrlHandle($(this).data('ajax-url')),
type: 'post',
dataType: "json",
timeout: 10000,

View File

@ -5,7 +5,7 @@ $(function()
{
// ajax请求
$.ajax({
url: $('.qrcode-pay').data('ajax-url'),
url: RequestUrlHandle($('.qrcode-pay').data('ajax-url')),
type: 'post',
dataType: "json",
timeout: 10000,

View File

@ -47,11 +47,11 @@ $(function()
// 发送验证码
$.ajax({
url:$('.verify-submit').data('url'),
type:'POST',
data:{"verify":verify, "type":$('form input[name="type"]').val()},
dataType:'json',
success:function(result)
url: RequestUrlHandle($('.verify-submit').data('url')),
type: 'POST',
data: {"verify":verify, "type":$('form input[name="type"]').val()},
dataType: 'json',
success: function(result)
{
if(result.code == 0)
{
@ -82,7 +82,7 @@ $(function()
Prompt(result.msg);
}
},
error:function()
error: function()
{
$this.button('reset');
if(is_win == 1)
@ -141,11 +141,11 @@ $(function()
// 发送验证码
$.ajax({
url:$('.verify-submit-new').data('url'),
type:'POST',
data:{"accounts":$accounts.val(), "verify":verify, "type":$('form input[name="type"]').val()},
dataType:'json',
success:function(result)
url: RequestUrlHandle($('.verify-submit-new').data('url')),
type: 'POST',
data: {"accounts":$accounts.val(), "verify":verify, "type":$('form input[name="type"]').val()},
dataType: 'json',
success: function(result)
{
if(result.code == 0)
{
@ -176,7 +176,7 @@ $(function()
Prompt(result.msg);
}
},
error:function()
error: function()
{
$this.button('reset');
if(is_win == 1)

View File

@ -56,7 +56,7 @@ function GetGoodsList(page)
// 请求数据
$.ajax({
url: $('.search-pages-submit').data('url'),
url: RequestUrlHandle($('.search-pages-submit').data('url')),
type: 'POST',
dataType: 'json',
timeout: 30000,

View File

@ -79,7 +79,7 @@ $(function()
// 发送验证码
$.ajax({
url: $('.verify-submit').data('url'),
url: RequestUrlHandle($('.verify-submit').data('url')),
type: 'POST',
data: {"accounts":$accounts.val(), "verify":verify, "type":$form_tag.find('input[name="type"]').val()},
dataType: 'json',