diff --git a/ZR.Admin.WebApi/Controllers/Liveforum/T_UserCertificationsController.cs b/ZR.Admin.WebApi/Controllers/Liveforum/T_UserCertificationsController.cs
index 9e51e67..375fd5c 100644
--- a/ZR.Admin.WebApi/Controllers/Liveforum/T_UserCertificationsController.cs
+++ b/ZR.Admin.WebApi/Controllers/Liveforum/T_UserCertificationsController.cs
@@ -124,5 +124,26 @@ namespace ZR.Admin.WebApi.Controllers.Liveforum
return ExportExcel(result.Item2, result.Item1);
}
+ ///
+ /// 审核认证申请
+ ///
+ /// 审核参数
+ ///
+ [HttpPost("review")]
+ [ActionPermissionFilter(Permission = "tusercertifications:review")]
+ [Log(Title = "认证审核", BusinessType = BusinessType.UPDATE)]
+ public IActionResult ReviewCertification([FromBody] ReviewCertificationDto parm)
+ {
+ if (parm.Id == 0)
+ {
+ throw new CustomException(ResultCode.CUSTOM_ERROR, "请求参数为空");
+ }
+
+ long reviewerId = HttpContext.GetUId();
+ var response = _T_UserCertificationsService.ReviewCertification(parm, reviewerId);
+
+ return ToResponse(response);
+ }
+
}
}
\ No newline at end of file
diff --git a/ZR.LiveForum.Model/Liveforum/Dto/T_UserCertificationsDto.cs b/ZR.LiveForum.Model/Liveforum/Dto/T_UserCertificationsDto.cs
index c12efea..a26e31a 100644
--- a/ZR.LiveForum.Model/Liveforum/Dto/T_UserCertificationsDto.cs
+++ b/ZR.LiveForum.Model/Liveforum/Dto/T_UserCertificationsDto.cs
@@ -78,4 +78,27 @@ namespace ZR.LiveForum.Model.Liveforum.Dto
[ExcelColumn(Name = "审核状态")]
public string? StatusLabel { get; set; }
}
+
+ ///
+ /// 认证审核对象
+ ///
+ public class ReviewCertificationDto
+ {
+ ///
+ /// 认证申请记录ID
+ ///
+ [Required(ErrorMessage = "认证申请记录ID不能为空")]
+ public long Id { get; set; }
+
+ ///
+ /// 审核状态(1-通过,2-拒绝)
+ ///
+ [Required(ErrorMessage = "审核状态不能为空")]
+ public int Status { get; set; }
+
+ ///
+ /// 拒绝原因(拒绝时必填)
+ ///
+ public string? RejectReason { get; set; }
+ }
}
\ No newline at end of file
diff --git a/ZR.LiveForum.Model/Liveforum/T_UserCertifications.cs b/ZR.LiveForum.Model/Liveforum/T_UserCertifications.cs
index 649da2c..06f36e6 100644
--- a/ZR.LiveForum.Model/Liveforum/T_UserCertifications.cs
+++ b/ZR.LiveForum.Model/Liveforum/T_UserCertifications.cs
@@ -45,7 +45,7 @@ namespace ZR.LiveForum.Model.Liveforum
public int? FanLevel { get; set; }
///
- /// 审核状态
+ /// 审核状态 审核状态:0-待审核,1-通过,2-拒绝
///
public int? Status { get; set; }
diff --git a/ZR.Service/Liveforum/ILiveforumService/IT_UserCertificationsService.cs b/ZR.Service/Liveforum/ILiveforumService/IT_UserCertificationsService.cs
index 95bbf8e..b041643 100644
--- a/ZR.Service/Liveforum/ILiveforumService/IT_UserCertificationsService.cs
+++ b/ZR.Service/Liveforum/ILiveforumService/IT_UserCertificationsService.cs
@@ -16,6 +16,13 @@ namespace ZR.Service.Liveforum.ILiveforumService
T_UserCertifications AddT_UserCertifications(T_UserCertifications parm);
int UpdateT_UserCertifications(T_UserCertifications parm);
+ ///
+ /// 审核认证申请
+ ///
+ /// 审核参数
+ /// 审核人用户ID
+ ///
+ int ReviewCertification(ReviewCertificationDto parm, long reviewerId);
PagedInfo ExportList(T_UserCertificationsQueryDto parm);
}
diff --git a/ZR.Service/Liveforum/ILiveforumService/IT_UsersService.cs b/ZR.Service/Liveforum/ILiveforumService/IT_UsersService.cs
index 791806b..9c55dd4 100644
--- a/ZR.Service/Liveforum/ILiveforumService/IT_UsersService.cs
+++ b/ZR.Service/Liveforum/ILiveforumService/IT_UsersService.cs
@@ -1,4 +1,4 @@
-using ZR.LiveForum.Model.Liveforum.Dto;
+using ZR.LiveForum.Model.Liveforum.Dto;
using ZR.LiveForum.Model.Liveforum;
namespace ZR.Service.Liveforum.ILiveforumService
diff --git a/ZR.Service/Liveforum/T_UserCertificationsService.cs b/ZR.Service/Liveforum/T_UserCertificationsService.cs
index 6e10ec5..35b2baa 100644
--- a/ZR.Service/Liveforum/T_UserCertificationsService.cs
+++ b/ZR.Service/Liveforum/T_UserCertificationsService.cs
@@ -1,7 +1,9 @@
-using Infrastructure.Attribute;
+using Infrastructure;
+using Infrastructure.Attribute;
using Infrastructure.Extensions;
-using ZR.LiveForum.Model.Liveforum.Dto;
+
using ZR.LiveForum.Model.Liveforum;
+using ZR.LiveForum.Model.Liveforum.Dto;
using ZR.Repository;
using ZR.Service.Liveforum.ILiveforumService;
@@ -13,6 +15,12 @@ namespace ZR.Service.Liveforum
[AppService(ServiceType = typeof(IT_UserCertificationsService), ServiceLifetime = LifeTime.Transient)]
public class T_UserCertificationsService : BaseService, IT_UserCertificationsService
{
+ private readonly IT_UsersService _usersService;
+
+ public T_UserCertificationsService(IT_UsersService usersService)
+ {
+ _usersService = usersService;
+ }
///
/// 查询认证申请记录列表
///
@@ -66,6 +74,69 @@ namespace ZR.Service.Liveforum
return Update(model, true);
}
+ ///
+ /// 审核认证申请
+ ///
+ /// 审核参数
+ /// 审核人用户ID
+ ///
+ public int ReviewCertification(ReviewCertificationDto parm, long reviewerId)
+ {
+ // 验证审核状态
+ if (parm.Status != 1 && parm.Status != 2)
+ {
+ throw new CustomException(ResultCode.CUSTOM_ERROR, "审核状态无效,只能为1(通过)或2(拒绝)");
+ }
+
+ // 验证拒绝时拒绝原因必填
+ if (parm.Status == 2 && string.IsNullOrWhiteSpace(parm.RejectReason))
+ {
+ throw new CustomException(ResultCode.CUSTOM_ERROR, "审核拒绝时,拒绝原因不能为空");
+ }
+
+ // 获取认证记录
+ var certification = GetById(parm.Id);
+ if (certification == null)
+ {
+ throw new CustomException(ResultCode.CUSTOM_ERROR, "认证申请记录不存在");
+ }
+
+ // 验证状态为待审核
+ if (certification.Status != 0)
+ {
+ throw new CustomException(ResultCode.CUSTOM_ERROR, "该认证申请记录已审核,不能重复审核");
+ }
+
+ // 使用事务处理
+ return Context.Ado.UseTran(() =>
+ {
+ // 更新认证申请记录
+ certification.Status = parm.Status;
+ certification.ReviewerId = reviewerId;
+ certification.ReviewedAt = DateTime.Now;
+ if (parm.Status == 2)
+ {
+ certification.RejectReason = parm.RejectReason;
+ }
+ Update(certification, false);
+
+ // 如果审核通过,更新用户表
+ if (parm.Status == 1)
+ {
+ var user = _usersService.GetById(certification.UserId);
+ if (user == null)
+ {
+ throw new CustomException(ResultCode.CUSTOM_ERROR, "用户不存在");
+ }
+ user.CertifiedType = 1;
+ user.IsCertified = true;
+ _usersService.UpdateT_Users(user);
+ }
+
+ return 1;
+ }).IsSuccess ? 1 : 0;
+ }
+
///
/// 导出认证申请记录
///
diff --git a/ZR.Vue/src/api/liveforum/tusercertifications.js b/ZR.Vue/src/api/liveforum/tusercertifications.js
index dc581ef..0921d0a 100644
--- a/ZR.Vue/src/api/liveforum/tusercertifications.js
+++ b/ZR.Vue/src/api/liveforum/tusercertifications.js
@@ -60,3 +60,15 @@ export function deltusercertifications(pid) {
export async function exporttusercertifications(query) {
await downFile('liveforum/tusercertifications/export', { ...query })
}
+
+/**
+ * 审核认证申请
+ * @param {审核参数} data
+ */
+export function reviewcertification(data) {
+ return request({
+ url: 'liveforum/tusercertifications/review',
+ method: 'post',
+ data: data,
+ })
+}
diff --git a/ZR.Vue/src/views/liveforum/tusercertifications.vue b/ZR.Vue/src/views/liveforum/tusercertifications.vue
index d97d8c3..a45d98f 100644
--- a/ZR.Vue/src/views/liveforum/tusercertifications.vue
+++ b/ZR.Vue/src/views/liveforum/tusercertifications.vue
@@ -75,9 +75,17 @@
-
+
+
@@ -140,13 +148,42 @@
{{ $t('btn.submit') }}
+
+
+
+
+
+
+ 通过
+ 拒绝
+
+
+
+
+
+
+
+ {{ $t('btn.cancel') }}
+ {{ $t('btn.submit') }}
+
+
\ No newline at end of file