master
huanghai 5 years ago
parent 31ef105d70
commit 096196b174

@ -55,6 +55,7 @@ func (s *Rpc) AddBaseStudent(ctx context.Context, in *BaseStudentProto.ModelArg)
var reply BaseStudentProto.Reply
//==========================================
//检查身份证的有效性
if len(in.Sfzjh) > 0 {
IdCardNo := []byte(in.Sfzjh)
if in.Sfzjlxm == "01" && !IdCardUtil.IsValidIdCardNo(&IdCardNo) {
reply.Success = false
@ -67,6 +68,7 @@ func (s *Rpc) AddBaseStudent(ctx context.Context, in *BaseStudentProto.ModelArg)
reply.Message = "证件号在系统中已存在,无法创建!"
return &reply, nil
}
}
//==========================================
//调用dao
model := new(models.TBaseStudent)
@ -261,6 +263,7 @@ func (s *Rpc) UpdateBaseStudent(ctx context.Context, in *BaseStudentProto.ModelA
//==========================================
//检查身份证的有效性
if len(in.Sfzjh) > 0 {
IdCardNo := []byte(in.Sfzjh)
if in.Sfzjlxm == "1" && !IdCardUtil.IsValidIdCardNo(&IdCardNo) {
reply.Success = false
@ -273,6 +276,7 @@ func (s *Rpc) UpdateBaseStudent(ctx context.Context, in *BaseStudentProto.ModelA
reply.Message = "证件号在系统中已存在,无法创建!"
return &reply, nil
}
}
//==========================================
model := new(models.TBaseStudent)
//身份证件号

@ -92,6 +92,7 @@ func (s *Rpc) AddBaseTeacher(ctx context.Context, in *BaseTeacherProto.ModelArg)
var reply BaseTeacherProto.Reply
//==========================================
//检查身份证的有效性
if len(in.Sfzjh) > 0 {
IdCardNo := []byte(in.Sfzjh)
if in.Sfzjlxm == "01" && !IdCardUtil.IsValidIdCardNo(&IdCardNo) {
reply.Success = false
@ -104,6 +105,7 @@ func (s *Rpc) AddBaseTeacher(ctx context.Context, in *BaseTeacherProto.ModelArg)
reply.Message = "证件号在系统中已存在,无法创建!"
return &reply, nil
}
}
//==========================================
//如果是手机号,是不是合法
if len(in.Lxdh) > 0 && len(in.Lxdh) == 11 && !MobileUtil.VerifyMobileFormat(in.Lxdh) {
@ -260,6 +262,7 @@ func (s *Rpc) UpdateBaseTeacher(ctx context.Context, in *BaseTeacherProto.ModelA
var reply BaseTeacherProto.Reply
//检查身份证的有效性
if len(in.Sfzjh) > 0 {
IdCardNo := []byte(in.Sfzjh)
if in.Sfzjlxm == "1" && !IdCardUtil.IsValidIdCardNo(&IdCardNo) {
reply.Success = false
@ -272,6 +275,7 @@ func (s *Rpc) UpdateBaseTeacher(ctx context.Context, in *BaseTeacherProto.ModelA
reply.Message = "证件号在系统中已存在,无法创建!"
return &reply, nil
}
}
//如果是手机号,是不是合法
if len(in.Lxdh) > 0 && len(in.Lxdh) == 11 && !MobileUtil.VerifyMobileFormat(in.Lxdh) {

Loading…
Cancel
Save