You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
package CheckHandler
import (
"github.com/bluesky335/IDCheck/IdNumber"
"github.com/gin-gonic/gin"
)
/**
功能:检查字符串是否是合法身份证号
作者:黄海
时间: 2020-03-17
*/
func idcardLimitIsLegal ( c * gin . Context , interName string , n int ) ( bool , ResultStruct ) {
//1、调用通用检查器
success , resultStruct , httpType , arr := commonIsLegal ( c , interName , n )
if ! success {
return success , resultStruct
}
//2、如果通过了常规检查, 那么进行业务专用检查
for i := 0 ; i < len ( arr ) ; i ++ {
paraStruct := arr [ i ]
//是否合法身份证
var id = IDNumber . New ( paraStruct . inputParameterValue )
if ! id . IsValid ( ) {
resultStruct . HttpType = httpType
resultStruct . Message = "不是合法身份证号!"
return false , resultStruct
}
}
return true , resultStruct
}