fix certification
This commit is contained in:
@@ -107,9 +107,9 @@ func (s *CertificationApplicationServiceImpl) SubmitEnterpriseInfo(
|
||||
// 验证验证码
|
||||
if err := s.smsCodeService.VerifyCode(ctx, cmd.LegalPersonPhone, cmd.VerificationCode, user_entities.SMSSceneCertification); err != nil {
|
||||
record.MarkAsFailed(err.Error())
|
||||
err = s.enterpriseInfoSubmitRecordService.Save(ctx, record)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("保存企业信息提交记录失败: %s", err.Error())
|
||||
saveErr := s.enterpriseInfoSubmitRecordService.Save(ctx, record)
|
||||
if saveErr != nil {
|
||||
return nil, fmt.Errorf("保存企业信息提交记录失败: %s", saveErr.Error())
|
||||
}
|
||||
return nil, fmt.Errorf("验证码错误或已过期")
|
||||
}
|
||||
@@ -119,17 +119,17 @@ func (s *CertificationApplicationServiceImpl) SubmitEnterpriseInfo(
|
||||
exists, err := s.userAggregateService.CheckUnifiedSocialCodeExists(ctx, cmd.UnifiedSocialCode, cmd.UserID)
|
||||
if err != nil {
|
||||
record.MarkAsFailed(err.Error())
|
||||
err = s.enterpriseInfoSubmitRecordService.Save(ctx, record)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("保存企业信息提交记录失败: %s", err.Error())
|
||||
saveErr := s.enterpriseInfoSubmitRecordService.Save(ctx, record)
|
||||
if saveErr != nil {
|
||||
return nil, fmt.Errorf("保存企业信息提交记录失败: %s", saveErr.Error())
|
||||
}
|
||||
return nil, fmt.Errorf("检查企业信息失败: %s", err.Error())
|
||||
}
|
||||
if exists {
|
||||
record.MarkAsFailed(err.Error())
|
||||
err = s.enterpriseInfoSubmitRecordService.Save(ctx, record)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("保存企业信息提交记录失败: %s", err.Error())
|
||||
record.MarkAsFailed("该企业信息已被其他用户使用,请确认企业信息是否正确")
|
||||
saveErr := s.enterpriseInfoSubmitRecordService.Save(ctx, record)
|
||||
if saveErr != nil {
|
||||
return nil, fmt.Errorf("保存企业信息提交记录失败: %s", saveErr.Error())
|
||||
}
|
||||
return nil, fmt.Errorf("该企业信息已被其他用户使用,请确认企业信息是否正确")
|
||||
}
|
||||
@@ -146,9 +146,9 @@ func (s *CertificationApplicationServiceImpl) SubmitEnterpriseInfo(
|
||||
if err != nil {
|
||||
s.logger.Error("企业信息验证失败", zap.Error(err))
|
||||
record.MarkAsFailed(err.Error())
|
||||
err = s.enterpriseInfoSubmitRecordService.Save(ctx, record)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("保存企业信息提交记录失败: %s", err.Error())
|
||||
saveErr := s.enterpriseInfoSubmitRecordService.Save(ctx, record)
|
||||
if saveErr != nil {
|
||||
return nil, fmt.Errorf("保存企业信息提交记录失败: %s", saveErr.Error())
|
||||
}
|
||||
return nil, fmt.Errorf("企业信息验证失败: %s", err.Error())
|
||||
}
|
||||
@@ -156,16 +156,16 @@ func (s *CertificationApplicationServiceImpl) SubmitEnterpriseInfo(
|
||||
if err != nil {
|
||||
s.logger.Error("企业信息验证失败", zap.Error(err))
|
||||
record.MarkAsFailed(err.Error())
|
||||
err = s.enterpriseInfoSubmitRecordService.Save(ctx, record)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("保存企业信息提交记录失败: %s", err.Error())
|
||||
saveErr := s.enterpriseInfoSubmitRecordService.Save(ctx, record)
|
||||
if saveErr != nil {
|
||||
return nil, fmt.Errorf("保存企业信息提交记录失败: %s", saveErr.Error())
|
||||
}
|
||||
return nil, fmt.Errorf("企业信息验证失败, %s", err.Error())
|
||||
}
|
||||
record.MarkAsVerified()
|
||||
err = s.enterpriseInfoSubmitRecordService.Save(ctx, record)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("保存企业信息提交记录失败: %s", err.Error())
|
||||
saveErr := s.enterpriseInfoSubmitRecordService.Save(ctx, record)
|
||||
if saveErr != nil {
|
||||
return nil, fmt.Errorf("保存企业信息提交记录失败: %s", saveErr.Error())
|
||||
}
|
||||
|
||||
var response *responses.CertificationResponse
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user