mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2024-12-02 03:48:47 +08:00
新增系统环境参数限制提示
This commit is contained in:
parent
686681ca6f
commit
029c29a4f5
@ -241,6 +241,9 @@ class Common extends BaseController
|
||||
// 后台公告
|
||||
$admin_notice = MyC('admin_notice');
|
||||
MyViewAssign('admin_notice', empty($admin_notice) ? '' : str_replace("\n", '<br />', $admin_notice));
|
||||
|
||||
// 系统环境参数最大数
|
||||
MyViewAssign('env_max_input_vars_count', SystemService::EnvMaxInputVarsCount());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -66,6 +66,7 @@
|
||||
var __attachment_host__ = '{{$attachment_host}}';
|
||||
var __currency_symbol__ = '{{$currency_symbol}}';
|
||||
var __is_mobile__ = '{{if IsMobile()}}1{{else}}0{{/if}}';
|
||||
var __env_max_input_vars_count__ = '{{$env_max_input_vars_count}}';
|
||||
</script>
|
||||
<body>
|
||||
{{if $module_name.$controller_name.$action_name neq 'adminindexindex'}}
|
||||
|
@ -339,6 +339,9 @@ class Common extends BaseController
|
||||
|
||||
// 纯净模式
|
||||
MyViewAssign('page_pure', in_array($this->controller_name.$this->action_name, ['usermodallogininfo']) ? 1 : 0);
|
||||
|
||||
// 系统环境参数最大数
|
||||
MyViewAssign('env_max_input_vars_count', SystemService::EnvMaxInputVarsCount());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,6 +74,7 @@
|
||||
var __user_id__ = {{if empty($user['id'])}}0{{else /}}{{$user.id}}{{/if}};
|
||||
var __currency_symbol__ = '{{$currency_symbol}}';
|
||||
var __is_mobile__ = '{{if IsMobile()}}1{{else}}0{{/if}}';
|
||||
var __env_max_input_vars_count__ = '{{$env_max_input_vars_count}}';
|
||||
</script>
|
||||
|
||||
<!-- 公共header内钩子 -->
|
||||
|
@ -11,6 +11,7 @@
|
||||
namespace app\install\controller;
|
||||
|
||||
use app\BaseController;
|
||||
use app\service\SystemService;
|
||||
|
||||
/**
|
||||
* 安装程序-公共
|
||||
@ -34,6 +35,9 @@ class Common extends BaseController
|
||||
{
|
||||
// 当前方法
|
||||
MyViewAssign('action', RequestAction());
|
||||
|
||||
// 系统环境参数最大数
|
||||
MyViewAssign('env_max_input_vars_count', SystemService::EnvMaxInputVarsCount());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,4 +19,7 @@
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="{{$Think.__MY_ROOT_PUBLIC__}}static/common/css/common.css" />
|
||||
<link rel="stylesheet" type="text/css" href="{{$Think.__MY_ROOT_PUBLIC__}}static/install/css/index.css" />
|
||||
<script type="text/javascript">
|
||||
var __env_max_input_vars_count__ = '{{$env_max_input_vars_count}}';
|
||||
</script>
|
||||
<body>
|
@ -153,5 +153,18 @@ class SystemService
|
||||
{
|
||||
return MyConfig($key).'_'.SYSTEM_TYPE.'_'.RequestModule();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取环境参数最大数
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2022-04-24
|
||||
* @desc description
|
||||
*/
|
||||
public static function EnvMaxInputVarsCount()
|
||||
{
|
||||
return intval(ini_get('max_input_vars'));
|
||||
}
|
||||
}
|
||||
?>
|
@ -498,6 +498,26 @@ function FromInit(form_name)
|
||||
return false;
|
||||
}
|
||||
|
||||
// 请求参数
|
||||
var form_data_count = 0;
|
||||
var form_data = GetFormVal(form_name);
|
||||
form_data.forEach(function(value, key)
|
||||
{
|
||||
form_data_count += 1;
|
||||
});
|
||||
|
||||
// 请求参数是否超过系统环境参数
|
||||
if(typeof(__env_max_input_vars_count__) != 'undefined')
|
||||
{
|
||||
var env_vars_count = parseInt(__env_max_input_vars_count__);
|
||||
if(env_vars_count > 0 && form_data_count > env_vars_count)
|
||||
{
|
||||
$button.button('reset');
|
||||
Prompt('请求参数数量已超出php.ini限制[max_input_vars]('+form_data_count+'>'+env_vars_count+')');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// ajax请求
|
||||
$.AMUI.progress.start();
|
||||
$.ajax({
|
||||
@ -505,7 +525,7 @@ function FromInit(form_name)
|
||||
type: method,
|
||||
dataType: "json",
|
||||
timeout: $form.attr('timeout') || 60000,
|
||||
data: GetFormVal(form_name),
|
||||
data: form_data,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(result)
|
||||
|
Loading…
Reference in New Issue
Block a user