func IsAdualt(cardid string) bool {
const Layout = "20060102"
loc, _ := time.LoadLocation("Asia/Shanghai")
reg, _ := regexp.Compile("^(\\d{6})(\\d{8})(.*)")
submatch := reg.FindStringSubmatch(cardid)
if len(submatch) < 2 {
fmt.Println("IsAdualt 数据不合法", cardid, submatch)
return false
}
birth := submatch[2]
btime, err := time.ParseInLocation(Layout, birth, loc)
if err != nil {
fmt.Println("IsAdualt 解析失败", err, cardid, submatch)
return false
}
//18年前
start_time := time.Now().AddDate(-18, 0, 0)
if start_time.Unix() > btime.Unix() {
return true
}
return false
}
06-21
933
07-14
245
09-06
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交