File tree Expand file tree Collapse file tree
src/plugin/admin/app/controller Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,8 +66,8 @@ public function insert(Request $request): Response
6666 if (Dict::get ($ name )) {
6767 return $ this ->json (1 , '字典已经存在 ' );
6868 }
69- if (!preg_match ('/^[a-zA-Z0-9 ]+$/ ' , $ name )) {
70- return $ this ->json (2 , '字典名称只能是字母数字的组合 ' );
69+ if (!preg_match ('/^[a-zA-Z0-9_ ]+$/ ' , $ name )) {
70+ return $ this ->json (2 , '字典名称只能是字母数字下划线的组合 ' );
7171 }
7272 $ values = (array )$ request ->post ('value ' , []);
7373 Dict::save ($ name , $ values );
@@ -88,8 +88,8 @@ public function update(Request $request): Response
8888 if (!Dict::get ($ name )) {
8989 return $ this ->json (1 , '字典不存在 ' );
9090 }
91- if (!preg_match ('/^[a-zA-Z0-9 ]+$/ ' , $ name )) {
92- return $ this ->json (2 , '字典名称只能是字母数字的组合 ' );
91+ if (!preg_match ('/^[a-zA-Z0-9_ ]+$/ ' , $ name )) {
92+ return $ this ->json (2 , '字典名称只能是字母数字下划线的组合 ' );
9393 }
9494 Dict::save ($ name , $ request ->post ('value ' ));
9595 }
You can’t perform that action at this time.
0 commit comments