diff --git a/server/MiAssessment/src/MiAssessment.Admin.Business/Models/Common/ErrorCodes.cs b/server/MiAssessment/src/MiAssessment.Admin.Business/Models/Common/ErrorCodes.cs
index 922e075..4161451 100644
--- a/server/MiAssessment/src/MiAssessment.Admin.Business/Models/Common/ErrorCodes.cs
+++ b/server/MiAssessment/src/MiAssessment.Admin.Business/Models/Common/ErrorCodes.cs
@@ -104,6 +104,11 @@ public static class ErrorCodes
///
public const int PromotionImageRequired = 3112;
+ ///
+ /// 首页导航不存在
+ ///
+ public const int NavigationNotFound = 3121;
+
#endregion
#region 测评模块错误 (3200-3299)
diff --git a/server/MiAssessment/src/MiAssessment.Admin.Business/Services/ContentService.cs b/server/MiAssessment/src/MiAssessment.Admin.Business/Services/ContentService.cs
index 04a5e5a..12f4e89 100644
--- a/server/MiAssessment/src/MiAssessment.Admin.Business/Services/ContentService.cs
+++ b/server/MiAssessment/src/MiAssessment.Admin.Business/Services/ContentService.cs
@@ -22,14 +22,14 @@ public class ContentService : IContentService
///
private static readonly Dictionary LinkTypeNames = new()
{
- { 0, "无" },
+ { 0, "? },
{ 1, "内部页面" },
{ 2, "外部链接" },
- { 3, "小程序" }
+ { 3, "小程? }
};
///
- /// 状态名称映射
+ /// 状态名称映?
///
private static readonly Dictionary StatusNames = new()
{
@@ -38,19 +38,19 @@ public class ContentService : IContentService
};
///
- /// 宣传图位置名称映射
+ /// 宣传图位置名称映?
///
private static readonly Dictionary PositionNames = new()
{
{ 1, "首页底部" },
- { 2, "团队页" }
+ { 2, "团队? }
};
///
- /// 构造函数
+ /// 构造函?
///
/// 数据库上下文
- /// 日志记录器
+ /// 日志记录?/param>
public ContentService(
AdminBusinessDbContext dbContext,
ILogger logger)
@@ -59,7 +59,7 @@ public class ContentService : IContentService
_logger = logger;
}
- #region Banner 轮播图操作
+ #region Banner 轮播图操?
///
public async Task> GetBannerListAsync(BannerQueryRequest request)
@@ -69,7 +69,7 @@ public class ContentService : IContentService
.AsNoTracking()
.Where(b => !b.IsDeleted);
- // 状态筛选
+ // 状态筛?
if (request.Status.HasValue)
{
query = query.Where(b => b.Status == request.Status.Value);
@@ -142,7 +142,7 @@ public class ContentService : IContentService
throw new BusinessException(ErrorCodes.BannerImageRequired, "图片URL不能为空");
}
- // 验证 LinkType 和对应字段
+ // 验证 LinkType 和对应字?
ValidateLinkType(request.LinkType, request.LinkUrl, request.AppId);
// 创建实体
@@ -171,7 +171,7 @@ public class ContentService : IContentService
///
public async Task UpdateBannerAsync(UpdateBannerRequest request)
{
- // 查找轮播图
+ // 查找轮播?
var banner = await _dbContext.Banners
.Where(b => b.Id == request.Id && !b.IsDeleted)
.FirstOrDefaultAsync();
@@ -187,7 +187,7 @@ public class ContentService : IContentService
throw new BusinessException(ErrorCodes.BannerImageRequired, "图片URL不能为空");
}
- // 验证 LinkType 和对应字段
+ // 验证 LinkType 和对应字?
ValidateLinkType(request.LinkType, request.LinkUrl, request.AppId);
// 更新字段
@@ -210,7 +210,7 @@ public class ContentService : IContentService
///
public async Task DeleteBannerAsync(long id)
{
- // 查找轮播图
+ // 查找轮播?
var banner = await _dbContext.Banners
.Where(b => b.Id == id && !b.IsDeleted)
.FirstOrDefaultAsync();
@@ -220,7 +220,7 @@ public class ContentService : IContentService
throw new BusinessException(ErrorCodes.BannerNotFound, "轮播图不存在");
}
- // 软删除
+ // 软删?
banner.IsDeleted = true;
banner.UpdateTime = DateTime.Now;
@@ -234,7 +234,7 @@ public class ContentService : IContentService
///
public async Task UpdateBannerStatusAsync(long id, int status)
{
- // 查找轮播图
+ // 查找轮播?
var banner = await _dbContext.Banners
.Where(b => b.Id == id && !b.IsDeleted)
.FirstOrDefaultAsync();
@@ -244,13 +244,13 @@ public class ContentService : IContentService
throw new BusinessException(ErrorCodes.BannerNotFound, "轮播图不存在");
}
- // 更新状态
+ // 更新状?
banner.Status = status;
banner.UpdateTime = DateTime.Now;
await _dbContext.SaveChangesAsync();
- _logger.LogInformation("更新轮播图状态成功,ID: {BannerId}, 状态: {Status}", id, status);
+ _logger.LogInformation("更新轮播图状态成功,ID: {BannerId}, 状? {Status}", id, status);
return true;
}
@@ -266,7 +266,7 @@ public class ContentService : IContentService
// 获取所有需要更新的轮播图ID
var ids = items.Select(i => i.Id).ToList();
- // 批量查询轮播图
+ // 批量查询轮播?
var banners = await _dbContext.Banners
.Where(b => ids.Contains(b.Id) && !b.IsDeleted)
.ToListAsync();
@@ -291,7 +291,7 @@ public class ContentService : IContentService
#endregion
- #region Promotion 宣传图操作
+ #region Promotion 宣传图操?
///
public async Task> GetPromotionListAsync(PromotionQueryRequest request)
@@ -301,13 +301,13 @@ public class ContentService : IContentService
.AsNoTracking()
.Where(p => !p.IsDeleted);
- // 位置筛选
+ // 位置筛?
if (request.Position.HasValue)
{
query = query.Where(p => p.Position == request.Position.Value);
}
- // 状态筛选
+ // 状态筛?
if (request.Status.HasValue)
{
query = query.Where(p => p.Status == request.Status.Value);
@@ -376,7 +376,7 @@ public class ContentService : IContentService
throw new BusinessException(ErrorCodes.PromotionImageRequired, "图片URL不能为空");
}
- // 验证 Position 值
+ // 验证 Position ?
ValidatePosition(request.Position);
// 创建实体
@@ -404,7 +404,7 @@ public class ContentService : IContentService
///
public async Task UpdatePromotionAsync(UpdatePromotionRequest request)
{
- // 查找宣传图
+ // 查找宣传?
var promotion = await _dbContext.Promotions
.Where(p => p.Id == request.Id && !p.IsDeleted)
.FirstOrDefaultAsync();
@@ -420,7 +420,7 @@ public class ContentService : IContentService
throw new BusinessException(ErrorCodes.PromotionImageRequired, "图片URL不能为空");
}
- // 验证 Position 值
+ // 验证 Position ?
ValidatePosition(request.Position);
// 更新字段
@@ -441,7 +441,7 @@ public class ContentService : IContentService
///
public async Task DeletePromotionAsync(long id)
{
- // 查找宣传图
+ // 查找宣传?
var promotion = await _dbContext.Promotions
.Where(p => p.Id == id && !p.IsDeleted)
.FirstOrDefaultAsync();
@@ -451,7 +451,7 @@ public class ContentService : IContentService
throw new BusinessException(ErrorCodes.PromotionNotFound, "宣传图不存在");
}
- // 软删除
+ // 软删?
promotion.IsDeleted = true;
promotion.UpdateTime = DateTime.Now;
@@ -465,7 +465,7 @@ public class ContentService : IContentService
///
public async Task UpdatePromotionStatusAsync(long id, int status)
{
- // 查找宣传图
+ // 查找宣传?
var promotion = await _dbContext.Promotions
.Where(p => p.Id == id && !p.IsDeleted)
.FirstOrDefaultAsync();
@@ -475,13 +475,13 @@ public class ContentService : IContentService
throw new BusinessException(ErrorCodes.PromotionNotFound, "宣传图不存在");
}
- // 更新状态
+ // 更新状?
promotion.Status = status;
promotion.UpdateTime = DateTime.Now;
await _dbContext.SaveChangesAsync();
- _logger.LogInformation("更新宣传图状态成功,ID: {PromotionId}, 状态: {Status}", id, status);
+ _logger.LogInformation("更新宣传图状态成功,ID: {PromotionId}, 状? {Status}", id, status);
return true;
}
@@ -491,7 +491,7 @@ public class ContentService : IContentService
#region 私有方法
///
- /// 验证 LinkType 和对应字段
+ /// 验证 LinkType 和对应字?
///
/// 跳转类型
/// 跳转地址
@@ -501,7 +501,7 @@ public class ContentService : IContentService
switch (linkType)
{
case 0:
- // 无跳转,不需要验证
+ // 无跳转,不需要验?
break;
case 1:
case 2:
@@ -512,7 +512,7 @@ public class ContentService : IContentService
}
break;
case 3:
- // 小程序,LinkUrl 和 AppId 都必填
+ // 小程序,LinkUrl ?AppId 都必?
if (string.IsNullOrWhiteSpace(linkUrl))
{
throw new BusinessException(ErrorCodes.BannerLinkUrlRequired, "跳转地址不能为空");
@@ -536,10 +536,10 @@ public class ContentService : IContentService
}
///
- /// 获取状态名称
+ /// 获取状态名?
///
- /// 状态值
- /// 状态名称
+ /// 状态?/param>
+ /// 状态名?/returns>
private static string GetStatusName(int status)
{
return StatusNames.TryGetValue(status, out var name) ? name : "未知";
@@ -548,7 +548,7 @@ public class ContentService : IContentService
///
/// 获取位置名称
///
- /// 位置值
+ /// 位置?/param>
/// 位置名称
private static string GetPositionName(int position)
{
@@ -556,23 +556,23 @@ public class ContentService : IContentService
}
///
- /// 导航状态名称映射
+ /// 导航状态名称映?
///
private static readonly Dictionary NavigationStatusNames = new()
{
{ 0, "即将上线" },
- { 1, "已上线" }
+ { 1, "已上? }
};
///
- /// 验证 Position 值
+ /// 验证 Position ?
///
- /// 位置值
+ /// 位置?/param>
private void ValidatePosition(int position)
{
if (position != 1 && position != 2)
{
- throw new BusinessException(ErrorCodes.ParamError, "位置值必须为1(首页底部)或2(团队页)");
+ throw new BusinessException(ErrorCodes.ParamError, "位置值必须为1(首页底部)?(团队页?);
}
}
@@ -641,7 +641,7 @@ public class ContentService : IContentService
if (nav == null)
{
- throw new BusinessException(ErrorCodes.ContentNotFound, "首页导航不存在");
+ throw new BusinessException(ErrorCodes.NavigationNotFound, "首页导航不存?);
}
return nav;
@@ -683,7 +683,7 @@ public class ContentService : IContentService
if (entity == null)
{
- throw new BusinessException(ErrorCodes.ContentNotFound, "首页导航不存在");
+ throw new BusinessException(ErrorCodes.NavigationNotFound, "首页导航不存?);
}
if (string.IsNullOrWhiteSpace(request.Name))
@@ -727,14 +727,14 @@ public class ContentService : IContentService
if (entity == null)
{
- throw new BusinessException(ErrorCodes.ContentNotFound, "首页导航不存在");
+ throw new BusinessException(ErrorCodes.NavigationNotFound, "首页导航不存?);
}
entity.Status = status;
entity.UpdateTime = DateTime.Now;
await _dbContext.SaveChangesAsync();
- _logger.LogInformation("更新首页导航状态成功,ID: {Id}, 状态: {Status}", id, status);
+ _logger.LogInformation("更新首页导航状态成功,ID: {Id}, 状? {Status}", id, status);
return true;
}