diff --git a/server/admin/ZrAdminNetCore/ZR.Service/Liveforum/T_UserCertificationsService.cs b/server/admin/ZrAdminNetCore/ZR.Service/Liveforum/T_UserCertificationsService.cs index 1970ee0..2f2b242 100644 --- a/server/admin/ZrAdminNetCore/ZR.Service/Liveforum/T_UserCertificationsService.cs +++ b/server/admin/ZrAdminNetCore/ZR.Service/Liveforum/T_UserCertificationsService.cs @@ -171,18 +171,21 @@ namespace ZR.Service.Liveforum certification.Status = parm.Status; certification.ReviewerId = reviewerId; certification.ReviewedAt = DateTime.Now; + int certifiedType = 0; if (parm.Status == 2) { certification.RejectReason = parm.RejectReason; } - // 将认证类型字符串转换为整数 - if (!int.TryParse(parm.CertificationType, out int certifiedType)) + else if (parm.Status == 1) { - - throw new CustomException(ResultCode.CUSTOM_ERROR, "认证类型格式错误,无法转换为数字"); + // 审核通过时才需要解析认证类型 + if (!int.TryParse(parm.CertificationType, out certifiedType)) + { + throw new CustomException(ResultCode.CUSTOM_ERROR, "认证类型格式错误,无法转换为数字"); + } + certification.CertificationType = certifiedType.ToString(); } - certification.CertificationType = ((int)certifiedType).ToString(); Update(certification, false); var user = _usersService.GetById(certification.UserId); if (user == null)