|
@@ -243,20 +243,34 @@ class Base extends Controller
|
|
|
protected function checking($modulename, $controllername, $action_name)
|
|
|
{
|
|
|
$params = $this->request->post();
|
|
|
-
|
|
|
- if (in_array($action_name, ['create', 'edit'])) {
|
|
|
- $get_module_list = CommonConstant::get_module_list();
|
|
|
- $rule = [
|
|
|
- 'module|模块类型' => 'require|in:' . implode(',', array_keys($get_module_list)),
|
|
|
- ];
|
|
|
- $message = [
|
|
|
- 'module.in' => '请选择正确的模块类型',
|
|
|
- ];
|
|
|
- $validate = new Validate($rule, $message);
|
|
|
- if (!$validate->check($params)) {
|
|
|
- $this->error($validate->getError());
|
|
|
+ if ($controllername == 'approveflow') {
|
|
|
+ if ($action_name == 'get_data') {
|
|
|
+ $get_module_list = CommonConstant::get_module_list();
|
|
|
+ $rule = [
|
|
|
+ 'module|模块类型' => 'require|in:' . implode(',', array_keys($get_module_list)),
|
|
|
+ ];
|
|
|
+ $message = [
|
|
|
+ 'module.in' => '请选择正确的模块类型',
|
|
|
+ ];
|
|
|
+ $validate = new Validate($rule, $message);
|
|
|
+ if (!$validate->check($params)) {
|
|
|
+ $this->error($validate->getError());
|
|
|
+ }
|
|
|
}
|
|
|
+ }
|
|
|
+ if ($controllername == 'approveinfo') {
|
|
|
if ($action_name == 'create') {
|
|
|
+ $get_module_list = CommonConstant::get_module_list();
|
|
|
+ $rule = [
|
|
|
+ 'module|模块类型' => 'require|in:' . implode(',', array_keys($get_module_list)),
|
|
|
+ ];
|
|
|
+ $message = [
|
|
|
+ 'module.in' => '请选择正确的模块类型',
|
|
|
+ ];
|
|
|
+ $validate = new Validate($rule, $message);
|
|
|
+ if (!$validate->check($params)) {
|
|
|
+ $this->error($validate->getError());
|
|
|
+ }
|
|
|
$id = $this->request->post('id');
|
|
|
$module = $this->request->post('module');
|
|
|
$validates = CommonConstant::get_module_validate_list();
|
|
@@ -266,18 +280,19 @@ class Base extends Controller
|
|
|
$this->error($validate->getError());
|
|
|
}
|
|
|
}
|
|
|
- if ($action_name == 'edit') {
|
|
|
- $module = $this->request->post('module');
|
|
|
- $validates = CommonConstant::get_module_validate_list();
|
|
|
- $validate = $validates[$module];
|
|
|
- $validate = new $validate;
|
|
|
- if (!$validate->check($params, [], 'edit')) {
|
|
|
+ if (in_array($action_name, ['get_detail', 'get_info', 'urging', 'cancel'])) {
|
|
|
+ $rule = [
|
|
|
+ 'id|申请参数' => 'require|gt:0',
|
|
|
+ ];
|
|
|
+ $message = [];
|
|
|
+ $validate = new Validate($rule, $message);
|
|
|
+ if (!$validate->check($params)) {
|
|
|
$this->error($validate->getError());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if ($controllername == 'approveflow') {
|
|
|
- if ($action_name == 'get_data') {
|
|
|
+ if ($controllername == 'approve') {
|
|
|
+ if ($action_name == 'edit') {
|
|
|
$get_module_list = CommonConstant::get_module_list();
|
|
|
$rule = [
|
|
|
'module|模块类型' => 'require|in:' . implode(',', array_keys($get_module_list)),
|
|
@@ -289,21 +304,14 @@ class Base extends Controller
|
|
|
if (!$validate->check($params)) {
|
|
|
$this->error($validate->getError());
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
- if ($controllername == 'approveinfo') {
|
|
|
- if (in_array($action_name, ['get_detail', 'get_info', 'urging', 'cancel'])) {
|
|
|
- $rule = [
|
|
|
- 'id|申请参数' => 'require|gt:0',
|
|
|
- ];
|
|
|
- $message = [];
|
|
|
- $validate = new Validate($rule, $message);
|
|
|
- if (!$validate->check($params)) {
|
|
|
+ $module = $this->request->post('module');
|
|
|
+ $validates = CommonConstant::get_module_validate_list();
|
|
|
+ $validate = $validates[$module];
|
|
|
+ $validate = new $validate;
|
|
|
+ if (!$validate->check($params, [], 'edit')) {
|
|
|
$this->error($validate->getError());
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- if ($controllername == 'approve') {
|
|
|
if (in_array($action_name, ['get_detail', 'get_info'])) {
|
|
|
$rule = [
|
|
|
'approve_id|审批参数' => 'require|gt:0',
|