Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wayhood authored and wayhood committed Mar 12, 2021
1 parent ed09d0c commit 4ba330b
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions src/Controller/MainController.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,31 +90,33 @@ public function validateParam($requestParam, $params, $actionMapping) {

//判断类型
$type = $requestParam['type'];
$value = $params[$key];
if ($type == 'string') {
if (!is_string($value)) {
return $this->systemExceptionReturn(9902, $key ." 类型不匹配,请查看文档", $actionMapping);
if (isset($params[$key])) {
$value = $params[$key];
if ($type == 'string') {
if (!is_string($value)) {
return $this->systemExceptionReturn(9902, $key ." 类型不匹配,请查看文档", $actionMapping);
}
}
}

if ($type == 'int') {
if (!is_int($value)) {
return $this->systemExceptionReturn(9902, $key ." 类型不匹配,请查看文档", $actionMapping);
if ($type == 'int') {
if (!is_int($value)) {
return $this->systemExceptionReturn(9902, $key ." 类型不匹配,请查看文档", $actionMapping);
}
}
}

if ($type == 'float') {
if (is_int($value)) {
$value = floatval($value);
}
if (!is_float($value)) {
return $this->systemExceptionReturn(9902, $key ." 类型不匹配,请查看文档", $actionMapping);
if ($type == 'float') {
if (is_int($value)) {
$value = floatval($value);
}
if (!is_float($value)) {
return $this->systemExceptionReturn(9902, $key ." 类型不匹配,请查看文档", $actionMapping);
}
}
}

if ($type == 'array') {
if (!is_array($value)) {
return $this->systemExceptionReturn(9902, $key ." 类型不匹配,请查看文档", $actionMapping);
if ($type == 'array') {
if (!is_array($value)) {
return $this->systemExceptionReturn(9902, $key ." 类型不匹配,请查看文档", $actionMapping);
}
}
}

Expand Down Expand Up @@ -177,7 +179,9 @@ public function index()
]);
break;
}
$filterActionRequestParams[$params['name']] = $actionRequest['params'][$params['name']];
if (isset($actionRequest['params'][$params['name']])) {
$filterActionRequestParams[$params['name']] = $actionRequest['params'][$params['name']];
}
}

$okRequest = [
Expand Down

0 comments on commit 4ba330b

Please sign in to comment.