Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/plugin/admin/app/controller/DictController.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public function insert(Request $request): Response
if (Dict::get($name)) {
return $this->json(1, '字典已经存在');
}
if (!preg_match('/^[a-zA-Z0-9]+$/', $name)) {
return $this->json(2, '字典名称只能是字母数字的组合');
if (!preg_match('/^[a-zA-Z0-9_]+$/', $name)) {
return $this->json(2, '字典名称只能是字母数字下划线的组合');
}
$values = (array)$request->post('value', []);
Dict::save($name, $values);
Expand All @@ -88,8 +88,8 @@ public function update(Request $request): Response
if (!Dict::get($name)) {
return $this->json(1, '字典不存在');
}
if (!preg_match('/^[a-zA-Z0-9]+$/', $name)) {
return $this->json(2, '字典名称只能是字母数字的组合');
if (!preg_match('/^[a-zA-Z0-9_]+$/', $name)) {
return $this->json(2, '字典名称只能是字母数字下划线的组合');
}
Dict::save($name, $request->post('value'));
}
Expand Down