File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -463,14 +463,16 @@ func (this *BookController) Create() {
463463 if identify == "" {
464464 this .JsonResult (6002 , "项目标识不能为空" )
465465 }
466- if ok , err := regexp .MatchString (`[a-zA-Z0-9_\-]*$` , identify ); ! ok || err != nil {
467- this .JsonResult (6003 , "项目标识只能包含字母、数字,以及“-”和“_”符号头,且不能是纯数字" )
466+ ok , err1 := regexp .MatchString (`^[a-zA-Z0-9_\-]*$` , identify )
467+ if ! ok || err1 != nil {
468+ this .JsonResult (6003 , "项目标识只能包含字母、数字,以及“-”和“_”符号,且不能是纯数字" )
468469 }
470+
469471 if num , _ := strconv .Atoi (identify ); strconv .Itoa (num ) == identify {
470- this .JsonResult (6003 , "项目标识只能包含字母、数字,以及“-”和“_”符号头 ,且不能是纯数字" )
472+ this .JsonResult (6003 , "项目标识只能包含字母、数字,以及“-”和“_”符号 ,且不能是纯数字" )
471473 }
472474 if strings .Count (identify , "" ) > 50 {
473- this .JsonResult (6004 , "文档标识不能超过50字 " )
475+ this .JsonResult (6004 , "项目标识不能超过50字 " )
474476 }
475477 if strings .Count (description , "" ) > 500 {
476478 this .JsonResult (6004 , "项目描述不能大于500字" )
You can’t perform that action at this time.
0 commit comments