修改了新增了题库类型2、3

This commit is contained in:
2024-11-04 13:03:52 +08:00
parent e44601c30f
commit b61ede1a03
7 changed files with 367 additions and 142 deletions
-3
View File
@@ -3,7 +3,6 @@ package utils
import (
"errors"
"fmt"
"regexp"
"strconv"
"strings"
@@ -38,10 +37,8 @@ func GetCardAge(cardNum string) (int, error) {
// CheckCardNum 检测身份证号
func CheckCardNum(cardNum string) (bool, error) {
fmt.Println(cardNum)
regex := `^(?:1[1-5]|2[1-3]|3[1-7]|4[1-6]|5[0-4]|6[1-5])\d{4}(?:1[89]|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])\d{3}[\dxX]$`
match, err := regexp.MatchString(regex, cardNum)
fmt.Println(match)
if !match || err != nil {
return false, errors.New("身份证号错误")
}
+14 -1
View File
@@ -1,3 +1,16 @@
package utils
// int转字符串
// QuestionType int转字符串
func QuestionType(t int) string {
if t == 1 {
return "单选题"
} else if t == 2 {
return "多选题"
} else if t == 2 {
return "问答题"
} else if t == 2 {
return "判断题"
} else {
return "未知"
}
}