fix certification

This commit is contained in:
2025-08-05 17:20:49 +08:00
parent f1478e475f
commit ec1bba4898
4 changed files with 36 additions and 23 deletions

View File

@@ -85,8 +85,11 @@ func (e *EnterpriseInfo) validateCompanyName() error {
return errors.New("企业名称长度不能超过100个字符")
}
// 检查是否包含非法字符
invalidChars := []string{"`", "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "+", "=", "{", "}", "[", "]", "\\", "|", ";", ":", "'", "\"", "<", ">", ",", ".", "?", "/"}
// 检查是否包含非法字符(允许括号)
invalidChars := []string{
"`", "~", "!", "@", "#", "$", "%", "^", "&", "*",
"+", "=", "{", "}", "[", "]", "【", "】", "\\", "|", ";", ":", "'", "\"", "<", ">", ",", ".", "?", "/",
}
for _, char := range invalidChars {
if strings.Contains(e.CompanyName, char) {
return fmt.Errorf("企业名称不能包含特殊字符: %s", char)

View File

@@ -12,8 +12,10 @@ import (
"tyapi-server/internal/domains/certification/entities"
"tyapi-server/internal/domains/certification/entities/value_objects"
"tyapi-server/internal/domains/certification/repositories"
"tyapi-server/internal/infrastructure/external/alicloud"
"tyapi-server/internal/infrastructure/external/tianyancha"
"tyapi-server/internal/infrastructure/external/westdex"
"tyapi-server/internal/infrastructure/external/yushan"
"tyapi-server/internal/shared/interfaces"
"go.uber.org/zap"
@@ -26,6 +28,8 @@ import (
type EnterpriseInfoSubmitRecordService struct {
westdexService *westdex.WestDexService
tianYanChaService *tianyancha.TianYanChaService
alicloudService *alicloud.AlicloudService
yushanService *yushan.YushanService
validator interfaces.RequestValidator
repositories repositories.EnterpriseInfoSubmitRecordRepository
appConfig config.AppConfig
@@ -36,6 +40,8 @@ type EnterpriseInfoSubmitRecordService struct {
func NewEnterpriseInfoSubmitRecordService(
westdexService *westdex.WestDexService,
tianYanChaService *tianyancha.TianYanChaService,
alicloudService *alicloud.AlicloudService,
yushanService *yushan.YushanService,
validator interfaces.RequestValidator,
repositories repositories.EnterpriseInfoSubmitRecordRepository,
appConfig config.AppConfig,
@@ -44,6 +50,8 @@ func NewEnterpriseInfoSubmitRecordService(
return &EnterpriseInfoSubmitRecordService{
westdexService: westdexService,
tianYanChaService: tianYanChaService,
alicloudService: alicloudService,
yushanService: yushanService,
validator: validator,
repositories: repositories,
appConfig: appConfig,
@@ -99,6 +107,8 @@ func (s *EnterpriseInfoSubmitRecordService) ValidateWithWestdex(ctx context.Cont
deps := &processors.ProcessorDependencies{
WestDexService: s.westdexService,
TianYanChaService: s.tianYanChaService,
AlicloudService: s.alicloudService,
YushanService: s.yushanService,
Validator: s.validator,
}