From 1dcc97354efb8a6d29ba82db9ae038c711fd8b94 Mon Sep 17 00:00:00 2001 From: liaofei <136327134@qq.com> Date: Thu, 20 Apr 2023 11:27:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=9F=E6=88=90service?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/crmeb/services/crud/Service.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crmeb/crmeb/services/crud/Service.php b/crmeb/crmeb/services/crud/Service.php index ce6e252e7..c8273d6a9 100644 --- a/crmeb/crmeb/services/crud/Service.php +++ b/crmeb/crmeb/services/crud/Service.php @@ -75,7 +75,7 @@ class Service extends Make $from[] = $this->tab(2) . $this->getframeImagesPhpContent($item['field'], $item['name'], $item['required'] ?? false) . ';'; break; default: - $from[] = $this->tab(2) . '$rule[] = FormBuilder::' . $item['type'] . '("' . $item['field'] . '","' . $item['name'] . '",$info["' . $item['field'] . '"] ?? "")' . $this->getOptionContent($item['option'] ?? []) . (!empty($item['required']) ? '->required()' : '') . ';'; + $from[] = $this->tab(2) . '$rule[] = FormBuilder::' . $item['type'] . '("' . $item['field'] . '","' . $item['name'] . '",$info["' . $item['field'] . '"] ?? "")' . $this->getOptionContent(in_array($item['type'], ['radio']), $item['option'] ?? []) . (!empty($item['required']) ? '->required()' : '') . ';'; break; } @@ -117,9 +117,9 @@ class Service extends Make * @email 136327134@qq.com * @date 2023/3/23 */ - protected function getOptionContent(array $option = []) + protected function getOptionContent(bool $isOption, array $option = []) { - if (!$option) { + if (!$option && $isOption) { $option = [ ['value' => 1, 'label' => '开启'], ['value' => 0, 'label' => '关闭']