上传工会创建时铭感词校验

This commit is contained in:
liwei 2023-06-25 14:52:02 +08:00
parent cf6f80a7d1
commit 2043d4f468
2 changed files with 835 additions and 806 deletions

View File

@ -2,6 +2,7 @@ package sociaty
import ( import (
"errors" "errors"
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/sys/log" "go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb" "go_dreamfactory/pb"
@ -11,6 +12,7 @@ import (
"go_dreamfactory/sys/configure" "go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
"go_dreamfactory/sys/wordfilter"
) )
// 公会创建 // 公会创建
@ -35,6 +37,27 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq)
return return
} }
//铭感词校验 工会名称
if iscompliance, inscriptionwords := wordfilter.Validate(req.Name); !iscompliance {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_SociatyNameInscriptionWords,
Title: pb.ErrorCode_SociatyNameInscriptionWords.ToString(),
Message: fmt.Sprintf("工会名称包含铭感词:%s", inscriptionwords),
}
return
}
//铭感词校验 工会公告
if len(req.Notice) > 0 {
if iscompliance, inscriptionwords := wordfilter.Validate(req.Notice); !iscompliance {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_SociatyNameInscriptionWords,
Title: pb.ErrorCode_SociatyNameInscriptionWords.ToString(),
Message: fmt.Sprintf("工会名称包含铭感词:%s", inscriptionwords),
}
return
}
}
uid := session.GetUserId() uid := session.GetUserId()
user := this.module.ModuleUser.GetUser(uid) user := this.module.ModuleUser.GetUser(uid)
if user == nil { if user == nil {

File diff suppressed because it is too large Load Diff