🐛fix查看文章详情文章不存在报错

This commit is contained in:
不做码农 2023-12-24 21:50:30 +08:00
parent 2a3d8bab6c
commit bc6ae48588

View File

@ -85,6 +85,7 @@ namespace ZR.Admin.WebApi.Controllers
long userId = HttpContext.GetUId();
var response = _ArticleService.GetId(id);
var model = response.Adapt<ArticleDto>();
if (model == null) return ToResponse(ResultCode.FAIL, "文章不存在");
if (model.IsPublic == 0 && userId != model.UserId)
{
return ToResponse(ResultCode.CUSTOM_ERROR, "访问失败");